Hardware Design

Our hardware design is relatively simple. We have connected an IR receiver/demodulator to an input pin and an IR LED to an output pin.

All of the interesting analog work is done within the $3 Radio Shack IR receiver. Infrared protocols demand that signals be modulated at 40kHz. This device is a combination photosensor and demodulator. Its output is a clean signal that we directly connect to the 8535.

We generate modulated signals in software, not with an external circuit. It is interesting to note that we briefly did experiment with an 555 timer to externally modulate the signal. Although it worked, it created a lot of electrical interference which threw off simultaneous measurements by our IR receiver.


Software Design

Our code implements a simple machine with three states:

  1. Wait for input
  2. Program a button
  3. Playback a button

500 of the 512 bytes of memory in the 8535 are used to store IR pulse sequences. We originally planed on using about 16 bytes each for the 31 available buttons (the 32nd button is the record button). It turned out that pulse sequences were a lot more complex than anticipated and took up more memory. Our final product dedicated all of the memory for just one button! If we were more efficient, we could store enough for about 5 buttons.

When recording, the code waits for the input pin to go low, and then records the time between transitions using timer0 with a prescalar of clk/64.

To playback, we set timer0 so that it overflows at the time of each transition. Transitions are implemented by switching timer1 on or off. When on, timer1 implements the 40kHz modulation between 0 and 5V.