Hello everyone, In this tutorial we will be using Arduino And Relay module to control home appliances using IR remote.
Controlling home appliances using IR remote is basics of home automation.Once done you can use the same method to control other appliances around your house like Fan, Coffee maker, e.t.c.
How it works?
- When you hit a key on your remote, the transmitting IR LED will blink very quickly for a fraction of a second, transmitting encoded data.
- The Arduino recive these encoded data using IR receiver and performs a pre-specified function.
Gather the Parts
In order to remote control your home appliances you'll need:
- A breadboard
- A LED
- An Arduino
- A TSOP382 IR receiver
- A 5V Relay module
- Some jumper or hookup wires
Wiring
Hookup all the components according to the circuit diagram shown above.
Receive IR Signals
Download Ken Sherrifs IR library from github then add the library to "Arduino installation location\libraries\"
Then upload the following code to your arduino:
#include
int IR_Recv = 2; //IR Receiver Pin 2
IRrecv irrecv(IR_Recv);
decode_results results;
void setup(){
pinMode(13, OUTPUT);
Serial.begin(9600); //starts serial communication
irrecv.enableIRIn(); // Starts the receiver
}
void loop(){
if (irrecv.decode(&results))
{
long int decCode = results.value;
Serial.println(decCode);
irrecv.resume();
}
}
Then open the serial monitor on your arduino IDE and receive IR decimal signals by pressing buttons on your remote for this project we'll need two IR decimal signals.
Arduino SketchUpload the following code to your arduino after replacing 2340092731 and 2086679999 with your IR remote decimal code:
#include
int IR_Recv = 2; //IR Receiver Pin 2
IRrecv irrecv(IR_Recv);
decode_results results;
void setup(){
pinMode(13, OUTPUT);
Serial.begin(9600); //starts serial communication
irrecv.enableIRIn(); // Starts the receiver
}
void loop(){
if (irrecv.decode(&results))
{
long int decCode = results.value;
Serial.println(decCode);
if (results.value == 2340092731)
{
digitalWrite(13, LOW);
Serial.println("Bulb turned ON");
}
if (results.value == 2086679999)
{
digitalWrite(13, HIGH);
Serial.println("Bulb turned OFF");
}
irrecv.resume();
}
}
NEXTPCB PCB MANUFACTURER COMPANY
NextPCB was founded in 2004 and has since established itself as a turnkey PCB manufacturing and assembly factory for prototype quantities as well as small-volume to big-volume production.
Why NEXTPCB?
NextPCB provides one-stop services for PCB with professional PCB manufacturing practices fulfilling the advanced design requirements. The company provides the speed of PCB and assembly manufacturing with efficient collaboration and quality assurance.
NextPCB provides a variety of PCBs with optimistic capabilities. Starting from the single-layer they provide PCB services up to 20 layers, with a board thickness of 0.6mm to 2.5mm with a tolerance of 10% and much more capabilities. Check out the manufacturing capabilities of NextPCB for better production of your PCB.
DoneNow, power up the arduino and relay. Then, Press the buttons on your remote to see your AC bulb turning on and off.
Comments
Please log in or sign up to comment.