9.STM32 platform------- Camera vision tracking
1-1 STM32 expansion board
1-2 STM32 smart car
2)Purpose of Experimental
After the STM32 MCU is powered on, press the start button next to the PS2 mark, the car will automatically walk the black line. In this experiment, the camera has higher requirements for light. When the car is placed on the black line, you will be able to see the scene captured by the camera by the 0.96-inch OLED screen. If the light is too bright or too dark, there will be some clutter on the camera, which is the black point that does not match the black line. At this time, we have to adjust the light to make sure that only the black line is visible on the screen.
Note! ! ! ! !
After the car is powered on, if the car can't normally patrol the line, then you need to fine-tune the code, you can modify the camera height, angle, camera threshold, servo median, etc. The servo median and camera threshold need to be modified in the program.
3)Principle of experimental
The camera used in this experiment is OV7670. The camera saves the data of the black line track to an array, and then binarizes the data. According to the position of the black line in the image, it can judge the position of the car in the black line track. Finally, we can calculate the deviation between the car and the black line track, and then calculate the angle of the servo by the PD algorithm to realize the car inspection function.
4-1 About the schematic
4-1 STM32 main control board circuit diagram
4-2 OV7670 interface
4-2 According to the circuit schematic:
4-3 About the code
Please see the folder named Camera vision tracking in the code folder.
The code of the experiment: 9.Camera_vision_tracking.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