Author Options:

LED color change activated by distance? Answered

How can I build a circuit that senses objects from a distance and turns a red LED on, then as the object gets closer it changes the red LED to a blue LED?
I'm trying to build a "robot" toy. I was wondering how I would go about getting the toy to change from red as someone passes by at a distance to blue as someone gets closer.
Thank you for your time.


If you have a high budget, I would suggest purchasing a Basic Stamp 2 from Parallax: http://www.parallax.com/Store/Microcontrollers/BASICStampModules/tabid/134/ProductID/1/List/1/Default.aspx?SortField=UnitCost,ProductName

It has an easy to learn programming language and is an appropriate MCU for this project.

Then, look forward into getting an ultrasonic PING sensor, Parallax also has a demo code for using a PING sensor with the BS2: http://www.parallax.com/Portals/0/Downloads/src/bs/28015-BScode-v1.4.zip

Start by looking for rangefinder designs, then adapt the output of one to act as motion and threshold detector. I believe ultrasonic rangefinders are a fairly standard Arduino project...