Subscribe to Make Magazine Today!


Here is a simple way to implement distance sensing and an Arduino. The website has more pictures and all the Arduino code so you can easily make one for yourself.

I bought a Sharp GP2Y0A21YK0F Distance Sensor to use in my robot. It was very easy to see the data returned in a serial console window, but I thought it would be cool to see the distance in zones represented by colors from a tricolor LED. Then you would not need to be connected to the computer to tell distance. Green would indicate a safe distance, yellow would represent a cautionary distance and red would be for distances that would require my robot to take evasive action.

Read more about Sharp IR sensor with color feedback