The rangefinder is a device that measures distance from the observer to a target being measured. The device uses a sensor as the method of gathering measurements of distance, such as ultrasonic, laser, and radar. The circuit is a DIY rangefinder using a PmodMAXSONAR ultrasonic sensor, an Arduino UNO, and a 16x2 LCD module. The ultrasonic sensor has an effective detection range of 6in - 255in. It can detect objects within 1in up to 20ft away. The PmodMAXSONAR can send range data in three methods: UART, analog and PWM.





The ultrasonic sensor sends thirteen 42KHz beams of varying widths to have a more accurate detection in gathering range data. In interfacing the sensor to the microcontroller, there are three ways of communicating: UART, analog, and PWM. In UART configuration the TX and RX pin is used and it is configured at 9600 baud rate, 8 bits, no parity, and a single stop bit. In Analog configuration, the AN pin is used. The measured distance of the object is represented by an analog signal. The output has a 9-bit resolution, this means that it has a 512-quantization levels. So with a power supply of 3.3V, the 512-quantization levels will divide the supply voltage, which results to a 6.4mV per inch. Since the output has a 9-bit resolution, using the popular 10-bit ADC, the user will have to divide their measured value by 2 before calculating the distance. In PWM configuration, the PWM pin is used. In every 147us that the pin is at logic high is equivalent to 1 inch. If the signal is measured to be high for 1.323ms, then the object is 9 inches away from the front of the sensor. The maximum distance of 255 inches will have a pulse time of 37.5ms.





The design circuit is just one of the common applications of the ultrasonic sensor. It has other applications, such as a level measuring device for containers, collision detection, parking sensor, industrial application and many more.