Interface MT8870 DTMF Decoder Module with Arduino (original) (raw)

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:

Number Pin Name Function
Number Pin Name Function
1 IN+ Non-Inverting input pin
2 IN- Inverting input pin
3 GS Gain Select pin
4 VRef Output Reference Voltage
5 INH Input Inhibit pin
6 PWDN Input Power Down pin
7 OSC1 Clock input pin
8 OSC2 Clock output pin
9 VSS Ground pin
10 TOE Decoder Output Enable pin
11-14 Q1-Q4 Decoder Output pins
15 StD Output Delayed Steering pin
16 ESt Output Early Steering pin
17 St/GT Input steering/Output Guard Time pin
18 VDD Positive Power Supply pin

DTMF Decoder Module Features and Specifications

Additional Features

Some extra features include:

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

Arduino UNO MT8870 DTMF Module
8 StD
12 Q1
11 Q2
10 Q3
9 Q4
5V VDD
GND VSS

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

2D Diagram

2D diagram

Related Articles:

Arduino Components Amazon Links
Arduino Starter Kit Buy Now
Arduino Development Kit Buy Now
Arduino Smart Robot Car Kit V4 Buy Now
Arduino Sensors Kit Buy Now