In this guide, we will learn how to build an IR-controlled home automation system, which is both practical and cool.
The reason I think of this is that I detest having to manually toggle the lights and appliances in my garage. In order to turn on or off my lights or other equipment, I had to get up from my workstation and walk to the switchboard. It’s a terrible hassle whenever I’m trying to get some work done in my garage. That’s why I set out to discover a solution. A device for automating the house is something I invented.
Hardware Required
- Arduino Uno
- Relay Module
- Mini BreadBoard
- Jumper Wire (male to male)
- TSOP1738 (or any equivalent)
- Buzzer (optional, used for notification)
- General Purpose PCB (only need a small piece).
- Male Header Pin (three pin).
Other Tools Needed:
- Soldering Iron
- Soldering Wire
- Soldering paste
- Box(used as enclosure for the device)
- Utility Knife and glue
Warning: In this tutorial we are dealing with high voltage so, do not proceed this tutorial without wearing safety glass and gloves.
Solder IR sensor On The PCB
The next step is to attach the TSOP1738 infrared sensor to a tiny PCB. such as the example picture provided above. I’m aware that the TSOP1738 may be used as a sensor module when plugged straight into an Arduino board, but I’ve found that in some instances the pin would break, rendering the sensor useless.
Download and install IR library
To start off the next steps, we need to go through this. It’s necessary to include the IRremote library to the Arduino Integrated Development Environment. This tutorial cannot be completed without this library.
Here are the steps you need to take to add the Library to your Arduino IDE:
When you extract the files, you’ll find an IRremote folder. In my instance, this is C:/Program Files/arduino-16.8, but it should be wherever you installed Arduino. The next step is to access the Libraries folder.
- First download the IRremote library file from here.
- Extract the file using the winrar or 7zip.
- Paste the IRremote folder there.
Get Hex Code From Remote
Now we need to get the hex code from the remote control.
Each button on an infrared remote control has its own unique hex code, allowing for precise tracking of which button was pressed. So, let’s start by extracting the hex codes of the buttons we’ll be using on the remote.
- Launch the Arduino IDE and paste the code below into it and select correct board ” ARDUINO UNO” and select correct “PORT” from tools tab.
- Send over the Sketch.
- Launch the Serial Monitor after that.
- In order to obtain the hex code, press the appropriate button on the remote.
- A string of hexadecimal digits will appear on your serial monitor at that time; jot them down in case we ever need them.
Here is Your Code
#include
int RECV_PIN = 8;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receive
}
void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
irrecv.resume(); // Receive the next value
}
}
Wire The Arduino
Warning: Do not plug the light or any other household appliances into the relay module at this time!
Once we’ve finished connecting the wires, we can go on.
Arduino Sketch
The following Arduino sketch, FDXUWSFIU9UX6WL.ino, can be downloaded directly into the Arduino IDE and uploaded with a few clicks.
You can programme up to four relay modules with the hex code of remote buttons you copied from your remote.
Powering Circuit
Carefully inspect the connections to ensure there are no faulty ones, and if all seems well, turn the power on to the Arduino board. Now, grab your IR remote and hit the button you used before.
If the relay activates and the buzzer sounds, then we can proceed. If you’re still having trouble getting it to function, double-check all of your wiring and the Arduino program.
After that, plug the Arduino back in and see how it performs. So now that we know the testing went well, we can go on to the next phase.
Find A Enclosure.
Conclusion
Finally, we have completed our infrared remote home automation system.
Mount it in the basement so you can manage your appliances from the couch, or put it in your bedroom so you can control your TV from bed.