Sensors · Component reference
HC-SR04 ultrasonic distance sensor
Measure distance using a trigger pulse and an echo response; useful for obstacle and level projects.
Pinout
Tested record| Pin | Function |
|---|---|
| vcc | 5 V supply |
| trig | Trigger input |
| echo | Echo output |
| gnd | Ground |
Pin labels describe the simulator's component definition. Physical breakout boards can differ; always check the silkscreen and the module datasheet.
Wiring checklist
- 1Connect VCC to a regulated 5 V supply and GND to common ground.
- 2Connect TRIG to a digital output and ECHO to a digital input.
- 3For 3.3 V boards such as ESP32, reduce the 5 V ECHO signal with a suitable resistor divider or logic-level shifter before it reaches the GPIO.
What the simulator models
Included in the recorded seven-part compiled-sketch matrix. The simulator models the sensor's trigger/echo interaction for supported firmware workflows.
Evidence: Recorded in the seven-part compiled-sketch matrix across the runnable-board test set (14 boards in the 2026-11-23 audit).
Known limits — read before relying on a simulation
- The simulator is not an acoustic or room-geometry solver; distance is a configured model input, not a ray-cast measurement of virtual objects.
- Real modules vary in range, beam width, dead zone and surface response. Validate the physical installation.
Common project ideas
Obstacle detectorParking assistantWater-tank level prototype
Try the component in the workbench
Open the simulator, find this part in the component palette and wire it to your board.