Digital Ultrasonic Distance Scale Using Arduino Nano

by DESHBOT in Circuits > Arduino

16 Views, 0 Favorites, 0 Comments

Digital Ultrasonic Distance Scale Using Arduino Nano

WhatsApp Image 2026-09-15 at 3.19.03 PM.jpeg
WhatsApp Image 2026-09-15 at 3.18.54 PM.jpeg

The Ultrasonic Digital Distance Scale is an electronic measuring project made using an Arduino Nano, HC-SR04 ultrasonic sensor, and 128×64 OLED display.

The ultrasonic sensor measures the distance between the sensor and an object. The Arduino Nano processes the sensor reading and displays the distance on the OLED in centimeters.

The project works like a small digital distance scale and provides a real-time measurement without physically touching the object.

Supplies

des 1.jpeg
uno.jpeg
oled.jpeg
ultra.jpeg

Deshbot shield

Arduino Nano

HC-SR04 Ultrasonic Sensor

0.96-inch 128×64 OLED

USB Cable

Working Principle

WhatsApp Image 2026-09-15 at 3.18.54 PM.jpeg


The HC-SR04 ultrasonic sensor sends a short ultrasonic pulse toward an object.

When the sound wave hits the object, it reflects back toward the sensor. The sensor measures the time taken for the echo to return.

The Arduino Nano calculates the distance using:

Distance = Time × Speed of Sound ÷ 2

The division by 2 is required because the ultrasonic wave travels from the sensor to the object and then back to the sensor.

The calculated distance is displayed on the OLED.

OLED Display

WhatsApp Image 2026-09-15 at 3.18.54 PM.jpeg


The OLED can display the measurement like:

ULTRASONIC

25.6cm


Program Logic


  1. Initialize the OLED display.
  2. Set the TRIG pin as an output.
  3. Set the ECHO pin as an input.
  4. Send a short ultrasonic pulse.
  5. Measure the echo time using pulseIn().
  6. Calculate the distance in centimeters.
  7. Display the distance on the OLED.
  8. Repeat the measurement continuously.


Conclusion

WhatsApp Image 2026-09-15 at 3.19.03 PM.jpeg


The Ultrasonic Digital Distance Scale is a simple and useful Arduino project that demonstrates how an ultrasonic sensor can be used for non-contact distance measurement.

The Arduino Nano processes the HC-SR04 sensor data and the OLED display provides a clear real-time measurement. This project is useful for learning about sensors, timing, calculations, I2C communication, and embedded C++ programming.