This is the first of several posts about how I put together a system to control my television from my phone. Much credit goes to Alex Bain and his Open Source Universal Remote project. I’ve made some material changes, hence this blog post, but much of the ‘try something’ -> ‘bang head against wall’ -> ‘repeat’ was done by him.
As a result, in this series, I will be focusing on the things that are different between our approaches, and highlight places where beginners might have trouble. I’ve also built a pair of apps, one for iOS and one for Android, that will communicate with the remote once everything is set up. For all you mobile devs out there, there will be some interesting things in those posts as well, for instance, implementing a RecyclerView in Android, and my review of Swift thus far in iOS. But enough meta explanations.
Part 1: Hardware
The first thing to do is to get the electronics set up. Regular TV remotes work by using an infrared LED to beam signals to the television. We’ll be using the same technology to control your TV with a Raspberry Pi. The high level process for what we’re doing in this part is:
1. Put together one circuit to record your remote’s signals
2. Put together another circuit to play those signals back
Turns out, we can put both circuits in the same place: a Raspberry Pi proto board. The proto board connects to the pins on top of a Raspberry Pi, and allows you to connect them to other electronic components. If you don’t know how to solder, here’s a good guide. For my soldering needs, I personally use a Weller WLC 100 soldering iron.
In order to put the proto board together, check out this guide.
Next, you’ll want to get all your parts together. There’s nice list on Alex Bain’s site, which I’ve reproduced here:
- 1 Adafruit RaspberryPi Protoboard
- 2 940nm 40deg IR LEDs
- 2 right angle LED holders
- 1 P2N2222AGOD-ND transistor
- 1 10k Ohm resistor
- 1 TSOP38238 38KHz IR receiver
- Hook-up Wire Spool Set – 22AWG Solid Core – 6 x 25 ft
Now for the fun part: putting the circuit together. You can see at the top of this post an image of a built out version of the RPi remote. For those of you who may not know circuit conventions very well, the red wires are the ‘power’ lines, while the black wires are for ground. White wires are connected to the ports the Raspberry Pi uses to receive signals from the infrared (IR) receiver and play them back with the two IR LEDs.
While my circuit is equivalent to Alex Bain’s, the exact position of the components on the proto board is different. This is primarily to cut down on the amount of soldering I had to do. See the images below.
Another place beginners might get confused is which LED wire to connect where. One wire is longer than the other (it’s called the Anode), while the other is shorter (called the Cathode). The Anode (long lead), in this circuit, should be connected directly to power (if it’s the first LED in series), or to the Cathode (short lead) of the other LED (if it’s the second LED in series).
Here are a bunch of photos of how I set up the circuit on the proto board. I’ve tried to take many photos from multiple angles and orientations, so you can tell what goes where. As you can see, I’m a novice solderer, and please excuse the dust that has accumulated on the proto board 🙂
1 thought on “Raspberry Pi as a Television Remote: Part 1”