# Answering a phone call with RN-52 and Arduino Mega 2560

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!

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 endButton = 53; //button to end

void setup(){
Serial.begin(9600); //start talking to RN52
pinMode(endButton,INPUT);
}
void loop(){

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!)

simulate this circuit – Schematic created using CircuitLab

• Can you edit in a circuit diagram and minimal example of your program source (sketch)? Do you set the serial speed? Is GPIO7 low or high? Does a TX LED blink? Did you connect GND? ... – RedGrittyBrick Jan 3 '14 at 17:02
• Ok, edit has been made! I hope this additional info helps. – ride_85027 Jan 3 '14 at 17:27
• Could you add a simple schematic showing the connections between the Arduino and the RN-52. This would go a long way toward clarifying what you have done. – Joe Hass Jan 3 '14 at 17:48
• Right, sorry. I had no idea this feature was here, will use in the future, pretty handy!@RedGrittyBrick , circuit diagram added! – ride_85027 Jan 3 '14 at 18:26

  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.

• Right you are! I guess not having to pull GPIO7 down when communicating through PC made me think that wasn't needed. But doing so allowed me to use Serial.println("C"); and accept an incoming call. Now I'll need to have a look at this "handshaking" business. Thank you for the help! I'll upvote you once I hit 15 rep. Cheers! – ride_85027 Jan 3 '14 at 20:47
• Also I think println prints \r\n and you only need \r "Each command terminates with the carriage return (\r)." quote from page 19 of dlnmh9ip6v2uc.cloudfront.net/datasheets/Wireless/Bluetooth/… – 19greg96 Jun 3 '14 at 22:13

Alright, I have been using the RN-52 a lot lately, so I've got a few things:

1. I guess I don't actually know the answer to this question, but aren't you not supposed to use a 5V device to communicate via UART with a 3.3V device? Sure you could just power the RN-52 with the Arduino Mega by ONLY connecting the 3.3V supply to the RN-52, but if you're going to use the UART to send commands from an Arduino to the RN-52, don't you need a 3.3V Arduino? That's exactly what I use with the RN-52. I use SparkFun's Arduino Pro Micro 3.3V/8MHz. I would just get that one because you don't need to bother with an FTDI breakout board; just plug a USB cable right into it!

2. I am able to control the RN-52 with this setup, and I have just always used a baud rate of 115200 without touching any of the GPIO pins. I would suggest that you just do the same.

3. Since I haven't seen it discussed here yet, you may be using the wrong serial line on the Arduino Mega, which you shouldn't be using anyway! For example, my particular Arduino Pro Micro has two different serial lines. Serial.begin(115200) and Serial.println("C") correspond to the device's USB communication with the computer. Serial1.begin(115200) and Serial1.println("C") apply to the TX and RX pins that are actually hooked up to the RN-52. You would have to look at the specific serial lines of the Mega, or whatever Arduino you end up using, to figure out how to properly initialize the correct serial communication line.

Check this out this video:

• Thanks for this info! While I get most of it, I'm not too sure why I wouldn't just power the RN52 with 3.3v from the Arduino? I'll read up on the Pro Micro you linked above. I have been successful in communicating with the RN52 however I can only send 1 command...likely due to the RX/TX not being connected to the Arduino (thanks for the video link, I've watched it and purchased the supplies). Re #3: I think you're right about using the incorrect serial line...I'm trying the adjustment tonight. Thanks again for your insight, I'll report the findings. Cheers! – ride_85027 Jan 21 '14 at 1:14
• Just out of curiosity: what microphone are you using for RN-52? – Darth.Vader Jul 11 '16 at 0:31