LabWired The easy way to build hardware
board I/O module

HC-SR04

The HC-SR04 is a board I/O module in the LabWired part catalog. Its catalog type is ultrasonic. It connects to the MCU over GPIO. The catalog gives a supply range of 4.5–5.5 V. It has 4 pins. A device model in the simulation engine, reached through a dedicated dispatch path rather than the peripheral registry.

From the catalog: Compiles to the hc-sr04 GPIO schedule descriptor. SimInput channel: distance.

Key facts

CategoryBoard I/O modules
Catalog typeultrasonic
InterfaceGPIO
Supply range4.5–5.5 V
Pins4

What LabWired simulates

What is simulated

Simulated device model

How it was validated

Built from the datasheet. Implemented from the part’s register documentation and exercised by automated tests. Nothing physical was ever placed next to it.

HC-SR04 pinout

PinElectrical typeFunction
VCC Power input Supply
GND Power input Supply
TRIG Input GPIO
ECHO Output GPIO

How to simulate the HC-SR04 in LabWired

  1. Open the Playground at app.labwired.com and place an MCU board.
  2. Add the HC-SR04 (catalog type ultrasonic).
  3. Connect VCC and GND to the supply and ground of the board. Use a supply inside the catalog range of 4.5–5.5 V.
  4. Connect TRIG and ECHO to free GPIO pins.
  5. Run the firmware. It drives and reads the pins of the part, and the device model responds on those pins.

Related Board I/O modules

All Board I/O modules · All parts

No manufacturer datasheet is indexed for this part yet, so none is linked here.