Arduino-Remote Control Home Automation

Arduino-Remote Control Home Automation

 

In this project, we are going to show you how to control home appliances using a TV Remote. This same principle can be applicable in offices and industries as well.

The project deals with the automation of four home appliances, like Tube lights, fan, bulbs, and of course TV. To automate them, four relays must be used. The circuit provided below is designed to switch the relays. But to automate and control home appliances, you must have a basic idea of connecting them to switchboards, and must learn on what to do if the remote malfunctions. Our article on Switchboard for Home Automation will give you a clear idea on the subject.

Other articles on Home Automation have also been published. You may also refer them and try it out.

Refer :

Home Automation Using Arduino & GSM Module

Bluetooth Home Automation Using AVR & Android App 

 

An Arduino Nano is used in the project, because its size is small and does not require any external programmer. If you are a pro in Arduino, you can use any other Arduino according to your choice. Arduino control the relays according to the button pressed on the remote. A 3-pin sensor TSOP 1838T is connected to the Arduino, which reads the signal and sends to the Arduino. Arduino decodes the signal and turn ON and OFF the appliances accordingly.

The project is not very easy but you can make easily, because PCB designed on EAGLE, so you just need to print the PCB.

Home Remote Control Systems PCB

Remote Control House PCB

IR Remote Control Home Automation – Components Used

ComponentSpecificationQuantity
ArduinoNano1
DC Adapter12 Volt1
IR SensorTSOP 1838T1
Relay12 Volt 4
TransistorBC5474
Resistance10K4
Resistance330 Ohms4
LEDRed4
Indicator Light240 Volts4

Working

In the project, an Arduino is using as controlling unit. A TSOP 1838T sensor is using for receiving signal from the remote. Output pin of sensor is connected to the Arduino, when any button of the remote is pressed, IR LED of remote sends a unique encoded signal, this signal is received by sensor and sent to the Arduino, The Arduino decode the signal and turn on and off the lights according to the signal. 12-volt relays are used for switching the appliances.

TSOP 1838

TSOP 1838 Connection in Home Automation

 

This is an IR sensor, which receives the signal of IR Remote. This sensor have three pins 1st is Vcc 2nd is GND and third is OUT; the operating voltage of the sensor is 3.7 to 5 volt.

Relay

Home Automation Connection with Relays

 

In the project, a12-volt relay used for switching the home appliances. It can hold 7Amps of current. A transistor is using for switching the relay and a diode is connected parallel to the relay but in reverse bias, which is used for limiting the reverse current.

You may find this helpful - Working of Relays

Transistor

Home Automation Circuit Using IR Remote

 

Arduino can operate the low current components like LED and Buzzer, but relays need high current (100 mA to 250mA) to switch appliances. Thus, a transistor is used for switching the relays. Transistor’s emitter pin is connected to GND and collector pin is connected to coil pin of relay, Arduino gives signal through a resistance to Base pin of transistor. When logical HIGH given to the base pin of Arduino collector and emitter are short circuits, so current passed through the coil of relay. Now coil energized and the relay switched ON.

IR Remote Controlled Home Automation Circuit

Circuit Diagram

Home Automation Using IR Remote Control
Home Automation Using IR Remote Control

 

In the circuit sensor’s output pin connected to D12 pin of the Arduino, remaining pins of sensor connected to Vcc and GND.

A2, A3, A4 and A5 pins of the Arduino connected to the transistor’s base pins through 10K ohm Resistance. Emitter pin connected to the GND and collector pin connected to the coil pin of the relay. Relay’s other pin is connected to the 12 volt.

Appliances are connected to the mains through relay’s C (Common) and NO (Normally Open) pin of the relay.

Remote Control Home Automation

Video Demonstration

 

Attach The Library

Before uploading the code, attach the library of IR Remote to Arduino, for this follow these steps

  1. Download the library here.
  2. Extract the ZIP file
  3. Copy the inside folder and paste into the libraries folder.
  4. Close the Arduino IDE and Reopen.
  5. Check the new library on example.

Remote Code

Remote sends the unique encoded signal, so first we need to identify the code according to the switch so follow these steps.

  1. Make a circuit as shown in the circuit diagram.
  2. Upload the Code1 to the Arduino.
  3. Open the serial Monitor.
  4. Set the Baud Rate 9600.
  5. Press the buttons of remote and note down the values of serial monitor.
  6. Double check the values and ignore the “FFFFFFFF” Code.

Now we have codes of all the buttons, so we can program the Arduino for home appliances.

Programming

We have all the Switch Codes, for uploading the main code follow these steps.

  1. Open the Code2
  2. Select any four buttons to operate the appliances.
  3. Go line 42 of Code2.
  4. Copy any code value of a switch and paste instant of YYYYYYY
  5. Do this for lines 43, 44 and 45, and chooses the different switch code.

Code

Two codes are used in this project, first is used for reading the value of Switch code and second is the main code.

Code1:

Program to read the value of Switch Code - Download

In the code1 first header file of IR Remote (IRremote.h) is declared. In the next line a function “IRrecv irrecv(12)” is used for declaring the pin of Arduino, which is connected to IR sensor. After it a function “decode_result results” is used for decoding the switch code.

In the “void setup” “serial.begin(9600)” is used for enabling the serial Monitor. After it, “irrecv.enableIRIn” used for enabling the IR Sensor.

In the void loop an “if Condition” is used, it become true when any button of the remote is pressed. After it, HEX value of result printed on serial monitor. After all “irrecv.resume()” resumes the IR Sensor.

Code2 :

Main Code - Download

Many functions of Code2 are similar to code, so we will not discuss the same function

From the line 6 to line 9 four integers are declared by name lig1, lig2, lig3 and lig4 they are used for indicating the pins.

After it, four integers are declared by name flag1, flag2, flag3 and flag4; all the flags are used for storing the status of output pin. After it, an unsigned integer declared by name value.

In the “void setup()”, first IR sensor is enabled. After it all the pins lig1, lig2, lig3, lig4 and D13 declared as output.

In the void loop an “if condition” is used, it become true when any switch is pressed, now decoded value is saved in an integer “value”. After it, IR sensor resumed. In line 34, 35 and 36 on board led are switched on for 100 milliseconds.

In the line 38 “if condition” is used for comparing the saved value and value coming from remote. When it becomes true, flag1 is reversed (‘0’to ’1’ and ‘1’ to ‘0’) and corresponding pin of Arduino switched ON and switched OFF. After it, value becomes zero. This same approach used in lines 39, 40 and 41 for switching other pins.

Author

3 Comments

  1. Ashad Zakariya

    how to modify the codes for 8 channel??????

  2. hello,

    i want to make a digital foil printer using arduino.! so can anybody help how to start this project.
    i have already thermal transfer head.!
    so anybody did this type of project.
    please contact with me.

    thank you

  3. Dr Mark Glickman

    There seems to be a mistake with the way the LEDs are connected. Two LEDs are connected to the same wire.

    Also, BC547 is a bad transistor for relays. It is meant to be used for audio applications. It might fail very quickly. A better choice would be 2N2222 or a power transistor.