IR Sensors


Dual Transmitter IR Detector as Described in
'Robots - Inspiration to Implementation'

Some of the companies put two transmitters - one on each side of the detector, to get a good field of coverage for the front of the 'bot and to detect left and right. 'Robots - Inspiration to Implementation has a great schematic that you can use to build one of these. I used all Radio Shack parts for the one I made and it cost about $10 to build. This detector will NOT detect black flower pots nor the bottom of boots (grin). Another description of an IR detector (which is the same as the one in Robots - Inspiration to Implementation) is at: If you want to see my implementation hooked up, look at the Anakin robot.

You can also get a good dual transmitter IR device from Lynxmotion (Called IRPD). They sell a kit for $30.00 - You have to put it together. Since you are putting one together anyway, you might as well make your own and save $20 plus shipping. I have two Lynxmotion detectors, and enough parts to build a jillion of the homebrew dual transmitter ones. I've made five so far, and it seems to be the way to go. I used a 7805 for the 5 Volt regulator so the device gives me an extra 5 volt source (a real one - not a tooky one).

 Here's a parts list for the one in 'Robots, etc'. I put my schematic here - you should get the book to see it - the book is well worth the price anyway - or go to the Seattle Robotics link and look at their schematic (

Larger Picture of the Dual Transmitter IR (with comments)


Note that alternate sources are available at much better prices. You should be able to build this for about $6.00

1. PC Board (276-150A) 1.19
2. 5K Pot (2710281) .49
3. IR Detector Module (2760137) 3.59 (or about 2.50 from Jameco PN 131908 - same as Radio Shack) I had a hard time finding the Sharp GPU detectors
4. 2 IR LEDs (2760143) 1.69 ea. (or .22 from BG Micro)
5. Hex Inverter (74HCT04) .89 (or about .25 from BG Micro)
6. 6.8K (about - the drawings may vary a little) resistor, 100K resistor, 2 330 ohm resistors (update! You can replace these with 1K or a bit higher and solve some of the sensitivity problems - thanks to Larry Barello for reminding me!), 2 10K pulldowns (.20?)
7. .001 uF cap (.75? or about .05 from Jameco
8. .1 uF cap (for power supply) (.50? or about .10 from Jameco)
9. 1 7805 (.35 from Jameco or 1.19? from Radio Shack)
10. Various headers, solder, hookup wire, etc... (a few cents)
Most schematics show a pullup resistor on the output of the IR detector. I forgot to put it on mine and everything still worked.
11. Schematic for the oscillator circuit: HERE

If you build one of these and want to know how to trigger it, read the book - it has general guidelines and some code. If you need a quick test program, you can use the lynxmotion source code that comes with the IRPD - or you can use the following: IRCODE

An even better IR detector - PIC based onboard brains

Otherwise known as: How to fill a Radio Shack Prototype Board

The IR detector here is detecting equal obstacles (the red LED is lit). It is nothing more than a PIC microcontroller that is handling the detection chore and bringing one of three LEDs high. You could do the same with a Stamp (though I doubt you would get it on the board in the picture). The PIC outputs are also connected to a three pin header (shown in the center left). The advantage to this is that the overhead of keeping the IR transmitter firing is taken over by the PIC. You can also add code to check for false transmissions and make the transmitted pulse more complex to avoid false detections (which can also be aided by adding higher current limiting resistors on the IR LEDs - try at least 1K to start with). This one does a VERY good job of detecting real targets.

I did not get fancy with the PIC code - I just used PIC Basic to make the hex file and downloaded it to the PIC using Peter Anderson's Morgan PIC Programmer. PIC Basic is almost the same syntax as Parallax Basic so you don't have to learn anything new. The compiler costs a tad ($200 or so) if you get the 'Pro' version. But it makes programming a PIC a piece of cake.

The cost of adding the PIC is pretty small - about $5.00 for a 16F84 which can give roughly the same capability as a Stamp (well, not quite - but we rarely use all the Stamp's ability). Of course the cost of getting set up in PIC programming can be a tad more (about a $100 or so would get you going nicely).

Les from the UK has loaned me the following PicBasic Pro files that show how to use the Basic Language and a PIC to modulate the files: PicBasicIR.html

Now For Something A Little Different

Click on the Picture To Learn How to Build A Kewl Detector