Introduction
Nowadays, measurement systems are used in motor vehicles like cars, buses, and trucks for auto-braking systems to avoid road accidents and to assist drivers when parking their vehicles. Industries are also using this system in machines like robots, forklifts, trolleys, etc., for moving materials. This operation is done with the help of a distance measurement system.
In this article, I am going to explain how to create a distance measuring system using Arduino UNO R3.
About Ultrasonic Sensor
The basics of ultrasonic sensors are like a RADAR system. This sensor contains one transmitter and one receiver drum. If the transmitter sends a small pulse of signal when the signal reaches any object it returns back to the receiver. We are calculating the distance using the traveling time of the signal in the air. This is a working principle of the ultrasonic sensor.

Prerequisites for developing this system:
Hardware requirements
| Hardware | Nos |
| Arduino UNO | 1 |
| Ultrasonic Sensor (HC-SR04) | 1 |
| LCD crystal display | 1 |
| Potentiometer 10k ohm | 1 |
| Breadboard | - |
| 220-ohm Resistor | 1 |
| Scale (30 CM) | 1 |
| Connecting wires | - |
Software requirements:
-
Arduino IDE (For uploading code to Arduino)
There are three stages for developing this system:
- Make the hardware connection
- Write & upload code to Arduino
- Testing our developed system
Stage 1: Make the hardware connection

Step 1
First, we can connect the LCD crystal display with the Arduino UNO board using jumper wires. I am using a breadboard to extend power terminals for making this system.
Refer to the below LCD crystal pin diagram for making an easy connection with Arduino.
Place a 10K ohm potentiometer near the LCD crystal display. It can adjust the contrast of the LCD screen and create a power connection from Arduino +5V and GND right and left end of the potentiometer. Make a connection from the center terminal of the potentiometer to VEE (contrast control) LCD crystal display. (Refer to the connection diagram)
Pin Configuration
Arduino Breadboard LCD Crystal Display
Pin 4 ---------------------------------------------------------------------------> Data pin 4
Pin 5 ---------------------------------------------------------------------------> Data pin 5
Pin 6 ---------------------------------------------------------------------------> Data pin 6
Pin 7 ----------------------------------------------------------------------------> Data pin 7
Pin 9 ----------------------------------------------------------------------------> Register select
Pin 8 ----------------------------------------------------------------------------> Enable
+ 5V -----------------> Potentiometer Right Terminal---------------------->Potentiometer Centre terminal ----> VEE (Contrast Control) LCD crystal

Join the conversation! Your thoughts help the community grow.