skip to Main Content

Configuring the HC-05 bluetooth module

If you have the HC-05 bluetooth module you can configure its basic parameters such as the default baud rate, device name, paring PIN and STATE pin behavior. Here is how you can configure the module.

Wiring the module

First, get yourselves a USB to UART converter. There are a multitude of these on the market with the FTDI’s FT232 being the most popular. There are plenty others such as the ones based on Silicon Labs CP2104, Prolific’s PL2303HX and the Chinese CH304G. Any of these should do the trick.

Wire up the module as shown below. The resistor divider translates the voltage level from the USB-UART bridge to 3.3V since the BT module is a 3.3V device. Any values in the ratio of 1:3 will work. I’ve used 5.1K and 10K resistors (UART bridge TX connected on the 5.1K and the RX of the module at the junction of 5.1K and 10K).

hc-05_2_bb

Powering up

Now connect the USB to UART converter to a computer and open up any serial communication tool such as CoolTerm or the Serial Monitor from the Arduino IDE. Note down the serial port number of the converter. The HC-05 module needs to be put into a special configuration mode and this is done by pressing the tiny push button on the module while powering it up. If you are powering from the USB-UART bridge then you’ll need to keep this button pressed before plugging in the cable (and powering up the module). If this was done right the indicator LED on the bluetooth module blinks slowly. Now open the serial terminal app and set the appropriate port. Select the baud rate as 38400. If you are using the Arduino Serial Monitor, then select Both NR and LF in the dropdown next to the baud rate selection at the bottom right corner.

AT Commands

Its now time to enter some AT commands. The BT module can be configured via AT commands that can be sent through the serial terminal app. Here are the commands you need to enter:

AT

and this should return an OK.

Lets change the default baud rate. Enter:

AT+UART=115200,0,0

This should set your module’s baud to 115200 bps. After every successful command an OK should be returned.

Now change the pairing PIN by entering:

AT+PSWD=7890

This will set the PIN to 7890. You can always enter something else as your PIN.

If you’d like change the name of the module that shows up in the device list by entering:

AT+NAME=CLASSB-CNC-xx

Last but not the least you need to set the STATE pin level when the module is active or inactive. This is useful if you also want to program an Arduino connected to this module. This can be done by entering:

AT+POLAR=1,0

Now we’ve configured the device and can move to connecting it to the machine. Connect the module as shown here:

<image of the section for bluetooth adapter>

Once plugged in, the device should power up and show a visual indication (usually rapidly blinking led on the module) that its ready to accept connections. On Windows machines, you should simply scan for devices and once this module shows up try and connect to it. Enter 7890 as the pin (for modules configured by us) and this should complete the bluetooth module install.

On OSX, the process is fairly simple and similar to Windows. You will need to go to System Preferences > Bluetooth. Once there make sure the module is turned ON and the pairing is automatic. You might see a message saying the pairing was not successful since we’ve changed the pairing passcode. Simply click on Options and change the passcode to whatever you’ve set it to. Click OK and the device should now successfully pair.

Leave a Reply

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

Back To Top