August 24, 2013

IR Remote Repeater

Last year I installed my TV on the wall. I really liked how it turned out, but I didn't like the look of cables running up the wall from my DVD player. So I put a recessed box behind the TV, routed the A/V cables through the wall and stowed the equipment in a nearby closet. It cleaned up the look of the room a lot, but there was a hurdle to overcome: how to I control the A/V equipment with a remote? I needed an infrared (IR) repeater to pick up the signal near the TV and repeat it in the closet where the media equipment is. I know there's commercial solutions to this problem, but I figured it would be easy enough to build my own.

To start, you should know a little bit about how a typical IR remote control works. For that, I'll steal an image from Wikipedia:

Without getting too heavy into the protocol, I'll walk you through it. Starting from the bottom of the image and working up, you see there's a time period where the signal is on and it repeats every so often (as long as the button is held down). Inside that signal we see the bits of information (high and low sequence). Each button on the remote has a unique sequence of high's and low's. Zooming in further we see that whenever the signal is high, it's actually modulating on and off at some even higher frequency, termed the carrier frequency. This modulated signal is what's sent to the IR LED at the front of the remote.

The purpose of the carrier frequency is for noise rejection--while you can easily have stray IR beams that might falsely trigger a dumb receiver, it's highly unlikely that you will have any stray IR beams at a this specific frequency. All the IR receivers in TV's, DVD players, etc., have a little sensor designed to look for a specific frequency. When it sees the carrier frequency, it de-modulates it and puts out a solid high (or low, depending on the device) for as long as the modulated signal is there. Once the signal turns off, the sensor puts out a low (or high). The majority of consumer electronics use a 36-38kHz carrier frequency, though those limits can extend out to 33-40kHz depending on the device. Another class of devices use a carrier frequency of 50-60kHz.

You can buy these de-modulating sensors for fairly cheap, you just need to know what carrier frequency you have. This one is rated for a 38kHz carrier frequency, but still works decently well for +/-10% frequency tolerance (that's 34.2-41.8kHz for those keeping score).

So here's the beauty of these IR repeaters: you don't need to know squat about the protocol, only the carrier frequency so you can buy the correct sensor. Once you get the sensor you then have a sequence of high and low pulses that can be sent across wires and then modulated again onto a carrier frequency on the other end. A 555 timer happens to work perfectly for the modulation task.

555 timers are handy little devices. There's no shortage of tutorials on how to set them up, so I'll leave those details to the adventurous googler. Suffice it to say that with a few resistors and capacitors you can set the 555 output to oscillate at a speed and duty cycle determined by those components. And since it has a handy enable pin, we can control when the output is on (oscillating) or off. BINGO! All we need to do is feed the output of the IR sensor into the enable pin of the 555, and then hook an IR LED to the output of the 555, so that the LED correctly mimics whatever the remote LED is transmitting. No protocol decoding, no software, no super fancy componentry. Just a few basic, dumb components.

So of course I designed a circuit board to do all this. It takes a 6-12V power input through a barrel jack (same as your Arduino power supply), or an optional pre-regulated 5V on a micro-USB plug (read: phone charger). I put a visible LED in parallel with the IR LED so that you can see that it's working, though it works just fine without it. To go from where you want to aim your remote (presumably where the TV mounts) to where the media equipment lives, it uses a standard ethernet (or phone cable by choosing the proper jack) cable which transmits power to and signal from the IR sensor. Run the cable to wherever you need it, put a sensor on one end of the cable (I just soldered the sensor leads directly to the cable wires), this circuit board on the other end, point the board at the device(s) to be controlled and there you have it.

Cool trick: if you shine your remote into your smart phone camera, it will show up as purple on the screen. That's why this photo has a purple looking LED.

You'll notice that I included a 5k potentiometer on the board. This is to allow you adjust the 555 frequency by several kHz and also allow your components to be of the non-precision variety. The values listed on the board are assuming you want the 555 timer running somewhere in the vicinity of 38kHz. If you want to use it in the 50-60kHz range you will need to replace the relevant resistors and/or capacitors. There's many calculators out there that will help you do this, just remember that the potentiometer is in series with one of the resistors. The 555 will see the resistance of that resistor plus whatever the pot is set at (0 - 5kohm). If you use 2.5kohm as the potentiometer value in your calculations, that will give you maximum adjustability around that range.

Like all my other circuit boards, I'm making the design files freely available:
For sale in the Makeatronics Store.

No comments:

Post a Comment