Universal Bit Whacker (UBW) IR Receiver
Note: Work In Progress (3/15/2009) The final version will have more specific descriptions, and pictures...
Funny how projects grow without bound. This one started with the simple need to reliably store the gigabytes of pictures we've taken since going to digital cameras in 2004, a topic worthy of its own page. To get to the point of this page, let me summarize: HTPC, or Home Theater PC. My idea was to build a PC with a RAID array that I could hook to the LCD TV in the family room. Being able to view pictures in a group setting was a plus; determining that mirror hard drive arrays are not the most reliable way to store data was a minus (yes, that'd be another page). Anyway, I ended up building a box for about $300 from parts bought at NewEgg; the AMD 780g northbridge has enabled high-quality graphics on motherboards (yet another page), running Ubuntu 8.10 and XBMC (okay, too many pages).
So, let's get to the point of this page. To go with the clutter of remote controls in the family room, the HTPC needs its own. I have an unused Hauppauge remote control that came with a TV card we bought when we procured the family desktop computer, so I set out to reuse it. Good choice, it turns out this remote conforms to the RC5 protocol, widely-used in remotes and with benefit of a number of DIY projects on the web. (ToDo: link to hackaday page) I also have a Universal Bit Whacker (UBW) board from Sparkfun, bought it to mess around some time ago, never found a viable use for it. So, my first experiment was to set up a simple receiver to see if I could see codes from the remote control. To do this, I procured a 38Khz IR receiver module from Radio Shack (the one most sites say won't work), and I wired it directly to a GPIO pin on the UBW using a breadboard. VCC and ground also came from the UBW. The UBW has a repeated sample command, I entered that and watched the stream of lines change as I pushed buttons on the remote. So far, so good. (ToDo: Picture of the beast...)
Well, that was of limited use as I couldn't make heads or tails of what was happening in the sample stream, so I set out to write some software that would facilitate that. I reinstalled the Microchip MPLAB IDE, the C18 compiler, and the UBW code from Brian Schmaltz' website and made sure I could compile and install the UBW firmware on my UBW. From there, I set out to make a command that would help to analyze RC5 IR codes. If you know a little C, the UBW code is easy to extend, so making my own command was simple. Setting up a timer to handle the sampling was less easy. I ended up configuring TIMER1 (the UBW already uses TIMER0 and TIMER2) to trigger the high-priority interrupt, as the RC5 code requires sampling the bits on 889ms centers. To play around with the various parameters, I wrote my command to require input of the bit half-width, number of samples, and the 'high' state of the input. So, my first command looked like this: