Project tutorial
TV remote controlled Light and Fan

TV remote controlled Light and Fan © GPL3+

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

  • 19,363 views
  • 13 comments
  • 64 respects

Components and supplies

IR receiver (generic)
×1
A000066 iso both
Arduino UNO & Genuino 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

Necessary tools and machines

A TV remote

About this project

This project is about controlling your room lights and/or fan wirelessly, all while sitting on your couch. The reason why I chose this project was because TSOP receiver was the best suited component for a short ranged wireless communication.

Firstly, it is really really cheap (Rs. 10 in India). Plus, you already have a transmitter with you i.e. the TV remote.

The TV remote sends Infrared signals at 38 kHz frequency and the TSOP receiver that I purchased can receive signals between 36-40 kHz.

The pinout of the receiver may vary according to the model

TV remote outputs high and low pulses at high frequency, thus, switching on and off the IR LED multiple times in a second corresponding to those pulses. Whenever the LED is ON , the TSOP goes low and when the LED is OFF, the TSOP is high (which means that it is also high when it is idle).

Here's the relay module :

These inputs, when receive a LOW, switch the relay on i.e. the switch is 'closed'.

I have posted a video of TV remote switching the relay on/off. Due to absence of a working extension board with a bulb holder, unfortunately, I can't post a video of the lamp turning on/off. But I will post it soon. Here's the connection for connecting the lamp to the relay :

In my module too, from left to right- the 3 pins are: NC (normally connected), COM (common), NO (normally open). Connect the live wire to the bulb as shown. You can solder the entire project and install it inside your switch board to control your tubelight, fan, lamp etc.

NOTE: On the left side of relay module, there are 3 pins: DVcc Vcc and GND. I strongly suggest you to remove the jumper and give the DVcc pin a separate 5V supply because it is connected to an optocoupler (which prevents physical connection between high ac voltage and the microcontroller) so that in case of spikes, your microcontroller is not damaged.

Code

Arduino codeArduino
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;
  }
}

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
ir.fzz
image file for the schematic
U can ignore the LED. and connect the relay pin insead.
(as shown in the next image)
Untitled
schematic
image looks dull, but shows good quality on zooming.
Give the 'DVcc' a separate 5V
Img 20160922 153227
Serial monitor
A hex code will be displayed on monitor , everytime you press a button on the remote
Untitledd
Receiving HEX codes
VID_20160919_161629.mp4
Relay being turned on or off
VID_20160919_174751.mp4

Comments

Similar projects you might like

Turn On/Off TV Sound System Using the TV IR Remote Control

Project tutorial by Lugh

  • 1,335 views
  • 1 comment
  • 6 respects

IR Remote Controlled Home Automation

Project tutorial by suhail jr

  • 11,412 views
  • 7 comments
  • 20 respects

Control TV Using A Touch Remote

Project tutorial by the lonely programmer

  • 1,034 views
  • 2 comments
  • 9 respects

Servo Control with TV Remote Control

Project showcase by eldo85

  • 11,128 views
  • 5 comments
  • 32 respects

Remote Controlled Smart Lamp

Project tutorial by Team gadget programmers

  • 4,951 views
  • 2 comments
  • 16 respects

Remote Controlled Jack-o-Lantern

Project tutorial by Josh From BreakoutBros.com

  • 1,870 views
  • 0 comments
  • 1 respect
Add projectSign up / Login