aerobotics

FOC_stm32f103CBT6 main control board_copy_xkb

 
Overview

# ** FOC brushless driver ** Design/Learning Record
##:
[IMG2022102104727.jpg] ! [IMG20210221214744.jpg] ! [IMG2022102105616.jpg]! pg]
## Function requirements:
- Able to realize single-channel motor foc control
- Able to adapt to a variety of position sensors
- Able to receive instructions from the host computer to achieve passive control
- Able to independently perform multi-mode active control
- There is a screen to display some status parameters of the motor operation

## Hardware design:
main control board and The separate design of the power board makes it easy to replace and test, and can be used for some expansion. The common signal pins of the main control board and the power board are connected through pin headers/female headers, and the two boards are assembled and reinforced through copper pillars.

**Main control board:**
![Main control board.png] MCU uses stm32F103CBT6. The connection interface with the power board includes three complementary PWM signal IOs, 4 adc channel IOs (two-phase current, bus current, power supply voltage), and GND/5V pin. External connection interfaces include screen spi communication port, magnetic encoder spi interface/IIC interface, ABZ encoder interface, reset button, function button, download debugging interface, and host computer communication interface. Carrying an LDO reduces the 5V power supply of the driver board to 3.3V, and the 5V is used to power the sensor.
- [x] MCU core circuit: crystal oscillator, boot, reset button
- [x] Public interface pin header: three complementary pwmIO, 4 adc sampling IO, GND/5V/3.3V
- [x] spi magnetic encoder interface
- [x] TFT screen interface
- [x] Software IIC encoder interface, add an IO so that it can be reused as ABZ encoder interface
- [x] Function button
- [x] Download debugging interface: swd download, uart1 debugging
- [x] One UART host computer communication interface
- [x] One LED system indicator light, one power indicator light



**Power board:**
![Driver board schematic diagram.png] Three-phase inverter, six-way pre-drive, power supply The voltage is divided for main board collection, ab phase current collection (plus bias voltage), bus current collection, DC-DC step down to 5V for supply to the main control board. In addition to power supply and output, the external interface also requires LED indicators and power switches.
- [x] Three H half-bridges
- [x] pwm pre-driver
- [x] Power supply voltage divider for adc collection
- [X] Bus current operational amplifier, ab phase current operational amplifier plus bias voltage
- [x] DC -DC step down to 5V
- [x] ldo step down 5V->3.3V
- [x] Public interface female socket
- [x] Power LED indicator, bus current LED indicator (indicates whether the three-phase inverter is Output)
- [x] Power switch

**Three-phase inverter:**
![Three-phase inverter circuit.png] uses the pre-driver **FD6288** with integrated three-way half-bridge driver, and the sampling resistor is placed below Half-bridge, using a low-end sampling scheme. The mos can withstand 40V voltage and 120A current, but the PCB layout and wiring of the first generation board cannot withstand too much current and is not suitable for testing high-power motors (because of the separate main drive design, you only need to ensure that the interfaces are consistent. Consider redesigning a PCB later. ).

**Current sampling operational amplifier:**
![Current sampling.png] uses a chip integrating four operational amplifiers to reduce the size of the pcb. One operational amplifier is used as a voltage follower to generate the bias voltage Vref required by the current sampling operational amplifier. The two operational amplifiers collect AB phase current. Because there is a bias voltage Vref, they can collect positive and negative currents. The last op amp collects the bus current.

**Encoder: **
The encoder uses the as5600 magnetic encoder chip, and the IIC and pwm interfaces are led out. The final program uses the IIC communication method. Personal use does not feel good, and there will be occasional angle fluctuations.

**Hardware problems:**
- The B-phase circuit sampling op amp output (whether driving the motor or not) is one value higher than the theoretical value (0.01xN volt). After current calculation, it is equivalent to 1A higher than the actual current value. The reason is not yet known (it is suspected to be a PCB design flaw). We temporarily rely on programming to eliminate this deviation. Moreover, the operational amplifier has large interference and cannot meet the current loop design requirements.
- The bus current indicator light on the driver board is of no use. The actual voltage is not enough when driving with a small current, and it will not light up at all (the original idea was that the LED brightness changes as the current changes (⊙x⊙;)
- Because the main The control board will be installed on the driver board, so the power switch designed on the driver board will be blocked, making it inconvenient to switch the power supply on and off. It should be designed as a side sliding

switch
Open source case and **simplefoc** solution, using the peripheral driver configured by cubemx, and finally combined with the board I made to type a set of code. Since I am a relatively newbie, the overall code looks a bit messy, and there are also potential Unreasonable design. In short, the level needs to be improved.

Due to the defects of hardware current sampling, the current loop was not successfully debugged. Currently, only the speed position closed loop through control voltage is implemented.

## Summary:
Initial foc learning. The stage has come to an end. I am very grateful to the blog tutorials of the big guys on the Internet and the explanations of the big guys in the large technical exchange group. Otherwise, it would be really difficult to learn it alone. Now I have a preliminary understanding of FOC. Later, I will learn some theoretical knowledge of FOC in depth, and then redesign a set of software and hardware to further improve FOC design capabilities.

## References:
参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-06-19 12:36:16

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号