Rishabh
Published © GPL3+

TV remote controlled Light and Fan

Make use of infrared receiver to receive signals and control the relays

BeginnerFull instructions provided1 hour27,248
TV remote controlled Light and Fan

Things used in this project

Hardware components

IR receiver (generic)
×1
Arduino UNO
Arduino UNO
or AVR Atmega328p if you want to make a permanent soldered circuit
×1
HL-525 relay module
Or any relay board having 2 or more channels
×1

Hand tools and fabrication machines

A TV remote

Story

Read more

Schematics

How TSOP is connected

From left to right- OUT , GND , VS.
OUT is connected to pin 11. VS connected to 5V pin of arduino and GND connected to gnd pin of arduino. LED's cathode is connected to pin 3, which when LOW , will switch on the led

image file for the schematic

U can ignore the LED. and connect the relay pin insead.
(as shown in the next image)

schematic

image looks dull, but shows good quality on zooming.
Give the 'DVcc' a separate 5V

Serial monitor

A hex code will be displayed on monitor , everytime you press a button on the remote

Receiving HEX codes

Relay being turned on or off

Code

Arduino code

Arduino
KEEP IN MIND THAT YOUR REMOTE KEYS WILL SIGNAL DIFFERENT HEX CODES. THE HEX CODE IN THIS EXAMPLE ARE JUST FOR EXPLAINING.

This code makes use of the "IRremote" library. You'll have to install it from 'library manager'.
The relays are switched on when LOW. So, when a certain HEX code is received the pin connected to the 1st relay is given LOW and for some other HEX code, it is given a HIGH so that the relay is switched off
#include <IRremote.h>
#include <IRremoteInt.h>


int RECV_PIN=11;

IRrecv irrecv(RECV_PIN);
decode_results results ;

void setup() {
  // put your setup code here, to run once:
  pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
Serial.begin(9600);
irrecv.enableIRIn();
}

void loop() {
  // put your main code here, to run repeatedly:
if(irrecv.decode(&results))
{
  Serial.println(results.value, HEX);
 translateIR();
  irrecv.resume();
}
}
void translateIR()
{
  switch(results.value)
  {
    case 0x80BFC13E:
    digitalWrite(3,LOW);
    break;
     case 0x80BF4BB4:
     digitalWrite(3,HIGH);
    
     break;
    case 0x80BF837C:
    digitalWrite(4,LOW);
     break;
    case 0x80BF9966:
    digitalWrite(4,HIGH);
     break;
  }
}

Credits

Rishabh

Rishabh

4 projects • 31 followers
I am an ECE engineer with embedded systems , circuit designing and Hardware engineering as my areas of interest. plz check my projects out

Comments