The previous month, I made an Electric board relay-controlled circuit. Using the exact schematics and circuit diagram, I want to build an IR controlled Electric extension board. Keeping the form factor in mind, I designed a PCB and ordered it from JLCPCB. And JLCPCB is the sponsor of this project; PCB manufacturing service is just available for $2.
- 4 channel controller
- IR remote compatible
- Range <50 meter
- Low power consumption
- Indicator light for each channel
- Small and 5volt operatable
The infrared signal from Remote is received by the Receiver section of the board (containing TSOP1738 IR receiver). Then this binary code is given to the microcontroller to process the signal. This Binary is converted in HEX code; then, there will be an ON/OFF action according to every pressed button. The microcontroller made its corresponding digital pin to high to control the relay system and then AC mains.
Here is a separate tutorial on decoding IR remote using Arduino.
Components required:- SPDT relay x4
- BC547 transistor x4
- PC817 optocoupler x4
- Atmega328p or Arduino
- Crystal 16Mhz x1
- 1k Resistor x 10
- 10k resistor x1
- 22pf capacitor x2
- 100nf capacitor x1
- Screw terminals x4
- 5mm red led x4
- 100ohm resistor x1
- 9v battery OR 5v supply
- 1N4007 Diode x4
- TSOP 1738- IR receiver x1
For one channel, Try this by placing a led Instead of relay, If this one work fine then go ahead.
Pcb:Download Gerber files from Here.
Here we have four outputs to connect to our 4-channel relay system. But the space inside the wooden box of extension is significantly less. So, we extended it using another wooden stick to solve the problem of space.
All the components are fixed inside the wooden box and glued correctly; make sure while making connections with TSOP1738, the wire length is not too long and use copper wires. Also, add a capacitor between the two legs of TSOP (470uf can do the job perfectly).
Use thick copper wire while making connections of AC mains. Then there will be a low dropout of voltage, and it will not overheat the circuity.
Here, we are using the SMD version of the microcontroller and headers is given to program the microcontroller. Now let’s program the microcontroller, Connect the pins in this format, and upload the code simply using Arduino as the ISP function. For more info, check this post.
#include <IRremote.h>
const int RECV_PIN=7;
IRrecv irrecv(RECV_PIN);
decode_results results;
#define Relay1 6 // Load1 Pin Out
#define Relay2 5 // Load2 Pin Out
#define Relay3 4 // Load3 Pin Out
#define Relay4 3 // Load4 Pin Out
int load1, load2, load3, load4, power;
void setup()
{
Serial.begin(9600);
pinMode(Relay1, OUTPUT); // declare as output for Load1 Pin Relay1
pinMode(Relay2, OUTPUT); // declare as output for Load2 Pin Relay2
pinMode(Relay3, OUTPUT); // declare as output for Load3 Pin Relay3
pinMode(Relay4, OUTPUT); // declare as output for Load4 Pin Relay4
digitalWrite(Relay1, 0); // Turn Off Load1
digitalWrite(Relay2, 1); // Turn Off Load2
digitalWrite(Relay3, 1); // Turn Off Load3
digitalWrite(Relay4, 1); // Turn Off Load4
irrecv.enableIRIn(); // Start the receiver
irrecv.blink13(true);
}
void loop() {
if (IrReceiver.decode())
{
Serial.println(IrReceiver.decodedIRData.decodedRawData, HEX);
if(IrReceiver.decodedIRData.decodedRawData==0xED127F80){ // For Load1 On
load1 = 0;
}
else if(IrReceiver.decodedIRData.decodedRawData==0xE51A7F80){ // For Load1 Off
load1 = 1;
}
else if(IrReceiver.decodedIRData.decodedRawData==0xFE017F80){ // For Load2 On
load2 = 0;
}
else if(IrReceiver.decodedIRData.decodedRawData==0xFD027F80){ // For Load2 Off
load2 = 1;
}
else if(IrReceiver.decodedIRData.decodedRawData==0xFB047F80){ // For Load3 On
load3 = 0;
}
else if(IrReceiver.decodedIRData.decodedRawData==0xFA057F80){ // For Load3 Off
load3 = 1;
}
else if(IrReceiver.decodedIRData.decodedRawData==0xF8077F80){ // For Load4 On
load4 = 0;
}
else if(IrReceiver.decodedIRData.decodedRawData==0xF7087F80){ // For Load4 Off
load4 = 1;
}
else if(IrReceiver.decodedIRData.decodedRawData==0xE11E7F80){ // For Load4 Off
load1=0;
load2=0;
load3=0;
load4=0;
}
else if(IrReceiver.decodedIRData.decodedRawData==0xFC037F80){ // For Load4 Off
load1=1;
load2=1;
load3=1;
load4=1;
}
irrecv.resume(); // Receive the next value
delay(100);
}
if(power==1){
digitalWrite(Relay1, 1); // Turn Off Load1
digitalWrite(Relay2, 1); // Turn Off Load2
digitalWrite(Relay3, 1); // Turn Off Load3
digitalWrite(Relay4, 1); // Turn Off Load4
}else{
digitalWrite(Relay1, load1);
digitalWrite(Relay2, load2);
digitalWrite(Relay3, load3);
digitalWrite(Relay4, load4);
}
delay(500);
}
Working:Every button in IR remote has different hex number data, if we want to turn ON/OFF a device, we need two buttons of IR remote. One to switch ON and other one to switch OFF the same device.
Similarly, here we are making 3 channel relay controllers, that’s why we need 6 different buttons. Also, when we want to switch ON/OFF all the devices at same time, we need two more buttons. In total our IR remote should have 8 buttons.
When remote release IR hex data, it will be captured at receiver end and microcontroller decode the data, immediately turn ON/OFF the respective pin.
This code only controls the digital pins of Arduino. To switch ON/OFF any load we cannot directly mount relay on any microcontroller without controlling and switching circuit. That’s why here we are using a combination of optocoupler and NPN transistor as a switch to control the relay properly. Optocoupler is used to control transistor and further relay and mains load. Download the proper IR library from Here.
Version 1:I posted version ONE of this circuit some time ago, but one is also working well. Circuit is designed on a general purpose holed pcb. You may get more info about the code, circuit from here.
JLCPCB is the one of the most popular PCB makers. Price is just $2 for 2, 4 and 6 layer PCB. They just launched new purple solder mask, aluminum Pcb and 3d printing service in very low cost. Pcb quality is not compromised at any cost. Check them out right now from Here.
JLCPCB Is also providing new user coupons and sign-up rewards of up to $30. So, check them out from here. Register using this link to get Free PCB assembly service coupons. Get your 2 layer to 6-layer PCB’s just in $2, stencil and PCB assembly service in just $7.
For PC: https://jlcpcb.com/SSRor mobile phone: http://m.jlcpcb.com/ssi
1) How to make Arduino Uno clone board.
2) How to program Arduino Using Smart Phone.
3) Arduino Nano clone board problems and solutions.
4) How to make Inductance Meter Using Arduino.
5) Raspberry Pi- PICO Oscilloscope.
Think you enjoy my work, stay tuned. Follow us on Instagram (sagar_saini_7294) and hackaday.
please support us- No donations, just follow and leave a comment.
Comments