A super simple IR remote project!

The Basic Stamp IR remote interface

My friend and fellow mad scientist Craig Gardner came up with this nifty little project. It is simple and cheap to make, and works really well. It allows the user to send commands to a Stamp using any standard universal remote that can use the Sony protocol. Craig is a Basic Atom guy (don't hold it against him, he's a really nice person ;-)) so I told him I would make a Stamp friendly version. Craig has an article HERE for his version.

His was neatly designed to plug into the servo pins of the Basic Atom equivalent to the Board of Education. Unfortunately, as we discovered, the Stamp BOE has VIN on the servo pins, and the Atom has VDD. I assumed (making a you know what out of you know who) that the BOE had VDD on the servo pins. The smell of scorching silicon is what alerted me to the problem. Oops! A tribute to the durability of the Stamp, it didn't smoke the pin, although it was really hot and refused to program until it cooled off.

So, I decided to make another board design. If I had any 5V zeners laying around, I might have made one that could mount as Craig intended onto the servo pins. But I didn't, so I made it to plug into a breadboard. I also added a jumper to allow user selection of the baud rates 9600 and 2400. I did this so that the device may be used with the BS1 as well as all BS2's.

The function of the device is very simple. Any IR remote than can be programmed to use the Sony protocol will work. The module outputs the device code (TV/VCR/DVD/AUX) and the button pressed, so the device can be used on as many different projects as your remote has devices (usually four). The numeric keys output the number of the key (0 outputs a 0, etc.). The function keys all output unique numbers. Note that not all buttons are available depending on which device you have selected. The VCR setting seems to use most of the keys on the remote. Also note that the first key pressed after the device is powered up does not output what it should. All subsequent numbers are correct. Luckily, all of the numbers so generated make a number different than any of the key codes, so it doesn't cause any problem. This could even be used to let the device know if it has just been powered up or rebooted. I have no idea why it does this.

Construction of the device is also simple. You will need:

1* PIC12F675
1* 8 pin DIP socket
1* T-1 LED
2* 1k resistor, 1/8 or 1/4 watt
1* 10k resistor, 1/8 or 1/4 watt
2* .1uF caps, 6V or higher ( I used E.G. part # G4408A)
1* pair jumper pins and jumper (Optional, see below)
1* IR module

The IR module I used was from the Electronic Goldmine, part #G6042. It is a Vishay/Telefunken TSOP28. There are many units you can use, but the pinout may be different. A 12F675 may be had for free from Microchip through their samples program. This project can basically be made for nothing on a piece of perfboard in 20 minutes. Now that's a good deal! Since many Stamp users will not have access to a PIC programer and the PicBasic Pro complier, pre-programmed PIC12F675's are available for US$10.

As it happened, when Craig gave me one of his units, I was working on a project that has need for a lot of user interface. I was in the process of getting a keypad and decoder set up on a breadboard, but after five minutes of playing with the IR remote, I was hooked, and pulled the keypad off and put it away. Now I have 38 buttons at a cost of one I/O pin, for less than US$6 if all is bought new! And I can use it on four different projects in the same room! It really can't be beat for a simple interface to the Stamp.

The schematic is shown below.


Here is the board layout. Note that the jumper can be omitted if you don't want 2400 baud. You must still put the 10K pullup resistor (R3) in place, or the baud rate may not set itself correctly. The long leg of the LED should be facing R3. The LED indicates the serial data output, and should blink once on powerup. It may be omitted along with it's current limiting resistor (R1) for lower power consumption on battery powered devices.

Here is the board artwork. I use the laser printer method, but as you can see it is simple enough that it could be hand drawn or mounted on perf or proto board. To use the artwork, I recommend printing it out and placing the 12F675 on it to make sure that it is the correct size. I have had trouble with downloaded art work not printing the right size before.

IMPORTANT NOTES: The PIC Basic Pro code available for download here IS NOT compatible with Craig's board!! This is because I added the jumper for the baud rate and changed the board layout. The HEX file is available for use with any programmer. The ASM file is available for use with other compilers. There are a number of cheap/easy programmers out there to build if you don't have one.

Here is a Basic Stamp code example for the unit. It is compatible with either unit.

irPin CON 1 ' Change this to whichever pin you want to use
irBaud CON 240 ' Default baud. Change to 1021 if jumper installed

command VAR byte
device VAR byte

SERIN irPin,irBaud,[device,command]
DEBUG "Device: ", dec device, " / ", "Command", dec command,CR
goto main

Any questions or comments, E-MAIL me.