STM32 learning-hardware design of two-wheeled balancing trolley

Component selection: select components for each part of the circuit that you need. Generally speaking, it is mainly to choose which type and what package chip. For some relatively special circuits, even common passive components such as resistors and capacitors need to be carefully selected However, some high-precision or very high-speed circuit parts are not required in the circuit of the balance car. Therefore, the following mainly introduces how to choose the main chip of each circuit part.

This article first writes the initial circuit design, and then will update the subsequent code writing and trolley debugging.

The basic process of circuit design is generally as follows: demand analysis-component selection-schematic design-PCB design-welding and debugging.

Demand analysis: Here, it is mainly to determine which modules, peripherals or interfaces the car needs. First of all, the minimum stm32 system is a must, which is the core of car control. Then the two wheels of the trolley require two H-axle drives and encoder interfaces. A gyroscope is needed to sense the attitude of the car (including tilt angle, steering angle, angular velocity, etc.). Need some peripherals for debugging and indication (buzzer, LED, etc.). A power circuit is required to power the system. The battery voltage acquisition circuit is needed to collect the battery voltage in real time, make a low-voltage alarm, and prevent the battery from over-discharging. Need to download the interface and the serial port for debugging. Basically, according to the functions you want to achieve, and then determine which parts of the circuit are needed.

Component selection: select components for each part of the circuit that you need. Generally speaking, it is mainly to choose which type and what package chip. For some relatively special circuits, even common passive components such as resistors and capacitors need to be carefully selected However, some high-precision or very high-speed circuit parts are not required in the circuit of the balance car. Therefore, the following mainly introduces how to choose the main chip of each circuit part.

1. Minimal system: Considering that the main control board of the car can be used as the basic circuit for four-axis or other more advanced robots in the future, the main control chooses stm32F405RGT6. This main control is M3 core, and the main frequency can reach 168M. There are abundant peripheral resources available, and the performance is very powerful, which is very suitable for future development and expansion.

2. Motor drive: The two wheel motors of the trolley need two H-axle drives. The choice of drive is closely related to the parameters of the motor. The normal working current of the motor I chose is 360mA, and considering that the car will not turn around under normal conditions, and in order to minimize the area of ​​the PCB board, I chose Toshiba’s motor drive chip TB6612, which has Two integrated H bridges can drive two motors at the same time, each H bridge can continuously output 1.2A current, the PWM frequency can reach 100kHz, the chip’s power supply voltage can reach 15V, suitable for 3S battery power supply, and the chip is packaged Very small, saving PCB area.

3. Power circuit: Mainly consider input voltage, output voltage, output current, etc. The car battery uses a 3S lithium polymer battery with a discharge rate of 25C, and it can be used as a four-axis in the future. The full battery voltage is about 12.6V, and the circuit needs 5V and 3.3V power supplies. Therefore, you need to choose two chips to step down the 12V voltage to 5V, and then step down the 5V to 3.3V. For 12V-5V chips, you can choose MPS’s DCDC step-down chip MP2482, which supports a maximum current output of 5A, a maximum voltage input of 28V, and an adjustable voltage output from 0.8 to 25V, which meets the needs. 5V-3.3V uses the common AMS1117-3.3.

4. Gyroscope: MPU6050 module is selected, the module comes with a software filtering algorithm, and uses a serial port to output data. In the case of 115200 baud rate, it can output 100 frames of data per second.

STM32 learning-hardware design of two-wheeled balancing trolley

Schematic design:

1. Minimal system: Including stm32f405rgt6, crystal oscillator circuit, reset circuit. R2 and R3 are used to configure the startup mode. C9 and C12 are the filter capacitors of the internal power conversion part of the microcontroller. The minimum system is basically the same, and there is generally nothing wrong with the commonly used circuit design. For the decoupling capacitors of the several capacitive chips, pay attention to the isolation of the analog voltage, analog ground, digital power supply, and digital ground with magnetic beads to prevent the high-frequency noise of the digital circuit from affecting the accuracy of the analog circuit.

STM32 learning-hardware design of two-wheeled balancing trolley

2. Power supply circuit: R22 and R23 divide the battery voltage to 1.2V and connect it to the ADC pin inside the microcontroller to monitor the battery voltage to prevent over-discharge.

STM32 learning-hardware design of two-wheeled balancing trolley

3. Motor drive and encoder circuit: Basically, it is designed according to the reference circuit on the chip datasheet. Pay attention to the decoupling of the power supply. Because the voltage and current of the motor are high, it is easy to affect other circuits through the power supply network.

STM32 learning-hardware design of two-wheeled balancing trolley

4. Gyroscope: integrated module, nothing to say, just connect the pin to the microcontroller, simply connect the power pin and a capacitor to do power decoupling (it’s OK if you don’t, because the module has already been done) ).

STM32 learning-hardware design of two-wheeled balancing trolley

5. CAN communication: CAN communication is not used in the car, but CAN communication is widely used in current robot design. In addition, we have to learn something when we make a car, and we need to adjust it to learn more knowledge. Why not do it? The chip used for CAN communication is Philips’ TJA1050, which is a CAN transceiver. The stm32 integrates a CAN controller. R4 is an impedance matching resistor. There are and only two nodes welded to this resistor in the entire CAN communication network, and the resistance value is 120 ohm. Now I haven’t studied the related knowledge of CAN communication in depth, so let’s study it in detail when debugging CAN communication in the future.

STM32 learning-hardware design of two-wheeled balancing trolley

6. Debugging circuit and other interfaces: SWD download interface, USART debugging serial port, Bluetooth interface (according to the selected Bluetooth module to determine the purpose of different pins of the interface, such as enable pin, status input pin, etc., when writing Bluetooth later in detail describe). The buzzer and two-color LED lights are used for debugging and indication. In addition, several timer pins are brought out, which can be reserved for extended use.

STM32 learning-hardware design of two-wheeled balancing trolley

PCB design: I won’t go into details, the project file is in the attachment. Matters needing attention mainly include power supply decoupling (for specific methods, please refer to my previous blog post on power supply decoupling), line width control (high current traces should be as wide as possible), and the layout and wiring of switching power supplies (generally remember three points Just fine: First, the SW signal of the chip is a high-voltage, high-frequency switching signal, which will cause serious interference to other circuits. Keep away from sensitive circuits as much as possible. Second, the feedback network is a very sensitive network. Interference. The third is that the current of the power supply is relatively large. Pay attention to the line width and the number of vias, the aperture, etc., to ensure the ability to pass such a large current. Pay attention to these three points, the integrated DCDC circuit generally has no problem), etc.Post here the 3D renderings of the front and back sides of the board

STM32 learning-hardware design of two-wheeled balancing trolley

STM32 learning-hardware design of two-wheeled balancing trolley

Welding and debugging: Not much to say, usually practice more, and the packaged components of 0603 QFP can be easily handled. When welding, first weld the power supply part. If there is no problem with the power supply, then weld the other parts. Otherwise, if there is a problem with the power supply, the whole board will be completely welded. . A picture of the welded and debugged physical object is posted below.

STM32 learning-hardware design of two-wheeled balancing trolley

STM32 learning-hardware design of two-wheeled balancing trolley

Well, let’s write something like this first.The comparison written above is to sway the hammer and sing the system to raise the accompaniment of the acquaintance of the acquaintance of the fascinating cloth of the fascinating sorrow of the cloth 電飞杓Pupiao screen ≈ Dong Umbrella V Huang Qiao M about the lotus 杓Pu 駠槠槠宓宓宓宓宓宓宓宓宓Ran Bing, low, Che Tun, spine, spine, spine, sorrow, Fu, Yohe, guide, awaken, awaken, imperial, choke, beech, suffocation, falcon, splendid, lip, yo, co-exist, na, sprout, more and more, malpractice, consolation, sorrow Strontium Strontium Strontium Strontium Strontium Tetrachon

The Links:   2MBI200VB-120 6MBI100FA-060

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *