Instructables

DTMF Touch Tone Decoder Using Microchip PIC Microprocessor

Picture of DTMF Touch Tone Decoder Using Microchip PIC Microprocessor

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.

 
Remove these adsRemove these ads by Signing Up
What is the best way of giving input....


Thank you..

nodoubtman1 year ago
what can i put on the output pins?

thank you!
marC:)
LargeMouthBass (author)  nodoubtman1 year ago
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 "LOW" and around "5V" 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.
nodoubtman1 year ago
what is a practical use of this?

thank you!
marC:)
LargeMouthBass (author)  nodoubtman1 year ago
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.
mluski2 years ago
Great utilisation of an inexpensive microprocessor.
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).
Would you be able to point in the right direction of modifying the ASM file ?
Thanks,
LargeMouthBass (author)  mluski2 years ago
If you are looking for something that can detect a single tone, I have another project on this site which might work for you:

http://www.instructables.com/id/Frequency-Detector-using-PIC-12F683-Processor/

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.

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 ?
LargeMouthBass (author)  mluski2 years ago
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.

You could just adjust the potentiometer while the frequency is applied and leave it in the position where the frequency is detected.

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.
fbcullom2 years ago
(removed by author or community request)
LargeMouthBass (author)  fbcullom2 years ago
The asm file I originally attached was written using a very old copy of MPLAB. I've now updated the file with one that will assemble without errors using the latest version of MPLAB. Go to step 9 of the instructable and download the new asm file and try that.

The hex file attached should work as described in the instructable regardless.

Good luck on your repeater project! Let me know if it works out for you.

elektrant3 years ago
Can you program a CTCSS decoder 12F683?
Included learning function of the CTCSS tone.
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
Would this idea (subtone decoder) work with the 12F683:

There are only 4 dual - frequency. These will only be changed:

697 Hz: replace = 28 Hz
Delete: 770 Hz
Delete: 852 Hz
941 Hz: replace = 38 Hz

and

1209 Hz: replace = 48 Hz
Delete: 1336 Hz
Delete: 1477 Hz
1633 Hz: replace = 58 Hz

LargeMouthBass (author)  elektrant3 years ago
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: 

http://www.eetindia.co.in/STATIC/PDF/200604/EEIOL_2006APR04_EMS_RFD_SIG_TA.pdf?SOURCES=DOWNLOAD

The article doesn't use a PIC processor, but it does give a good amount of detail about using this approach for CTCSS.
LargeMouthBass (author) 3 years ago
To those who requested the source code, it has been added. Refer to step 9 of the instructable.

I can answer a few questions if you have any. I'd be interested in any cool applications that anyone come up with.

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.

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.