0

I'm able to detect a DTMF tone with the library https://github.com/Adrianotiger/phoneDTMF and code example:

#include <PhoneDTMF.h>

PhoneDTMF dtmf = PhoneDTMF();

void setup() {
    Serial.begin(9600);
    dtmf.begin(A0);
}

void loop() {
    uint8_t tones = dtmf.detect();
    char button = dtmf.tone2char(tones);
    if (button > 0) {
        Serial.print(button);
        Serial.println(" pressed");
    }
    delay(1000);
}

The following code example also works to detect a tone: https://github.com/Adrianotiger/phoneDTMF/blob/master/examples/sampleDetect/sampleDetect.ino

And I have set up the following schematic with Arduino:

enter image description here

The problem is that the program seems to be detect the wrong tone. Using the tone generator here, https://onlinetonegenerator.com/dtmf.html, whatever button I push, the program detects the button down one row and to the right one column. E.g. I push 1 and 5 is detected. Or I push 5 and 9 is detected. I couldn't adjust the library code, because frankly, I don't understand it well. How can I get the program to detect the correct tone? Thanks.

1
  • 1
    Did you try to adjust the parameters in the object's constructor? PhoneDTMF(int16_t sampleCount = 128, float amplify = 1.0f). Something like this: PhoneDTMF(300, 4.0).
    – VE7JRO
    Jan 13 at 20:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.