0

I'm trying to read an incoming DTMF signal through the A0 input pin. I want to do this programmatically and not with the MT8870 module. This library (https://github.com/Adrianotiger/phoneDTMF) is supposed to do just that but I can't figure out how to connect my incoming DTMF signal to Arduino's A0 pin to receive the signal. Basically, my laptop produces the DTMF signal and I want to attach the line out, which is two wires, the positive and ground, to Arduino. None of the configurations I've tried work. I've tried to attach the positive to A0 and the ground to ground, but A0 doesn't seem to be detecting anything. I also don't want to use a microphone on the A0 pin to detect the DTMF. A simple Fritzing type diagram showing how to connect the incoming DTMF signal to A0 would be helpful. Thanks.

2
  • 1
    Not an expert on DTMF, but have you made sure to get the signal range into the 0 to 5V range of the Arduino? Line Out is symmetrical around ground and I think the peak to peak range might also be wrong. The linked library also has a circuit for adjusting the range, though it is designed for the landline voltage levels
    – chrisl
    Jan 11, 2022 at 13:11
  • I was thinking of trying to connect an LM386 amplifier to boost the incoming signal, but I still don't know how to configure the two wires to Arduino. Jan 11, 2022 at 13:20

1 Answer 1

3

Your problem is that you think there's a "positive" signal. In audio there isn't a "positive" signal, there is just a signal that swings around 0V.

You have to convert said signal to a "positive" signal by adding a DC offset to it.

The simplest way is with one capacitor and two resistors:

schematic

simulate this circuit – Schematic created using CircuitLab

That schematic will remove any DC offset that your laptop may add ("AC couple") and then add a 2.5V DC offset of your own to the signal. The audio signal will then be alternating around 2.5V.

You may need to boost the audio signal's volume with an op-amp (note: do not use a "power" amplifier like the LM386, it is not suitable; use an op-amp) to increase the sensitivity of the input. You could do this with a simple inverting amplifier arrangement with the DC offset being injected into the non-inverting input:

schematic

simulate this circuit

Here the gain of the amplifier is the ratio between R3 and R4 - in this case a 10:22 ratio (or a 2.2x gain).

From a software point of view you now remove 512 from each analog read value to give you a range of +/-511 for your sampled values. You then probably (maybe with the library you link to) take a block of samples at a defined frequency and perform an FFT analysis to find what dominant frequency components are present.

1
  • I set up the first schematic, and was able to detect the DTFM tones. Thanks! The only problem, though, is that the program seems to be detect the wrong tone. Using the tone generator here, onlinetonegenerator.com/dtmf.html, whatever button I push, the program detects the button down one row and to the right one column. Eg. I push 1 and 5 is detected. Or I push 5 and 9 is detected. I will post a question about this because it seems to be a software problem. Jan 13, 2022 at 20:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.