HC-SR04 Ultrasonic Sensor – Precision Distance Measuring for Arduino Projects Best Price Lahore, Pakistan
₨230 Original price was: ₨230.₨200Current price is: ₨200.
you can payment online thorugh Easypaisa, jazzcash, Raast
Cash on Delivery All over Pakistan
Direct Bank Transfer Payments
🚚 Delivery: Rs 350 all over Pakistan — 3 to 4 working days. Cash on Delivery available. Order on WhatsApp: +92-302-8577025 / +92-336-4459320
About this item
- Accurate Distance Measurement: Ideal for student robotics projects.
- Wide Range: Measures 2 cm to 400 cm with 3mm accuracy.
- Arduino Integration: Perfect for final-year engineering projects.
- Low Power: Consumes less than 15 mA for energy-efficient designs.
What is the HC-SR04 Ultrasonic Sensor?
The HC-SR04 is the most popular distance-measuring sensor for Arduino projects in Pakistan. It works like a bat: it sends out a short burst of ultrasonic sound (which humans cannot hear), the sound bounces off an object, and the sensor measures how long the echo takes to come back. From that time it calculates the distance. No touch, no light — just sound.
It is the standard sensor for robot obstacle avoidance, water-level measurement, parking systems and distance alarms, and it appears in almost every Arduino robot car and final-year project.
Key Specifications
| Specification | Value |
|---|---|
| Operating frequency | 40 kHz |
| Measuring range | 2 cm to 400 cm |
| Accuracy | ±3 mm |
| Measuring angle | 15 degrees |
| Operating voltage | 5V DC |
| Operating current | 15 mA |
| Pins | 4 — VCC, TRIG, ECHO, GND |
| Size | 45 × 20 × 15 mm |
Wiring with Arduino UNO
| HC-SR04 Pin | Arduino UNO Pin |
|---|---|
| VCC | 5V |
| TRIG | D9 |
| ECHO | D10 |
| GND | GND |
That is the whole wiring — four wires, no resistor needed. The TRIG pin sends the sound pulse and the ECHO pin receives it back.
How It Works
The Arduino sends a 10-microsecond pulse to TRIG. The sensor replies with eight 40 kHz sound pulses. When the echo returns, the ECHO pin goes HIGH for exactly as long as the sound took to travel out and back. Distance in centimetres = (echo time in microseconds × 0.0343) ÷ 2. Sound travels at about 343 metres per second, and the ÷ 2 is because the sound makes a return journey.
Arduino Code — Distance Measurement
// HC-SR04 distance measurement — TRIG D9, ECHO D10
const int trigPin = 9;
const int echoPin = 10;
void setup() {
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
Serial.begin(9600);
}
void loop() {
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
long duration = pulseIn(echoPin, HIGH);
float distance = duration * 0.0343 / 2;
Serial.print("Distance: ");
Serial.print(distance);
Serial.println(" cm");
delay(500);
}
Upload it, open the Serial Monitor at 9600 baud, and move your hand in front of the sensor — the distance prints live. For a full step-by-step build, see our Arduino ultrasonic sensor project guide and our HC-SR04 complete guide.
Where to Use It
- Robot obstacle avoidance: the sensor on every Arduino robot car — see our obstacle avoidance robot car guide.
- Water-level measurement: mount it above a tank and read the water level without touching the water.
- Parking assistance: beep faster as the car gets closer to the wall.
- Distance alarms and counting: detect a person or object passing a point.
Unlike an IR sensor, the HC-SR04 does not care about sunlight or the colour of the object — sound reflects off black surfaces just as well as white ones. That is why robots use it outdoors and in bright rooms where IR sensors fail. For the full comparison, see our ultrasonic vs PIR sensor guide.
What You Get
1 × HC-SR04 ultrasonic sensor module, tested before dispatch. Jumper wires are not included — add them below if you need them.
Frequently Asked Questions
Q1: Why does my sensor always read 0 cm or no distance?
Check the wiring first — TRIG to D9, ECHO to D10, VCC to 5V (not 3.3V), GND to GND. Then check that the code’s pin numbers match your wiring. A loose Dupont wire is the most common cause.
Q2: Does it work in sunlight?
Yes. Sunlight is light — the HC-SR04 uses sound, so bright light and sunshine do not affect it at all. This is its big advantage over IR obstacle sensors.
Q3: Can it detect a black object?
Yes. Sound reflects off dark surfaces just like light ones, so a black box is detected at the same range as a white one — unlike an IR sensor, which struggles with black.
Q4: What is the minimum distance it can measure?
About 2 cm. Closer than that, the echo returns before the sensor is ready to listen. For very close detection, an IR obstacle module is the better choice.
Complete Your Project
- Arduino UNO R3 DIP — Rs 1,200
- MB102 Breadboard — Rs 250
- 40-Pin Jumper Wires — Rs 180
- LCD1602 Display with I2C Module — Rs 660
- Active Buzzer — Rs 35
Delivery across Pakistan — flat Rs 350, 3–4 working days, Cash on Delivery available. Questions? Message us on WhatsApp at +92-302-8577025.
Customer Reviews
Related products
-
Sale!

1602 Character LCD Display 16×2 Green/Blue for Electronics Projects – Available in Lahore, Pakistan
₨315Original price was: ₨315.₨275Current price is: ₨275.Add to Cart This product has multiple variants. The options may be chosen on the product page -
Sale!

Arduino CNC Shield V3 Compatible with A4988 and DRV8825 Drivers – Available in Lahore, Pakistan for Your CNC Projects
₨400Original price was: ₨400.₨350Current price is: ₨350. -
Sale!

Color Sensor Module – Precise Color Detection, Programmable, Adjustable LED, Great for Arduino & Raspberry Pi Best Price in Lahore, Pakistan
₨2,100Original price was: ₨2,100.₨1,825Current price is: ₨1,825. -
Sale!

I2C/IIC Module for LCD Displays Serial Interface Adapter PCF8514T – Best Price in Hall Road Lahore, Pakistan
₨205Original price was: ₨205.₨180Current price is: ₨180.

Reviews
There are no reviews yet.