Projects / Bluetooth home automation with four relays

Bluetooth home automation with four relays

Intermediate1.5 hGuided buildReviewed

Build it step by step

0 of 5 done
  1. UNO

    Wire the HC-05

    TXD to D2, D3 to RXD through the 1 kΩ / 2.2 kΩ divider, VCC and GND.

  2. UNOON

    Wire the relay board

    VCC, GND and IN1 to IN4 to D4 to D7.

  3. UNOON1216.2 mA

    Add a safe load

    Switch a 12 V LED strip through relay 1 (COM to adapter plus, NO to strip plus).

  4. UNODC

    Upload and pair

    Upload, pair the phone with HC-05 and connect from a serial terminal app.

  5. UNOONABS

    Box it

    Mount everything in the project box with the low-voltage side away from the relay contacts.

In short

How do you build a bluetooth home automation with four relays?

Switch four loads on and off from a phone over Bluetooth using an HC-05 and a 4-channel relay board. You need Arduino Uno R3, HC-05 Bluetooth Module, Relay module 4-channel 5 V, Resistor 1 kΩ, Resistor 2.2 kΩ, 12 V LED strip warm white (5 m, 2835), 12 V 2 A DC adapter, DC barrel to screw terminal adapter (female), ABS project box (100 × 60 × 25 mm) and Jumper wires female to female (40 pcs). It takes 5 steps and about 90 minutes.

Level
Intermediate
Time
About 90 min
Parts
10

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
HC-05 TXDUno D2Commands from the phone
Uno D31 kΩ to HC-05 RXD, 2.2 kΩ from RXD to GNDReplies, divided to 3.3 V logic
Relay board VCC / GNDUno 5V / GNDRelay coils
Relay IN1 / IN2 / IN3 / IN4Uno D4 / D5 / D6 / D7One pin per relay
12 V adapter +Relay 1 COM; relay 1 NO to LED strip +Practice load switched by relay 1
LED strip −12 V adapter −Load return

Code

Arduino IDE, board "Arduino Uno". Use any Bluetooth serial terminal app: send 1 to 4 to switch on, a to d to switch off, 0 for all off and ? for the status.

Runs on a virtual Arduino Uno in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).

#include <SoftwareSerial.h>

SoftwareSerial bt(2, 3);
const int RELAY[4] = {4, 5, 6, 7};
const bool ON = LOW;                  // most relay boards are active-low
bool state[4] = {false, false, false, false};

void apply() { for (int i = 0; i < 4; i++) digitalWrite(RELAY[i], state[i] ? ON : !ON); }

void report() {
  for (int i = 0; i < 4; i++) { bt.print("Relay "); bt.print(i + 1); bt.println(state[i] ? ": ON" : ": OFF"); }
}

void setup() {
  for (int i = 0; i < 4; i++) pinMode(RELAY[i], OUTPUT);
  apply();
  bt.begin(9600);
}

void loop() {
  if (!bt.available()) return;
  char c = bt.read();
  if (c >= '1' && c <= '4') state[c - '1'] = true;       // 1-4 switch on
  else if (c >= 'a' && c <= 'd') state[c - 'a'] = false; // a-d switch off
  else if (c == '0') for (bool &s : state) s = false;    // all off
  else if (c == '?') { report(); return; }
  else return;
  apply();
  report();
}

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Send ?Four status lines, all OFF
Send 1Relay 1 clicks, its LED lights, the LED strip turns on
Send aRelay 1 releases, strip off
Send 0All relays off

If it does not work

Relays switch the opposite way

Your board is active-high. Change ON to HIGH.

Relays chatter or the Uno resets

Four coils draw about 300 mA. Power the relay board's JD-VCC from a separate 5 V supply and remove its jumper.

Phone shows nothing back

Check the D3 divider goes to HC-05 RXD.

Mains loads

Mains wiring must be done by a qualified electrician in a closed, earthed box with fuses. Learn with 12 V loads.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the bluetooth home automation with four relays?

Arduino Uno R3, HC-05 Bluetooth Module, Relay module 4-channel 5 V, Resistor 1 kΩ, Resistor 2.2 kΩ, 12 V LED strip warm white (5 m, 2835), 12 V 2 A DC adapter, DC barrel to screw terminal adapter (female), ABS project box (100 × 60 × 25 mm) and Jumper wires female to female (40 pcs). 12 V LED strip warm white (5 m, 2835): Practise with 12 V loads first.

How long does the bluetooth home automation with four relays take to build?

About 90 minutes for a intermediate maker, in 5 steps.

How do I know the bluetooth home automation with four relays works?

Send ?: Four status lines, all OFF. Send 1: Relay 1 clicks, its LED lights, the LED strip turns on. Send a: Relay 1 releases, strip off.

Relays switch the opposite way: what should I check?

Your board is active-high. Change ON to HIGH.

Relays chatter or the Uno resets: what should I check?

Four coils draw about 300 mA. Power the relay board's JD-VCC from a separate 5 V supply and remove its jumper.

Phone shows nothing back: what should I check?

Check the D3 divider goes to HC-05 RXD.

Mains loads: what should I check?

Mains wiring must be done by a qualified electrician in a closed, earthed box with fuses. Learn with 12 V loads.