Electronic – arduino – Answering a phone call with RN-52 and Arduino Mega 2560

arduinoaudiobluetoothcellphoneuart

I come from Stackoverflow in need of some guidance.

My goal: stream tunes (completed) and answer/end calls through the RN-52 (not completed)

My issue: I am getting confused on the RX/TX/CTS/RTS functions of the RN-52 (datasheet).

I have tried: Connecting the RX and TX of the RN52 to the TX and RX of the Mega 2560 (pins 0 and 1) to initiate UART however when I attempt to send the command C to the module, nothing occurs (that should tell the RN52 to answer the call).

Perhaps: my issue is getting the RN52 into command mode, but I have ground GPIO9 (putting low makes it command mode).

Perhaps: I am not sending the command correctly? I used Serial.println("C");.

I hope my question and struggle is clear. Any reading material pointing me in the right direction would be greatly appreciated. I would love to get this to work but I would love to learn how it works even more. Thanks in advance and happy New Year!

Helpful link: https://learn.sparkfun.com/tutorials/rn-52-bluetooth-hookup-guide/c

EDIT (diagram, additional info)

Here is my code for using two push buttons to answer or decline a call.

#include <SoftwareSerial.h>//not sure if this is needed...read about it during a tutorial?

const int answerButton = 52; //button to answer
const int endButton = 53; //button to end

void setup(){
  Serial.begin(9600); //start talking to RN52
  pinMode(answerButton,INPUT); //set buttons to input
  pinMode(endButton,INPUT); 
}
void loop(){
  int answer = digitalRead(answerButton); //read the state of the buttons
  int endCall = digitalRead(endButton);

  if (answer == 1){ //if depressed, print C (command to answer the call)
    Serial.print("C");
    delay(2000);
  }
  if (endCall == 1){ //if depressed, print E (command to end/reject call) 
    Serial.print("E");
    delay(2000);
  }
  delay(1);//for stability...although I'm not entirely sure this is needed :)
}

When I use this, I do see the RX LED illuminate however the call is not answered. And unfortunately I can't connect to the RN52 serial to see what is says through CoolTerm at the same time since the Arduino is using the connection (read about that in this forum).

GPIO7 is NOT connected to anything (just open).

The RN52 is grounded and does stream tunes properly through Bluetooth on my iPhone. HOWEVER, there is mention about grounding or sending a signal on GPIO2 in the datasheet (table 1-3) but I can't comprehend what they are saying to do…this might be part of my issue.

ADDING SCHEMATIC (awesome, had no idea I could do this! Sorry, will include in all future posts!)

schematic

simulate this circuit – Schematic created using CircuitLab

Best Answer

  Serial.begin(9600); //start talking to RN52

I think you need to pull GPIO7 down to set speed to 9600.

From datasheet

GPIO7 Driving this pin low sets the UART baud rate to 9,600. By default the pin is high with a baud rate of 115,200.