Interface MT8870 DTMF Decoder Module with Arduino

Dual Tone Multiple Frequency technologies were introduced by Bell Labs to replace pulse-dialing in telephones. MT8870 is a DTMF Decoder module that generates a 4-bit digital code with respect to the DTMF audio signal. The MT8870 Decoder IC is integrated with an operational amplifier with user-adjustable Guard time. The embedded band-split filter uses switch capacitor techniques to distinguish and split low and high frequencies from the received signal. The module is provided with an audio jack to receive the DTMF signal generated.

MT8870 DTMF Decoder Module

A small power-efficient module requires only 5 volts for performance. In addition to mobile phones, it finds its application in a variety of embedded projects, DIY Robotics, and communication systems.

MT8870 DTMF Module Components

MT8870 DTMF Decoder module is available in either 18 PIN PLASTIC DIP/SOIC or 20 PIN SSOP. The Decoder module consists of Crystal Oscillator, Input Connector, Module connecting Headers, MT8870 Decoder IC and Output LEDs.

MT8870 DTMF Decoder Module components

Crystal Oscillator: The oscillator provides clock pulses for timing and controlling the module.

Input Connector: The 3.5mm input Connector is used to connect any peripheral with a dial keypad. It receives the audio signal.

Module Connecting Headers: These are Input/Output pins responsible for the connectivity between an MCU and the module.

Decoder IC: The chip processes the input audio signals and gives the binary output.

Output LEDs: The output binary states are visually displayed through these LEDs.

MT8870 Pinout

The following diagram shows the pinout of the MT8870 DTMF Decoder module:

MT8870 DTMF Decoder Module pinout diagram

Pin Configuration

MT8870 DTMF Decoder IC has a total of 18/20 pins but only 9 pins are extended up to the module. The pin configuration detail in tabular is mentioned below:

NumberPin NameFunction
NumberPin NameFunction
1IN+Non-Inverting input pin
2 IN-Inverting input pin
3GSGain Select pin
4 VRefOutput Reference Voltage
5 INHInput Inhibit pin
6 PWDNInput Power Down pin
7 OSC1Clock input pin
8 OSC2Clock output pin
9 VSSGround pin
10TOEDecoder Output Enable pin
11-14Q1-Q4Decoder Output pins
15StDOutput Delayed Steering pin
16EStOutput Early Steering pin
17 St/GTInput steering/Output Guard Time pin
18VDDPositive Power Supply pin
  • IN+/IN-: These are input pins of the operational amplifier.
  • INH: It holds back the tone detection of characters like A, B, C and D.
  • PWDN: It is an active-high pin. It shuts down the amplifier to reduce power consumption when idle.
  • TOE: It enables the output of the decoder pins.
  • StD: It gets high when a tone-pair is received. It gets low automatically after the latch is updated.
  • ESt: It gets high when a tone-pair is received by the digital detecting algorithm. It gets low automatically if there is signal loss.

DTMF Decoder Module Features and Specifications

  • Operating Voltage: 4.75 – 5.25 Volts
  • Operating Temperature: -400C – 850C
  • Oscillator Frequency: 3.579545 MHz
  • Source/Sink Current: 10 mA
  • Power Dissipation: 500 Watts
  • Minimum Op-Amp Gain: 0.30 MHz

Additional Features

Some extra features include:

  • A power mode is provided to the module to minimize power loss during idle state.
  • The module is provided with an inhibit mode which if utilized will not detect the tones of characters other than numbers.
  •  MT8870 comes with a 3.5mm audio jack for DTMF reception.

MT8870 DTMF Decoder IC Block Diagram

The block diagram of the  MT8870 DTMF Decoder module showing the internal circuitry of the IC is as follows:

MT8870 DTMF IC block diagram

How does the MT8870 DTMF module work?

Dual Tone Multiple Frequency is also known as Touch-Tone. It is a signaling system that produces a unique frequency for each particular key present on the dial keypad. When a key is pressed on the keypad, a unique DTMF signal is generated. This signal is processed by the IC and produces a respective binary output code. This helps us to recognize the key pressed.

The IC has an operational amplifier, filter network, and a digital code detector and converter. The operational amplifier receives the input audio signal. The amplified signal is passed to the filter network consisting of a pre-processing dial tone filter, low and high-frequency filter to differentiate the audio signal into respective frequency groups. The filtered frequencies are detected by the detecting circuitry and a 4-bit output binary code is produced in return. The code is then visually shown through the states of output LEDs and if its output pins are interfaced with a microcontroller unit, they can be displayed on the PC.

Interfacing with Arduino

This section deals with the interfacing of  MT8870 DTMF Decoder with Arduino UNO.

Connection Diagram

The following diagram shows the interfacing circuit for DTMF decoder and Arduino.

MT8870 DTMF Decoder Module interfacing with Arduino
  • Connect the MT8870 module to the Arduino using the following steps.
  • Power supply pins of the module to the Arduino.
  • Decoder output pins to any of the four digital pins of the microcontroller.
  • Connect the StD pin to any digital pin of the Arduino.
  • Connect the mobile dial keypad to the DTMF using an auxiliary cable.
Arduino UNOMT8870 DTMF Module
8StD
12Q1
11Q2
10Q3
9Q4
5VVDD
GNDVSS

Arduino Code

/*Define input pins for DTMF Decoder pins connection */
void setup() {
  Serial.begin(9600); 
  pinMode(8, INPUT); // connect to Std pin
  pinMode(9, INPUT); // connect to Q4 pin
  pinMode(10, INPUT); // connect to Q3 pin
  pinMode(11, INPUT); // connect to Q2 pin
  pinMode(12, INPUT); // connect to Q1 pin
}

void loop() {
  uint8_t number_pressed;
  bool signal ;  
  signal = digitalRead(3);
  if(signal == HIGH)  /* If new pin pressed */
   {
    delay(250);
    number_pressed = ( 0x00 | (digitalRead(7)<<0) | (digitalRead(6)<<1) | (digitalRead(5)<<2) | (digitalRead(4)<<3) );
      switch (number_pressed)
      {
        case 0x01:
        Serial.println("Button Pressed =  1");
        break;
        case 0x02:
        Serial.println("Button Pressed =  2");
        break;
        case 0x03:
        Serial.println("Button Pressed =  3");
        break;
        case 0x04:
        Serial.println("Button Pressed =  4");
        break;
        case 0x05:
        Serial.println("Button Pressed =  5");
        break;
        case 0x06:
        Serial.println("Button Pressed =  6");
        break;
        case 7:
        Serial.println("Button Pressed =  7");
        break;
        case 0x08:
        Serial.println("Button Pressed =  8");
        break;
        case 0x09:
        Serial.println("Button Pressed =  9");
        break;
        case 0x0A:
        Serial.println("Button Pressed =  0");
        break;
        case 0x0B:
        Serial.println("Button Pressed =  *");
        break;
        case 0x0C:
        Serial.println("Button Pressed =  #");
        break;    
      }
  }
}

How Code Works?

Libraries

No libraries are required for the working of a DTMF module because we are using the inbuilt function “digitalRead” to obtain the input from DTMF. It does not require any separate library to execute.

void Setup

In the setup function, the Serial monitor is initialized to display the key with respect to the binary code. The pin modes are also defined in this loop to determine the value of the pin using the digitalRead function.

/*Define input pins for DTMF Decoder pins connection */
void setup() {
  Serial.begin(9600); 
  pinMode(8, INPUT); // connect to Std pin
  pinMode(9, INPUT); // connect to Q4 pin
  pinMode(10, INPUT); // connect to Q3 pin
  pinMode(11, INPUT); // connect to Q2 pin
  pinMode(12, INPUT); // connect to Q1 pin
}

void loop

First, the loop initializes a variable “number” to store the binary code received from the DTMF module and the boolean variable “signal”. When any key on the keypad is pressed, it will be high and the loop will execute the if loop accordingly. The digitalRead function reads the value on pin 12, 11, 10, and 9 which is connected to Q1, Q2, Q3, and Q4 respectively and stores the code into the number variable. The value stored will then be compared to all the cases. The case with which the value matches will be executed and the Serial monitor then displays the result.

void loop() {
  uint8_t number_pressed;
  bool signal ;  
  signal = digitalRead(3);
  if(signal == HIGH)  /* If new pin pressed */
   {
    delay(250);
    number_pressed = ( 0x00 | (digitalRead(7)<<0) | (digitalRead(6)<<1) | (digitalRead(5)<<2) | (digitalRead(4)<<3) );
      switch (number_pressed)
      {
        case 0x01:
        Serial.println("Button Pressed =  1");
        break;
        case 0x02:
        Serial.println("Button Pressed =  2");
        break;
        case 0x03:
        Serial.println("Button Pressed =  3");
        break;
        case 0x04:
        Serial.println("Button Pressed =  4");
        break;
        case 0x05:
        Serial.println("Button Pressed =  5");
        break;
        case 0x06:
        Serial.println("Button Pressed =  6");
        break;
        case 7:
        Serial.println("Button Pressed =  7");
        break;
        case 0x08:
        Serial.println("Button Pressed =  8");
        break;
        case 0x09:
        Serial.println("Button Pressed =  9");
        break;
        case 0x0A:
        Serial.println("Button Pressed =  0");
        break;
        case 0x0B:
        Serial.println("Button Pressed =  *");
        break;
        case 0x0C:
        Serial.println("Button Pressed =  #");
        break;    
      }
  }
}

Code Output

Upload the code on the Arduino. Press any key from the dial-pad. For example, 2 is pressed from the dial-pad. The number 2 will produce a special DTMF signal. The module receives, differentiates, and then generates a 4-bit binary code that will be further received by the Arduino. The MCU processes the value and prints “Pin Pressed: 2”. Press different numbers and observe the results.

Applications

  • Robotics
  • Home Automation
  • Smartphones
  • Paging Systems
  • Telecommunication systems
  • Industrial Applications

2D Diagram

2D diagram

Related Articles:

10 thoughts on “Interface MT8870 DTMF Decoder Module with Arduino”

  1. Issue: Stereo audio socket – audio input only on tip/left wire!

    Why fit a stereo socket? and if you have to, why not connect audio input to both left and right channels as the dtmf is a mono signal normally?

    I have found that my modules audio input was between the ring and ground/screen on the audio connector, I assumed that the audio input would be on the tip of the connector as well and spent 3 hrs trying to figure out why I could not decode tones!

    Make sure your audio cable plug is set up so that the sound is coming into the ring side (normally left on a stereo plug). The ring/right is not working on my module.

    Reply
  2. !! Don’t use mono mic or mono input jacks. I am using a microphone amplifier module the mazx4466 and it’s only working when I use one channel of a stereo jack. Monophones jacks will short the op-amp of the mt8870. See block diagram

    Reply
    • In my project a MAX4466 is connected via a stereo jack (using only the tip, left channel) to a MT8870 DTMF Decoder Module which is then connected to an Arduino Nano. The Nano also commands an IC2 TB6612FNG dual motor driver that drives 2 dc motor using PWM. However the 6612motor driver FETs are interfering with the Electret Microphone which also has a FET and the PWM is messing everything up. (in other words while the the driver drives a motor the Electret mic doesn’t work as it should, therefore no DTMF are recognised).
      To solve this leave the GND pin of the IC2 unconnected. Then connect the VCC of IC2 to the motors Power VIN. Make sure you have external or separate (battery or DC) supply for the motor driver board. I used a Battery and Regulator R-78B5 that powers the Vin of Arduino, the driver board VIN and Ground which in turn powers/controls the dc motors.
      In addition to power up the DTMF decoder and the MAX4466 from the Arduino nano 5V and GND. To be more specific the MAX4466’s VCC goes to nano’s 5V, the GND to nano’s GND and the OUT to a male stereo 3.5 jack (tip-left channel) to the female jack of the DTMF decoder.
      So basically the Driver board power circuit and the DTMF power circuit are isolated from one another.
      Good luck.

      Reply
  3. I am looking for a DTMF controller based on the 8870 and Arduino like this project. Has anyone taken this project farther than this application ?
    For example, reading a short string of DTMF tones, or command, to actuate output pins and read input pins on the Arduino ? This project is a good start.

    Reply
  4. Yes,
    I managed to extract a 3 chars length string when I press the # key. Then compare it with codes and if condition is true to start or stop 2 dc motors. The DTMF signal is send via and intercom system to a bunker.
    What are you looking to do?

    Reply

Leave a Comment