2OEn3baMo

【LiChuang Development Board】Balancing car design based on LiChuang Liangshan School

 
Overview

Design demonstration video of a balancing car based on LiChuang Liangshan School
: The result of the 2023 winter vacation - balancing car_bilibili_bilibili
Items to buy:
1. 7.4V 1400mah 18650 lithium battery (the capacity can be different, the voltage requirement is greater than 6V. When choosing a high-voltage battery, the decoupling capacitor at the power input end needs to be replaced with a capacitor with a high rated voltage).
2. N20 motor (with encoder) x2 (6V 310 rpm).
3. Bluetooth module (this time using Huicheng HC-04 Bluetooth module).
4. LiChuang Liangshan School.
5. 7.4V lithium battery charger.
6. Welding and debugging tools: welding gun, solder; computer, mobile phone, multimeter, etc.
Hardware part
1. Power
supply Motor power supply: Since I have a 7.4V 1400mah 18650 lithium battery in my hand, this design uses this battery. Since the N20 motor used is 6V, the 7.4V voltage needs to be reduced to 6V. The circuit is as follows:
The buck chip used in the figure is MT2492, and the output voltage is changed by changing the resistance values ​​of R3 and R4. The FB pin is 0.6V. Output voltage = 0.6* (R3+R4)/R4.
Development board power supply: When designing, considering that the input voltage of the buck chip on Liangshanpai cannot be too high, the battery voltage cannot be directly added to the 5V voltage of the board. Therefore, a buck circuit is needed. The reason why the motor power supply is not used is that it is worried that the motor will affect the development board when it starts, so an additional 7.4V to 5V buck circuit is added. The circuit is as follows:
MPU6050, Bluetooth, encoder power supply: The buck circuit on the Liangshanpai development board is a DC/DC power supply with large ripple. I am worried that the ripple will affect the chip and cause large data fluctuations, so I use a low-ripple LDO power supply AMS1117 voltage regulator. The circuit is as follows:
2. The MPU6050 module
circuit is as follows:
The MPU6050 is used to take the attitude angle and acceleration of the balancing car.
3. The motor driver module
uses the TB6612FNG chip. The power supply voltage is 2.5~13.5V, the average current of the H-bridge output is 1.2A, and the maximum can reach 3.2A. Built-in overheat protection and low voltage detection shutdown circuit, the frequency of PWM control can reach 100kHZ. The application is basically similar to DRV8833, but the performance is better and the price is relatively high. The circuit is as follows:
4. Bluetooth module
The Bluetooth module uses the HC-04 of Shihuicheng. This company has corresponding Android Bluetooth APP and Bluetooth serial port assistant for easy debugging. Official website: Guangzhou Huicheng Information Technology Co., Ltd. (hc01.com)
5. The main control is Liangshanpai GD32F450.
Lichuang Liangshanpai development board is based on GD32F450ZGT6, a national open source development board with rich resource interfaces, complete supporting video tutorials, document tutorials, and experimental cases. Provide online compiler, 10 minutes quick start. Open source technology iteration, project-based learning, make learning more in-depth, and sublimate creativity.
Software part
1. MPU6050 data reading.
2. Encoder speed measurement.
3. Serial communication.
4. Battery power detection.
5. N20 motor drive.
The code is as shown in Attachment 5. The finished picture of the
hardware debugging
circuit board is as follows:
Note: When using Bluetooth, connect the two jumper caps.
Problems encountered in hardware debugging:
1. The battery charging interface does not match the charger. You can buy a matching charger again, but it is a bit expensive, so a charging interface that matches the charger is welded on. Because it does not match the original circuit board, a pin is not welded on the circuit board, resulting in failure to charge. After inspection, it was found that the unconnected pin was the GND of the charging interface. The problem was solved by a pin header (similar to a flying wire).
2. I bought a fake MPU6050, and the self-test has been unsuccessful. After removing the self-test, the data obtained varied between -180 and 180, which was completely wrong. So I bought a new chip. The problem was solved.
After verification. There is no problem with the circuit.
 
PID debugging
can be wired or wireless.
Wired debugging: Connect the computer through the serial port on the development board, enter the corresponding command in the serial port assistant on the computer, and change the value of PID. This method is more troublesome. It is not recommended.
The instructions are as follows:
I chose wireless debugging, communicated with the balancing car through the mobile phone Bluetooth APP, and changed the values ​​of KP, KD, and Ki. When debugging, be sure to cancel the information printing function comments in the following main.c file.
The mobile phone Bluetooth APP is Huicheng's HC Bluetooth Assistant. The PID debugging interface of the mobile phone Bluetooth APP is set as follows:
The control interface of the mobile phone Bluetooth APP balance car is set as follows:
The PID debugging steps of the balance car can refer to a UP host of Bilibili: HZ12I38.
 
参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-06-23 08:35:47

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

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号