US-100 Ultrasonic Distance Sensor

Contents

Description

The US-100 is a drop-in replacement for the older HC‑SR04 ultrasonic distance sensor. It's much more versatile but retains full compatible with the older driver libraries.

US-100 board front view
US-100 board rear view

FIG 1 - US-100 board: [Left] front view, [Right] rear view

The following table provides a comparison of the original HC‑SR04 and the improved US‑100 version.

Parameter HC-SR04 US-100
Voltage 5V 2.4V to 5.5V
MCU
5V
Direct connect Trig and Echo pins. Direct connect Trig and Echo pins.
MCU
3.3V
Direct connect Trig pin.

Echo pin must be connected through a voltage divider or logic level shifter.
Direct connect Trig and Echo pins.
Operating
range (cm)
2 to 400 2 to 450
Accuracy
(Datasheet)
±0.3 cm ±0.3 cm
Built-in temperature compensation No Yes
Interfaces Digital pin x 2 • Digital pin x 2
• UART

Ultrasonic Distance Sensing

The US-100 has two ultrasonic transducers. One is a transmitter, the other is the receiver.

The transmitter emits ultrasonic waves with a 40kHz frequency. The receiver listens for the echo of those waves after they bounce off an object.

Knowing the speed of sound in air, it's a simple task to calculate the distance between the target object and the sensor board.

Ultrasonic Sensor Working Principle

Ultrasonic Sensor Working Principle[1]

Pinout

The US-100 has five pins:

  • VCC: Power supply input, usually 3.3V or 5V.
  • Trig/Tx:
    • Trig: Used to trigger a measurement if using HC-SR04 Digital pin x 2 mode.

      Connect to any available digital pin on the microcontroller.
    • Tx: Connected to microcontroller's Tx pin if using UART mode.
  • Echo: Goes High if using HC-SR04 Digital pin x 2 mode; time that signal is held High is proportional to distance measured.

    Connect to any available digital pin on the microcontroller.
  • GND x 2: There are two ground pins. Either one is connected to microcontroller's ground pin.

Interfaces

As noted in the table above the US-100 has two different modes that can be used to obtain a distance measurement.

The rear of the US-100 board has a jumper block which enables the following two configurations:.

  • Jumper pin removed: The sensor acts like an HC-SR04 with a trigger and echo pin i.e. Digital Pin x 2 mode.
  • Jumper pin in place: The sensor is in UART mode.

Digital Pin x 2

This is the classic HC-SR04 distance measurement mode. These are the steps:

  • The microcontroller pulls the Trig pin High for at least 10µs.
  • The sensor sends eight x 40kHz ultrasonic pulses then waits to receive the returning (reflected) pulse back.
  • The sensor pulls the Echo pin High for the same amount of time that the ultrasound pulse has taken to leave and return back.
  • The microcontroller must detect the rising edge of the Echo pin and time the period that it remains high.
  • Distance (cm) = (0.0340 X Time)/2

    Where:
       Time = Echo pin High time in µs
       Speed of sound in air = 340 m/s

HC-SR04 ultrasonic timing diagram

HC-SR04 ultrasonic timing diagram[2]

UART

The sensor's UART baud rate is 9600. Use wiring hook up given in Pinout.

Distance Measurement

The steps to obtain a distance measurement are:

  • Transmit the byte 0x55 to the sensor to initiate a distance measurement.
  • Wait 150 ms for the sensor to take the measurement and process the result.
  • Receive two bytes from the sensor after it has processed the distance measurement.
  • Assemble the bytes into a single 16-bit unsigned integer. This gives the distance in mm.

Temperature Measurement

The US-100 has an internal temperature sensor that it uses to compensate the speed of sound for temperature variation when in UART mode. Readings from this temperature sensor are available to the user.

The steps to obtain a temperature measurement are:

  • Transmit the byte 0x50 to the sensor to initiate a temperature measurement.
  • Wait 150 ms for the sensor to take the measurement and process the result.
  • Receive one byte from the sensor after it has processed the temperature measurement.
  • Subtract 45 from the raw value to obtain the temperature in degrees Celsius.

US-100 MicroPython Drivers for micro:bit

Two MicroPython drivers that support the US-100 have been written that specifically target the BBC micro:bit:

References

  • [1]Author: electrocomps.in; 27 September, 2024
    Article: HC-SR04 Ultrasonic Sensor Working with Arduino & Raspberry Pi,
    Section: How Does the HC-SR04 Work?,
    Available at: https://electrocomps.in/understanding-how-ultrasonic-sensors-work-a-comprehensive-guideunderstanding-how-the-hc-sr04-ultrasonic-sensor-module-works-with-arduino-and-raspberry-piunderstanding-how-ultrasonic-sensors-work-a-c/
    Accessed: November, 2025.
  • [2]Author: ElectricWings;
    Article: HC-SR04 Ultrasonic Sensor Guide with Arduino Interfacing,
    Section: Ultrasonic Sensor HC-SR04 Working Principle,
    Available at: https://www.electronicwings.com/sensors-modules/ultrasonic-module-hc-sr04
    Accessed: November, 2025.