Building a DIY Dual-Tone Multi-Frequency (DTMF) decoder using an Arduino is an excellent project for enabling remote control via phone calls, radios, or audio jacks. DTMF is the signaling system used by telephone keypads, where pressing a key generates a unique combination of two audio frequencies.
The most common, reliable, and straightforward way to build this is by interfacing an Arduino with an MT8870 DTMF decoder module Go to product viewer dialog for this item. . Components Needed Arduino Board: Arduino Uno Go to product viewer dialog for this item. Go to product viewer dialog for this item. Go to product viewer dialog for this item. MT8870 DTMF Decoder Module Go to product viewer dialog for this item.
: A breakout board housing the MT8870 IC, an audio jack, and status LEDs.
Audio Cable: 3.5mm AUX cable to feed audio from a smartphone or radio.
Jumper Wires & Breadboard: For making electrical connections.
Output Hardware (Optional): LEDs or a Relay Module to test real-world control. How the MT8870 Interfacing Works
chip takes an analog audio signal, isolates the dual frequencies, and decodes them into a 4-bit digital binary output (Q1 to Q4) representing the pressed key (0–9,, #, A–D). It also features a StD (Delayed Steering / Tone Detect) pin. The StD pin goes HIGH the moment a valid DTMF tone is detected, alerting the Arduino that it is time to read the data pins. Wiring Connections MT8870 Pin Arduino Pin Description VCC Power Supply GND StD / STQ Digital Pin 3 Signal Detection Pin Q1 Digital Pin 7 Binary Data Bit 1 (LSB) Q2 Digital Pin 6 Binary Data Bit 2 Q3 Digital Pin 5 Binary Data Bit 3 Q4 Digital Pin 4 Binary Data Bit 4 (MSB) Arduino Source Code
This sketch monitors the StD pin. When a tone is detected, it reads the 4-bit binary data from Q1-Q4, converts it into an integer, maps it to the actual keypad character, and prints it out to the Serial Monitor.
// Define MT8870 connections const int StD = 3; const int Q4 = 4; const int Q3 = 5; const int Q2 = 6; const int Q1 = 7; void setup() { Serial.begin(9600); // Initialize Serial Monitor // Configure DTMF pins as inputs pinMode(StD, INPUT); pinMode(Q1, INPUT); pinMode(Q2, INPUT); pinMode(Q3, INPUT); pinMode(Q4, INPUT); } void loop() { // Check if a valid DTMF tone is being received if (digitalRead(StD) == HIGH) { // Read the 4-bit binary value int bit1 = digitalRead(Q1); int bit2 = digitalRead(Q2); int bit3 = digitalRead(Q3); int bit4 = digitalRead(Q4); // Convert binary bits to a 4-bit integer value int binaryValue = (bit4 << 3) | (bit3 << 2) | (bit2 << 1) | bit1; // Map the binary integer value to its matching DTMF character char decodedKey = convertToChar(binaryValue); // Print result Serial.print(“Pressed Key: “); Serial.println(decodedKey); // Wait until the button is released to prevent duplicate readings while (digitalRead(StD) == HIGH); } } char convertToChar(int val) { // MT8870 binary mapping standard if (val == 1) return ‘1’; if (val == 2) return ‘2’; if (val == 3) return ‘3’; if (val == 4) return ‘4’; if (val == 5) return ‘5’; if (val == 6) return ‘6’; if (val == 7) return ‘7’; if (val == 8) return ‘8’; if (val == 9) return ‘9’; if (val == 10) return ‘0’; if (val == 11) return ‘*’; if (val == 12) return ‘#’; if (val == 13) return ‘A’; if (val == 14) return ‘B’; if (val == 15) return ‘C’; if (val == 0) return ’D’; return ‘?’; } Use code with caution. Testing Your Setup