Arduino Bluetooth Home Automation with HC-05 and Relays
Level 57 · Talk to My Home · 35 minutes
Bluetooth home automation: type LIGHT ON or FAN OFF on a phone, and the Arduino switches the lamp and fan.

Preview the project free; a course seat is required to run and submit. No hardware kit needed.
Your project challenge
Switch the lamp and fan from a phone. - HC-05: VCC 5V, GND GND, TXD D0, RXD D1 - Relays: lamp IN D7, fan IN D6, VCC 5V, GND GND - Battery + to each COM, NO to the load +, load − to battery − Commands: LIGHT ON/OFF, FAN ON/OFF, ALL OFF, STATUS, any case. Reply OK and the command, or ? and the word.
Components you’ll use
- Arduino Uno
- HC-05 Bluetooth Module
- Relay Module × 2
- Low-voltage DC Lamp
- Low-voltage DC Fan
- Battery
What you’ll build
Home automation from your phone. Type LIGHT ON in a Bluetooth app, and the lamp comes on.
How it works
- The HC-05 passes every letter from the phone to
Serial, and every reply back. - Each relay is active low:
LOWswitches its load on. - The battery powers the lamp and fan. The Arduino only switches the relays.
The key idea
A protocol is a set of rules both sides agree on. Here the rule is one command per line. Letters arrive one at a time, so collect them and decide only at the newline \n. Drop any \r, and make the line upper case first.
⚠ Watch out
Do not decide on the first letter: then LOW would light the lamp. Reply to every command, and send ? for a word you do not know. A real home switches mains power: that needs an adult and a proper box.
Make it yours: add FAN 50 for half speed, or ask for a password first.
The interactive editor includes the wiring guide, code editor and simulation controls.