1-1 STM32 expansion board
1-2 STM32 smart car
1-3 Ultrasonic module
2) Purpose of Experimental
After the car is powered on, press the start button next to the PS2 logo on the expansion board. When the current side has obstacles, the car turns to 90 degrees.
3) Principle of experimental
The ultrasonic module is a sensor that uses ultrasonic characteristics to detect the distance. It has two ultrasonic probes for transmitting and receiving ultrasonic waves. The range of measurement is 3-450 cm.
3-1 Ultrasonic emission and reception schematic
(1) You need to input a high level signal of at least 10us to the Trig pin to trigger the ranging function of the ultrasonic module.
3-2 Ultrasonic module sends trigger signal
(2) After the ranging function is triggered, the module will automatically send out 8 ultrasonic pulses with 40 kHz and automatically detect whether there is a signal return. This step is done internally by the module.
(3) When the module detects an echo signal, the ECHO pin will output a high level. The high level duration is the time from when the ultrasonic wave is sent to when it returns. You can calculate the distance by using the time function to calculate the high level duration. Formula: Distance = High level duration * Speed of sound(340M/S)/2.
4) Experimental Steps
4-1 About the schematic
4-1 STM32 main control board circuit diagram
4-2 Ultrasonic module interface
4-2 According to the circuit schematic:
4-3 About the code
Please see the folder named Ultrasonic obstacle avoidance in the code folder.
The code of the experiment: 7.Ultrasonic_obstacle_avoidance.rar
STM32 Visual Tracking Car Tutorial Overview
- 2.1 Keil uVision5 install tutorial
- 2.2 Keil uVision5 create a new project tutorial
- 2.3 How to download code
- STM32 Visual Tracking Car Tutorial 3.1 Light up LED
- STM32 Visual Tracking Car Tutorial 3.2 Advance
- STM32 Visual Tracking Car Tutorial 3.3 Servo control
- STM32 Visual Tracking Car Tutorial 3.4 OLED
- STM32 Visual Tracking Car Tutorial 3.5 Battery voltage detection
- STM32 Visual Tracking Car Tutorial 3.6 Color LED
- STM32 Visual Tracking Car Tutorial 3.7 Ultrasonic obstacle avoidance
- STM32 Visual Tracking Car Tutorial 3.8 Screen display font
- STM32 Visual Tracking Car Tutorial 3.9 Camera vision tracking
- STM32 Visual Tracking Car Tutorial 3.10 PS2 control car
- STM32 Visual Tracking Car Tutorial 3.11 Bluetooth control car
4. About battery
5. About installation
Buy the STM32 Visual tracking robot car