IRR - yet another IR RS232 receiver

(c) 2003 seb


Update! (2003/07/28)

I've ported IRR from the 16F84 to the 12F629, thus reducing quite some cost. For those that have built it for the 16F84: Simply replace the 16F84 by the 12F629 as shown in the old board-image, unsolder the oscillation-circuit (crystal and C1, C2) and you're set!

The new file-archive also includes a newer version of the client-application which has few features more.

Nowadays there are quite some home-built IR receivers around, searching on Google yields quite some result.

Most of them send the received pulses "as-is" over the line, which is probably a good idea. I however decided to decode the Sony and Sharp protocols in the PIC itself So if somebody needs an IR-protocol-decoder in a PIC-project this might be of help.

Before you can do anything you will have to find a way to flash code to a 12F629 PIC sold by Microchip (thanks for sending me a free sample!). You might have to build such a programmer yourself, JDM's works for me. ICProg is a very nice programming-tool.

I'm not a pro electrical engineer so if you have any suggestions let me know.

IMPORTANT: The PIC's internal oscillator is used which uses a factory-set calibration-value. Do not overwrite this value! ICProg is smart enough to ask you whether you want to keep the value already stored in the PIC, if you use an application which doesn't do that be sure to backup that value and program it instead of the value already in the hex-file!


R1820 Ohm
R210 kOhm
D11N4148 (or similiar)
D25.1V Zener
C310 uF
IC1PIC 12F629
IC2Telefunken TSOP 1740 IR Decoder Module (or similar)

The circuit is quite simple. On top is the stabilisation-circuit, in the middle there's the PIC and beneath there's the TSOP with a pull-up.

You can test your circuit easily with a terminal-program. If it doesn't work a good point to start is to test whether the supply-voltage is OK (measure at C3), it should be around 5V. Then check if the PIC and the TSOP have supply-voltage.

Here's the picture of a board you could use. It actually doesn't pay off to make a PCB for this small circuit but it might give you an idea how to arrange your parts.

Incase you want to make a board you can download the Eagle project files beneath.

DTR, GND and RCV refer to the respective RS232-pins, search Google for the pin assignment.

This is how my prototype (old one with 16F84) looks like: front, back, spooky front (esentially the same as front), in a chassis

Note: R2 is probably not needed since I've configured the PIC to use the internal pull-ups, I haven't tested it tho because I used the old board.


The current version of the code decodes Sony codes (12, 15 and 20 bit) and Sharp codes. The RS232-communication is at 1200 Bauds, 1 stopbit and no parity. Feel free to add your own decoding routine (RC-5 etc) and send it back to me.

Comments are in german, if you have any questions don't hesitate to ask.


Once the receiver powers up it sends "OK\r\n" over the line. If you don't receive that something's wrong. :)

As soon as it decodes (and verifies) an IR-command it sends it over the serial line, looking like this:


<manuf>2-character manufacturer-code (currently "SY" (Sony) or "SH" (Sharp))
<device>Devicecode, 16 bit (little endian)
<command>Command, 16 bit (little endian)
\r\nChars 0xd (Carriage return) and 0xa (Line feed)


I've written a small Win32-App that sits in the tray and is able to send messages to other programs and start programs.
It has a configuration file which allows a tree to be constructed. This can be handy if you want to do several things only if a certain key-sequence has been pressed. In my case my PC shuts down if I pull a Mortal-Kombat-Finish-Move-like combo.

A Linux-sample is available, too - it doesn't have any features, it should help you if you want to write something yourself (or port the Win32-app), tho - if you want it contact me.

Download (272Kb), containing


SB-Projects: IR theroy & protocols
SIRCS, Sony IR protocol
Quozl's 16F84 to 12C509 Porting Checklist
2012-05-10 13:51