Arduino + Bluetooth (HC-05/HC-06) Wireless Control
HC-05 vs HC-06
HC-06 is slave-only — it can be connected to (like from your phone) but can't initiate a connection itself. HC-05 supports both master and slave mode, configurable via AT commands, and can connect Arduino-to-Arduino as well as phone-to-Arduino. For most "control my project from my phone" projects, either works fine; HC-05's flexibility only matters if you need two Arduinos talking to each other wirelessly.
Wiring
- Module VCC → 5V (some modules are 3.3V-only logic despite accepting 5V power — check your specific module's datasheet if you see erratic behavior)
- Module GND → GND
- Module TXD → Arduino RXD (pin 0) or a SoftwareSerial RX pin — using pin 0 conflicts with USB serial during upload, so SoftwareSerial on other pins is usually cleaner
- Module RXD → Arduino TXD, through a voltage divider (two resistors, e.g. 1kΩ + 2kΩ) — the module's RX is 3.3V logic and Arduino's TX is 5V, feeding 5V directly into it risks damaging the module over time
Basic Code (SoftwareSerial)
#include <SoftwareSerial.h> SoftwareSerial BT(2, 3); // RX, TX void setup() { Serial.begin(9600); BT.begin(9600); // HC-05/06 default baud, unless you've reconfigured it } void loop() { if (BT.available()) { char c = BT.read(); if (c == '1') digitalWrite(13, HIGH); if (c == '0') digitalWrite(13, LOW); } }Pairing
Default PIN on most HC-05/06 modules is 1234 or 0000 — pair from your phone's Bluetooth settings like any other device, then use a generic "Bluetooth Terminal" app (several free ones on Android; iOS is more restrictive about raw Bluetooth serial due to Apple's MFi requirements, so Android is the easier path for hobby projects) to send characters and watch the LED respond.
Reconfiguring via AT Commands (HC-05)
Hold the module's onboard button while powering on to enter AT command mode, connect at 38400 baud (the AT mode baud rate, different from the normal operating baud rate), and send commands like AT+NAME=MyRobot or AT+PSWD=1234 to rename the device or change its pairing PIN.
Building a Real Control Interface
Beyond raw single-character commands, define a simple text protocol (e.g. "F" forward, "L50" turn left at 50% speed) and parse incoming strings rather than single characters once your project needs more than a couple of states — this scales much better as control complexity grows.
Related Guides
- How to Use Bluetooth HID on the Flipper Zero for Wireless BadUSB Attacks
- Flipper Zero as a Bluetooth HID Keyboard — Wireless Scripting
- nRF24L01 Wireless Modules: Cheap 2.4GHz Point-to-Point Control for Arduino and ESP32
- How to Build a Class-D Audio Amplifier: TPA3116, Power Supply, and Speaker Matching
- How to Program Addressable LED Strips: WS2812B Patterns, Effects, and Power Design
- How to Use the ESP32-CAM: Video Streaming, Motion Detection, and Time-Lapse
- I2C vs SPI vs UART: How to Choose and Use Serial Communication Protocols
- How to Use Sensors with Arduino and ESP32: Temperature, Distance, Load, Current, and Hall Effect