How To Control Lights Through Mobile App Using Bluetooth Module HC-06 and Arduino

How To Control Lights Through Mobile App Using Bluetooth Module HC-06 and Arduino

How To Control Lights Through Mobile App Using Bluetooth Module HC-06 and Arduino

Nowadays the home automation is becoming more and more popular due its abundant advantages. Home automation systems can range from simple remote control of lighting through to complex computer/micro-controller based networks with varying degrees of intelligence and automation. Home automation is adopted for reasons of ease, security and energy efficiency. Here, our aim is to design a kit that can be used for controlling AC Loads from Android phone via Bluetooth by using Arduino as microcontroller. Here I’m using Arduino Uno r3 which is a microcontroller board based on the ATmega328 that can be purchased from amazon, sparkfun etc.

To control the relays and thereby the lights we need to make a driver circuit which is needed for the driving purpose as well as for the isolation of the AC power with the Arduino (Dc power). For the driving purpose the LM293d can also be used. In the upcoming posts I’ll discuss about the motor driver IC i.e. LM293d.

List of components required-

  1. Arduino Uno r3
  2. HC-06 Bluetooth module
  3. Power supply for Arduino and relay circuit (battery can be used)
  4. Mosfet (IRF510)
  5. Jumper Wires
  6. DC Relays (12 V DC)
  7. Diode 1N4007 (To block the reverse current)
  8. Resistances 1K and 10 K
  9. Ac Mains (230 V)
  10. Lamp

Circuit Diagram To Drive The Relay Through Arduino 

Relay Driving Circuit

Relay Driving Circuit

Pin configuration of IRF510

The IRF510 is a N-Channel enhancement mode silicon gate power field effect transistor. For further details you can see the datasheet of the MOSFET. And the pin configuration is shown below-

Pin Configration of IRF510

Pin Configuration of IRF510

Connecting Arduino with the driver circuit

Driver Circuit                       Arduino

Vin                              –           Pin 13

GND                           –           Arduino Ground

And the Vcc is connected with the 12 V power supply that we’ve designed (full wave bridge rectifier) in the previous post: how to design your own DC Power Supply for Arduino.

Connecting the Bluetooth Module HC-06

The Bluetooth module is used for communication between smart phone and the Arduino. The module is powered from Arduino 3.3 volt supply. The HC-06 Bluetooth module contains four pins namely TXD (for the transmission of data), RXD (for receiving the data), VCC and GND (used for powering up the module). The Arduino pins 0 and 1 are specified for Universal Asynchronous Receiver/Transmitter (UART) that control the interface with its attached serial devices.

HC-06                         Arduino

TX                   –           RX (pin 0)

RX                   –           TX (pin 1)

VCC                –           3.3 volt supply from Arduino

GND               –           Arduino ground


When the switch on button is pressed in the application the mobile will send a signal to the Arduino board through HC-06 module which will put pin 13 in HIGH state, meaning 5V on pin 13. This voltage is used to drive the MOSFET that will switch ON the relay and the load will be powered from the main power supply. Similarly, when the command sent is switch off through the app then the pin 13 will be in LOW state therefore switching OFF the lights.

We’ve used an external power supply (Vcc) that is between 7 to 12 volts to power up the Arduino board and the transistor + relay. For this purpose we’ve already made a full wave bridge rectifier. The load uses its own power supply, for instance if you use a light bulb then you might connect it to the 110/220V mains or any other power source.

Arduino code to control lights through HC-06

const int relay = 13;
int val;
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(relay, OUTPUT);
Serial.begin (9600);
// the loop routine runs over and over again forever:
void loop()
void relaycontrol(int val)
{ case 97 : turnon();
case 101 : turnoff();
default: turnoff();
void turnon()
digitalWrite(relay, HIGH);
void turnoff()
digitalWrite(relay, LOW);

You can also learn how to make Android Application For Bluetooth Controlled Lights suing MIT App Inventor.

If you still have any doubts feel free to ask. Suggestions are welcomed. Thank you for reading.

  • Kiprotich Robinson

    Do you have writen project for this.