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
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
Deshbot shield
Arduino Nano
HC-SR04 Ultrasonic Sensor
0.96-inch 128×64 OLED
USB Cable
Working Principle
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
The OLED can display the measurement like:
Program Logic
- Initialize the OLED display.
- Set the TRIG pin as an output.
- Set the ECHO pin as an input.
- Send a short ultrasonic pulse.
- Measure the echo time using pulseIn().
- Calculate the distance in centimeters.
- Display the distance on the OLED.
- Repeat the measurement continuously.
Conclusion
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.