This is a neat little device that you can hook to an Arduino micro-controller. It can sense up to 2 meters with very good accuracy . You can get it on amazon for around 12 bucks. Stay tuned for cool projects that include this sensor.
find the code used at http://pastebin.com/UXXwhFFU
this code will only turn a light on when the object is closer than 90 cm and off when father away