1. HC-SR04 ultrasonic sensor
The HC-SR04 ultrasonic sensor is the most commonly used sensor. It can measure the distance of 2cm~4m. The specific parameters are introduced in the user manual. I won’t go into details here. I will mainly talk about how to control the sensor with STM32:
As shown in the figure above, the HCSR04 ultrasonic module has 4 interfaces, namely: VCC, Trig, Echo, GND
- VCC: working voltage is DC 5V;
- Trig: Trigger signal, generally a TTL high level with a duration greater than 10us;
- Echo: Receive a signal and return a TTL high level whose duration is equal to the time elapsed from transmitting to receiving the sound wave;
- GND: Ground port.
Its working principle is shown in the figure below:
</