|Overview||This project uses a PIC 12C508A
microcontroller to interpret commands sent by a Sony IR
Remote Control (SIRCS format), or any universal remote
programmed as a Sony unit. The received command is
returned to a host microcontroller via a single pin at
2400 baud (8-N-1). The unit should be fully compatible
with all microcontrollers that can accept serial data at
2400 baud. It has been tested with the Basic Stamp II and
the BasicX BX-24 controller from NetMedia. In addition to
the 12C508A, only 3-4 additional components are required
for a fully functioning remote decoder. I have provided
here a circuit diagram, parts list and the source code
for the 12C508A, which is the heart of the circuit.
I use this circuit to remotely control my robot, but it should be of general interest wherever IR remote control is desired for a particular project.
NOTE: For those without PIC programmers, I can sell you pre-programmed 12C508As for $6.00 USD + $1.00 postage and handling. Contact me at firstname.lastname@example.org if interested..
|Schematic and Parts List||
Of course you will also need either a Sony Remote, or any Universal remote programmed as a Sony remote. The Universal Remote should run you less than $10.00 USD.
The circuit can be built onto your own PCB, but I just built mine onto a simple protoboard -- the smallest Radio Shack makes. You can optionally add an LED to this circuit to show when data is being received from the IR Remote. Connect the cathode to Vout on the IR Decoder. Connect the anode to the power supply via a 10K ohm resistor. This LED will then flash whenever any signal is received from the remote.
To see a photo of an assembled board, click here. This board includes the test LED discussed above, a 4-pin header and a diode on the Vcc header pin to prevent bone-headed polarity reversal when hooking it up to the microcontroller (I had no keyed connectors on hand when I built this). Note that there is still plenty of room on this board for more stuff -- the complete IR decoder circuit uses only about 1/2 the board.
IR Remote Modules are available from a number of sources, including DigiKey and RadioShack. You can also probably pull them out of old VCRs or Television sets. Note that if you do not use the Lite-On module, your pinouts may be different from the schematic above. Note also that many of the non-Lite On units want to have their cases connected to ground. Some of the Sony units actually have no explicit ground lead -- you MUST connect the case itself to ground.
|Program Listings and How to Use the Circuit||When the circuit detects and decodes a new command
from the remote, it will bring Atn (GP4) high. To read
the command, signal the 12C508a by pulling the Trig/Data
line (GP5) low, waiting 45 ms or so, then pull it high
again. Then make Trig/Data an input and read the 8-bit
command value at 2400 baud, 8-N-1 using the host
controllers standard serial functions. Note that all
serial logic is non-inverted TTL -- to read from a PC,
you will need to add line inverting/conditioning hardware
to the circuit above. Most microcontrollers will not need
such hardware, however. Once the command byte has been
read, the Atn line is pulled low by the 12C508A.
If you want to poll the circuit for new data, you can ignore the Atn line, and just periodically check for data by just using the Trig/Data line. This allows a simpler one-wire interface to the unit. If there is no new data since the last call, 255 will be returned as the command byte. When using this method to read data, make sure your serial read function does not hang indefinitely waiting for data (specify a timeout), since it is possible to hang here if the 12C508A misses the low/high pulse.