Judy@4pcba.com
7:30 AM - 7:30 PM
Monday to Saturday

Using the MT8870 DTMF Decoder with Arduino

How to crack 74hc decoder

Introduction

The MT8870 is a popular DTMF tone decoder chip that can detect the dual-tone multi-frequency signals used for telephone dialing. This allows you to decode DTMF tones using an Arduino.

Some applications for decoding DTMF tones with Arduino:

  • Caller ID or phone dialing projects
  • Controlling devices via phone keypresses
  • Decoding signals from a DTMF keypad

Hooking Up the MT8870 to Arduino

The MT8870 requires a few external components to function properly:

Components Needed

  • MT8870 chip
  • 22pF capacitors
  • 10k ohm resistors
  • Wires to connect to Arduino

The MT8870 pins should be connected as follows:

MT8870 PinConnection
VDD5V
VLGND
StD10k pull-up resistor to 5V
StQArduino digital input pin

The StQ pin connects to an Arduino digital input and allows you to detect when a valid tone is decoded.

Decoding DTMF Tones

Once connected, the MT8870 will decode DTMF tones present on its input pins (Xi and Xo).

You can apply audio signals from a phone line or DTMF keypad to these pins. When a tone is detected, the StQ pin will go low.

In your Arduino sketch, look for this pin to go low in order to identify which key was pressed.

Example Code

Here is simple example code to detect button presses on a DTMF keypad:

cpp

Copy code

const int dtmfInput = 2; // DTMF input on pin 2 void setup() { Serial.begin(9600); pinMode(dtmfInput, INPUT); } void loop() { if (digitalRead(dtmfInput) == LOW) { Serial.println("DTMF tone detected"); } }

This will print out a message whenever a DTMF tone is detected by the MT8870.

You can expand on this to detect each tone and take action based on the key pressed. Refer to the MT8870 datasheet for details on decoding the exact keys.

Common Issues

Here are some common issues and solutions when using the MT8870:

  • No tones detected – Ensure your audio signals are within the MT8870 frequency range. Add amplification if needed.
  • Intermittent detection – Add 10uF capacitors between VDD/VL and Xi/Xo to filter the power lines.
  • Detects tones randomly – Add resistors or potentiometers between Xi/Xo pins and your audio source to adjust gain.

Conclusion

The MT8870 is an easy-to-use DTMF decoder that can identify telephone key presses and number dial tones. With just a few external components, you can hook it up to an Arduino and start detecting DTMF tones in your own projects. The applications are endless for telephone/DTMF controlled devices.

Frequently Asked Questions

What is the typical voltage to supply the MT8870?

The MT8870 needs between 4.5V and 5.5V, so the standard 5V from an Arduino’s 5V pin is perfect.

How fast can the MT8870 decode DTMF tones?

The MT8870 can detect tones within about 40ms, making it fast enough for most applications.

What external components are absolutely needed?

You need decoupling capacitors between VDD/VL pins and ground, and pull-up resistors from STQ and StD outputs.

What pins on the MT8870 connect to my Arduino?

The main pins are VDD, VL, StQ, Xi, and Xo. StQ connects to an Arduino digital input to detect tones.

How do I know which DTMF tone is being detected?

The MT8870 has dedicated output pins corresponding to each row/column tone. Monitor these to determine each keypress.