Skip to content
Sensors

HC-SR04 Ultrasonic Distance Sensor

৳140

Measures distance from 2 cm to about 400 cm by timing an ultrasonic echo, with roughly 3 mm resolution. The standard obstacle sensor.

Send a 10 microsecond pulse on the trigger pin, then measure how long the echo pin stays high — the round-trip time converts directly to distance. Works in complete darkness, which is where infrared sensors fail.

What you can build

  • Obstacle avoidance for robots
  • Car parking assistants and reversing alarms
  • Water tank level measurement from above the surface

Not sure it will work? Test your circuit free in Tekko Sim — on your phone, in Bangla or English.

CategorySensors
Model no.HC-SR04
AvailabilityIn stock
In stock10 pcs
DeliveryCash on Delivery, nationwide Bangladesh
Measuring Range2–400 cm
Resolutionroughly 3 mm
Operating Voltage5V DC
Operating Currentabout 15 mA
Ultrasonic Frequency40 kHz
Measuring Angleroughly 15 degrees
Trigger Input10 microsecond TTL pulse

Questions about the HC-SR04 Ultrasonic Distance Sensor

How do I read the HC-SR04 in Arduino code?
Send a 10 microsecond HIGH pulse on the trigger pin, then use pulseIn on the echo pin to measure how long it stays high. Distance in centimetres is that time in microseconds divided by 58, because sound covers the round trip at roughly 58 microseconds per centimetre.
Why do I get random or zero readings?
Usually the target. Soft, angled or very small surfaces scatter the pulse instead of reflecting it back. The sensor also needs a short gap between readings — poll it no faster than about every 60 milliseconds — and it cannot measure closer than 2 cm.
Does it work with a 3.3V ESP32?
Power it from 5V, but the echo pin outputs 5V and must not go straight into an ESP32 GPIO. Drop it with a two-resistor divider first.