Ultrasonic Distance Meter Using HC-SR04 and Arduino UNO

HC-SR04 Ultrasonic Distance Meter

Information Header

ParameterDetails
Design IDDB-0004
Design NameHC-SR04 Ultrasonic Distance Meter
CategorySensors & Measurement
SubcategoryDistance Measurement
ApplicationNon-contact distance measurement
ControllerArduino UNO R3
SensorHC-SR04 Ultrasonic Sensor
Complexity LevelBeginner
Hardware StatusReference Design
Design PlatformKiCad EDA
Design License[LICENSE TO BE CONFIRMED]
Last Updated05 November 2026

Quick Summary

The HC-SR04 Ultrasonic Distance Meter is an Arduino-based hardware design for measuring the distance between a sensor and a target object without physical contact. It uses the HC-SR04 ultrasonic ranging module to transmit ultrasonic pulses and calculate distance from the time taken by the reflected signal to return.

An Arduino UNO processes the sensor’s trigger and echo signals and calculates the measured distance. The measurement can be monitored through the Arduino Serial Monitor. This design is suitable for distance measurement experiments, robotics, obstacle detection and object-position monitoring.

Key Features

  • Non-contact distance measurement using the HC-SR04 ultrasonic sensor.
  • Measurement range of approximately 2 cm to 400 cm under suitable operating conditions.
  • Arduino UNO-based signal processing.
  • 40 kHz ultrasonic transmission.
  • Digital trigger and echo interface.
  • Distance calculation using ultrasonic time-of-flight measurement.
  • Real-time measurement output through the Arduino Serial Monitor.
  • Simple hardware architecture with minimal external components.

Block Diagram

🔧

Need a modification?

Need changes in this design for your application?

Modify This Design – From $15

🛠️

Need a new design?

Need changes in this design for your application?

Custom Hardware Design From 49$

Applications

  • Distance Measurement

Hardware Specifications

ParameterSpecification
Main ControllerArduino UNO R3
MicrocontrollerATmega328P
Ultrasonic SensorHC-SR04
Sensor Operating Voltage5V DC
Sensor Operating CurrentApproximately 15 mA (module-dependent)
Measurement PrincipleUltrasonic Time-of-Flight
Measurement Range2 cm – 400 cm
Ultrasonic Frequency40 kHz
Trigger Signal10 µs TTL HIGH pulse
Echo SignalTTL digital output
Communication InterfaceDigital GPIO
Measurement OutputSerial Monitor
Serial Baud Rate9600 bps (reference implementation)
PCB DimensionsNot Specified
PCB Layer CountNot Specified

Design Overview

The design consists of an Arduino UNO R3 connected to an HC-SR04 ultrasonic ranging module.

The sensor uses ultrasonic time-of-flight measurement to determine the distance of an object.

The Arduino generates a trigger pulse on the TRIG pin of the HC-SR04 module. After receiving the trigger signal, the module transmits eight ultrasonic pulses at 40 kHz.

When these pulses encounter an object, a portion of the transmitted acoustic energy is reflected towards the sensor.

The HC-SR04 detects the returning signal and generates a HIGH-level pulse on its ECHO output. The pulse duration represents the total time taken by the ultrasonic signal to travel to the object and return.

The Arduino measures this pulse duration and calculates the distance.

Distance Calculation

The distance is calculated using the following equation:

Distance = (Time × Speed of Sound) / 2

Where:

  • Time = Measured ECHO pulse duration.
  • Speed of Sound = Approximately 343 m/s at 20°C.
  • Division by 2 accounts for the outgoing and returning ultrasonic paths.

For distance in centimetres:

Distance (cm) = Echo Duration (µs) × 0.0343 / 2

The calculated distance is transmitted through the Arduino serial interface for monitoring.

Complete BOM

ReferenceMPNMFRQty
C1,C325YXJ220M6.3X11Rubycon2
C2,C4,C8,C9C315C104M5U5TAKEMET4
C5,C6C315C220K5G5TAKEMET2
D1WP710A10IDKingbright1
D21N4007-E3/54Vishay1
DS2WC1602AWincom Tech1
IC1HC-SR04OSEPP Electronics1
J1DCJ200-10-A-K1-KGCT1
R1,R3CFR-25JB-52-330RYageo2
R2CFR-25JB-52-10KYageo1
RV13296W-1-103LFBourns1
SW1B3F-1022Aratas1
U1ATMEGA328P-PUMicrochip1
U2L7805CVSTMicroelectronics1
Y1ABL-16.000MHZ-B2Abracon1

FAQ

1. What is the HC-SR04 ultrasonic distance meter?

It is an Arduino-based distance measurement system that uses ultrasonic time-of-flight measurement to determine the distance between a sensor and an object without physical contact.

2. What is the measurement range of the HC-SR04 sensor?

The commonly specified measurement range is approximately 2 cm to 400 cm. Actual performance depends on the target object and operating environment.

3. How does the HC-SR04 calculate distance?

The sensor transmits ultrasonic waves and measures the time taken for the reflected signal to return. The Arduino calculates distance using the speed of sound and the measured round-trip travel time.

4. Why does the HC-SR04 have separate TRIG and ECHO pins?

TRIG receives the trigger pulse from the microcontroller to initiate measurement. ECHO provides a pulse whose duration represents the ultrasonic signal’s round-trip travel time.

5. Can the HC-SR04 be used without Arduino?

Yes. The HC-SR04 can interface with other microcontrollers that support suitable digital trigger and echo signals.

6. Can I manufacture a custom PCB for this design?

Yes. The circuit can be converted into a custom PCB using KiCad EDA. PCB manufacturing and assembly can be requested through ICDigest manufacturing partners.

Schematic in pdf

Download

KiCad File

Download

Leave a Comment