Some success with decoding the IR signals in real time!
At first I attempted to do this using the Python script from Part I, but this means that the entire signal must be sent over serial, which is slow and can miss events.
Instead, I implemented decoding directly on the Arduino board. I used a simple state machine that polls the output of the IR receiver and changes state based on the amount of time the signal was one or zero before it changed. The Arduino has an internal timer (call
micros) that was used for timing.
Serial output is not printed until decoding is complete as to not interfere with timing.
I had to do some manual timing of signals to get the decoder to work correctly, but now it decodes both sides of the IR conversation quite cleanly.
ac 00 0e d6 01 0c 05 18 00 00 03 88 00 00 10 00 02 00 00 ff 1 ff ff 55
From a Tamagotchi named “Alex” (01 0c 05 18 in IR).