PROJECT REPORT
on
Digital Ruler Using Arduino
Presented by
Muzamil
GMS Dardwooder
Zone Hariganiwan
Abstract
The Digital Ruler is an electronic distance-measuring device that uses an ultrasonic
sensor to determine the distance between the sensor and an object without physical
contact. The measured distance is processed by an Arduino Uno microcontroller and
displayed on a 16×2 LCD display using I2C communication.
The system works by transmitting ultrasonic waves toward an object and measuring the
time taken by the reflected waves to return. Based on this time interval, the Arduino
calculates the distance and displays it on the LCD screen. The project provides a low-
cost, portable, and accurate alternative to conventional measuring tools and
demonstrates the practical application of embedded systems and sensor technology.
Table of Contents
1. Introduction
2. Objectives
3. Literature Review
4. Components Required
5. Hardware Description
6. Working Principle
7. Circuit Diagram
8. Methodology
9. Arduino Program
10. Flowchart
11. Results and Observations
12. Advantages
13. Limitations
14. Applications
15. Future Scope
16. Conclusion
17. References
1. Introduction
Measurement plays an important role in engineering, science, construction, and
industrial applications. Traditional rulers and measuring tapes require physical contact
and manual reading, which may introduce errors.
The Digital Ruler project eliminates these limitations by using ultrasonic technology. An
ultrasonic sensor measures distance by emitting high-frequency sound waves and
receiving their reflections. The Arduino Uno processes the received signal and
calculates the distance, which is displayed on an LCD screen.
The project demonstrates the integration of sensors, microcontrollers, and display
modules in an embedded system.
2. Objectives
The main objectives of this project are:
• To design a digital distance measuring system.
• To interface an HC-SR04 ultrasonic sensor with Arduino Uno.
• To display measured distance on a 16×2 LCD using I2C communication.
• To improve measurement accuracy.
• To understand embedded system programming and sensor interfacing.
• To create a low-cost electronic ruler.
3. Literature Review
Ultrasonic distance measurement technology is widely used in:
• Robotics
• Automotive parking systems
• Industrial automation
• Water level monitoring
• Smart home applications
The HC-SR04 ultrasonic sensor is one of the most popular sensors for distance
measurement because of its low cost, ease of use, and acceptable accuracy.
Arduino Uno provides an open-source platform for sensor interfacing and embedded
system development, making it ideal for educational and prototype applications.
4. Components Required
[Link] Component Quantity
1 Arduino Uno 1
2 HC-SR04 Ultrasonic Sensor 1
3 16×2 LCD with I2C Module 1
4 Breadboard 1
5 Jumper Wires As required
6 USB Cable 1
7 Laptop with Arduino IDE 1
5. Hardware Description
5.1 Arduino Uno
The Arduino Uno is based on the ATmega328P microcontroller.
Specifications
• Operating Voltage: 5V
• Input Voltage: 7–12V
• Digital I/O Pins: 14
• Analog Pins: 6
• Flash Memory: 32 KB
• SRAM: 2 KB
• Clock Speed: 16 MHz
Function
Arduino acts as the central processing unit of the project.
5.2 HC-SR04 Ultrasonic Sensor
The HC-SR04 measures distance using ultrasonic sound waves.
Specifications
• Operating Voltage: 5V
• Measuring Range: 2 cm to 400 cm
• Accuracy: ±3 mm
• Frequency: 40 kHz
Pin Configuration
Pin Function
VCC Power Supply
Trig Trigger Signal
Echo Echo Signal
GND Ground
5.3 I2C 16×2 LCD Display
The LCD is used to display distance readings.
Features
• 16 Characters × 2 Lines
• Uses I2C communication
• Requires only SDA and SCL pins
• Reduces wiring complexity
Pin Configuration
Pin Function
VCC Power
Pin Function
GND Ground
SDA Data
SCL Clock
6. Working Principle
The ultrasonic sensor emits sound waves at 40 kHz frequency.
When these waves strike an object, they reflect back to the sensor.
Arduino measures the travel time of the ultrasonic pulse.
The distance is calculated using:
For practical calculations:
The calculated distance is displayed on the LCD screen.
7. Circuit Diagram
+------------------+
| Arduino Uno |
| |
| D9 ---------- Trig
| D10 ---------- Echo
| A4 ---------- SDA
| A5 ---------- SCL
| 5V ---------- VCC
| GND ---------- GND
+------------------+
HC-SR04
+------------------+
| VCC -> 5V |
| GND -> GND |
| Trig -> D9 |
| Echo -> D10 |
+------------------+
I2C LCD 16×2
+------------------+
| VCC -> 5V |
| GND -> GND |
| SDA -> A4 |
| SCL -> A5 |
+------------------+
8. Methodology
Step 1
Connect the ultrasonic sensor to Arduino.
Step 2
Connect the I2C LCD display to Arduino.
Step 3
Upload the Arduino program.
Step 4
Trigger ultrasonic pulses.
Step 5
Measure echo return time.
Step 6
Calculate distance.
Step 7
Display distance on LCD.
9. Arduino Program
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
const int trigPin = 9;
const int echoPin = 10;
long duration;
float distance;
void setup()
{
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
[Link]();
[Link]();
[Link](0,0);
[Link]("Digital Ruler");
delay(2000);
[Link]();
}
void loop()
{
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = duration * 0.034 / 2;
[Link](0,0);
[Link]("Distance:");
[Link](0,1);
[Link](distance);
[Link](" cm ");
delay(500);
}
10. Flowchart
START
|
Initialize LCD
|
Initialize Sensor Pins
|
Send Trigger Pulse
|
Receive Echo Signal
|
Measure Time
|
Calculate Distance
|
Display Distance
|
Repeat Loop
|
END
11. Results and Observations
Actual Distance Measured Distance
10 cm 10.1 cm
20 cm 19.9 cm
30 cm 30.2 cm
40 cm 39.8 cm
50 cm 50.1 cm
Observation
The measured values closely match the actual distances, demonstrating good
accuracy.
12. Advantages
• Contactless measurement
• Easy to use
• Portable
• Cost-effective
• Accurate results
• Real-time display
13. Limitations
• Sensitive to environmental conditions
• Soft surfaces may reduce accuracy
• Limited measuring range
• Performance affected by temperature variations
14. Applications
• Electronic measuring devices
• Robotics
• Smart parking systems
• Obstacle avoidance robots
• Industrial automation
• Water level monitoring
• Security systems
15. Future Scope
• Bluetooth connectivity
• Mobile app integration
• Voice output system
• Data logging capability
• Wireless measurement system
• Integration with IoT platforms
16. Conclusion
The Digital Ruler using Arduino Uno, HC-SR04 Ultrasonic Sensor, and I2C 16×2 LCD
Display successfully measures distances accurately and displays the results in real
time. The project demonstrates the practical implementation of ultrasonic sensing and
embedded system design. Due to its low cost, ease of implementation, and wide range
of applications, it is an excellent educational and practical project for students and
hobbyists.
17. References
1. Arduino Official Documentation
2. HC-SR04 Ultrasonic Sensor Datasheet Resources
3. Arduino LiquidCrystal I2C Library Documentation
4. Arduino IDE Documentation and Examples.