RN-52 Bluetooth Hookup Guide
Configure the Module
Now that you can actually power up the RN-52 and send it into command mode, let’s talk about changing the settings, and thus the behavior, of the Bluetooth module.
- Make sure the CMD Mode switch is in the OFF position (GPIO9 NOT shorted to GND).
- Turn on your RN-52.
- The two status LEDs should both stay solid for about 1 second and then begin flashing alternately.
- Your device is now ready to make a connection. Rather than connect over Bluetooth, the connection will be made over the serial UART.
- Open a terminal window on the port your RN-52 has been assigned (115200 Baud, 8,N,1).
- With the terminal open and connected to the RN-52, flip the CMD Mode switch to the ON position (GPIO9 shorted to GND). You should now see
CMDappear in your terminal.
You are now in Command Mode!
To exit command mode, simply flip the switch back to the OFF position. You will see
END appear in the window.
*Note: The RN-52 can enter and exit CMD mode while streaming music.
Now let’s explore the module’s settings.
This portion of the tutorial will only briefly touch on the command set. To see a list of all the RN-52 commands, read the Command Reference User Guide.
Get commands query the device for information.
D - Displays the basic settings such as name, address, pin code, etc.
Set commands change actual settings of the module such as name, profile mode, and extended features.
SN,<string> - changes the name of your RN-52. The default name is RN52-xxxx, where the last four numbers are the same last for numbers of the RN-52’s address. If you only have one RN-52, you can change the name to whatever you’d like. If you have multiple RN-52s active, it may be best to keep the default names for identification purposes.
SA,<value> - sets the authentication mode. If you don’t want others snooping in on your tunes, be sure to enable some sort of authentication.
All set commands are followed by an
AOK if the command was entered correctly and an
ERR if it was not.
If you change any set commands, you must reboot the module before the settings will take effect. Type
R,1(/r) to reboot the module.
Action commands tell the module what action to take. With these commands, you can accept incoming calls, change the volume, change the track, and pause your music. Check out the Command Reference for a complete list of action commands.
If you cannot talk to the RN-52 over the serial port, make sure you are connected at the correct baud rate (default:115200).
To change the baud rate, GPIO7 must be pulled LOW (it is HIGH by default). This will set the baud rate to 9600. 115200 and 9600 are the only two baud rates available on the RN-52.
If you need to implement a factory reset, send
SF,1(/r)to reset the module, then
R,1(/r)to reboot it.
The commands for the RN-52 all terminate with a carriage return (\r), not with a carriage return/line feed. If you keep seeing
?after every command you enter, there should be a setting in your serial terminal to turn on just carriage return.
This is especially important to note if you plan on having a microcontroller communicate with the RN-52.