CM8870 arduino problem

Hello ;
I dont know english well :slight_smile: sorry
I will make Cm8870 arduino project
I m make code for test .

const int Q[4]={
  6,5,4,3};            


void setup()
{
  Serial.begin(9600);
  
  for(int i=0;i<4;i++)
    pinMode(Q[i],INPUT);             
}

void loop()
{
  dtmf();
}

void dtmf()
{
  
  
  int a=digitalRead(6); 
  int b=digitalRead(5); 
  int c=digitalRead(4); 
  int d=digitalRead(3); 
  Serial.println(a);
  delay(1000);
  Serial.println(b);
  delay(100);
  Serial.println(c);
  delay(100);
  Serial.println(d);

}

I connect arduino - cm8870 with diagram
I connect pc and Telephone audio jack.I press 1 or 9 from telephone . But serial monitor write =
0
0
0
0
What s the problem

the code looks ok, as far as i can tell. do you have a multimeter? if so, check the outputs of the cm8870 as you hold down telephone numbers, and see if the cm8870 is working like you expect.

OK I will try multimeter
How to connect audio jack to cm8870 from telephone (galaxy s2 )
My audio jack out is 2 cable . Which cable gnd ?

You aren't checking whether the chip has detected a valid tone. Pin 15 will go high when a valid tone has been detected and the BCD output is valid.
You need to wire pin 15 to a digital input. Then the code can just loop waiting for that pin to go high. When it does, read all four data pins, and then wait for pin 15 to go low.

// The digital pin where the chips pin15 is connected
#define Pin15 7

// In setup Pin15 must be declared an input with pullup
// pinMode(Pin15,INPUT_PULLUP);

void loop(void)
{
  // wait for pin 15 to go high
  while(!digitalRead(Pin15));
  int a=digitalRead(6); 
  int b=digitalRead(5); 
  int c=digitalRead(4); 
  int d=digitalRead(3);

  Serial.println(a);
  Serial.println(b);
  Serial.println(c);
  Serial.println(d);
  // Wait for pin 15 to go low again.
  while(digitalRead(Pin15));
}

Pete

el_supremo:
You aren't checking whether the chip has detected a valid tone. Pin 15 will go high when a valid tone has been detected and the BCD output is valid.
You need to wire pin 15 to a digital input. Then the code can just loop waiting for that pin to go high. When it does, read all four data pins, and then wait for pin 15 to go low.

// The digital pin where the chips pin15 is connected

#define Pin15 7

// In setup Pin15 must be declared an input with pullup
// pinMode(Pin15,INPUT_PULLUP);

void loop(void)
{
  // wait for pin 15 to go high
  while(!digitalRead(Pin15));
  int a=digitalRead(6);
  int b=digitalRead(5);
  int c=digitalRead(4);
  int d=digitalRead(3);

Serial.println(a);
  Serial.println(b);
  Serial.println(c);
  Serial.println(d);
  // Wait for pin 15 to go low again.
  while(digitalRead(Pin15));
}




Pete

Thanks for help.I write same code and connect pin 15 . I open phone conncet jack . I press number but serial monitor does not print .

I will try another jack . How ? connect ?