Wow! Its amazing that you can easily control any appliances through any of your old/new Remote. As we have developed this project cost effective too, so we've used relay and an IR sensor only, which costs less than $5.
Working!First you need to go to this page and download the IR library. You just need to follow the read me file to install. I think that any IR remote control can do this, I’ll be using a Philips Universal one. The infrared receiver has 3 pins:
- First pin: Vout, outputs HIGH when no signal is present and LOW when a mark is received.
- Second pin: GND.
- Third pin: Vcc.
Connect relay pins:
- Gnd( A ) with Arduino Gnd
- Middle pin(A/C) pole with AC power as given in circuit.
- RELAY NO Pin with One lamp pin(wire)
- RELAY ( B ) with lamp another pin(wire)
Now you will get two wires as shown in given below figure, one from relay side and another from lamp (bulb) side connect to ac (but wait here.). Circuit Diagram:
You need to wire your circuit something like this. And then COPY AND PASTE BELOW GIVEN CODE in Arduino then upload it:
/*Created By: Anshul Pareek
*usage : read IR SIGNALS AND PRINT ON SERIAL
*/
#include <boarddefs.h>
#include <ir_Lego_PF_BitStreamEncoder.h>
#include <IRremote.h>
#include <IRremoteInt.h>
int RECV_PIN = 9;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
}
void loop()
{
if (irrecv.decode(&results))
{
Serial.println(results.value);
irrecv.resume(); // Receive the next value
}
delay(000);
}
Open your serial port by going tools->serial monitor. When you run this code and pressing remote buttons you'll see some of the codes of your remote buttons like as. I've received POWER button code as: 490607474 VOLUME UP: 1053668050 Write these code somewhere for our upcoming code below. After remembering above code use in below given code in condition part:
/*Light on off code*/
#include <boarddefs.h>
#include <ir_Lego_PF_BitStreamEncoder.h>
#include <IRremote.h>
#include <IRremoteInt.h>
int RECV_PIN = 9;
int OUT_PIN=8;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
pinMode(OUT_PIN,OUTPUT);
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
}
void loop()
{
if (irrecv.decode(&results))
{
Serial.println(results.value);
if(results.value == 490607474){ //Please replace your remote button code for which you want to on the light
digitalWrite(OUT_PIN,HIGH);
delay(1000);
}else{
digitalWrite(OUT_PIN,LOW);
}
delay(1000);
irrecv.resume(); // Receive the next value
}
delay(000);
}
Now upload above code in Arduino and run this code. If everything is alright your lights will glow and off with your remote buttons. As I am controlling only one Bulb only but you can control more than one bulb using different pins and relays and please beware about the AC Connections. We are going to Launch more interesting clone of this project soon. Have query shout in comment box.You can check out our latest project by going below url: http://www.gadgetprogrammers.parikshacrack.com
Thanks for your time.
Comments