Bluetooth
Interfacing HC 05 Bluetooth with ESP32
What is the HC 05?
A classic Bluetooth SPP module that can act as either master or slave, widely used for wireless serial links to phones and PCs. The HC-05 implements the Bluetooth Serial Port Profile (SPP), essentially turning a Bluetooth connection into a transparent wireless replacement for a wired UART cable — pair it with a phone or PC, and any bytes sent to its RX pin appear on the other device's Bluetooth serial terminal and vice versa, making it the long-standing default for wireless Arduino projects, Bluetooth-controlled robots, and simple phone-app-to-microcontroller links.
Specifications
| Bluetooth version | Bluetooth 2.0 + EDR (Classic Bluetooth, not BLE) |
| Operating voltage | 3.3V DC logic (module often includes an onboard regulator accepting 3.6V-6V supply) |
| Operating current | ~30-40 mA typical during active connection |
| Role support | Configurable as master or slave via AT commands — HC-06 (a related module) is slave-only |
| Range | ~10m typical (Class 2 Bluetooth radio) |
| Profile | Serial Port Profile (SPP) — transparent wireless UART bridge |
| Default baud rate | 9600 baud in data mode (configurable via AT commands in command mode) |
| Interface | UART (TX/RX) to the host microcontroller |
HC 05 Pinout
| Pin | Name | Description |
|---|---|---|
| 1 | VCC | Power, 3.6-6V DC (breakout boards regulate down to the 3.3V logic level internally) |
| 2 | GND | Ground |
| 3 | TX | UART transmit — connect to microcontroller RX |
| 4 | RX | UART receive — connect to microcontroller TX (3.3V logic, use a voltage divider from 5V boards) |
| 5 | KEY / EN (AT mode) | Pulling HIGH (often before power-up) puts the module into AT command configuration mode instead of normal data mode |
| 6 | STATE | Indicates connection status — HIGH when a Bluetooth link is actively connected |
The HC-05's RX pin is 3.3V logic and not reliably 5V-tolerant on most boards, so a voltage divider or logic-level shifter should be used when connecting to a 5V Arduino's TX pin to avoid long-term damage. To reconfigure settings (name, pairing PIN, baud rate, master/slave role) via AT commands, the KEY/EN pin typically needs to be held HIGH during power-up to enter command mode rather than normal transparent data mode.
Setting Up HC 05 with ESP32
Library
HardwareSerial by Espressif (built-in)
Built into the ESP32 Arduino core — no install needed
Wiring
| Component pin | ESP32 pin | Note |
|---|---|---|
| VCC | 3.3V | Confirm your HC-05 breakout accepts 3.3V — most do, but a few need 5V via a separate regulator |
| GND | GND | — |
| TXD | GPIO16 (RX2) | HC-05 TXD → ESP32 RX2 |
| RXD | GPIO17 (TX2) | ESP32 GPIO is 3.3V logic, so this pairs directly with HC-05 RXD — no divider needed |
Example code
ESP32 already has WiFi + BLE onboard, so HC-05 (classic Bluetooth SPP) is mainly useful here if you specifically need Serial Bluetooth compatibility with an existing phone app. For new projects, the ESP32's built-in BLE is usually a better fit and needs no extra module.
Related Guides & Projects

ESP32-CAM Web Server: Stream Live Video in 5 Minutes
A complete, no-guesswork walkthrough for flashing an AI-Thinker ESP32-CAM as a live MJPEG video stream -- wiring, Arduino IDE setup, the CameraWebServer sketch, and every failure mode that actually causes problems.

ESP32 MQTT Tutorial: Publish and Subscribe with Arduino IDE
A complete, broker-agnostic ESP32 MQTT tutorial -- topics, QoS, retained messages, Last Will and Testament, TLS security for production, and a working publish/subscribe example with PubSubClient.

Installing ESP8266 in Arduino IDE: NodeMCU (ESP-12E) Complete Setup Guide for Windows
From driver headaches to a blinking LED — the full Windows walkthrough for getting NodeMCU ESP8266 boards running in Arduino IDE, plus notes for Mac and the bare ESP-01 module.

ESP32 Pinout Guide: Every GPIO, ADC, PWM, and Restricted Pin Explained
Complete ESP32 pinout guide covering all GPIOs, input-only pins, strapping pins, flash-reserved pins, dual ADC channels, PWM via LEDC, I2C, SPI, UART, and deep sleep wake pins.