How to start with RN-52 Bluetooth module | applied electronics engineering

Latest

How to start with RN-52 Bluetooth module

By Applied Electronics - Thursday, May 4, 2017 No Comments
There are couple of things that you have to do to start working with RN-52 Bluetooth module. These work includes adding male or female headers so the device breakout pins so that you can connect external devices to it. For example you may want to connect microcontroller or Arduino and interface with RN-52 module. Other work then includes powering up the bluetooth module.

How to power on RN-52

To power on the RN-52 bluetooth module, you must supply voltage from 3.3V to 3.6V. If you apply more than that you will damage the chip, applying less may result in that the device will not function properly.

There are 3 pins related to powering on the RN-52 module- the VDD, the GND and the PWR_EN. The VDD and GND goes to 3.3V power supply and GND goes to ground. The PWR_EN can either be directly connected to VDD in which case the device will start up or you can connect PWR_EN to a switch which is then connected either to the VDD or GND. So if the switch is connected such that PWR_EN is connected to VDD the device will start up and it is the same as connecting directly connecting PWR_EN to VDD. If the switch is connected such that PWR_EN is connected to GND then the device will disabled. So the switch allow essentially allows one to connect or disconnect the module.

How to enter command mode

The next important step is to learn how to enter the command mode. If you want to send instructions to the device then you need to enter the device command mode. As was told in previous blog post RN-52 bluetooth module pins and their functions GPIO pins have specific functions attached to them besides being a general purpose input/output module, the GPIO9 is used for entering command mode. If you want to enter the command mode, then you have to pull the GPIO9 pin low. In default state, the GPIO9 is either floating(nothing connected) or high.

Now there are numbers of ways you can pull down GPIO9 low. The simplest way is just to connect the GPIO9 to GND using wires. Or, again, you can use a switch that either connects the GPIO9 to GND or lets it floating. On the other hand, if you are building sophisticated electronics, you may want to make it low using microcontroller via programming. For example, if you are connecting and using Arduino, you may be using Arduino Development Environment, and in such case, this just means to send LOW value to the GPIO, via digitalWrite(x, LOW), where x is arduino pin that is connected to GPIO9.

How to communicate with RN-52 bluetooth module

Next we must create a communication link between the PC and the module in order to send command and receive message from the device. This is done using the UART pins of the device which sends out RS232 signals. To receive and interpret and send command to this UART pins via USB we must have a RS232 to USB transceiver chip. The FTDI driver or module does this. It contains the FTDI chip, one side has USB connector and the other has pins for UART connection. This FTDI is thus used to interface RN-52 module Rx and Tx pins to the Tx and Rx pins of the FTDI module.

How to configure RN-52 bluetooth module

Now after creating power supply connection, creating connection for entering command mode and creating connection to the module to PC, we have all that is required to configure RN-52 module.

First, make sure the command mode is turned off, that is un-connect GPIO9. Then power on the module. Open a terminal and set the appropriate serial data rate(115200) and com port to which the RN-52 is connected. Then turn on the command mode, that is connect the GPIO9 to GND. In the terminal window you should then see "CMD" which lets you know that everything is ok and that you are in the CMD mode.

At this point you are ready to send command to the RN-52 module. Now there are lots of commands for the RN-52 and it is not possible to cover them all here. To know what commands are supported and how to use them see the command reference user guide of the RN-52.

But for brief introduction on what you can do with some typical example, read ahead.

Basically, the command sets can be classified as Get commands, Set commands, Action commands. The Get command is used to get information about the module device. The Set command is to set the device properties and the action commands is used to tell the module to do something like play, pause etc.

As an example of Get command is D, which means Display. If you type D in the terminal, you will get a list of basic setting in the device such as the device name, bluetooth address, pin code,audio route etc.



As an example of Set command is SN,mybluetooth which you would type into the terminal. This will set the name of the RN-52 bluetooth to mybluetooth. You can specify any name. Another example of set command is SA, 123 which means to set authentication.

If your set command is correct you will see AOK message otherwise you will see ERR message in the terminal.

After making changes with Set command, you have to reboot the device. To reboot you have to type R,1(/r) into the terminal.

The final type of command you would use is the action commands. Commands issued to the device for example to accept incoming call, change volume, change track etc are action commands.



Tags:

No Comment to " How to start with RN-52 Bluetooth module "