I have designed an infrared sensor to detect objects in the robots path. I used a pic 12C508JW microcontroller to do the signal processing. The system has a range of zero to 2 feet depending on the size and reflectivity of the object to be detected. To reduce the range to a nominal 6 inches I had to put a piece of index card stock in front of the sensor! (not shown above)
I used 3 IR LEDs and one IR remote control receiver module to generate outputs for LEFT, RIGHT and CENTER detection zones. The LEDs are pulsed at 40KHz for 500uS in rotation. Each LED is active only 1/3 of the time. The microcontroller observes the output of the IR receiver during each LEDs on and off time slot and updates the internal data accordingly. There are 2 bits of output. Each bit represents LEFT or RIGHT and if both bits are ON it indicates CENTER.
The performance is very robust with no falsing even when a VCR remote control is pointed directly at the sensor. In fact it still works with interference from a remote but the range is reduced slightly.
9-25-99 update: A remote at the club meeting did cause falsing! However, the electronic ballast florescent room lights did not have any effect.
The cost is quite low. The 12C508JW is $9.12 in qty one from DigiKey. If you dare use a one-time-programmable 12C508A-04 chip the cost drops to $1.58 . The IR receiver module is only $2.50 from DigiKey. The IR LEDs are about $0.31 .
Click here to view the schematic in pdf format.
Click here to download the source and schematic as a zip file.