SENSOR PROJECT

Ultrasonic Distance Finder

Measure distance using HC-SR04 Ultrasonic Sensor and Arduino UNO

Arduino UNO HC-SR04 Beginner Level Real-time Monitoring

This project uses an HC-SR04 ultrasonic sensor to measure the distance of an object. Arduino calculates the distance using the echo time and displays the result in the Serial Monitor. It can be used for robotics, obstacle detection, smart parking, automatic systems and distance measurement.

Difficulty Beginner
Time 30 - 45 min
Cost Low
Category Sensor
Arduino UNO and HC-SR04 Ultrasonic Distance Finder
25.21 cm
  Loading project from ERDC Project CMS...

Choose Your Learning Path

FREE

Watch Free Project Video

Learn the project basics before you start building.

  • Project Introduction
  • Working Principle
  • Components Overview
  • Applications
POPULAR

Complete Project Support

Circuit, connections, tested program, execution help, design files and documentation.

  • Circuit Diagram (PDF)
  • Exact Pin Connections
  • Tested Arduino Code
  • Execution / Upload Guide
  • Troubleshooting Guide
  • Project Documentation
LIVE

Live Mentor Class

Get expert real-time support for circuit verification, debugging and execution.

  • Live Zoom Session
  • Circuit Verification
  • Code Debugging
  • Sensor Calibration
  • Project Execution Help

How It Works

The Arduino sends a short trigger pulse to the HC-SR04 sensor. The sensor generates ultrasonic sound waves. When the sound hits an object it returns to the Echo pin. Arduino measures this travel time and calculates the distance.

Distance = (Time × Speed of Sound) / 2

  Speed of Sound ≈ 343 m/s at 20°C

Circuit Diagram

Arduino UNO and HC-SR04 Connection Diagram
VCC → 5V
TRIG → D9
ECHO → D10
GND → GND

Components Required

  • 1 × Arduino UNO
  • 1 × HC-SR04 Ultrasonic Sensor
  • 1 × Breadboard
  • 4 × Jumper Wires
  • 1 × USB Cable
Download Resources Download Circuit Diagram

Output Preview

Distance: 25.21 cm
Distance: 24.87 cm
Distance: 25.30 cm
Distance: 24.91 cm
Distance: 25.02 cm
Distance: 25.18 cm

Want to build more exciting projects like this in your school?

Set up an Atal Tinkering Lab with ERDC Solution and empower young innovators through Robotics, Electronics, IoT and Coding.

Apply for ATL Lab  
5000+ Students Empowered
75+ ATL Labs Established
100+ Workshops Conducted
50+ Schools Supported
15+ Districts / Regions
STEM Innovation Support