Sending and Receiving DTMF with HamShield
In this guide we will give some background, and quickly set up the HamShield to transmit and receive DTMF code. We will use the helpful example sketch in the HamShield Arduino library. Also, if you don't already have one, you can purchase HamShield or our new HamShield Mini from our store.
You will need:
- 1x HamShield with antenna, headset
- 1x Arduino with USB cord and power adapter
- 1x Computer with Arduino software and USB port
- 1x Optional second HamShield to confirm functionality
In this tutorial you will learn:
- How to load a HamShield example sketch to easily start using DTMF
- How to open the Arduino serial monitor to complete DTMF setup
- How to use the serial monitor to transmit DTMF signals
- How to confirm DTMF signal transmission with a second device
What is DTMF?
Dual-Tone Multi-Frequency signaling (DTMF) is a code of 16 inputs originally used to command telephone systems. The possible commands are 0 through 9, #, *, and A, B, C, and D. And consists of a pair of tones.
Each pair of tones played at the same time, and therefore is a signal made of two sine waves summed together. There are 4 low tones and 4 high tones, and each command is one low tone with one high tone.
The spacing between the tones of each set is inconsistent. This was done so that an error in tone generation, such as a shifted frequency, would produce nonsense instead of false commands.
A combination of two tones from the same set also produces no output command.
It should be noted that in most DTMF phone implementations, and some handheld radios, the forth column was not available. In the early days of DTMF, the A, B, C and D tones were typically used in military, operator applications, and some payphone functions. It was also thought that since no one had these tones on their telephone, they were inherently secure. However, phone phreaks at the time soon proved them wrong.
In amateur radio applications, these tones are very valuable, as they provide a few extra commands to control repeaters and other remote control systems.
The possible DTMF inputs (frequency combinations) can be most simply displayed in a keypad arrangement:
|1209 Hz||1336 Hz||1477 Hz||1633 Hz|
DTMF code makes it easy for remote-controlled devices to receive radio communication and distinguish control signals from noise or non-control transmissions. One of the best examples of this use are repeaters designed to also work with phone-patch control.
Quick DTMF Start with HamShield
If this is your first time using HamShield, you might want to optionally check out our getting started guide out first before diving into DTMF.
For those who already have the HamShield libraries installed, open your Arduino software, and under File -> Examples -> HamShield, find the DTMF example code.
The DTMF sketch will load. Hit the Verify button at the top to make sure you don’t
encounter any errors.
Make sure your HamShield is connected to your Arduino, and that your HamShield
has an antenna attached to the SMA jack. Plug your Arduino into wall power, and
then connect it to your computer via USB.
If you have other devices connected to USB ports, you can make sure you’re
connected to the right one by looking in the Tools menu at board and ports.
Upload the HamShield DTMF code to your Arduino.
Open the Serial Monitor.
Press the button on your HamShield, note that the code chooses certain default settings. Once it has finished its shot setup, you can type the DTMF characters 0-9, *, #, and A, B, C, D into your serial monitor and press enter to transmit the corresponding tones.
Your Serial Monitor will also display the characters when it detects them in Rx mode.
If you have two HamShields, you can transmit between them. Set up both HamShields as described above, and then:
- Open serial terminals for both (you can use a program like CoolTerm if you want to open up multiple serial ports)
- Send DTMF commands from one
- Receive DTMF commands on the other
Now that you have been able to send and receive DTMF, you are on to creating the following:
- Transmitting data from one device to another
- Use DTMF to turn on a light or motor
- Build an amateur radio powered robot!
- Create custom repeater applications