February 1, 2012 Hardware arduino, IR, webapp The IR Shield

The primary component of my media center is an HTPC with boxee on it. One neat feature of boxee is that you can use a web or android based remote to control it, which I do. The problem though, is that my television and sound system both use IR for remote communication. So with that problem in mind I set about making a link between a web-based interface and my IR controlled components. Here’s the video showing what I made, followed by the article showing how I did it.

The prototype of my shield consisted of an IR LED and Receiver diode break-out boards from Sparkfun.com, an RGB LED, an Atmel EEPROM, and a Peizo sensor. The prototype then connects to an Arduino ethernet shield and an Arduino Duemilanove. An Arduino sketch sets up a web server that listens for http requests to send or delete an IR code, and outputs CSV data for an Android or web-based app to parse out and use. The sketch is also using the IR receiver diode to constantly ‘listen’ for new IR codes from almost any type of remote. Once received, the codes are stored to a large eeprom. The RGB led has one common color to show that the device is running and uses green and red to show whether action is being taken or something is being recorded, respectively.

After a successful prototype, I designed a board in eagle and sent it off to Laen‘s PCB service. Which turned out to be an excellent decision, the boards were high quality, cheap and it only took about two weeks! Even more importantly, the board was correct! After checking over the final design and soldering all the components on, there were no jumpers or cuts needed. Though I did manage to order one of the resistors from mouser in the wrong size. Assembly was very easy, novice level difficulty. But I do have one construction tip to share. These peizo sensors from sparkfun are difficult to connect. As EliTheIceMan explains,

Some advice on these. DO NOT SOLDER THEM! (Especially top side soldering -haha) You might get away with regular through hole soldering if your very fast but I somewhat melted mine in about a second. Use a 3 pin female header.

Well, ElitheIceman is wise but also not the boss of me; I wanted it soldered. The solution that I came up with was holding the peizo lead onto a header lead on one side with an alligator clip so that the other side is aligned and ready to solder. Then, I filled a small glass full of water very full and submerged the peizo sensor completely with only the lead sticking out. I then soldered one side, you could hear a quick sizzle as the metal and plastic heated up and were immediately cooled. This trick worked and I didn’t notice any warping at all on the sensor. :)

With the board assembled, it gets plugged into some stacking headers, then onto an ethernet shield, then onto the arduino and the entire thing is plugged into power and cat5, then placed onto a suitable coffee table in front of your media center.

On the software side of things, the functionality list goes like this:

The theme color selector at the bottom will change the background image as well as the status color of the RGB LED, which is saved to non-volatile memory.

The IR receiver is constantly listening for commands and will work with almost any remote type as it will record in ‘raw’ mode for codes that it doesn’t know about, thanks to Ken Shirriff’s amazing IR library.

After receiving codes you can see them listed in the interface, where you can click them to replay a code or check the ‘Options’ checkbox at the bottom, after that clicking a code button will bring up a modal dialog that will let you relabel, delete or signify as the knock button

The firmware is constantly listening for vibration (with a fairly high tolerance) from the peizo sensor. The software will let you select which code a ‘knock’ will activate.

Alright, here’s the goods. This zip will contain:

Arduino sketch

Web app code (.html, .php, .css, .js)

Eagle board and schematic

README.txt with a MOUSER.com parts list and some installation advice

Download weur.zip

Besides being a web enabled remote, I think this shield could have some other interesting possibilities. You could essentially reverse the situation and make it easy to access a desktop computer or HTPC through a remote control, if you preferred those over tablets and phones. Or, lots of neat, minature toys have come out lately that are using IR for communication to save on weight and cost. The Infrared Shield would allow you to control them with your computer with new firmware and software.

References

IR Receiver and LED breakout were purchased at Sparkfun and their schematic’s were used in my designs. (Thanks Sparkfun, you rock, so much.)

I bought my Arduino and ethernet sheild at Adafruit (Hi Lady Ada!)

Liudr’s blog helped me get my code working after I finally figured out it wasn’t working because I ran out of ram

Ken Sheriff’s amazing IR library sees and transmits codes.

I used the EDB Library to store codes onto the eeprom

This fun RGB library by Raymund Blum powers the mood lighting

π