Blog

HC-05 Bluetooth Module – Complete Guide

Bluetooth Serial Module

HC-05 Bluetooth Module

Wireless Serial Communication with AT Command Configuration

The HC-05 is built around the CSR BC417 Bluetooth chip and implements the Serial Port Profile (SPP) - meaning it essentially turns a wireless Bluetooth link into what looks, to your code, exactly like a plain UART serial cable. Anything you would normally send or receive over Serial.write()/Serial.read() works completely unchanged, just now traveling over Bluetooth instead of a wire. What sets the HC-05 apart from the cheaper HC-06 is that it can operate as either Master or Slave: as a Slave it waits for another device (like a phone) to connect to it, while as a Master it can actively scan for and initiate a connection to another Bluetooth device itself, including a second HC-05 - enabling board-to-board wireless serial links with no phone involved at all. Configuration - name, pairing PIN, baud rate, and master/slave role - is done through an AT command mode entered by holding the KEY/EN pin HIGH while powering the module on, after which a terminal connected at the AT-mode baud rate (commonly 38400) can query and set these values before switching back to normal data mode.

Bluetooth 2.0+EDR (SPP)
Protocol
~10m (Class 2)
Range
Master or Slave
Role

Key features

Serial Port Profile (SPP)

Emulates a wireless serial cable - existing UART code works unchanged over Bluetooth.

Master/Slave Configurable

Unlike the Slave-only HC-06, the HC-05 can also initiate connections to other Bluetooth devices.

AT Command Configuration

Device name, pairing PIN, baud rate, and role are all configurable over a simple AT command set.

Bound-Address Auto-Reconnect

Can store a paired device's MAC address for automatic reconnection on power-up.

Status LED Feedback

Onboard LED blink pattern changes between searching, connecting, and connected states.

Wide Baud Rate Support

Configurable from 9600 up to 1382400 bps to match your application's data needs.

Technical specifications

Bluetooth Version 2.0+EDR
Operating Voltage 3.6V – 6V (onboard regulator)
Logic Level 3.3V (RX not 5V tolerant)
Default Baud Rate 9600 (data mode)
Range ~10m (Class 2)
Operating Current ~30–40 mA (connected)
Frequency Band 2.4 GHz ISM
Profile SPP (Serial Port Profile)
Default Pairing PIN 1234 or 0000

Pinout

PinFunction
VCC 3.6V – 6V power supply
GND Ground
TXD Serial data out (3.3V logic) - connect to microcontroller RX
RXD Serial data in (3.3V logic, NOT 5V tolerant) - use a voltage divider from a 5V TX
KEY/EN Hold HIGH during power-up to enter AT command mode
STATE Goes HIGH once a Bluetooth connection is established

Applications

Wireless Arduino-to-PC serial link Bluetooth-controlled robots and RC vehicles Wireless sensor data logging to a phone or laptop Phone-to-microcontroller control apps via serial terminal apps Wireless debugging console for embedded projects Home automation remote switches

What's in the box

1x HC-05 Bluetooth module
6-pin header pre-soldered

Downloads

Datasheet (PDF) AT Command Set Reference
🔌
Pin Connections
1 Table
Pin Connections Table 1
BoardSensor PinConnection
HC-05VCC/GND/TX/RX3.3-5V / GND / board RX pin / board TX pin (via divider)
📟
HC-05 Bluetooth Module with 6 Pins and Integrated Button
7 Examples • C/C++ | Boards: Arduino Uno, Arduino Nano, Arduino Mega, ESP32, ESP8266, STM32, Raspberry Pi Pico
HC-05 Bluetooth Module with 6 Pins and Integrated Button - Arduino Uno
HC-05 Bluetooth Module with 6 Pins and Integrated Button - Arduino Nano
HC-05 Bluetooth Module with 6 Pins and Integrated Button - Arduino Mega
HC-05 Bluetooth Module with 6 Pins and Integrated Button - ESP32
HC-05 Bluetooth Module with 6 Pins and Integrated Button - ESP8266
HC-05 Bluetooth Module with 6 Pins and Integrated Button - STM32
HC-05 Bluetooth Module with 6 Pins and Integrated Button - Raspberry Pi Pico
📄 File: hc-05_bluetooth_module_with_6_pins_and_integrated_button_-_arduino_uno.inoArduino Uno
668 characters
1//ekostra.com
2//electronics store in egypt
3//+201008896258
4
5// RX=2, TX=3 on Arduino Uno (module TX -> board RX; module RX needs a voltage divider from 5V boards since the module is 3.3V logic)
6#include <SoftwareSerial.h>
7SoftwareSerial LINK_SERIAL(2, 3);
8
9void setup() {
10 Serial.begin(115200);
11 LINK_SERIAL.begin(38400); // 38400 is HC-05's default AT-mode/factory baud - many pre-paired modules run at 9600, check yours
12}
13
14void loop() {
15 if (LINK_SERIAL.available()) Serial.write(LINK_SERIAL.read()); // data from the paired Bluetooth device -> USB serial
16 if (Serial.available()) LINK_SERIAL.write(Serial.read()); // USB serial -> Bluetooth device
17}
📄 File: hc-05_bluetooth_module_with_6_pins_and_integrated_button_-_arduino_nano.inoArduino Nano
669 characters
1//ekostra.com
2//electronics store in egypt
3//+201008896258
4
5// RX=2, TX=3 on Arduino Nano (module TX -> board RX; module RX needs a voltage divider from 5V boards since the module is 3.3V logic)
6#include <SoftwareSerial.h>
7SoftwareSerial LINK_SERIAL(2, 3);
8
9void setup() {
10 Serial.begin(115200);
11 LINK_SERIAL.begin(38400); // 38400 is HC-05's default AT-mode/factory baud - many pre-paired modules run at 9600, check yours
12}
13
14void loop() {
15 if (LINK_SERIAL.available()) Serial.write(LINK_SERIAL.read()); // data from the paired Bluetooth device -> USB serial
16 if (Serial.available()) LINK_SERIAL.write(Serial.read()); // USB serial -> Bluetooth device
17}
📄 File: hc-05_bluetooth_module_with_6_pins_and_integrated_button_-_arduino_mega.inoArduino Mega
637 characters
1//ekostra.com
2//electronics store in egypt
3//+201008896258
4
5// RX=19, TX=18 on Arduino Mega (module TX -> board RX; module RX needs a voltage divider from 5V boards since the module is 3.3V logic)
6#define LINK_SERIAL Serial1
7
8void setup() {
9 Serial.begin(115200);
10 LINK_SERIAL.begin(38400); // 38400 is HC-05's default AT-mode/factory baud - many pre-paired modules run at 9600, check yours
11}
12
13void loop() {
14 if (LINK_SERIAL.available()) Serial.write(LINK_SERIAL.read()); // data from the paired Bluetooth device -> USB serial
15 if (Serial.available()) LINK_SERIAL.write(Serial.read()); // USB serial -> Bluetooth device
16}
📄 File: hc-05_bluetooth_module_with_6_pins_and_integrated_button_-_esp32.inoESP32
630 characters
1//ekostra.com
2//electronics store in egypt
3//+201008896258
4
5// RX=16, TX=17 on ESP32 (module TX -> board RX; module RX needs a voltage divider from 5V boards since the module is 3.3V logic)
6#define LINK_SERIAL Serial1
7
8void setup() {
9 Serial.begin(115200);
10 LINK_SERIAL.begin(38400); // 38400 is HC-05's default AT-mode/factory baud - many pre-paired modules run at 9600, check yours
11}
12
13void loop() {
14 if (LINK_SERIAL.available()) Serial.write(LINK_SERIAL.read()); // data from the paired Bluetooth device -> USB serial
15 if (Serial.available()) LINK_SERIAL.write(Serial.read()); // USB serial -> Bluetooth device
16}
📄 File: hc-05_bluetooth_module_with_6_pins_and_integrated_button_-_esp8266.inoESP8266
668 characters
1//ekostra.com
2//electronics store in egypt
3//+201008896258
4
5// RX=D7, TX=D8 on ESP8266 (module TX -> board RX; module RX needs a voltage divider from 5V boards since the module is 3.3V logic)
6#include <SoftwareSerial.h>
7SoftwareSerial LINK_SERIAL(D7, D8);
8
9void setup() {
10 Serial.begin(115200);
11 LINK_SERIAL.begin(38400); // 38400 is HC-05's default AT-mode/factory baud - many pre-paired modules run at 9600, check yours
12}
13
14void loop() {
15 if (LINK_SERIAL.available()) Serial.write(LINK_SERIAL.read()); // data from the paired Bluetooth device -> USB serial
16 if (Serial.available()) LINK_SERIAL.write(Serial.read()); // USB serial -> Bluetooth device
17}
📄 File: hc-05_bluetooth_module_with_6_pins_and_integrated_button_-_stm32.inoSTM32
633 characters
1//ekostra.com
2//electronics store in egypt
3//+201008896258
4
5// RX=PA10, TX=PA9 on STM32 (module TX -> board RX; module RX needs a voltage divider from 5V boards since the module is 3.3V logic)
6#define LINK_SERIAL Serial1
7
8void setup() {
9 Serial.begin(115200);
10 LINK_SERIAL.begin(38400); // 38400 is HC-05's default AT-mode/factory baud - many pre-paired modules run at 9600, check yours
11}
12
13void loop() {
14 if (LINK_SERIAL.available()) Serial.write(LINK_SERIAL.read()); // data from the paired Bluetooth device -> USB serial
15 if (Serial.available()) LINK_SERIAL.write(Serial.read()); // USB serial -> Bluetooth device
16}
📄 File: hc-05_bluetooth_module_with_6_pins_and_integrated_button_-_raspberry_pi_pico.inoRaspberry Pi Pico
640 characters
1//ekostra.com
2//electronics store in egypt
3//+201008896258
4
5// RX=1, TX=0 on Raspberry Pi Pico (module TX -> board RX; module RX needs a voltage divider from 5V boards since the module is 3.3V logic)
6#define LINK_SERIAL Serial1
7
8void setup() {
9 Serial.begin(115200);
10 LINK_SERIAL.begin(38400); // 38400 is HC-05's default AT-mode/factory baud - many pre-paired modules run at 9600, check yours
11}
12
13void loop() {
14 if (LINK_SERIAL.available()) Serial.write(LINK_SERIAL.read()); // data from the paired Bluetooth device -> USB serial
15 if (Serial.available()) LINK_SERIAL.write(Serial.read()); // USB serial -> Bluetooth device
16}
Classic Bluetooth (SPP) UART bridge module.
The RXD pin is 3.3V logic and is generally NOT 5V tolerant on standard breakout boards - always run a 5V microcontroller's TX line through a simple voltage divider (e.g. 1k + 2k resistors) before it reaches the HC-05's RXD pin, while the module's TXD can connect straight to a 5V board's RX pin without extra parts, since 3.3V already reads reliably as HIGH. When entering AT command mode, make sure the module is not already paired/connected - on most firmware versions the KEY/EN pin only takes effect at power-up, so cycle power with KEY/EN already held HIGH rather than pulling it high afterward. If AT responses come back garbled, the most common cause is a baud-rate mismatch: many HC-05 units respond to AT commands at 38400 baud by default, not the 9600 baud used for normal data mode.