Skip to content
S

Distance

Interfacing US 100 Distance with STM32 Blue Pill

What is the US 100?

US 100 practical reference

A drop-in HC-SR04 upgrade that adds temperature compensation and an optional UART mode for more consistent readings. The US-100 uses the same physical dual-transducer layout as the classic HC-SR04, so it fits existing mounts and wiring, but internally it corrects for the fact that the speed of sound changes with air temperature — giving noticeably steadier distance readings across hot and cold environments — and it can optionally be switched into a simple 3-wire UART mode that skips the fussy pulse-timing of the standard trigger/echo interface entirely.

Key specifications

  • Sensor type: Dual-transducer ultrasonic ranging module with onboard temperature compensation
  • Operating voltage: 2.4V–5.5V DC
  • Operating current: ~2.2 mA
  • Measuring range: 2cm to 450cm
  • Accuracy: ±1% typical, improved over standard HC-SR04 thanks to temperature compensation
  • Interface modes: Trigger/Echo pulse mode (pin-compatible with HC-SR04) or UART serial mode, selectable by a jumper
  • UART settings: 9600 baud, 8N1, when jumper-configured for serial mode
  • Temperature sensor: Onboard temperature sensor used internally to correct the speed-of-sound calculation

Pinout and connection notes

A small onboard jumper (often a solder pad or physical switch) selects between classic trigger/echo pulse mode — wired and coded exactly like an HC-SR04 — and UART serial mode, which instead streams distance readings as simple serial bytes at 9600 baud, avoiding the need for precise pulse-width timing in your microcontroller code.

  • VCC: Power, 2.4–5.5V DC
  • Trig / TX: Trigger input in pulse mode, or UART TX in serial mode (set by onboard jumper)
  • Echo / RX: Echo output in pulse mode, or UART RX in serial mode
  • GND: Ground

Integration checklist

  1. Confirm the exact part number and breakout-board revision.
  2. Verify supply voltage, current demand, logic levels, and signal direction against the datasheet.
  3. Check controller pin assignments and bus address or interface mode against the example code.
  4. Power up with external loads disconnected, then test signals before full integration.
  5. If readings or communication fail, check power and ground first, then pin mapping, interface settings, and library initialization.

Troubleshooting and reproducibility

Record the board used, wiring, library/version, supply arrangement, and measured behavior. Use the selected board-specific wiring example as the source of truth. Never assume visually similar modules share identical voltage tolerance or pin order.

Setting Up US 100 with STM32 Blue Pill

Wiring

Component pinSTM32 Blue Pill pinNote
VCC5V
TXPA10 / Serial1 RX (through a divider)Sensor TX is 5V logic — Blue Pill GPIOs are 3.3V-only
RXPA9 / Serial1 TX

Swipe sideways to see every column →

C++
  • Blue Pill's USB-CDC Serial often doesn't show up without extra setup — flash via ST-Link and watch Serial1's USB-TTL output if this is new to you, same as other UART components on this board.
  • The divider on the sensor's 5V TX line feeding into PA10 is still required.
  • Same 0x55-request / 2-byte-reply protocol as the other boards.

Related Components

Related Guides & Projects