HC-SR04 Ultrasonic Distance Sensor — 2cm–400cm Range (5V, Arduino / ESP8266 / Home Assistant)
R 34.00
In Stock — 54 available

📏 HC-SR04 Ultrasonic Distance Sensor — 2cm–400cm Range (5V, Arduino / ESP Compatible)

The HC-SR04 is the classic ultrasonic distance sensor for DIY electronics and IoT projects. Measures distance from 2cm to 400cm (4 metres) with ~3mm accuracy using ultrasonic sound pulses. 4-pin interface (VCC, Trig, Echo, GND). DC 5V powered. Compatible with Arduino, ESP8266, ESP32, Raspberry Pi, ESPHome, and Home Assistant. The go-to sensor for water tank level monitoring, obstacle detection, parking sensors, and robotics.

Ultrasonic distance sensors:

🚚
Free Delivery
Orders over R2,500
🇿🇦
Local Stock
Ships from Gauteng
📏
2–400cm
~3mm Accuracy
DC 5V
4-Pin Interface
⚠️ NOT waterproof. The HC-SR04 has exposed transducers and an open PCB. For outdoor or wet environments (water tanks, rain exposure), use the DYP-A02 waterproof ultrasonic sensor instead. Also note: the Echo pin outputs 5V — use a voltage divider (two resistors) when connecting to 3.3V ESP8266/ESP32 boards.

⚡ Key Features

  • 2cm–400cm Range — measures distances from 2cm to approximately 4 metres using 40kHz ultrasonic pulses
  • ~3mm Accuracy — precise enough for water tank level monitoring, bin level detection, and proximity sensing
  • 15° Detection Angle — narrow beam provides focused measurement; minimise interference from walls and obstacles
  • Simple 4-Pin Interface — VCC (5V), Trig (trigger pulse input), Echo (distance pulse output), GND
  • ESPHome Built-In Support — ESPHome has a native ultrasonic sensor platform; define Trig/Echo pins in YAML and get distance readings in Home Assistant instantly
  • Arduino / Raspberry Pi — use the NewPing library (Arduino) or RPi.GPIO (Python) for quick integration
  • Ultra-Low Cost — the most affordable distance sensor available; stock up for multiple projects
  • 5V Logic — outputs 5V on the Echo pin; ESP8266/ESP32 need a voltage divider (e.g. 1kΩ + 2kΩ) on the Echo line

🏠 Perfect For

🪣

Water Tank Level (Indoor Tank)

Mount above an indoor JoJo tank or header tank. Measure the distance to the water surface and calculate fill percentage. Alert via Home Assistant when the tank is low or full. For outdoor tanks, use the DYP-A02 waterproof sensor instead.

🤖

Robotics & Obstacle Detection

The classic sensor for line-following robots, obstacle avoidance bots, and Arduino-powered rovers. Detect walls and objects up to 4m ahead with a narrow 15° beam.

🚗

DIY Parking Sensor

Mount in your garage to display distance as you park. Connect to a D1 Mini with an LED strip — green/yellow/red as you approach the wall. Fun weekend project.

🗑️

Bin & Hopper Level

Monitor fill level of rubbish bins, grain hoppers, feed bins, or pellet stores. Get alerts when it's time to empty or refill.

🔀 HC-SR04 vs DYP-A02 — Which to Choose?

HC-SR04 (this product) — exposed PCB, NOT waterproof, 5V logic, ultra cheap (R34). Perfect for indoor projects, prototyping, robotics, and learning. Use it anywhere moisture isn't a concern.

DYP-A02 — sealed waterproof housing, 3.3V/5V compatible, 4.5m range. Designed for outdoor water tank monitoring where the sensor is exposed to humidity, condensation, and splashes. Costs more but built for the job.

💡 ESP8266 wiring tip: The HC-SR04 Echo pin outputs 5V. ESP8266 GPIOs are 3.3V and NOT 5V tolerant. Use a simple voltage divider: connect Echo → 1kΩ resistor → GPIO pin → 2kΩ resistor → GND. This drops the 5V signal to ~3.3V safely. The Trig pin can be driven directly from a 3.3V GPIO — the SR04 accepts 3.3V as a logic HIGH.

📋 Technical Specifications

Product HC-SR04 Ultrasonic Distance Sensor
Model HC-SR04
Working Voltage DC 5V
Static Current ~5mA
Measurement Range 2cm – 400cm (~4m)
Accuracy ~3mm (0.3cm)
Detection Angle ≤15°
Trigger Pulse 10µs HIGH on Trig pin
Echo Output 5V HIGH pulse (duration proportional to distance)
Interface 4-pin: VCC · Trig · Echo · GND
Frequency 40 kHz ultrasonic
Board Size ~45 × 20mm
Waterproof No (indoor use only)
Compatible With Arduino · ESP8266 · ESP32 · Raspberry Pi · ESPHome · Home Assistant

🔗 Pair With

❓ Frequently Asked Questions

Can I use this for an outdoor water tank?
The HC-SR04 is NOT waterproof. Humidity and condensation inside a water tank will damage the exposed transducers and PCB. For outdoor/tank use, choose the DYP-A02 waterproof ultrasonic sensor. The HC-SR04 is fine for indoor tanks in dry environments.
Why does the Echo pin need a voltage divider?
The HC-SR04 runs on 5V and outputs a 5V signal on the Echo pin. ESP8266 and ESP32 GPIOs are 3.3V and can be damaged by 5V input. A simple voltage divider (1kΩ + 2kΩ) reduces the signal to ~3.3V. Arduino Uno/Mega boards run at 5V natively and don't need a divider.
How does it work?
Send a 10µs HIGH pulse to the Trig pin. The sensor emits an ultrasonic burst (40kHz). The Echo pin goes HIGH for a duration proportional to the round-trip time of the sound wave. Distance = (Echo pulse duration × speed of sound) ÷ 2. ESPHome handles all of this automatically.

🤝 Need Help? We're Here for You!

🏢

Visit Us

8 Wildebraam Street
Weltevreden Park, Roodepoort
Gauteng, 1709

📧

Email

info@eiferer.co.za

Measure Distance for R34 📏

The most popular ultrasonic sensor in the world — now in your project.