Welcome to 8-Channel Tracking Module repository
5.MSPM0-Wheeled car chassis_V1
MSPM0 National Competition Chassis Car
MSPM0 National Competition Chassis Car1. Experimental preparation2. Car wiring2.1 Wiring of MSPM0 and dual-channel driver board2.2 Wiring of MSPM0G3507 and infrared sensor (this example uses IO communication)Main proceduresExperimental phenomenon:
1. Experimental preparation
Knowledge reserve
Have good programming skills (mainly C language)
Familiar with the architecture of MSPm0
Material preparation
Smart car mini chassis *1
MSPM0G3507 core board *1
Yabo version of dual-channel motor driver board *2 (other motor driver boards may not be suitable for the source code provided in this tutorial, you need to transplant them yourself)
Eight-way tracking module *1
310 motor *4
7.4V battery *1
Several Dupont wires
Several M3 copper pillars and M3 screws
2. Car wiring
After the car is assembled, it is shown as follows

2.1 Wiring of MSPM0 and dual-channel driver board
Wiring of MSPM0G3507 and dual motor board (topmost board)
| MSPM0G3507 | The top dual-circuit motor board |
|---|---|
| PA13 | AIN1 |
| PA12 | AIN2 |
| PB6 | BIN1 |
| PB7 | BIN2 |
| 3V3 | 3V3 |
| GND | GND |
| PA14 | E1A |
| PA15 | E1B |
| PA8 | E2A |
| PA9 | E2B |
| 5V | 5V |
Wiring of MSPM0G3507 and dual-circuit motor board (bottommost board)
| MSPM0G3507 | The bottom layer dual-circuit motor board |
|---|---|
| PA27 | AIN1 |
| PA26 | AIN2 |
| PB9 | BIN1 |
| PB8 | BIN2 |
| 3V3 | 3V3 |
| GND | GND |
| PA24 | E1A |
| PA25 | E1B |
| PA21 | E2A |
| PA22 | E2B |
The top motor driver board is connected to the motors of the two wheels near the infrared sensor (the front motor),
motorA--->left motor, motorB--->right motor
The bottom motor driver board is connected to the motors of the two wheels far from the infrared sensor (the back motor),
motorA--->left motor, motorB--->right motor

2.2 Wiring of MSPM0G3507 and infrared sensor (this example uses IO communication)
| MSPM0G3507 | Infrared sensor |
|---|---|
| PA28 | X1 |
| PA31 | X2 |
| PA02 | X3 |
| PB24 | X4 |
| PB20 | X5 |
| PB19 | X6 |
| PB18 | X7 |
| PA07 | X8 |
| 5V | 5V |
| GND | GND |
MSPM0 developers need to build the environment before compiling and running the project Environment building tutorial: https://wiki.lckfb.com/zh-hans/dmx/beginner/install.html
Main procedures
xint main(void){ SYSCFG_DL_init(); Motor_PID_Init();//Motor pid initialization
//Wait for the infrared module to be normal delay_ms(1000); delay_ms(1000); delay_ms(1000); delay_ms(1000); //Clear the serial port interrupt flag NVIC_ClearPendingIRQ(MYUART_INST_INT_IRQN); //Enable serial port interrupt NVIC_EnableIRQ(MYUART_INST_INT_IRQN); init_motor();//Motor timer on
while (1) { //Using io LineWalking();//Line patrol pid }}
The main function is to perform PID processing for line patrol according to the value of the infrared probe, so that line patrol can be completed on the 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.
xxxxxxxxxx
//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 checking whether the motor wiring is correct, you can give a positive speed and set the value of line patrol PID to 0. If the wiring is correct, turn on the machine and wait for a while, the car will move forward, and all four motors will move forward.
Experimental phenomenon:
If the 8-way module probe still cannot detect the black and white lines normally, you need to press and hold the reset button of MSPM0, wait for the module to work normally, and then release the reset button On the premise of ensuring that the wiring and installation are correct, after the 8-way line patrol module is calibrated, (if the same map as the tutorial is used), you need to put the car under the starting point diagram as shown below, turn on the machine and wait for a while, and then you can start patrolling the line.
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.
