Evolution of a Design
When I started this, as can be seen in the image at left, the case was two parts that fit together in a semi-complex manner (Actually, the very first version just had a little plastic square that covered the AVR, but nothing else). It was hard to print with any quality and, frankly, the front looked awful. So I simplified it such that the IR LED could stick out a small hole, as seen in the middle. But then it dawned on my that the translucent plastics might just be transparent enough to IR that no hole was needed at all.
And sure enough, it just worked!
Thus, the design is now even simpler (assuming you have translucent filament).
Both professionally and as a couch surfer, I’ve found myself interacting with a great deal of devices that can be controlled via infrared remotes. Often, remotes lost in the depths of a couch or misplaced in the fridge (it happens). Clearly, I needed an IR blaster that could be controlled from a computer to both eliminate the “losing the remote” problem and to integrate control of multiple devices into a single UI. Conveniently, Arduino micro-controllers with integrated USB ports are commonly available and quite cheap. Adding an IR LED to an Arduino is trivial, as the ever popular TV-B-Gone project demonstrates.
Thus, the Teensy IR Blaster was born. I started with the Teensy v2.0 AVR-based micro controller that includes USB support. It unofficially supports Arduino using the Teensyduino extension. To this, I added Ken Shirriff’s IRremote library modified fro the Teensyduino environment and
Construction.
1. Hardware
Along with the Teensyduino, the IR blaster uses a handful of discrete components to drive the IR LED. This requires a simple driver transistor circuit to drive the LED (See discussion under IR-Driver Transistors on Lady Ada’s site). However, when I first hooked that up, any attempt to send an IR signal would cause the micro controller to crash.
As it turns out, the power requirements of the LED were enough to cause the voltage available to the CPU to drop too low, causing a crash!
Windell Oskay of Evil Mad Scientists Laboratories set me straight by recommending that I place a 100uF capacitor across the power rails as close to the LED driver as possible! And, in fact, I used EMSL’s rather awesome Diavolino board to build the original prototype prior to the Teensy solution.
Note: With a “hole-less” case, you’ll want to mount the LED with shorter leads than pictured such that it doesn’t stick out past the front of the board.
Parts list:
- Generic IR LED (picked some up at HSC for ~ 9 cents/each).
- 3904 transistor
- 100uF electrolytic capacitor (mind the polarity!)
- 270ohm 1/4 watt resistor
Once the circuit was proven, I wanted to make it as small as possible. So I soldered 4 header pins (same used to connect Arduino to their shields) into the 4 corners of the Teensy board and built a freeform wired circuit on the underside of the Teensy, as pictured. Fortunately, all 3 of the connection points for the discrete components could be done at the 4 corners! Thus the pins are used for both wiring and as standoffs to keep the parts from getting squished in the case.
2. Software
The Teensy IR Blaster software is quite simple, but only because of the generosity of the Open Source community. Leveraging a fork of Steven Cogswell‘s SerialCommand library combined with Ken Shirriff’s IRRemote library.
The end result is hosted on GitHub. The setup()
function configures the serial port for 9600 baud communication and then adds a series of sample commands to the SerialCommand library’s serial interpreter via a set of calls to SCmd.addCommand()
. Each call passes the name of the command and the function to call when the command is entered.
The standard Arduino loop()
function passes control to SerialCommand’s serial input parser, causing the Teensy board to wait for input from the serial port and respond accordingly.
That is it!
Writing a sendCommand()
function that decodes a numeric argument and sends that as an IR command is an exercise left to the reader (unless I find time sometime soon). To learn more about IR remote protocols, Make Volume 30 (page 118) includes the article “Skill Builder: IR Remote Hacking” and Volume 05 (page 157) includes the article “IR Remote Control Protocol”.
Once the code is written, you can upload the code to your Teensy board via the USB cable. For controlling the Teensy IR Blaster, you can use any capable serial port terminal program. I use miniterm.py from the PySerial package.
3. Case
Of course, having a teensy board with discrete components hanging off of it just really isn’t acceptable bit of packaging. Quite obviously, that I have a 3D Printer the only possible solution would be to design my own case!
So, out came the micrometer. Using ViaCAD (if I were to do this over, I would use Autodesk’s Inventory Fusion), I created a simple box with a slot at one end for the IR LED and a shallower, but wider, slot at the other end for the USB connector. The inside of the box is pretty much exactly the width/length of the Teensy board such that the board won’t fall out (which remains true across all revisions of the case).
It worked, but the two halves of the case fit together in an awkward fashion and the print quality of the stick like bit from the top case was awful. Thus, the next revision of the case simplified the top into just being a lid while the bottom had a hole in the front of the case for the LED to stick out.
Neat, but still too complex. Using translucent PLA, there was no need for a hole for the LED at all! Thus, the final version of the case is a simple solid box like base with a pressure fit lid. Looks great and, better yet, the orange LED on the Teensy makes the top glow like an ember whenever an IR signal is sent!
All of the model files are available on Thingiverse, including the version with an LED hole if you want to print it with fully opaque material. Print, stuff the Teensy into the box, snap the top on, plug in the USB cable and you should be all set!
TIP: As it turns out, the plastic prints are pretty remarkably accurate. However, the slight corrugation between the layers means that any vertical surfaces will have a regular horizontal texture. Thus, if you print a part that just fits inside another part, as is the case with the lid and box here, it will snap together and actually hold quite well without having to model a true snap mechanism!
Conclusion
With the Teensy IR Blaster, I have integrated control over a number of home entertainment devices. I use the blaster to control a TV whose remote long ago broke. Because of the flexibility of the software, I also use the blaster to control an ancient receiver that uses non-standard remote codes. I have also used the Teensy IR Blaster as the basis for some automated testing infrastructure.
Note that the same basic design, substituting an IR sensor for the IR LED, could easily be modified to act as an infrared receiver.