Bluetooth Setup and Baud Rate Changing Guide

Bluetooth to Serial HC-06 Module

Figure-1: HC-05 and HC-06 Bluetooth Modules

Grbl Firmware communicates with host interface or gui with a fixed (115200 v1.1) baud rate. Any Bluetooth module you are using must use the same baud rate as the Grbl Firmware. Most of the Bluetooth modules ships with a default baud rate of 9600. If you are going to use Bluetooth connection to control and run your CNC machine, then you must change the baud rete of the Bluetooth device to match with Grbl Firmware.

This guide will help you to change the baud rate of the most popular and common Bluetooth to serial modules HC-05 and HC-06.


HC-06 Bluetooth Module Setup

Figure-2 shows the HC-06 module with on-board voltage converter and level shifter. Most of Bluetooth modules works with 3.3v, you must use a voltage converter from 5v to 3.3v and a level shifter for serial communication with Arduino since Arduino i/o pins has 5v output. We will use Arduino Uno R3 and Arduino IDE to change the baud rate of the HC-06 Bluetooth module.

Hardware Connections

Connect the Bluetooth module to Arduino board as shown in the Figure-3.

  • Connect Arduino PIN 10 to TXD of HC-06.
  • Connect Arduino PIN 11 to RXD of HC-06.
  • Connect GND of HC-06 GND of Arduino.
  • Connect VCC of HC-06 to 5V of Arduino.

After this LED on the HC-06 should be blinking.

  • Upload the attached sketch to you Arduino using arduino IDE.
  • Open serial monitor in Arduino IDE (Menu Bar => Tools => Serial Monitor)
  • Make sure you have selected a baud rate of 9600 (if you are not changed the baud rate of HC-06 before) in your serial monitor. (also select line termination as "both \r and \n")
Bluetooth to Serial HC-06 Module

Figure-2: Typical HC-06 Bluetooth to Serial Module

HC-06 Arduino Connection Diagram

Figure-3: Hc-06 Arduino Connection Diagram

  • Type "AT" in the serial monitor with out " and press enter. You should see a response "Ok", if not then make sure you have followed the above steps correctly.
  • Type "AT+VERSION" in the serial monitor without " and press enter. You should be able see the firmware version.
  • Type "AT+BAUD8" in the serial monitor with out " and press enter. The baud rate should be changed by now.

Bellow is the list of other baud rates.

AT+BAUD1 baud rate 1200
AT+BAUD2 baud rate 2400
AT+BAUD3 baud rate 4800
AT+BAUD4 baud rate 9600
AT+BAUD5 baud rate 19200
AT+BAUD6 baud rate 38400
AT+BAUD7 baud rate 57600
AT+BAUD9 baud rate 115200
AT+BAUD9 baud rate 230400
AT+BAUD10 baud rate 460800
AT+BAUD11 baud rate 921600
AT+BAUD12 baud rate 1382400

NOTE: If your Bluetooth module has default baud rate other than 9600, then you might want to try by changing the baud rate in the Arduino sketch. hcSerial.begin(9600); // software serial Arduino to HC-06 (9600 is default)

HC-06 Arduino Sketch Download Show Sketch

HC-05 Bluetooth Module Setup

HC-06 and HC-05 are similar, but HC-05 has more features it can work as master and can create connection with other Bluetooth devices. Typical HC-05 module will look like Figure-4. HC-05 has a 6 pin header rather than 4 pin header HC-06. The two extra pins are state and enable (en). Some HC-05 module also comes with a on bord button wich can be used to enter AT command mode.

Main parts of the HC-05 module

  • 3.3V low dropout regulator, which allows you to power it from 3.6V to 6V.
  • An LED to show the current working mode of the module.
    1. Fast Blink: Waiting for Bluetooth connection
    2. Slow Blink: In AT command mode
    3. Double Blink: Connected via Bluetooth

HC-05 can be put into AT command mode by holding the switch during power-up, LED will blink slowly at regular intervals to indicate the AT command mode. AT Mode accepts commands at 38400 baud , N,8,1 using the Rx and Tx pins.

Below are the commands to configure the HC-05 for slave mode, each command must be followed by a line feed and carriage return.

  • AT+VERSION? (firmware version info)
  • AT+ROLE=X (0: Slave Mode, 1: Master Mode, 2: Slave-Loop Mode, default = 0)
  • AT+NAME=XXXX (change name to XXXX default=HC-05)
  • AT+PSWD=1234 (change password to 4 digit number 1234, default = 1234)
  • AT+UART=X,S,P (X=Baud, S=stop bits (0=1, 1=2), P=parity (0=None, 1=Odd, 2=Even) Example AT+UART=115200,1,0
  • AT+ORGL (reset all parameters to defaults)
Tipical HC-05 Bluetooth Module

Figure-4: Tipical HC-05 Bluetooth Module

Using an Arduino Uno to Program HC-05 Bluetooth Module

Wiring Diagram Arduino Uno and Bluetooth HC-05

Figure-5: Wiring Diagram Arduino Uno and Bluetooth HC-05

We have to setup 2 serial links. One link will be from the PC to the Arduino to send the commands from the keyboard over USB. Another will be a serial connection from the Arduino to the HC-05. We will use a software serial port for this and can use any remaining pins to do this. HC-05 uses 38400 baud for AT commands, regardless of the what you set it to for Bluetooth operation.

You can then type AT commands in the Arduino Serial Monitor.