




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





1. Introduction Distance measurement is a fundamental task in numerous engineering and scientific applications. Traditional methods of measuring distance using mechanical instruments are limited in precision, speed, and automation capability. With advancements in microcontroller technology, it is now possible to measure distances accurately and in real-time using sensor-based electronic systems. This microproject presents the design and implementation of a distance measurement system using an Arduino Uno microcontroller board and an HC-SR04 ultrasonic sensor. The system measures the distance of an object placed in front of the ultrasonic sensor and displays the result on a 16x2 LCD display. The project is simple, cost-effective, and demonstrates the practical application of pulse-echo ultrasonic sensing technology. Ultrasonic sensors work on the principle of echolocation — similar to how bats navigate in the dark. The sensor emits high-frequency sound waves (40 kHz) that travel through air, bounce off an object, and return to the receiver. By measuring the time taken for the echo to return, the microcontroller calculates the distance using the speed of sound. The Arduino Uno serves as the core processing unit that triggers the sensor, captures the echo signal, computes the distance, and transmits the value to the LCD. This project is extremely relevant in robotics, parking assistance systems, industrial automation, smart bins, and level measurement systems.
2. Components and Materials Required The following components are required to build the distance measurement system. All components are readily available in the local electronics market or online platforms such as Amazon, Robu.in, or Flipkart. Sr. No. Component^ /^ Material^ Specification^ Quantity^ Approx.^ Cost^ (₹) 1 Arduino Uno R3 ATmega328P, 5V, 16 MHz 1 ₹ 350 2 HC-SR04 Ultrasonic Sensor Range: 2 cm – 400 cm, 5V 1 ₹ 100 3 16×2 LCD Display HD44780, 5V, 16 - pin 1 ₹ 200 4 Breadboard Full-size, 830 tie-points 1 ₹ 60 5 Connecting Wires (Jumpers) Male-to-Male, Male-to- Female 10 ₹ 20 6 USB A to B Cable For Arduino programming 1 ₹ 20 7 9V Battery + Connector For standalone operation 1 ₹ 40 8 Computer / Laptop With Arduino IDE installed 1 — TOTAL ESTIMATED COST ₹ 790
4. Circuit Diagram The circuit connections for the distance measurement system are described below. The diagram illustrates the wiring between the Arduino Uno, HC-SR04 ultrasonic sensor, and 16×2 LCD display. Figure 1: Circuit Diagram of Distance Measurement System Using Arduino
5. Program Code The following Arduino sketch (written in C/C++) implements the distance measurement and LCD display functionality: include include LiquidCrystal_I2C lcd (0x27, 16, 2); define trigPin A0 //Sensor Trig pin connected to Arduino pin A define echoPin A1 //Sensor Echo pin connected to Arduino pin A long distanceInch; void setup () { pinMode(trigPin, OUTPUT); pinMode(echoPin, INPUT); lcd.init(); lcd.backlight(); lcd.clear(); lcd.setCursor(0,0); lcd.print("Simple Circuits"); delay (2000); lcd.clear(); lcd.setCursor(0,0); //Set LCD cursor to upper left corner, column 0, row 0 lcd.print("Distance:") ;//Print Message on First Row lcd.setCursor(0,1); lcd.print("Distance:"); }
6. Observations and Results The circuit was assembled on a breadboard, and the program was uploaded to the Arduino Uno using the Arduino IDE. The system was tested by placing objects at various known distances in front of the HC-SR04 sensor. The actual distance was measured using a standard measuring tape and compared with the Arduino-displayed value.
Sr. No. Actual^ Distance (cm) Measured Distance (cm) Error (cm) Accuracy (%) 1 5 cm 5.1 cm 0.1 cm 98.0 % 2 10 cm 10.2 cm 0.2 cm 98.0 % 3 20 cm 20.1 cm 0.1 cm 99.5 % 4 30 cm 30.4 cm 0.4 cm 98.7 % 5 50 cm 50.5 cm 0.5 cm 99.0 %
7. Applications Distance measurement using ultrasonic sensors and Arduino has a wide variety of real-world applications across multiple domains: