念慈菴

[Lichuang Development Board] Smart car driver board

 
Overview

# 1. Project function introduction

Liangshanpai smart car based on GD32F450ZGT6

# 2. Project attributes

Liangshanpai smart car is equipped with two LED lights in the front, one on the left and one on the left, which can be used to simulate the state of the car lights while driving; Liangshanpai smart
car The smart car has two independent buttons, KEYS and KEYM, which can be used to start and switch between sports modes;
the Liangshanpai smart car is equipped with a buzzer, which can be used to sound an alarm when encountering obstacles, and can also use a timer to change its The output frequency allows it to play music;
the Liangshanpai smart car is equipped with four motor drives and four N20 motors, which can realize PWM output and speed adjustment functions;
the Liangshanpai smart car is equipped with five-channel infrared tracking, which can be used to follow black lines , learn the use of the comparator circuit to realize the tracking function; the Liangshan Pai smart car is equipped with the HCSR04 ultrasonic module interface circuit, which can realize the ultrasonic obstacle avoidance function by learning the module principle and the underlying driver code; the Liangshan Pai smart car uses
the HCSR04 ultrasonic module interface circuit on the development board.
The ADC function detects the power of the smart car, which is convenient for us to charge in time;
the Liangshanpai smart car provides an HC-05 Bluetooth module interface circuit, which can be used with the mobile phone Bluetooth APP to realize the function of wireless remote control of the car;
the Liangshanpai smart car provides a camera module interface circuit. Can be used to learn camera recognition related knowledge;

# 3. Open source protocol

GPL 3.0

# 4. Hardware part

## 1. Main control chip:

![image.png] uses GD32F450ZGT6 microcontroller, all interfaces are reserved, please pay attention to the power supply of 3.3V.
![image.png] Because I bought the Lichuang Liangshan development board directly from participating in the training camp, so the driver board can be used as an interface directly and plugged directly into the pin header and female header, which is completely OK.

## 2. Power supply voltage reduction circuit:

![image.png] Analyze the power supply circuit of the smart car system. By consulting the chip manual and the schematic diagram of the Lichuang Liangshanpai core board, we know that the maximum power supply of the motor drive chip RZ7899 The voltage does not exceed 25V. The Lichuang·Liangshanpai core board is powered by 3.3V (compatible with 5V), the ultrasonic module is powered by 5V, and the other peripheral modules are powered by 3.3V. Based on this demand, we can start selecting the power supply. Here I chose a 7.4V rechargeable lithium battery.
  The power input interface P3 is a battery holder, through which two 3.7V lithium batteries are connected to power the car. After the power comes in, it passes through an SSP7603 step-down chip. The maximum input voltage of the step-down chip is 15V. It can output a fixed 5V voltage to provide power to the microcontroller and peripheral devices. The motor driver chip is directly powered by a 7.4V battery. Among them, D1 is a Schottky diode, model number is SS43. Its function is to prevent the positive and negative poles of the power input terminal from being connected reversely, which plays a protective role. LED1 is the power working indicator light. When the power switch SW1 is turned on, the system turns on the power supply and LED1 will be lit. C1 and C2 are 10uF capacitors. Their main function is that the current may be relatively large when the power is turned on. Using capacitors can act as a buffer.

## 3. Motor drive circuit

! [image.png]   First of all, we all know that the IO port current of the microcontroller itself is very limited. If the motor is directly connected to the IO port of the microcontroller, it will not be able to drive the motor to rotate normally, so we must use The motor driver chip drives our motor set. Here I choose the RZ7899 motor driver chip. RZ7899 is a DC bidirectional motor drive circuit, suitable for automatic valve motor drive, electromagnetic door lock drive, etc. The circuit has good anti-interference performance, small standby current, low output internal resistance, and it also has built-in diode capability. Release the reverse inrush current of inductive loads.
  It controls the forward, backward and braking of the motor through two logic input terminals BI and FI. We connect BI and FI to the IO of the microcontroller. By changing the level of the I/O port of the microcontroller and thereby changing the level of the output pin of the chip control end, we can control the forward and reverse rotation, stop and brake of the motor. The control principle is very It is simple, very convenient to use, and can also meet the large current requirements of DC motors.
  When debugging the code, we can refer to the following pin function table and input and output truth table for debugging. As long as we connect the BI and FI pins to the timer channel pin of the microcontroller, we can combine the timer PWM output function of the microcontroller to control the motor speed, thereby changing the speed of our smart car.
![image.png]
## 4. Tracking circuit

![image.png]  The design of the tracking circuit takes advantage of the principle that infrared light has different reflection levels when encountering different colors of ground. The tracking circuit is designed using an LM393 voltage comparator and an ITR9909 infrared pair tube, in which an infrared transmitter tube and an infrared receiver tube are integrated inside the ITR9909. The working principle of tracking is to connect pin 1 of the voltage comparator to the pin of the microcontroller, and configure the IO to input mode. When pin 1 of the voltage comparator outputs a high level, it means that the infrared light is absorbed and a black line is detected. , the LED1 indicator lights up, and the microcontroller IO reads high level.
**Principle of infrared tracking: Use the reflection of infrared light in different colors for identification**

* The principle of detecting black lines is that the infrared transmitting tube emits light to the ground. When the infrared light encounters the white ground, it is reflected, and the infrared receiving tube After receiving the reflected light, it outputs a low level after passing through the voltage comparator.
* The principle of detecting black lines is that the infrared transmitting tube emits light to the ground. When the infrared light encounters the black ground, it is absorbed. The infrared receiving tube does not receive the reflected light and outputs a high level after passing through the voltage comparator.

## 5. Obstacle avoidance circuit

The obstacle avoidance circuit uses the ultrasonic HC-SR04 module. The type of this module can be selected and purchased by yourself. The following is a physical picture.
![image.png] The following is the ultrasonic module interface on the smart car expansion board.
![image.png] The principle of ultrasonic ranging is that the ultrasonic transmitting device emits ultrasonic waves, and starts timing while transmitting the ultrasonic waves. The ultrasonic waves propagate in the air, and when they encounter obstacles while propagating, a signal will be returned to the ultrasonic receiver. , the ultrasonic receiver stops timing immediately after receiving the signal. At this time, there will be a time t, and the speed of ultrasonic waves propagating in the air is 340m/s. Through the formula s=340 xt / 200, the distance to be measured can be calculated as How many.
**Working principle of HC-SR04 ultrasonic ranging module**

* Working voltage: DC 5V;
* Use I/O port trigger mode to measure distance, and send a high level signal of at least 10us through the microcontroller to the Trig pin of the ultrasonic module. Use Used to trigger the operation of the ultrasonic module;
* The transmitting probe of the module will automatically send 8 40KHz square wave signals and automatically detect whether there is a signal return;
* If there is a signal return, the I/O port connected to the microcontroller through the Echo pin will output a high level , the high-level duration is the time from emission to return of the ultrasonic wave;
* According to the propagation speed of sound in the air is 340 meters/second, the measured distance can be calculated.

The following figure is the working timing diagram.
![image.png]
## 6. Other circuits

### 6.1 LED car lights and button circuit

#### (1) LED car lights:

One end of the LED light is connected to the IO port of the microcontroller, and the high and low levels of the IO of the microcontroller are passed To control the LED lights, two driving methods are designed here. The circuit of the LED car light is lit at a low level, and the circuit of the button indicator light is lit at a high level. The size of the resistor can be combined with the required brightness of the light and Ohm's law calculations. For example, if the button indicator here does not need to be too bright, the resistance should be 1KΩ, and if the LED lights need to be brighter, the resistance should be 100Ω, which is smaller.
![image.png]
#### (2) Button circuit:

The circuit design principle of the independent button here is to connect one end of the button to the IO port of the microcontroller and the other end to ground. When the button is pressed, a low level is read; When the button is released, a high level is read. Note that when configuring the IO port here, it needs to be configured as a pull-up input. Of course, you can also add a pull-up resistor to pull the level of the IO port high, so there is no need to configure it as a pull-up input.
![image.png]
### 6.2 Buzzer and ADC voltage acquisition circuit

#### (1) Buzzer circuit:

The buzzer used here is an active buzzer, and the active buzzer automatically With a vibration source, it will chirp as soon as it is powered on. The principle of the circuit designed here is to use a PNP type transistor to act as a switch. By adjusting the high and low levels of the IO port of the microcontroller, the effect of controlling the buzzer is achieved. The reason why a triode is used is because we all know that the current driving capability of the microcontroller is relatively small, and the direct drive device cannot work properly, so the emitter of the triode is used to guide the current into the collector, instead of directly adding the IO port of the microcontroller to the buzzer. superior.

* When the IO port outputs a high level, the emitter voltage is not much greater than the base voltage, the transistor is not turned on and is in a cut-off state, and the buzzer does not make a sound;
* When the IO port outputs a low level, the emitter voltage is much greater than the base voltage. The transistor is turned on, current flows from the emitter to the collector, and the buzzer sounds.

![image.png]
#### (2) ADC voltage acquisition circuit:

First of all, before we use the ADC, we need to know its number of digits, that is, its accuracy. You can check from the data sheet that our ADC is 12-bit.

* So how to convert the value measured by ADC into a voltage value to determine the current battery level? To understand this principle, we need to know what the 12-digit value of 4095 we calculated here means. Assuming that the maximum voltage is 7.4V, then the value measured by the ADC is the maximum value 4095. When the access voltage is GND, which is 0V, the value measured by the ADC is 0. Therefore, we can calculate the slope of the function, so that we can find the function of the ADC sampling value, and then know the voltage value corresponding to any ADC measurement value.
![image.png] * The circuit schematic diagram of the ADC is as follows. Here, the ADC is measured in the form of resistor voltage division, because the IO port can be compatible with a maximum of 5V. If it exceeds 5V, the IO port will be burned out. A 20K resistor is used directly. The size can be calculated based on the IO port level. After dividing the voltage, it should not exceed the voltage tolerated by the IO port. Choose an appropriate value. Next, I will show you how to convert the ADC value and voltage value through calculation.
![image.png] ![image.png]
参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2024-11-24 22:01:09

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号