This project contains the details of using a Microchip PIC12F683 8 bit microprocessor to detect DTMF tones. The completed program allows the processor to be programmed with a string of DTMF tones to detect. If the programmed string is detected in the audio applied the audio input, the output will turn on (go high), and can be used to control other circuitry of the users design.

UPDATE! 11/2/2010:
Due to requests for the source code, I have attached it. I have created a new step (Step 9) containing the *.asm file, along with some important notes.

UPDATE! 10/12/2010:
The HEX file for progdramming that I originally attached to this instructable had a bug that prevented successful programing of the tone sequence, unless the microprocessor was in serial output mode while in programming mode. The HEX file attached now works properly. Sorry for any inconveniene caused for those who may have tried the original code.

I have included the *.hex file needed to program the microprocessor, 12F683_DTMF_DECODE_01A.HEX. You will need a programmer for PIC microprocessors. I have seen instructions on this site for building your own, but I cannot speak for any of them. The programmer I use came from a company called Micro Engineer Labs, Inc at www.melabs.com.

The only other parts needed are the electronic components, as shown in the schematic in step 3, Circuit Details. Digikey (www.digikey.com) is an excellent source for electronic components .

A telephone or other means of generating DTMF tones is also needed for programming the microprocessor with the the sequence of tones you want to detect. This is described in more detail in step 4.

Step 1: Quick DTMF Overview

There are a total of 8 tones used to represent DTMF or "touch tone" numbers. The tones are in two groups of four, often referred to as the low and high tones. A number is represented by an audio waveform consisting of the sum of one of the low tones and one of the high tones. This can easily be visualized in a matrix format, as shown in the figure. Note that the DTMF system actually allows a total of 16 different tone pairs. The A, B, C, and D tones shown on the right hand column of the keypad in the figure are not included on a normal telephone, but they are often included on two way radios that have a DTMF keypad. They are sometimes used by two way radios for business or ham radio. The software for the project will also detect these additional 4 tone pairs.

<p>HI</p><p>CORRECTION!</p><p>I am looking for a programmer that can produce something similar to this to the extent of detecting a DTMF tone from an audio signal and sending a signal high when a correct digit has been detected and also sending the correct digit via an 8 bit port on the processor. Is this something you would be interested in doing?</p><p></p><p><a rel="nofollow">[delete]</a></p>
<p>HI </p><p>I am looking for a programmer that can produce something similar to this to the extent of detecting a DTMF tone from an audio signal and sending a signal high when a correct digit has been detected and also sending the correct digit to a 7 segment display. Is this something you would be interested in doing?</p>
<p>very nice writing i will study it.</p>
What is the best way of giving input.... <br> <br> <br>Thank you.. <br> <br>
what can i put on the output pins? <br> <br>thank you! <br>marC:)
The output that goes high once the sequence of tones is detected is just a logic level signal from the microprocessor. Like other digital outputs, it will be around 0 volts when &quot;LOW&quot; and around &quot;5V&quot; when high in the circuit shown. The output can only source a small amount of current, usually several milliamps. This output can then be used as an input by other logic ciruitry which may process or act on it. If the output is to controll a load that operates at a higher current or voltage, such as turning on a lamp, then the signal from the microprocessor would need to drive a transistor. Really the possibilities are wide open as to how the output can be used.
what is a practical use of this? <br> <br>thank you! <br>marC:)
The practical use is to dected a specific string of DTMF tones in an audio signal and turn something on (or signal another circuit) when the string is detected.
Great utilisation of an inexpensive microprocessor. <br>I am working on a project requiring similar functionality, the only different is that it requires the learning function of a single tone (not DTMF). <br>Would you be able to point in the right direction of modifying the ASM file ? <br>Thanks,
If you are looking for something that can detect a single tone, I have another project on this site which might work for you: <br> <br>http://www.instructables.com/id/Frequency-Detector-using-PIC-12F683-Processor/ <br> <br>That project detects a single frequency between 148Hz and 2148Hz. The frequency to be detected is set using a potentiometer.
The frequency range is perfect. <br> <br>My project requires the learning feature, is it easier to modify the codes so the detected frequency is set by capturing the tone into the EEPROM instead of the use of potentiometer ?
The way the code works is that the potentiometer is read, and based on that the software looks for a specific frequency. It would be a fair amout of extra code to detect what the frequency is first, and then look only for that frequency after that. It would involve sweeping through the whole frequency range to see what the input frequency is, which would be somewhat time consuming. <br> <br>You could just adjust the potentiometer while the frequency is applied and leave it in the position where the frequency is detected. <br> <br>So, there isn't a real straightforward way to train the device by having it determine the input frequency with the present revision of the code.
Can you program a CTCSS decoder 12F683? <br>Included learning function of the CTCSS tone. <br>Frequencies: 67Hz, 71.9Hz, 77Hz, 82.5Hz, 88.5Hz, 94.8Hz, 100Hz, 103.5Hz, 110.9Hz, 118.8Hz and 74.4Hz, 79.7Hz, 85.4Hz, 91.5Hz, 97.4Hz, 123.0Hz <br>
Would this idea (subtone decoder) work with the 12F683: <br> <br>There are only 4 dual - frequency. These will only be changed: <br> <br>697 Hz: replace = 28 Hz <br>Delete: 770 Hz <br>Delete: 852 Hz <br>941 Hz: replace = 38 Hz <br> <br>and <br> <br>1209 Hz: replace = 48 Hz <br>Delete: 1336 Hz <br>Delete: 1477 Hz <br>1633 Hz: replace = 58 Hz <br> <br>
I've never worked with CTCSS before, but I am familiar with the general principle. Using code similar to that in the asm file included in the instructable, one could scan for the 16 tones you listed, and then determine if any are present. It would take some modification to the code, as the logic that would be needed would be different from that used with the DTMF. Also, the code would take longer to sweep through the list of frequencies, as there are 16 in your list versus 8 for DTMF. On top of that, I see that these frequencies are much more closely spaced than DTMF, so the algorithm would have to be configured to give a much sharper response to differentiate them. This would likely increase the overall detection time even further. I think that your application is getting to the point where a real DSP processor is needed, and not the general purpose 12F683 or similar PIC processor. In my own research into the Goertzel algorithm, one artical I came across describes using it for CTCSS applications. Here is a link:&nbsp;<br> <br> <a href="http://www.eetindia.co.in/STATIC/PDF/200604/EEIOL_2006APR04_EMS_RFD_SIG_TA.pdf?SOURCES=DOWNLOAD">http://www.eetindia.co.in/STATIC/PDF/200604/EEIOL_2006APR04_EMS_RFD_SIG_TA.pdf?SOURCES=DOWNLOAD</a><br> <br> The article doesn't use a PIC processor, but it does give a good amount of detail about using this approach for CTCSS.<br>
To those who requested the source code, it has been added. Refer to step 9 of the instructable. <br> <br>I can answer a few questions if you have any. I'd be interested in any cool applications that anyone come up with. <br> <br>Enjoy.
Thanks for the code. I had issues downloading it because it saved as a weird .tmp file. But I searched it and found that if you rename the file that it will work then. again thanks for the code.
No problem. I hope it works out for your senior design project.
Would you be willing to post your assembly code? I am working on a senior design project and am trying to learn how to write the code for the dtmf detection part of our project. Any help would be much appreciated. I know I can use a chip like the MT8870 but want to encode it on our microprocessor.
I recently had another request for the source code. I did not attach it to the instructable originally, as I had not commented it very thoroughly. I am wrapping up the comments and should be able to update the instructalbe with the attachment in about a week. <br> <br>You can check back with this instructable in the future, to see whether I have updated the intro section with a notice stating that the source code has been added. <br>

About This Instructable




Bio: "But I was going to Toshi station to pick up some power converters!"
More by LargeMouthBass:Audio Delay Module Reverse Engineering an Electric Fence Charger Stop Time with an LED Stroboscope! 
Add instructable to: