RN52 Bluetooth Tutorial

Learn how to start up RN52 Bluetooth module, how to configure it using Terminal and how to stream and play audio

In this RN52 Bluetooth tutorial, you will learn how to start up and connect RN-52 bluetooth module for the first time, then how to configure the module by sending commands via Terminal to the module and finally how to stream audio(music) to bluetooth module.

First we explain briefly about RN52 bluetooth module for those who don’t know what it is and why and where it can be used. Then we adopt the following steps.

  1. Start up RN52 Bluetooth Module
  2. Configure RN52 Bluetooth Module
  3. Stream and Play Audio with the Bluetooth Module

About RN52 Bluetooth Tutorial and RN52 Module

RN52 Bluetooth module is a audio Bluetooth module produced by Microchip. It allows you to send audio from computer or smartphone over Bluetooth to the module and you can hear the audio in speaker or headset. The following illustrate the idea just mentioned.

RN 52 Bluetooth Tutorial

The exact name of the module is RN52-I/RM and is shown in the following picture.

RN52-I/RM

In order to use the RN-52 bluetooth module you need a break out board such as the one supplied by Sparkfun as shown below.

But you can also make your own break out board for the RN 52 bluetooth module using the PCB files available for free download in the Sparkfun website for RN-52. Here we made a break out board our-self.

See the tutorial Home Made RN52 Bluetooth module break out board to learn how to do this.

Below is the picture, the first one is top side and the second is bottom side.

home made RN52 bluetooth break out board home made RN52 bluetooth break out board back side

On the bottom side you can see pin header. Although this header should have been mounted on the top side it has been done on the bottom because of the lack of proper through hole via.

1. Start up RN52 Bluetooth Module

The first thing we need to learn is to how to actually power up the module and start it. To power ON the module we have to apply voltage of 3.3V to two pins on the RN52- One is the VDD and the other is the PWREN(power enable) pin.

Shown below is schematic drawn in Proteus.

RN-52 schematic proteus

The pin 21(PWREN) and pin 22(VDD) should be connected to +3.3V positive terminal on the breadboard(used here).

There are also two LEDs connected to 3.3V via 330Ohm resistors. They show the state of the device.

The ground should be already connected properly if you used the RN52 PCB files from the Sparkfun. If you are using your own board then you should connect them.

Now we show how it is connected in the breadboard.

2. Configure RN52 Bluetooth

To configure RN52 bluetooth we must send command via Terminal on the PC or other device. This is done by connecting USB to TTL converter to the UART port of the module. And to be able to send command to the Bluetooth we must make the GPIO9 pin low(which is otherwise high or unconnected) to enter into command mode.

First let see first how to connect the GPIO9 pin. The following circuit illustrates how a SPDT switch can be used to connect 3.3V to the GPIO9 pin and switch to ground.

Shown below is the SPDT connection to the GPIO9 via breadboard.

SPDT switch for RN52 command mode

Next is the connection to the PC via the USB UART connecting device. Such converter is readily available in electronics part shops. One such is shown below.

USB UART converter

This device was also explained and used in the tutorials PIC32 UART Interrupt example Project using MPLAB Harmony.

One side is used to connect to PC USB and the other side is used to connect to the RN52 UART RX and TX pins. This is illustrated in the picture below.

USB UART converter proteus

Note that the TX of RN52 goes to RX of USB to UART converter and RX of RN52 goes to TX of the converter. Also you have to connect the ground to the same ground as for the 3.3V supply ground. The 3.3V and 5V from the converter need not be connected.

So overall the circuit schematic is shown below.

RN52 USB to UART Proteus RN 52 Bluetooth Tutorial

The implementation is shown below.

l

Now we are ready to communicate with the RN52 Bluetooth module via the Terminal running in the computer. The Terminal we are going to use is the Tera Term(free to download).

Open the Tera Term and select Serial communication with the appropriate COM port. In this case the com port is 13 but yours might be different.

Tera Term for RN52

Then you will see a blank blank terminal. In order to communicate with the RN52 we have to configure the baud rate from default 9600kbps to 115200 kpbs. Otherwise you won’t be able to communicate with the module.Click on the Setup then Serial Port and set the baud rate to 115200.

Then to enter the command mode, use the SPDT switch to the GPIO9 pin to low(ground). You should see CMD appear in the terminal and one of the LED will blink.

Now type in D(or just d) and hit ENTER and you should see the following.

RN 52 Bluetooth Tutorial

The command D is used to get the current setting of the module.

Notice that although you typed D in the terminal you won’t see it. To see what you have typed you must enter + on your keyboard (don’t forget to hit ENTER). This will turn on echo and will notify you.

Now enter D again and you should see the D appears also on the screen.

Now there are various commands used to configure the Bluetooth such as name of the module, pin code, turn on different features, check version and so on. You should check out the command list for RN52 that is available freely on the net.

So in this way, you can power up the RN52 module and configure the module using terminal. The next is to actually send audio to the module and hear the audio from the speakers connected the module.

3. Stream and Play Audio with the Bluetooth Module

When the RN52 is used for the first time and/or is not configured by user, the default setting is that the A2DP/AVRCP profile is enabled. This means once you have paired with a bluetooth enabled device like PC or smartphone, you can send the RN52 module audio signal such as music for example. The RN52 will receive this audio via wireless bluetooth and send them to the speaker connection pins. So if you hook up speakers(thehre are two left and right) to the speaker pins on the module breakout board we can hear the audio.

Below is shown schematic of connection of speakers.

RN 52 Bluetooth Tutorial

The implementation is shown below.

RN52 speaker connection

Now we have to pair and send music over the bluetooth.

On the PC(or mobile phone) open and turn on the bluetooth. The RN52 module should be listed in the bluetooth devices list with the name of the bluetooth module. In this case the default bluetooth name is listed as RN52-5953.

Double click on the RN52 device to open the connection window and click on connect(windows 7 was used here).

After connecting play some music on your computer and you should hear the same in the speaker connected to the module.

Also see our another Bluetooth tutorial- Arduino Bluetooth Module HC-05 Tutorial.

Leave a Reply

Your email address will not be published. Required fields are marked *