IR remote controlled home automation system using Arduino

IR remote controlled home automation system using Arduino:  Hi Everyone, I hope you are fine and doing well. Recently, I posted a Arduino based project on PC based Home Automation using Arduino. It uses serial communication between PC and Arduino. I thought I could do better so I tried it to do with the IR receiver and remote. Guess what it works like a charm. Now I can control the devices from a distance. Now I can control devices with the help of TV remote or IR remote. So I named it IR remote controlled home automation. You may also like to check TV remote controlled home automation system using pic microcontrollerIR remote controlled home automation system using Arduino

Block Diagram of IR remote controlled home automation system

In this IR remote controlled home automation system; Arduino Uno is used as brain of circuit. First of all IR receiver receives signal from remote. These signals read by Arduino and compare it with the defined values in the code. If the values are same then it performs its corresponding operation like turning on and off the relay or display messages on LCD.block diagram of IR remote controlled home automation system using Arduino

Components Required for IR remote controlled home automation system

  • Arduino Uno: We use Arduino due to easy to use and it also provides much digital pin to interface with LCD, IR and relay module at the same time. It is very friendly when you prototyping any project.
  • 4 Channel Relay Modules: The module we use in this project is HL-54S. It switches on and off using 5v logical signal from Arduino. It can handle up to 250VAC and 10A. These modules have 4 relays so we can control 4 AC devices or appliances.
  • IR remote and receiver: IR remote sends infrared signal which is receives by IR receiver. Each button on remote has its unique value. I use VS1838 in this project.
  • 16×2 LCD: LCD is used to display project name, list of commands which can be enter then it ask to give any command and show the status of the command which is entered. We use 16×2 LCD because it is easy to interface with Arduino and very cheap in price. 10k potentiometer is used to control the contrast of display
  • AC bulbs with holders: AC bulbs are used to represent devices and appliances. Because it is easy to handle and very useful when you are prototyping any AC project. In final product just replace with AC socket to control.
  • AC wire with plug: I recommend you to use good quality wire when working with higher voltages. It is always good to use electrical tape to cover connections.
  • External 5 volt supply: 5 volt dc supply is required to switch relay on and off. Otherwise it did not work. Also do not supply 5v from Arduino.

Circuit IR remote controlled home automation systemIR remote controlled home automation system circuit diagram

Connections IR remote controlled home automation system

IR receiver:

Pin 1 to digital pin 2.

Pin 2 to ground.

Pin 3 to Vcc.

16×2 LCD:

  • VSS to ground.
  • VDD to supply voltage.
  • VO to adjust pin of 10k potentiometer.
  • RS to Pin 8.
  • RW to ground.
  • Enable to Pin 9.
  • LCD D4 to Pin 10.
  • LCD D5 to Pin 11.
  • LCD D6 to Pin 12.
  • LCD D7 to Pin 13.
  • Ground one end of potentiometer and cathode
  • 5v to other end of potentiometer and anode

 4 Channel Relay modules:

  • External 5 volt to JD VCC.
  • Ground to ground.
  • Ini1 to Pin 3.
  • Ini2 to Pin 4.
  • Ini3 to Pin5.
  • Vcc to Arduino 5v.
  • Connect one end of all bulbs to normally open terminal of relays.
  • One end of 220VAC to all common terminals of relay and other end with other terminal of bulbs.

Working of IR remote controlled home automation system

Each button on IR remote has its unique value. So we can use each button separately. I used 3 buttons labels as “1. 2. 3.” Each button has its own performance in the code. When I pressed the button from remote it send infrared signal which is then receives by the IR receiver. Arduino read the signal and perform the corresponding operation like switch on and off appliances and display status on LCD. When I press button one “1” from the remote Arduino reads the value and compare it with the value defined in code which is “16724175” if it is equal than Arduino switch on the first relay and the bulb light up and if it press again the bulb light off. Other two buttons works similarly.

Code of IR based home automation system

#include <LiquidCrystal.h>
#include <boarddefs.h>
#include <IRremote.h>
#include <IRremoteInt.h>
#include <ir_Lego_PF_BitStreamEncoder.h>
LiquidCrystal lcd(8, 9, 10, 11, 12, 13);
#define bulb1 3
#define bulb2 4
#define bulb3 5

int RECV_PIN = 2;

int itsON[] = {1,1,1,1};

#define code1 16724175 
#define code2 16718055 
#define code3 16743045 

IRrecv irrecv(RECV_PIN); 
decode_results results;
char temp;
char str[10];
char i=0;
void setup() 
lcd.begin(16, 2);
pinMode(bulb1, OUTPUT);
pinMode(bulb2, OUTPUT);
pinMode(bulb3, OUTPUT);
digitalWrite(bulb1, HIGH);
digitalWrite(bulb2, HIGH);
digitalWrite(bulb3, HIGH);
lcd.print(" LAB ");
lcd.print("HOME AUTOMATION ");
lcd.print(" USING IR ");
lcd.print("1. Bulb 1");
lcd.print("2. Bulb 2");
lcd.print("3. Bulb 3");
lcd.print("Bulb 1 2 3 ");
lcd.print(" OFF OFF OFF");
void loop() {
lcd.print("Bulb 1 2 3 ");
if (irrecv.decode(&results)) {
unsigned int value = results.value;
switch(value) {
case code1:
if(itsON[1] == 1) { 
digitalWrite(bulb1, LOW); 
itsON[1] = 0;
lcd.print("ON ");
else { 
digitalWrite(bulb1, HIGH);
itsON[1] = 1;
case code2:
if(itsON[2] == 1) {
digitalWrite(bulb2, LOW);
itsON[2] = 0;
lcd.print("ON "); 
} else {
digitalWrite(bulb2, HIGH);
itsON[2] = 1;
case code3:
if(itsON[3] == 1) {
digitalWrite(bulb3, LOW);
itsON[3] = 0;
lcd.print("ON ");
} else {
digitalWrite(bulb3, HIGH);
itsON[3] = 1;
lcd.print("OFF "); 
Serial.println(value); // you can comment this line
irrecv.resume(); // Receive the next value

Implementation of IR remote controlled home automation system

Leave a Comment