In this project, you’ll use infrared LEDs and a Raspberry Pi to automatically operate a remote-controlled device.
HOW IT WORKS: INFRARED LIGHT
In the early 1800s, astronomer William Herschel discovered that sunlight split into colors by a prism is noticeably warmer the closer it is to the red end of the spectrum. However, the area of the spectrum beyond red is even warmer. It turns out there is another, the warmer color of light—called infrared (IR)—which humans can feel but not see.
Infrared LEDs have dozens of important applications, including data communications. Circuits that send data using IR LEDs are called transmitters. Circuits that receive the infrared light and convert it back to data are called receivers.
While it may seem like a disadvantage, the line-of-sight nature of infrared communications actually has its pluses: the IR transmissions are unlikely to interfere with other IR communications happening in completely different rooms or buildings. Anybody who has ever had their ceiling fans turned on and off by a neighbor’s radio remote will be able to appreciate that!
In the simplest possible sense, an IR transmitter communicates data by turning its LED on and off. For example, it would be possible to communicate using Morse code with an LED. However, several complicated languages and systems, called protocols, have been developed specifically for data communication over IR. Over the decades, more and more information has needed to be conveyed through the messaging sent by remotes. This has sparked many inventive ways of increasing the signal-to-noise ratio, error correction, and data-carrying capacity. Here’s an overview of some of the things that might be included in a protocol specification.
GET THE PARTS
The instructions in this project will use the equipment listed here. New to electronics projects? Stick with this parts list and I’ll make it easy! If you have more experience and are able to modify the steps, feel free to substitute your own transmitter, receiver, computer, OS, and A/C or another item to be controlled.
Let’s make the project! The following steps assume you already have an assembled IR transmitter and receiver, A/C unit and remote, and sudo root privileges on your Pi. (Raspbian provides the “pi” user for this purpose.)
TAKE IT FURTHER
One option for modifying this project is to make it a closed-loop system where the Pi can actually check on the state of the A/C. You could set up a temperature sensor in the room, or an inductive current sensor on the air conditioner’s power cord, then have the Pi read the signals from those to determine what the A/C is doing. You could even have the Pi visually check for the state of the LEDs on the front of the A/C if you are feeling ambitious and have a camera.
You created a system to control an air conditioner remotely from a computer using infrared light. I hope that you’ll explore further in books and online because there is a lot to learn about serial communications, circuit design, and LED technology. To learn the nitty-gritty of designing electronics circuits from discrete components, including LEDs, I recommend The Art of Electronics by Horowitz and Hill.