Ultrasonic Distance Measurement Using Arduino

An ultrasonic range finder is a useful tool in a variety of real-life and robotic applications, such as in obstacle avoidance and distance measurement systems. The ultrasonic range finder measures the distance by emitting a 40KHz pulse of ultrasonic sound that travels through the air until it hits an object, then it measures the delay of the reflected signal and sends proper commands to other units.

I used an SRF05 ultrasonic sensor and an ATTiny85 microcontroller. The distance data is displayed on a 128*64 OLED screen, both in centimeters and inches. Also, a horizontal bar graph provides a visual estimation of the distance. The MCU code was developed using the Arduino IDE.

To design the schematic and PCB, I used Altium Designer 22 and SamacSys component libraries (Altium plugin). To get high-quality PCB boards, I sent the Gerbers to PCBWay and purchased original components using componentsearchengine.com. To examine the current consumption of the circuit, I used the Siglent SDM3045X multimeter.

Isn’t cool?! So let’s get started.


Input Voltage: 6-24VDC

Current Consumption: 24mA

Detection Range: 2-400cm (see text)

Distance Data: Centimeters, Inches, Bar Graph

Display: 128*64-Yellow Blue OLED

Blog entry information

Last update

More entries in General

More entries from SAM-Mo

Share this entry