Welcome to 8-Channel Tracking Module repository
3.STM32 development board car
STM32 development board car
1. Experimental preparation
Knowledge reserve
Have good programming ability (mainly C language)
Familiar with the architecture of stm32
Material preparation
STM32 development board car *1
Eight-way tracking module *1
7.4V battery *1
Several Dupont wires
2. Car wiring
After assembling the car, connect the motor wires (black head to the motor, white head to the development board)


Wiring of the development board and infrared sensor (this example uses IO communication)
| Development Board | Infrared sensor |
|---|---|
| L1 | X1 |
| L2 | X2 |
| L3 | X3 |
| L4 | X4 |
| L5 | X5 |
| L6 | X6 |
| L7 | X7 |
| L8 | X8 |
| 5V | 5V |
| GND | GND |
As shown in the figure:


Warm reminder: If the battery cover cannot be closed after connecting the 8-way module, you can fix the battery on the top and remove the battery cover.
Main procedures
// TIM6 interruptvoid TIM6_IRQHandler(void){ if (TIM_GetITStatus(TIM6, TIM_IT_Update) != RESET) //Check whether TIM update interruption occurs { TIM_ClearITPendingBit(TIM6, TIM_IT_Update); //Clear TIMx update interrupt flag if(timer_delay_cnt != 0) { timer_delay_cnt --; } //encoder pid Encoder_Update_Count(); Motion_Handle(); //IO direct line inspection 10ms to detect the status of the line LineWalking(); }}This project uses a timer interrupt to perform PID processing for line patrol according to the value of the infrared probe (every 10ms), so that line patrol can be completed on a map with black lines and white background.
In app_irtrackin.c, there is a parameter for adjusting PID line patrol. If you want to increase or decrease the speed and optimize the effect, you can adjust the macro definition value inside.
x
//P//I//D
//Line patrol speedIRTrack_Trun_KP: P value of pid line patrol
IRTrack_Trun_KI: I value of pid line patrol
IRTrack_Trun_KD: D value of pid line patrol
IRR_SPEED: Speed of line patrol
When you want to check whether the motor wiring is correct, you can give a positive speed and then set the line patrol PID value to 0. If the wiring is correct, after pressing the key button on the RCT6 development board, the car will move forward and all four motors will move forward.
Experimental phenomenon:
On the premise of ensuring that the wiring and installation are correct, after the 8-way line patrol module is calibrated, press the key1 button to start line patrol. If the 8-way module probe cannot detect the black and white lines normally, you need to wait for the module to work normally before pressing the key1 button If the floor is black, you need to put a piece of white paper under our map to cover the black. The main reason is that the material of the map is relatively transparent, which has a greater impact on the 8-way line patrol sensor.