Table of Contents

Ready to go wireless? Your journey often starts with a simple search: ​​”HC05 Bluetooth module price”​​ vs ​​”HC06 Bluetooth module price”​. But what’s the real difference between the ​Bluetooth module HC06​ and the classic ​Bluetooth HC05 module​? This guide will crack the code, helping you choose the perfect Bluetooth ​ for your project!

What is the Bluetooth Module?

Bluetooth is a technical stan1dard for wireless communication, allowing devices to exchange data and communicate within a short range. It operates in the UHF radio wave band of the ISM band at 2.4 – 2.485 GHz. It has replaced traditional wired connection methods, enabling low-power and low-cost data transmission and communication between devices and solving the problem of data synchronization.

Characteristics of Bluetooth Technology

  1. Wireless communication: Bluetooth enables devices to communicate within a short range (usually around 10 meters, depending on the device version) without the need for cables or other physical connections.
  2. Low power consumption: The Bluetooth technology is designed as a low-power communication method, which makes it widely used in mobile devices such as smartphones, tablets, and Bluetooth headphones.
  3. Multi-device connection: Bluetooth allows a main device (such as a mobile phone) to connect to multiple slave devices (such as Bluetooth headphones, Bluetooth speakers, etc.) simultaneously, enabling more flexible data transmission and communication.
  4. Universality: The Bluetooth technology is widely used in many devices and applications, such as wireless headphones, keyboards, mice, car Bluetooth connections, smart home devices, etc.
  5. Security: The Bluetooth technology is constantly evolving and improving to enhance its security to prevent unauthorized access and data leakage.

The Bluetooth technology has different characteristics and functions in different versions, from Classic Bluetooth to Low Energy Bluetooth (BLE), each version is tailored for different application scenarios and requirements.

HC 05 Bluetooth Module / HC 06 Bluetooth Module

  • HC-05 and HC-06 are widely used classic Bluetooth modules, which are commonly employed for wireless communication with microcontrollers (such as Arduino).
  • They are based on the Bluetooth 2.0 standard and support the serial port communication (UART) protocol, making the connection with the microcontroller and data exchange relatively simple.
  • The HC-05 can function as either a master device or a slave device, and it supports Bluetooth SPP (serial port communication) and AT command mode.
  • The HC-06 is usually used as a slave device and only supports the Bluetooth SPP mode.
  • They have a basic communication range, typically around 10 meters.

The HC-05 and HC-06 are two common classic Bluetooth modules, and there are some differences in their design and functionality. The following is a detailed explanation of them.

HC 05 Feature and Performance

The HC-05 sensor is a powerful classic Bluetooth module produced by EGBT.

It is based on the Bluetooth 2.0 standard and supports various transmission protocols, including serial communication (UART) and Bluetooth SPP (serial communication).

The HC-05 can switch between master mode and slave mode, offering high flexibility.

It supports the setting of Bluetooth connection passwords to enhance security.

The HC-05 can be configured and controlled through AT commands, such as changing the Bluetooth name, baud rate, pairing password, etc.

HC 06 Feature and Performance

The HC-06 sensor is another common classic Bluetooth module, also produced by EGBT.

Compared with HC-05, HC-06 is relatively simpler and is mainly used in slave mode from the device.

It only supports the Bluetooth SPP (serial port communication) protocol and cannot switch to the master device mode.

HC-06 can be directly paired and communicate with other master devices (such as smartphones or computers).

Similar to HC-05, HC-06 can also be configured through AT commands, such as changing the Bluetooth name and pairing password.

HC-05 VS HC-06

1. Master-Slave Mode

HC-05 Master-Slave Mode:

The HC-05 module can switch between the master mode (Master) and the slave mode (Slave). This means it can act as the Bluetooth master device and establish connections with other slave devices, or it can act as a slave device and receive connection requests from the master device.

HC-06 Slave Mode:

The HC-06 module is mainly used in the slave mode (Slave). It cannot switch to the master mode and can only receive connection requests from the master device.

2. Working Mode

HC-05 Working Mode:

The HC-05 has two working modes: command mode and transparent transmission mode. In command mode, AT commands can be sent via the serial port to configure and set parameters of the module, such as modifying the module name, baud rate, pairing code, etc. In transparent transmission mode, the module will automatically transmit the serial port data via Bluetooth to achieve wireless transmission. Through AT commands, users can conveniently configure the behavior of the HC-05 module, such as setting the Bluetooth name, baud rate, pairing password, etc.

HC-06 Working Mode:

The working mode and configuration method of HC-06 are similar to those of HC-05, and it also supports command mode and transparent transmission mode. In command mode, configuration can be done by sending AT commands via the serial port. Although the AT command set of HC-06 is somewhat simplified compared to HC-05, it still meets the basic configuration requirements. Through AT commands, users can set parameters such as Bluetooth name and pairing password.

3. Status indicator light

① Connection mode: HC-05 flashes rapidly, HC-06 flashes rapidly.

② AT mode: HC-05 flashes slowly, HC-06 flashes rapidly.

Under this mode, the name, password, baud rate, master-slave relationship and other attributes of the Bluetooth module can be set by sending AT commands from the serial port. It should be noted that when HC 05 sends AT commands, it must end with \r\n (newline), while HC06 cannot end with \r\n (newline). Otherwise, an error of no response will occur.

Note: If you want to collect data, you must set it to slave mode!!! Additionally, after exiting AT (that is, by powering off and then on again), you should perform the pairing process!!!

③ Connection mode: The HC-05 flashes twice and then stops, and the HC06 also always has a bright light.

It should be noted that if after the mobile phone Bluetooth serial port assistant sends data, the screen displays garbled characters, it indicates that the baud rate setting is incorrect. The baud rate needs to be set to the same value as that in the “AT + UART” setting.

4. Supported Protocols

HC-05 Supported Protocols:

The HC-05 module supports multiple transmission protocols, including serial communication (UART) and Bluetooth SPP (serial communication) protocols. It can perform data transmission and communication with other devices through these protocols.

HC-06 Supported Protocols:

The HC-06 module only supports the Bluetooth SPP (serial port communication) protocol. It does not have support for the UART transmission protocol, so when using HC-06 to communicate with other devices, data transmission needs to be carried out through the serial port.

5. Pin Functions

HC-05 Pin Functions:

HC05 pinout

The HC 05 module has 6 pins, including VCC (power supply), GND (ground), TXD (transmit data), RXD (receive data), STATE (status), and EN (enable). The STATE pin can be used to detect the connection status and the working mode of the module.

HC-06 Pin Functions:

HC06 pinout

The HC 06 module is relatively simple, with only 4 pins, including VCC (power supply), GND (ground), TXD (transmit data), and RXD (receive data). It does not have the STATE and EN pins, so it cannot provide information related to connection status and working mode.

6. Application Scenarios

HC-05 Application Scenarios:

Since HC-05 supports master device mode and multiple transmission protocols, it is quite common in applications where it needs to connect other slave devices as the master device. It is suitable for projects that require flexible control of connections.

The HC-05 Bluetooth module is widely used in wireless remote control, wireless data transmission, and smart home applications due to its high stability and reliability, as well as its simple and understandable interface. It is suitable for scenarios requiring low power consumption and long-distance transmission, such as remote control devices in smart homes and smart phones.

HC-06 Application Scenarios:

The HC-06 is mainly used as a slave device and is suitable for applications that require receiving connections from a master device. It is suitable for simple Bluetooth serial communication scenarios.

The HC-06 Bluetooth module, due to its low cost and ease of use, is widely applied in fields such as smart home, temperature and humidity controllers, remote controls, automotive electronics, etc. It is suitable for simple Bluetooth serial communication scenarios, such as sensor data transmission in smart homes, etc.

  • Choose between HC-05 and HC-06 based on your specific application requirements. If you need the master device mode, support for multiple transmission protocols, and flexible connection with other devices, HC-05 might be a better choice. If you only need the simple slave device mode and the Bluetooth serial port communication function, HC-06 can meet your needs.

HC05/HC06 Parameter

Model

HC-05/HC-06

Airspeed

2mbds

Working frequency range

2.4G

Antenna interface

Built-in PCB antenna

Communication interface

UART 3.3V TTL level

Communication current

HC-05:15MA

HC-06:40MA

Working voltage

3.0V~3.6V

Receive sensitivity

-85dbm@2mbps

RSSI support

nonsupport

Operating humidity

10%~90%

Communication level

3.3V

Storage temperature

-40℃~80°C

Transmitting power

4dbm

Operating temperature

-25℃~5℃

Reference range

10m

 

 

Common AT Commands

HC-05 AT Commands

Press the button on the HC-05 module and then power it on. At this point, the LED on the module will flash slowly, indicating that it has entered the configuration mode.

  1. Default parameters for startup: Slave device, baud rate 9600, Bluetooth name HC-05, pairing password 1234, LED status light on.
  2. Test if the AT command function is normal: AT

    After sending “AT”, the module should return OK indicating normal operation.

  1. Restore to default settings: AT+RESET

    Send “AT+RESET”, the module will restart and return to the factory settings.

  1. Restore the module to default state: AT+ORGL

    Send “AT+ORGL”, similar to AT+RESET, but the specific behavior may vary slightly depending on the implementation of the module.

  1. Query the Bluetooth address of the module:AT+ADDR?

    Send “AT+ADDR?”, the module will return its Bluetooth address.

  1. Set the Bluetooth name of the module: ‌AT+NAME=XXX‌

    Send ‌”AT+NAME=Bluetooth-Name”, where ‌Bluetooth-Name‌ is the name you want to set.

  1. Query or set the master-slave mode of the module: ‌AT+ROLE? / AT+ROLE=X

    Query: By sending “AT+ROLE?”, the module will return the current master-slave mode (0 for slave, 1 for master).

    Setting: Send “AT+ROLE=0” or “AT+ROLE=1” to set the module as a slave or a master.

  1. Query or set the pairing password of the module:AT+PSWD? / AT+PSWD=XXXX‌

    Query: Sending “AT+PSWD?” will return the current pairing password.

    Setting: Sending “AT+PSWD=1234” will set the new pairing password to 1234.

  1. Query or set the serial communication parameters of the module: AT+UART? / AT+UART=baud,stop,parity‌

    Query: By sending “AT+UART?”, the module will return the current baud rate, stop bit and parity bit.

    Setting: Sending “AT+UART=115200,1,0” will set the baud rate to 115200, with a stop bit of 1 and no parity bit.

  1. Query or set the binding address of the module: AT+BIND? / AT+BIND=XX:XX:XX:XX:XX

    Query: Sending “AT+BIND?”  will return the current binding address.

    Setting: Sending “AT+BIND=00:11:22:33:44:55” will set the new binding address (note to replace the colons with commas).

  1. Set the connection mode of the module: AT+CMODE=X

    Sending “AT+CMODE=0” will set to the specified address connection mode.

    Sending “AT+CMODE=1” will set to the arbitrary address connection mode.

  1. Clear the pairing list of the module: AT+RMAAD

    Sending “AT+RMAAD”, the module will clear all paired devices.

HC-06 AT Commands

Note: The HC-06 defaults to entering the AT setting mode.

  1. Default production parameters: Slave device, baud rate 9600, Bluetooth name HC-06, pairing password 1234, LED status light on.
  2. Test if the AT command function is normal: AT

    After sending AT, the module should return OK indicating normal operation.

  1. Bluetooth serial port communication baud rate: AT+BAUD*

    * is a number from 1 to C

    Send: AT+BAUD1  Send: AT+BAUD2  ……

    Return: OK1200     Return: OK2400     ……

    1———1200              2———2400             3———4800            4———9600

    5———19200           6———38400           7———57600          8———115200

    9———230400         A——–460800          B——–921600        C———1382400

If connecting the microcontroller, it is not recommended to use a baud rate higher than 115200. Interference in the signal will make the system unstable.

  1. Bluetooth Name:AT+NAME*

    Send: AT+NAME*

    Return: OKname

    * This is the desired Bluetooth name for yourself.

  1. Bluetooth Pairing Password: AT+PINxxxx

    Send: AT+PINxxxx

    Return: OKsetpin

    xxxx: The pairing password you want to set. It must be **4 bytes** long. If it exceeds this length, the command will not be returned.

HC-06 Arduino

HC-06 Pinout

  • HC-06         Arduino

       VCC  ——>  5V

       GND  ——>  GND

       RXD  ——>  TXD

       TXD  ——>  RXD

  • OLED          Arduino

       VCC  ——>  5V

       GND  ——>  GND

       SCL  ——>  A5

       SDA  ——>  A4

HC-06 Code

				
					#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

// OLED Screen parameters
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

// Display position tracking variable
int currentY = 10;         // The current Y-coordinate position (starting from the second row)
const int LINE_HEIGHT = 10; // Height of each row
const int MAX_Y = SCREEN_HEIGHT - LINE_HEIGHT; // Maximum Y coordinate
const int FIXED_LINE_Y = 0; // Fixed Y coordinate of the row

String bluetoothData = "";
bool newData = false;
bool isConnected = false;
unsigned long lastDataTime = 0;
const unsigned long DATA_TIMEOUT = 500; // Data reception timeout time (ms)

void setup() {
  // Initialize serial communication (connected to the Bluetooth module)
  Serial.begin(9600);
  
  // Initialize the OLED display screen
  if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
    Serial.println(F("SSD1306 allocation failed"));
    for(;;); // Loop termination
  }
  
  // Initialize display settings
  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(SSD1306_WHITE);
  
  // Draw the fixed first row
  drawFixedLine();
  
  // Initial display information (starting from the second line)
  display.setCursor(0, currentY);
  display.println("Initializing...");
  currentY += LINE_HEIGHT;
  display.display();
  
  delay(1000);
  
  // Clear the content area but keep the fixed rows.
  clearContentArea();
  currentY = 10; // Reset the Y coordinate of the content area
  display.setCursor(0, currentY);
  display.println("Waiting for");
  currentY += LINE_HEIGHT;
  display.println("Bluetooth connection");
  currentY += LINE_HEIGHT;
  display.display();
  
  Serial.println("System ready");
  Serial.println("Connect your phone via Bluetooth");
}

void loop() {
  checkConnection();
  receiveBluetoothData();
  
  // Check if the time limit has been exceeded. If so, consider the data reception complete.
  if(isConnected && bluetoothData.length() > 0 && 
     millis() - lastDataTime > DATA_TIMEOUT) {
    newData = true;
  }
  
  if(newData) {
    updateDisplay();
    newData = false;
  }
  
  delay(10); // Short delay, reducing CPU usage
}

// Draw the fixed first row
void drawFixedLine() {
  display.setCursor(0, FIXED_LINE_Y);
  display.println("Received Data:"); // The fixed content of the first line
}

// Clear the content area (keep the first row)
void clearContentArea() {
  // Only clear the area below the first row.
  display.fillRect(0, LINE_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT - LINE_HEIGHT, SSD1306_BLACK);
}

void checkConnection() {
  if(Serial.available() > 0 && !isConnected) {
    isConnected = true;
    clearContentArea(); // Only clear the content area
    currentY = 10; // Reset the Y coordinate of the content area
    display.setCursor(0, currentY);
    display.println("Connected!");
    currentY += LINE_HEIGHT;
    display.println("Send message now");
    currentY += LINE_HEIGHT;
    display.display();
    delay(1000);
  }
}

void receiveBluetoothData() {
  while(Serial.available() > 0) {
    char receivedChar = Serial.read();
    
    // Update the time of the last received data
    lastDataTime = millis();
    
    // Filter out the carriage return and line feed characters, but do not use them as the end markers.
    if(receivedChar != '\n' && receivedChar != '\r') {
      bluetoothData += receivedChar;
      newData = false; // New data has been received. Reset the flag for new data.
    } else if(bluetoothData.length() > 0) {
      // If a carriage return is received followed by data, it is considered that a message has ended.
      newData = true;
    }
    
    // Prevent memory issues caused by excessively long strings
    if(bluetoothData.length() > 100) {
      bluetoothData = bluetoothData.substring(bluetoothData.length() - 100);
    }
    
    delay(2);
  }
}

void updateDisplay() {
  display.setTextSize(1);
  display.setTextColor(SSD1306_WHITE);
  
  // Calculate the number of rows required for the current message
  int linesNeeded = 1;
  if(bluetoothData.length() > 16) {  // Each line can have a maximum of 16 characters.
    linesNeeded = (bluetoothData.length() + 15) / 16;  // round up to an integer
  }
  
  // Check if it will exceed the screen. If so, clear the content area (keep the first row).
  if(currentY + linesNeeded * LINE_HEIGHT > MAX_Y) {
    clearContentArea(); // Only clear the content area
    currentY = 10; // Reset to the top of the content area
  }
  
  // Display new messages and support automatic line wrapping (starting from the second line)
  for(int i = 0; i < bluetoothData.length(); i += 16) {
    String line = bluetoothData.substring(i, min(i + 16, bluetoothData.length()));
    display.setCursor(0, currentY);
    display.println(line);
    currentY += LINE_HEIGHT;
    
    // If you reach the bottom of the screen, clear the content area and start over from the beginning.
    if(currentY > MAX_Y) {
      clearContentArea(); // Only clear the content area
      currentY = 10; // Reset to the top of the content area
    }
  }
  
  // Redraw the fixed rows to ensure they are not covered.
  drawFixedLine();
  
  display.display();
  
  // Debugging output
  Serial.print("Displayed: ");
  Serial.println(bluetoothData);
  
  // Clear the data buffer and prepare to receive new data.
  bluetoothData = "";
}
				
			

HC-06 Effect Demonstration

Relative Information

HC-05/HC-06 Bluetooth Module Purchase Link

FAQ

  1. Why is the AT command not responding?

Possible reasons: The module has not entered the AT command mode, or the serial port settings are incorrect.

Solution: Ensure that the module has entered the AT command mode before sending the AT command (usually by pressing the button on the module and powering it on), and check if the serial port settings (such as baud rate, parity bit, etc.) are consistent with the default settings of the module.

  1. Why does the AT command return an error?

Possible reasons: The command format is incorrect, or the module does not support this command.

Solution: Ensure that the format of the AT command is correct (lowercase letters, followed by a carriage return and line feed), and consult the module’s technical documentation to confirm the set of supported commands.

  1. What are the reasons for the module not working properly?

Possible reasons: The module has insufficient voltage, or the module itself is faulty.

Solution: Check if the power supply voltage of the module meets the requirements (usually 3.3V or 5V), and try replacing the module to eliminate the fault.

Leave a Reply

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