Rectronx Circuits
Components

HC-SR04 Ultrasonic Sensor

Popular ultrasonic distance sensor for robots, bins and water-level demos.

Distance Sensor4.6/5RM3-RM10Beginner
ArduinoESP32STM32Raspberry Pi
HC-SR04 ultrasonic sensor with two round transducers

AI Ready Overview

Quick Summary

HC-SR04 is a distance sensor commonly used in FYP and embedded projects. It is best for obstacle avoidance and smart bin fill level, with wiring and testing planned around Arduino, ESP32, STM32.

Difficulty

Beginner

Time Required

1-3 days for basic wiring and sample code; 1 week if used inside a complete FYP prototype

Cost

RM3-RM10 module range in Malaysia; full project cost depends on scope.

Components

HC-SR04, Arduino, ESP32, STM32

Overview

What is HC-SR04?

HC-SR04 measures distance using ultrasonic pulses. It is cheap and common in obstacle avoidance, smart bin, blind stick and level detection prototypes.

Engineering Reference

Quick Specs

Operating Voltage5V
RangeAbout 2cm to 400cm
InterfaceTrigger and echo pins
Best ForDistance and level demos

Real Usage Notes

Suitable / Not Suitable

Suitable for

  • Obstacle avoidance
  • Smart bin fill level
  • Water tank level demo
  • Blind stick prototype

Not suitable for

  • Soft/angled surfaces
  • Outdoor rain exposure
  • High-precision measurement

Build Planning

Difficulty

HC-SR04 is rated Beginner. Plan around 1-3 days for basic wiring and sample code; 1 week if used inside a complete fyp prototypedepending on wiring, libraries, calibration, dashboard/app integration and testing evidence.

Build Planning

Time Required

1-3 days for basic wiring and sample code; 1 week if used inside a complete FYP prototype

Malaysia Price Guidance

Cost

Typical module price range: RM3-RM10. This is component guidance only; a complete FYP cost depends on controller, sensors, casing, display, app/dashboard, documentation and timeline.

Connections

Pinout

VCC

5V power input.

TRIG

Trigger pulse input.

ECHO

Echo pulse output. Level shift for 3.3V boards.

GND

Ground connection.

Platform Notes

Wiring Guides

HC-SR04 with Arduino

Connect trigger and echo to digital pins.

VCC5V
TRIGD9
ECHOD10
GNDGND

Fix Common Problems

Troubleshooting

Check wiring against the pinout before debugging code.
Use a stable power supply and common ground between modules.
Test the component with a simple example sketch before adding dashboard, app or database features.

Troubleshooting

Common Mistakes

Using 5V echo directly on ESP32
Mounting sensor at a bad angle
Expecting reliable readings on soft fabric

FYP Ideas Using HC-SR04

Related Projects

Compare Options

Alternative Components

Student Questions

FAQ

Can HC-SR04 work with ESP32?

Yes, but the echo pin is 5V on many modules, so use voltage scaling for ESP32 input.