February 20, 2011
I wanted an infrared receiver for my home theatre PC. The main goal was to use any remote to control Windows Media Center. There are very few remotes for Media Center and they are kind of ugly. After searching for universal IR receivers, the only thing I could find was USB-UIRT and LiRC. USB-UIRT cost $50. LiRC requires a serial port, which is not found in new computers. I decided to build my own
IR remotes work by sending out a series of pulses of IR light. Each key of the remote has a different pulse pattern.
I salvaged an IR receiver from a Hauppage TV card and hooked it up to an Arduino.
The pinout was easy to figure out with a little trial and error. Looking at the receiver with the window facing your, Pin 1 is data, Pin 2 is Ground, and Pin 3 is Vcc. After modifying come code from Arduino Playground, I started to get IR timings.
I had an old TiVo Remote and thought it would be perfect to use with Media Center. Armed with keyboard shortcuts and timings from above, I started to write a C# program that translates IR codes into keyboard outputs.
The program listens to timings sent from the Arduino's serial port. The timings were not always the same. After some adjustment, I let each timing to be off by 100 microseconds. Since the minimum time between to pulses was about 450 microseconds, it shouldn't be an issue.
After a match is found, a keyboard sequence is created and is played using the SendInput function.
The result was a perfectly working universal infrared receiver. In a future version, you will press a learn key, press a button on a remote, and then press they keyboard combination you want that key to perform.
The source code for Aruino and C# are available below.