
Ultrasonic Distance Measurement Using Arduino
Measure distance using an ultrasonic sensor and Arduino by calculating the time taken for sound waves to reflect back from an object.
Inclusive of all taxes
- Secure payments via Razorpay
- 7-day returns on defective items
- GST invoice on every order
Free delivery on orders above ₹2,000
Delivers in 4-7 business days
Check delivery at your pincode
₹2089.00
Inclusive of all taxes
Components
5 items
Difficulty
Beginner
Build Time
1 – 2 Hours
Project Details
How It Works
The project works by sending a 10µs trigger pulse from Arduino's digital pin 9 to the HC-SR04 sensor. The sensor emits an ultrasonic pulse, which travels through the air and reflects off an object. The reflected sound wave returns to the sensor, which sends an echo pulse to Arduino's digital pin 10. Arduino measures the duration between the trigger and echo pulses using the pulseIn() function. The distance is calculated using the formula: Distance = (Time × Speed of Sound) / 2, where Speed of Sound is approximately 343 m/s at room temperature. The result is displayed in centimeters via the serial monitor.
Prerequisites
Basic understanding of electronics and Arduino programming. Familiarity with the Arduino IDE and how to upload code to an Arduino board. Knowledge of basic circuit connections and component identification.
What You'll Learn
Understand how ultrasonic sensors use sound waves to measure distance
Learn to measure pulse duration using Arduino functions
Write and upload code to control Arduino board
Apply mathematical formulas to convert time to distance
Display sensor data on computer via serial monitor
Key Features
Measures distance with reasonable accuracy for beginner projects
Uses common, inexpensive components for easy implementation
Simple circuit and code suitable for electronics newcomers
Can be integrated into larger projects like obstacle-avoiding robots
Displays distance measurements in real-time on computer screen
What's Included in the Kit
| Component | Qty | Price |
|---|---|---|
![]() | 1 | ₹767.00 |
![]() | 1 | ₹59.00 |
![]() | 1 | ₹171.00 |
![]() | 1 | ₹77.00 |
![]() | 1 | ₹190.00 |
Operating Instructions
Pin Connections
| MCU Pin | Connected To | Purpose | Notes |
|---|---|---|---|
| 5V | HC-SR04 VCC | Power supply to sensor | - |
| GND | HC-SR04 GND | Ground connection | - |
| Digital Pin 9 | HC-SR04 Trig | Trigger pulse output | - |
| Digital Pin 10 | HC-SR04 Echo | Echo pulse input | - |
Tools Required
Safety Precautions
Electrical
- ⚠Do not power sensor with more than 5V
- ⚠Ensure proper wiring connections to avoid short circuits
Handling
- ⚠Avoid placing sensor near water
- ⚠Handle components carefully to prevent damage
Frequently Asked Questions
Q:What is the range of HC-SR04?
Q:Does it work in sunlight?
Q:Can it detect soft materials?
Q:Is it accurate?
Product images are for illustration purposes only. Actual products may differ in appearance, packaging, or specifications. See our Terms of Service.






