Idea
In short
How do you build a blue Pill distance by input capture?
A Blue Pill times the echo pulse of an HC-SR04 with a timer in input-capture mode. The sensor runs at 5 V and its echo is 5 V, so cut it to about 3.3 V with a resistor divider before the board pin. You need STM32 Blue Pill (STM32F103C8T6), ST-Link V2 programmer (clone), HC-SR04 Ultrasonic Sensor, Resistor 1 kΩ × 3, SSD1306 OLED Display and Breadboard 830 Tie Points.
- Level
- Intermediate
- Time
- About 140 min
- Parts
- 6
An idea, not a guided build yet. Goal, parts and steps; no wiring, code or tests. Copy it to My Garage to plan it.
Goal
Time a pulse in hardware instead of with a polling loop.
Parts list
- Development Boards
- Interfaces
- Sensors
- PassivesResistor 1 kΩ × 3
- Displays
- Prototyping
How to build it
- Send a 10 microsecond trigger pulse from a timer output
- Divide the echo with 1 k and 2 k resistors
- Capture the rising and falling edges
- Convert the pulse width to centimetres
- Show the distance on the OLED
Common questions
What parts do I need for the blue Pill distance by input capture?
STM32 Blue Pill (STM32F103C8T6), ST-Link V2 programmer (clone), HC-SR04 Ultrasonic Sensor, Resistor 1 kΩ × 3, SSD1306 OLED Display and Breadboard 830 Tie Points.
How long does the blue Pill distance by input capture take to build?
About 140 minutes for a intermediate maker.
