STEP 1 • HARDWARE WIRING
HC-05 / HC-06 / HC-08 to Arduino Pinout
Using SoftwareSerial on Arduino Digital Pins D10 (RX) and D11 (TX) lets you upload code over USB without unplugging your Bluetooth module every time.
| Bluetooth Module Pin | Arduino Uno / Nano Pin | Notes |
|---|---|---|
VCC |
5V |
Most HC-05/06/08 breakout boards accept 3.6Vā6V |
GND |
GND |
Common ground between Arduino, BT & relays |
TXD |
Pin D10 (Soft RX) |
Direct 3.3V logic output is read safely by 5V Arduino |
RXD |
Pin D11 (Soft TX) |
Recommended: 1kΩ / 2kΩ resistor divider (5V → 3.3V) |
Hardware Serial Tip: If you wire Bluetooth directly to Arduino
Pin 0 (RX) and Pin 1 (TX) instead of D10/D11, temporarily disconnect RX/TX while clicking Upload in the Arduino IDE.
Cross-connect Serial lines: Module
TXD → Arduino RX (D10) and Module RXD → Arduino TX (D11)
MODULE SPECS
HC-05 vs HC-06 vs HC-08 Quick Reference
| Module | Bluetooth Standard | Default Baud Rate | Default Pairing PIN | Best Use Case |
|---|---|---|---|---|
| HC-05 | Bluetooth 2.0+EDR (Classic SPP) | 9600 (AT mode: 38400) |
1234 or 0000 |
Smart switchboards, multi-relay home automation, robotics |
| HC-06 | Bluetooth 2.0+EDR (Classic SPP Slave) | 9600 |
1234 |
Simple Arduino Uno/Nano starter relays & voice switches |
| HC-08 | Bluetooth 4.0 BLE (UART Service) | 9600 |
No PIN (Direct BLE Connect) | Low-power IoT sensors, battery-backed smart controllers |
STEP 2 • ARDUINO SKETCH
Multi-Relay + PWM Fan Speed Arduino Code
Upload this sketch to your Arduino Uno or Nano. It listens for single-character relay ON/OFF payloads (A/a, B/b, C/c) and fan speed commands (0ā4) sent by button tap or Google voice command from Bluetooth Device Controller:
#include <SoftwareSerial.h>
// Bluetooth TXD -> Arduino D10, Bluetooth RXD -> Arduino D11
SoftwareSerial btSerial(10, 11);
const int RELAY_1 = 7; // Room Light (ON: 'A', OFF: 'a')
const int RELAY_2 = 8; // Socket (ON: 'B', OFF: 'b')
const int RELAY_3 = 12; // Garden Pump (ON: 'C', OFF: 'c')
const int FAN_PWM = 9; // PWM Fan Pin (Speeds: '0' to '4')
void setup() {
Serial.begin(9600);
btSerial.begin(9600); // Default baud rate for HC-05, HC-06 & HC-08
pinMode(RELAY_1, OUTPUT);
pinMode(RELAY_2, OUTPUT);
pinMode(RELAY_3, OUTPUT);
pinMode(FAN_PWM, OUTPUT);
// Active-HIGH defaults (invert HIGH/LOW if using Active-LOW relay boards)
digitalWrite(RELAY_1, LOW);
digitalWrite(RELAY_2, LOW);
digitalWrite(RELAY_3, LOW);
analogWrite(FAN_PWM, 0);
Serial.println("Bluetooth Device Controller Ready!");
}
void loop() {
if (btSerial.available() > 0) {
char cmd = btSerial.read();
Serial.print("Received Command: ");
Serial.println(cmd);
switch (cmd) {
case 'A': digitalWrite(RELAY_1, HIGH); break;
case 'a': digitalWrite(RELAY_1, LOW); break;
case 'B': digitalWrite(RELAY_2, HIGH); break;
case 'b': digitalWrite(RELAY_2, LOW); break;
case 'C': digitalWrite(RELAY_3, HIGH); break;
case 'c': digitalWrite(RELAY_3, LOW); break;
// Fan Speed Commands
case '0': analogWrite(FAN_PWM, 0); break;
case '1': analogWrite(FAN_PWM, 70); break;
case '2': analogWrite(FAN_PWM, 130); break;
case '3': analogWrite(FAN_PWM, 190); break;
case '4': analogWrite(FAN_PWM, 255); break;
}
}
}
STEP 3 • APP CONFIGURATION
Matching App Buttons & Voice Phrases to Your Sketch
Creating ON/OFF & Fan Buttons
- Open Bluetooth Device Controller and pair/connect to your
HC-05,HC-06, orHC-08module. - Open Buttons Setup and add a new button.
- Enter a friendly label (e.g., Room Light), set ON command to
Aand OFF command toa. - For fans or dimmers, configure speed levels mapped to
0,1,2,3, and4.
Voice Phrases & JSON Backup
- Save a custom voice phrase for each action (e.g., "light on" →
A, "light off" →a). - Tap the Microphone icon on the controller screen and speak your phrase clearly.
- To back up or copy your layout to another phone, tap Home Menu → Export buttons to file to save a portable
.jsonfile.