After checking out Ken Shirriff’s IR Library for the Arduino, it seemed like an appropriate place to get started building a self-contained LED License Plate Frame reprogrammer. I started with his code found here, just to see if I could get an Arduino to play back a learned signal. Wired up an Arduino-bootloaded Atmega168 with the necessary components and hooked up a IR sensor and LED as per Ken’s diagram. And then I met with failure. The code seemed to look like it was doing what it was supposed to do; it would read and report back with a code over serial, and the LED lit up. No matter what I did though, it wouldn’t trigger the plate frame.
Out came the IR Toy again to get to the bottom of this! First I sampled the output of the remote, then sampled the output of the Arduino IR library. Here is the result. The signal for the remote is overlayed under the signal from the Arduino.
The Arduino successfully copied and re-transmitted the code, but a tad too quickly. I don’t unfortunately know enough about the tolerances of IR receivers, but clearly the difference is significant enough to make a difference to the frame. I also don’t know enough to determine if this is a code problem or perhaps my 16Mhz crystal isn’t oscillating at a very accurate rate. Will have to explore more to find out!
Edit: Problem Solved!
According to Ken’s page,
IR sensors typically cause the mark to be measured as longer than expected and the space to be shorter than expected. The code extends marks by 100us to account for this (the value MARK_EXCESS). You may need to tweak the expected values or tolerances in this case.
MARK_EXCESS was increased to 200 in irremote.h and, when tested, the timing from the Arduino matched the timing from the original remote. And the LED frame responded appropriately. Success!
More to come…