Arduino Projects: Home Automation System Using a Simple Android App

By Karthik Rajasekaran

104
86711

efy testedNowadays, people have smartphones with them all the time. So it makes sense to use these to control home appliances. Presented here is a home automation system using a simple Android app, which you can use to control electrical appliances with clicks or voice commands. Commands are sent via Bluetooth to Arduino Uno. So you need not get up to switch on or switch off the device while watching a movie or doing some work.

Home automation: circuit and working

The home automation circuit is built around an Arduino Uno board, Bluetooth module HC-05 and a 3-channel relay board. The number of channels depends on the number of appliances you wish to control. Arduino Uno is powered with a 12V DC adaptor/power source. The relay module and Bluetooth module can be, in turn, powered using a board power supply of Arduino Uno. Author’s prototype is shown in Fig. 1. Connection details for each appliance are shown in Fig. 2.

home automation using android
Fig. 1: Author’s prototype
fig 2
Fig. 2: Connections for the appliances

Bluetooth module.

Bluetooth module used in this project is HC-05 (Fig. 4), which supports master and slave mode serial communication (9600-115200 bps) SPP and UART interface. Using these features it can communicate with other Bluetooth-enabled devices like mobile phones, tablets and laptops. The module runs on 3.3V to 5V power supply.

fig 3
Fig. 3: Control panel on Android smartphone

Relay module.

A relay allows you to turn on or turn off a circuit using voltage and/or current much higher than what Arduino could handle. Relay provides complete isolation between the low-voltage circuit on Arduino side and the high-voltage side controlling the load. It gets activated using 5V from Arduino, which, in turn, controls electrical appliances like fans, lights and air-conditioners. An 8-channel relay module is shown in Fig. 5.

Arduino Uno board.

Arduino is an open source electronics prototyping platform based on flexible, easy-to-use hardware and software. It is intended for artists, designers, hobbyists and anyone interested in creating interactive objects or environments.

Arduino Uno is based on ATmega328 microcontroller (MCU). It consists of 14 digital input/output pins, six analogue inputs, a USB connection for programming the onboard MCU, a power jack, an ICSP header and a reset button. It is operated with a 16MHz crystal oscillator and contains everything needed to support the MCU. It is very easy to use as you simply need to connect it to a computer using a USB cable, or power it with an AC-to-DC adaptor or battery to get started. The MCU onboard is programmed in Arduino programming language using Arduino IDE.

fig 4
Fig. 4: Bluetooth module

In this home automation project circuit, Pins 10 and 11 of Arduino are connected to pins TXD and RXD of the Bluetooth module, respectively, as shown in Fig. 6.

Pins Gnd and Vcc of the Bluetooth module are connected to Gnd and +3.3V of Arduino board respectively. Pins 2, 3 and 4 are connected to the three relays (RL1, RL2 and RL3) of the relay board. Pins Vin and Gnd of the relay board are connected to pins Vin and Gnd of Arduino board, respectively.

Note. Vin is usually used to give input power, but since we are supplying 12V to Arduino using an adaptor, we can use Vin pin on Arduino to power the 12V relay module.

fig 5
Fig. 5: An 8-channel relay module
fig 6
Fig. 6: Relay module connection

104 COMMENTS

    • Yes, relay is connected in parallel with physical switch but in this case when physical switch turn on then the AC appliances is still on even after off the relay.

    • No. In this project, the relay board used here requires 12V power supply. So an external 12V DC adaptor for the Arduino board is used instead of USB cable. Therefore, 12V is reflected at Vin pin of the Arduino board, which is used to power the relay board.

  1. First compile the homeautomation.ino sketch from Arduino IDE.
    Then select the correct Arduino board and COM port from Tools menu. Now, you should be able to upload the code without any problem.

  2. sir…can we use arduino nano or arduino mini insted of arduino uno? n can we add more relay and on/off button in apk after using another digital pin of arduino n programing as acording to pin?……..thank you for your answer……

  3. Hello sir, I want to know
    >how to connect DC fan,
    >physical connection of each components,
    >circuit diagram,
    >block digram,
    >flow chart and
    >code,
    of this project using “audino uno” board android base.
    Please…… help me sir as soon as possible my email id-
    sikankumarnayak65@gmail. com

  4. Hi Sir, Could you send me the source code of the application? I am also creating the same kind of application for my TY project but there are errors. So could you please help me out and send the source code for the application just for reference ?

  5. Bro every thing is fine but when i try to on light in my android mobile corresponding operation in load side is not happening. Can u suggest me where is the problem.

    • Upload this code into your Arduino board. Make sure you pair the Android Bluetooth with the Bluetooth connected in the circuit. Next, turn on or off ‘Light1’ button on your Android. If the light is still not turning on/off, check the corresponding relay connection.

  6. It’s not working properly,can you help me.
    connectionsm are ok, but it is not responding and when responding its like get confuse and execute any command whatever its wants to..
    Iam using 3 individual relay and relay driver …

  7. How to connect the relay with power supply and the bulb. The relay has NO, C & NC ports which to connect with what.
    Kindly reply soon.

  8. dear sir can u pls give the circuit diagram of Arduino Projects: Home Automation System Using a Simple Android App.its very urgent…….

  9. As per your instructions I connected the circuit, uploaded the program, paired Bluetooth module with my android mobile & ur app and used a 12volt dc adapter to power the Arduino, still it is not working. Can u define where is the problem?

  10. good project!
    where to find the codes for programming the arduino uno??
    its not there on your pages. kindly send me the link. would be ver thankful to you.

  11. How to solve this error : sketch_mar17b.cpp: In function ‘void loop()’:
    sketch_mar17b:13: error: ‘class SoftwareSerial’ has no member named ‘available’

  12. i have a doubt i do the project but we press off the only the light is on,we press on the only the light is off what we do for that plz reply soon sir its urgent

  13. hi sir my name is raja i want to create my andriod application for my home automation. plz suggest me the it is possible or not if it can happend then suggest me how to start ?

  14. sir, could u please provide the source code for Android application or suggest us writing code for the realys.
    which ide would be good MIT app inventor or android studio.

  15. Hi Thanx for this tutorial
    I have one question that if we are connected switch board with relay that is fine but how about actual Switch board work
    if i have no phone with me then can i start switch manually ?

  16. Can u tell me why I am receiving “stk500_recv(): programmer is not responding” error while uploading program to port COM 4 ..

  17. why you did not connect all the live wire to all common relay and all neutral wire to all appliance?
    why you do only one appliance to one plug?
    are that same method?

LEAVE A REPLY

Please enter your comment!
Please enter your name here