This is an extremely cheap IR proximity sensor you can make with a few cheap parts and an AVR programmer. I use an Arduino as my programmer in this Instructable.
This sensor only has a range of about 3 inches. You can easily add more LEDs or brighter ones to extend the range. You can also easily re-arrange the LEDS to detect when a beam is broken as well.
The design takes advantage of a cheap AVR (computer on a chip). The computer pulses the IR LEDs off and on and compares the analog readings from the sensor in each state. When the reading with the lights on is above the reading with the lights off the sense pin goes high indicating the sensor is seeing it's own (reflected) light. There is an LED on the sense indicator in this design so you can see when the sensor engages. You can connect the signal right to a microcontroller like an Arduino or Picaxe.
This design moves some processing out of your main robot brain and into it's own node. You may want to debounce the signal, but you don't have to flash the leds and take the readings. You can also use just one digital pin to take the reading. The sketch is around 700K out of 1024 available.
Why I built this
I'm way out of high school, but this is part of a series of designs related to bringing the robots from the game Robot Oddysey into the real world. I want to allow grade schoolers the same chance to learn robotics I had. So I am working on building really inexpensive robots that can move in 8 directions without turning. The "bumpers" are complete now.