To begin with, we need an Arduino Uno board (or any other Arduino board). We also need an ultrasonic range finder sensor. A quick web search shows hundreds of rangefinder sensors for less than a quarter of a dollar. We use a sensor named HC-SR04-Ultrasonic Range Finder, but just about any other sensor would do. The sensor we have chosen provides a range-finding capability for distances in a 2 cm - 300 cm range, with an accuracy of up to 3 mm.
These sensors use sonar to determine the distance to an object, just as dolphins and bats do. Here's how the sensor calculates the distance. The module has two units. The transmitter transmits ultrasound, while a receiver reads any ultrasound that reflects back. Since the speed of ultrasound ...