Do we need another chip to generate DTMF tones with Arduino?

Dilshan R Jayakody
4 min readMay 9, 2019

--

Dual-tone multi-frequency (DTMF) is a common signaling system used in telephone networks and other communication devices. It uses a mixture of two sine waves to generate tones which represent ten digits, the letters A to D, and the symbols # and *.

While I’m examining other Arduino based DTMF generators I noticed most of the designs are based on Holtek HT9200 DTMF generator IC. After a couple of experiments, I figure out that Arduino itself is capable enough to generate DTMF tones without using any external IC or generator.

The design which I explained in this article is based on R-2R ladder DAC. I did this design using Arduino Uno board and still this library support only for this board. But it can easily extend to other AVR MCU based Arduino boards.

The R-2R ladder is attached to the PORTD of the MCU which is Digital out 0 to 7 in Arduino Uno board. In this design, I used 100Ω and 220Ω resistors to construct the R-2R ladder circuit.

Wiring layout for the DTMF generator.

As shown above, this generator can easily construct on a breadboard and it needs only 16 resistors and one electrolytic capacitor. The schematic of the above layout is given below.

Schematic of the DTMF generator.

In MCU, waveforms are generated using precalculated wavetable. For example, to generate a tone for digit 1, it synthesizes 700Hz (≈ 697Hz) and 1200Hz (≈ 1209Hz) waveform separately and combines at the later stages to produce the final output.

Following diagrams illustrate how Arduino MCU generate sine waves with above-mentioned frequencies using its wavetable.

700Hz waveform. Y-axis represents the value of the PORTD.
700Hz waveform. Y-axis represents the value of the PORTD.

After combining the above two signals, we can get the waveform which represents the digit 1.

Final waveform. Y-axis represents the value of the PORTD.

Due to the lower resolution of our DAC, the output waveform is not in a pure sine wave shape, but it works absolutely fine with all the system which we checked.

Comparison of the waveforms generated by Arduino and analog generator.

Above screen capture reveal the difference between the waveforms generated by Arduino and some analog generator. Channel 1 represents the waveform which is generated by Arduino for digit 1.

The waveform in channel 2 is captured using the analog generator and it also expresses the digit 1.

Prototype version of DTMF Generator.

To verify the resulting tone I feed the output of this DTMF generator to MT8870 DTMF decoder and it decodes all the tones without any issues. Also, I checked this library with a voice telephone network by dialing some numbers and it also works fine.

DTMF tone verification with MT8870.

The Arduino library for this DTMF generator is quite easy to use. Both packaged library and source codes are available at https://github.com/dilshan/dtmfgen.

The downloaded library file can directly installed into the Arduino IDE by navigating over Sketch > Include Library > Add .ZIP library menu.

After the installation clicks File > Examples > DTMFGen to open the example sketch.

Once the library is integrated into the IDE, Arduino can generate DTMF tones with few lines of codes.

I prefer to use this method to generate DTMF tones because it’s simple and extensible. Another issue which I encounter with DTMF generator chips is that sometimes those chips and modules are hard to find in some marketplaces. With this approach, anyone can build a DTMF tone generator with a few discrete components.

The major drawback of this approach is it consumes 8 I/O pins of the Arduino board.

--

--

Dilshan R Jayakody

Embedded systems engineer 💻 , amateur radio operator 📻 and amateur astronomer 🔭 from Colombo, Sri Lanka.