HC-SR04 Ultrasonic Sensor: The Classic Way to Measure Distance With Arduino

Rs. 250 - In stock - SKU ABH-SENS-0406 - Brand Generic

The HC-SR04 measures distance from 2 to 400 cm by sending 40kHz ultrasonic pulses and timing the echo, with about 3 mm resolution. It is the go-to sensor for obstacle-avoiding robots, parking sensors and water level meters.

Delivery anywhere in Pakistan for a flat Rs. 250 paid in advance, product price Cash on Delivery. 7-Day Checking Warranty.

Key features

Specifications

Range2-400 cm
Resolutionapprox. 3 mm
Frequency40kHz
Beam angleapprox. 15 degrees
Supply5V DC
Currentapprox. 15mA

What's in the box

Use cases

Description

How it works

The left transducer sends a 40kHz sound pulse. The right one listens for the echo. Your microcontroller measures the echo time and converts it to distance: distance (cm) = echo time (microseconds) / 58.

Wiring

Code

Use `pulseIn()` in Arduino, or the NewPing library for faster, non-blocking readings.

Projects

Tips

Soft materials like cloth absorb sound and reduce range. Angled surfaces can deflect the echo. For water tanks, mount it pointing straight down and keep it dry.

Frequently asked questions

Can I use HC-SR04 with ESP32?

Yes. Power it at 5V and use a voltage divider on the Echo pin to protect the 3.3V input.

How do I calculate distance?

Distance in cm equals echo pulse time in microseconds divided by 58.

Is HC-SR04 waterproof?

No. Use the JSN-SR04T waterproof sensor for wet areas.

Related products

All Sensors & Sensor Modules