Step 4: Hacking the Remote
I bought a big old GE component video monitor at an auction about 10 years ago. Earlier this year I finally found a use for the monitor, but lo and behold when I hooked it up the thing was dead. The good news is that the monitor came with this awesome remote control!
Measuring the IR Signals:
To understand the remote control I hooked up my IR detector to a storage oscilloscope and started pressing buttons. The nice thing about a storage scope is that it saves the IR code on the screen for you to analyze. Taking it a step further, I actually saved the traces for each button as a .CSV file to import into an Excel or OpenOffice Calc Spreadsheet. See the attached file for my IR signal spreadsheet for the Power button.
Analyzing the IR Signals:
To use the remote, I wasn't necessarily interested in decoding the whole message structure. Mainly, I wanted to find the differences in the signal for each button press.
Using the spreadsheet and the time-stamped scope data, I discovered each IR signal had three parts - a start pulse, a 16-bit Remote ID (which is the same for all buttons), and then a 16-bit Button Code which is unique for each button. By looking at the last 16-bits of the IR signal, we are able to discern which button was pressed.
The one tricky part to using the remote code is when you hold down any button, the remote sends out an identical "repeat code" until the button is released. This repeat code is very similar to the start pulse, but with different time durations.
Using the IR Signals:
I have the IR signal connected to the PIC Interrupt-On-Change pin. Using the internal Timer 0 module, we can count the time period between falling edges on this pin. Everytime there is a falling edge, the PIC saves the state of the TMR0 register (to record the previous period) and then restarts TMR0 (to record the next period). Using this information, we can determine whether a 1, 0, Start pulse, or Repeat pulse was received.