ARDUINO IR REMOTE CONTROLLED RELAY
by umar_khalid in Circuits > Arduino
6109 Views, 8 Favorites, 0 Comments
ARDUINO IR REMOTE CONTROLLED RELAY
this circuit works with both AC and DC current. Once the circuit gets an IR signal from a remote, ( you need to register the remote numbers in the code.) the relay will turn ON and if u again give that same signal, it will turn off. the code is at the bottom of this project.
THESE ARE THE COMPONENTS U NEED,
- arduino pro mini
- 5v relay
- 2 pin screw header
- BC547 transistor
- 1K RESISTOR
- vs1838 ir receiver
- 220ohm resistor
- 10k resistor
- 100ohm resistor
- LED
- 5v- 9v power supply.
CIRCUIT DIAGRAM
in this case, i have made a PCB of my own and it works both with AC and DC current.The PCB has a rectifier bridge and a few capacitors to convert the AC current to DC. the link for the pcb that i made will be in the description. if you are going to purchase the PCB, you need to get more components to help convert the AC to DC. the first image of this is only DC current ,the last one shows the full circuit diagram with the AC to DC conversion.
the link to purchase the PCB will be at the end of this project :)
THE CODE
- u need to download the arduino IR library to do this project.
the code will be here below in the description. in this case, u need to put the numbers of your remote code.
example : got to ir remote examples> ir dumpinfo > upload the code.
once uve uploaded the dump info code, simply get the results from ur remote and pu it in this code.
#include <IRremote.h>
int RECV_PIN = 3; int RELAY_PIN2 = 8;
IRrecv irrecv(RECV_PIN); decode_results results;
void dump(decode_results *results) { int count = results->rawlen; }
void setup() { pinMode(RELAY_PIN, OUTPUT); pinMode(13, OUTPUT); digitalWrite(13,LOW); Serial.begin(9600); irrecv.enableIRIn(); // Start the receiver }
int on = 0; unsigned long last = millis();
#define BUTTON_1 0xFF30CF
void loop() { if (irrecv.decode(&results)) { if (results.value == BUTTON_1) { on = !on; digitalWrite(RELAY_PIN2, on ? HIGH : LOW); digitalWrite(13, on ? HIGH : LOW); dump(&results); } else{ digitalWrite(13,LOW); } }
TO ORDER THE PCB
if u purchase this PCB, I recommend u to use "PCBWay". the order link is below. and pls read the discription in the page :)
thank u.
hope u enjoyed this project. and if there are any questions, pls leave them in the comments section.