Bluetooth Home Automation Light Bulb Switch Using An HC-05, A Relay, and Arduino
I used an HC-05 Bluetooth module, a relay switch, a light bulb switch, and an Arduino Uno to create a wireless home automation light switch. The goal was to establish a wireless protocol for switching a light bulb on and off using a simple app on a smartphone. The relay switch controls the power to the light bulb, the HC-05 handles the Bluetooth, and the Uno reads the Bluetooth module to control the relay. The tools implemented can be extrapolated to other projects such as automated blinds, temperature controlled fans, motion sensors, security cameras, smoke detectors, etc.
I used a simple Andoid app that connects to the HC-05 and transmits strings. Using the app, on the Arduino side we can decode the signal to create a protocol that turns the light switch on or off. It can be as simple as 1s and 0s, or as complex as you want. I used a 1 for on, and a 0 for off, and this method is used in the Arduino code below. To change the protocol, just change the code section in the 'if' statement, and make sure to send the desired protocol through the Android app.
This project is straightforward, so I did not feel the need to make many comments throughout. The important thing to remember about using a relay module is that it involves switching AC current, also called mains power. This is a dangerous process. So please use caution when disassembling the light bulb socket. This project is a great introduction to using relays and switching, while also utilizing wireless technology and Arduino. The Bluetooth protocol process is useful for wireless sensing and control, and I hope the educational nature of this project opens up avenues in home automation, remote sensing, wireless control, and electronics in general.