Project tutorial
Generate DTMF Tones Only Using Arduino

Generate DTMF Tones Only Using Arduino © CC BY

This article explains how to generate DTMF tones only using Arduino Uno.

  • 1,844 views
  • 0 comments
  • 4 respects

Components and supplies

About this project

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.

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.

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.

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.

#include "dtmfgen.h"
  
DTMFGenerator dtmf;
  
void setup()
{
}
  
void loop()
{
 // Generate 100ms long DTMF tone for digit 5. 
 dtmf.generate('5', 100);
}

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.

Code

DTMFGen library
This repository contains source codes and samples of DTMFGen library.

Schematics

Fritzing.org project files

Comments

Similar projects you might like

Generating Tones of Different Frequencies Using Mathematics

Project tutorial by Jalal_Mansoori

  • 2,218 views
  • 2 comments
  • 13 respects

Playing Tones Using Bananas

Project tutorial by HeathenHacks

  • 927 views
  • 0 comments
  • 6 respects

Automation basics using arduino and DTMF decoder

Project tutorial by TEAM DIY

  • 3,605 views
  • 2 comments
  • 6 respects

DTMF Decoder Using Only Arduino

Project tutorial by

  • 1,904 views
  • 0 comments
  • 4 respects

DTMF Decoder

by

  • 1,443 views
  • 2 comments
  • 4 respects

Arduino MKR GSM 1400 and DTMF

by Arduino_Genuino

  • 18,030 views
  • 0 comments
  • 29 respects
Add projectSign up / Login