HC-SR04 ultrasonic distance sensor front view with T and R transducers and Vcc, Trig, Echo, Gnd pins

HC-SR04 Ultrasonic Distance Sensor Module

$2.79 NZD
Skip to product information
SKU: HCSR04-1PK

HC-SR04 Ultrasonic Distance Sensor Module

$2.79 NZD
5.0 1 review
Availability:
Order before 7:30am for same-day dispatch Dispatch 7 days a week, excluding public holidays

NZ Post: 1-2 days urban · 2-4 days rural

Shipping from $5.99 urban / $9.99 rural, or free pick-up in Te Awamutu.

Easy 30-day returns · 12-month warranty

Add these too
Add $66.00 for Free Urban delivery ($88.00 for Rural)
Urban $66 Rural $88

The HC-SR04 is an ultrasonic distance sensor that measures from 2 to 400 cm by timing a 40 kHz sound pulse. It needs no library or calibration: one pin starts a reading and another returns a pulse whose length is the distance. It runs on 5V and wires straight to an Arduino; on 3.3V boards such as the ESP32 or Raspberry Pi, add two resistors to the Echo pin.

Specifications

ModelHC-SR04 ultrasonic module
Supply5V DC
Working currentAbout 15 mA
Measuring range2 to 400 cm
ResolutionAbout 3 mm
Beam angleAbout 15 degrees
Frequency40 kHz
TriggerHIGH pulse of at least 10 µs on Trig
Echo output5V pulse, width = round trip time
PinsVCC, Trig, Echo, GND, 2.54 mm header
Reading intervalAt least 60 ms apart
SizeAbout 45 x 20 x 15 mm

Datasheets

What's in the box

1×
HC-SR04 ultrasonic sensor module

4-pin header fitted. Jumper wires not included.

Great for

Stopping a robot car before it hits a wall
A parking distance alarm in the garage
Checking the level in a bin or hopper from above
Counting people through a doorway
Turning on a light when someone walks up
Showing students the speed of sound

Wiring & getting started

  1. Find the pins

    With the two round transducers facing you and the pins pointing down, the pins are VCC, Trig, Echo, GND from left to right. The names are also printed on the back.

  2. Wire to an Arduino

    VCC to 5V, GND to GND, Trig to D9 and Echo to D10. Our female-to-male jumper wires plug straight onto the header.

  3. On an ESP32, Pico or Raspberry Pi

    Keep VCC on the 5V pin. Trig can go straight to a 3.3V output. Run Echo through a 1k resistor to your input pin, with a 2k resistor from that pin to GND.

  4. Take a reading

    Send a 10 µs HIGH pulse on Trig, then read the Echo pulse with pulseIn(echoPin, HIGH, 30000). Divide the microseconds by 58 for centimetres. Point it at a wall about a metre away and the number should hold steady.

  • 5 stars: 1 (100%)
  • 4 stars: 0 (0%)
  • 3 stars: 0 (0%)
  • 2 stars: 0 (0%)
  • 1 star: 0 (0%)
y
yannik78
Trade Me feedback

Great product, fast delivery; perfect trade.

Frequently Asked Questions

Answers to the questions buyers ask most.

Will it work with an ESP32, Pico or Raspberry Pi?
Yes, with two resistors. Power VCC from the board's 5V pin, not 3V3. Trig is happy with a 3.3V output, but Echo comes back at 5V, which is too much for a 3.3V input. Put a 1k resistor from Echo to your input pin and a 2k resistor from that pin to GND, or use a level shifter.
How far and how accurately does it measure?
From 2 to 400 cm, to about 3 mm, on a flat hard surface facing the sensor. Closer than 2 cm it cannot read at all. Soft things like cloth, foam and fur, and surfaces angled away from the sensor, shorten the range.
How do I turn the Echo pulse into a distance?
Measure how long Echo stays HIGH in microseconds and divide by 58 for centimetres (or 148 for inches). In Arduino code that is pulseIn(echoPin, HIGH, 30000) / 58.0. The 30000 is a timeout, so a missed echo returns 0 instead of stalling your sketch for a second.
How often can I take a reading?
Leave at least 60 ms between readings, which is up to about 16 a second. Firing faster lets the previous echo arrive late and gives false short readings. About 10 readings a second suits most projects.
Why do I get 0 or jumpy readings?
0 usually means no echo came back: the target is too far, too soft, at a steep angle or closer than 2 cm. Jumpy numbers often come from readings fired too close together or a loose ground. Check the wiring, aim at a flat wall and average a few readings.
Is there an Arduino library for it?
You do not need one, but the NewPing library in the Arduino Library Manager makes it tidier and can filter out odd readings. In ESPHome and Home Assistant it works with the built-in ultrasonic sensor platform.
Can I use it in a water tank or outside?
Only if it stays dry. The board and transducers are open, so condensation or rain will upset or damage it. For a tank, mount it in a dry, sheltered spot above the water.

Have a Question About This Product?

Send it through and we will get back to you by email.

Why Buy from NZN

Useful parts, fair prices and someone local to help.

I'm Lukas, an engineering student and maker based in Te Awamutu. NZN grew out of a CNC build that dragged on for months because every missing cable, bolt or electronic part meant another overseas order. I started the shop so Kiwi makers can spend more time building and less time waiting for the next parcel.

  • Stocked here in New Zealand

    Orders are picked and packed in Te Awamutu and dispatched within 24 hours every day, excluding public holidays. NZ Post target delivery is 1-2 days urban and 2-4 days rural. In Te Awamutu and Kihikihi you can choose local delivery at checkout: same day if you order before 8am, otherwise next day.

  • Fair prices, clearly shown

    Prices are kept competitive and quantity discounts are shown upfront. Free delivery starts at $66 for urban addresses and $88 for rural addresses.

  • 30-day returns and 12-month warranty

    Get in touch if something is not right and we will help sort it.

  • Practical product support

    Ask a product question and get help from a real person in New Zealand who knows the range.

You may also like