Assembly and wiring of stm32 car

1.Experiment preparation

  1. Material preparation

2.Car wiring

After the car is assembled, as shown in the figure below.

01

02

2.1 Stm32 and dual driver board wiring part

  1. Wiring of stm32F103RCT6 and dual motor board (top board)

STM32RCT6The top two-way motor board
PA11BN1
PA8BN2
PC6AN1
PC7AN2
3.33V3
GNDGND
PA0E2A
PA1E2B
PA15E1A
PB3E1B
  1. Wiring of stm32F103RCT6 and dual motor board (lowest board)

STM32RCT6The bottom two-way motor board
PB0BN1
PB1BN2
PC8AN1
PC9AN2
3.33V3
GNDGND
PA7E2A
PA6E2B
PB7E1A
PB6E1B
  1. The motor drive board on the top layer is the motor of the two wheels (that is, the front motor) that is connected to the electromagnetic sensor.,

    motorA--->right motor、motorB--->left motor

  2. The motor drive board at the bottom is connected to the two-wheeled motors away from the electromagnetic sensor (that is, the motor at the back),

motorA--->right motor、motorB--->left motor

03

2.2 Wiring of STM32F103RCT6 and infrared sensor

STM32RCT64-way line inspection sensor
PA5S1
PA4S2
PA3S3
PA2S4
3.3VVCC
GNDGND

2.3 Wiring of STM32RCT6 and k210

STM32RCT6k210
PA9RXD
PA10TXD
VCCVCC
GNDGND

At this point, the assembly and wiring of the car is over.

3.Follow the line driving

Flash the STM32_K210_AI.hex file in the stm32 source code provided in this tutorial to the assembled car. The car can drive on the black line(To flash the program to the car through the serial port), This series of tutorials only provides the source code of the stm32 car part. If you only need a small part of the functions in it, you can transplant it into the source code.

3.1 Main source code analysis

The above is a simple line inspection function. After initializing the 4-way line inspection module and the motor, call this function in the while(1) loop to realize the car line inspection

3.2 Experimental effect

04

The car will be able to patrol the line normally, and will stop when it hits the stop line.