Arduino: Ultrasonic Rangefinder Using Parallax Ping and LCD
Here’s a little Ultrasonic Ranger using the Parallax brand Ping ultrasonic transducer pair and the Parallax LCD display. Both are easy to use with the Arduino system. Just don’t try to supply more than 5 volts to the Ping! (And don’t ask how I found out.)
The program sketch is modified from the ultrasonic ranger sketch in the Arduino libraries. It times the pulse and return in microseconds and computes the distance based on the speed of sound in air, so the math can be calibrated and adjusted easily enough to yield good accuracy for any given use or installation. Further, the demo sketch I show here just uses integer variables to display the distance reading; greater precision is there, for example you could calculate and display to the nearest millimeter if you like.