English / 中文
Are you still buying a DC brush motor drive module in about 3$? Are you still worried about the high noise in addition to the already low response speed and life? Allow me to present you our project, miniFOC---- a FOC brushless motor control scheme that can get you the most bang for your buck, for just 3 $! miniFOC has a built-in torque closed-loop controller so that you can control a brushless motor with a 3-wire UART port. The software and hardware design are fully compliant with the AGPL-3.0 open source license.
This open-source project aims to accomplish a FOC(Field Oriented Control) scheme that is operatable with minimum costs in China. The components selected in the example circuit are all manufactured in China. FOC possesses various advantages when it comes to controlling BLCD (Brushless Direct Current) motor; some of the benefits are as follows:
- FOC has no speed limit at all and can be accurately controlled at any speed
- FOC excels at its reversing performance, ensuring the smoothness of forward and reverse switching even when running at its highest speed
- FOC can also perform braking control in the form of energy recovery.
- FOC can achieve three closed-loop control of torque, speed, and position.
- FOC has significantly lower noise but much higher efficiency compared that of electric regulation
Although FOC has many advantages, its large amount of calculation and complex principles requires an expensive controller, which made FOC unpopular. After half a year’s research and iteration, I deeply optimized the part of the code that implements mass calculations and re-selected its components to fit the domestic supply chain. I hope this open-source project can help domestic developers use BLDC motors with excellent performance and contribute to the open-source community.
| Open source solution | miniFOC | simpleFOC | ODrive | FpOC |
|---|---|---|---|---|
| Microcontroller | CH32V203C8T6 | ATmega328P | STM32F405RGT6 | FPGA |
| Driver chip | BDR2L00 | L6234 | DRV8301 | MP6540 |
| PID loop frequency | 30kHz (max) | 830Hz (max) | 8kHz (typical) | 18kHz (typical) |
| Whether have current loop | Yes | No | Yes | Yes |
| Driving power | 400W | 120W | 960W | 90W |
| Cost price (approx.) | 20¥ | 100¥ | 300¥ | 150¥ |
As can be seen from the table above, the scheme adopted by miniFOC can achieve high performance at low cost. At the same time, due to the re-selection according to the domestic supply chain, the selection of devices is not so limited, and there are many alternatives. amid the chip shortage in 2023, the cost of FOC still can be controlled at about 3$, which further proves the degree of cost optimization and the great potential of the project.
- Input voltage range: 6V ~ 24V (you can modify the circuit according to the tutorial here to adapt to higher voltage).
- Maximum driving current: 30A (you can modify the circuit according to the tutorial here to achieve greater driving current).
- Detailed parameters of FOC: Current loop close loop control, SVPWM (Space Vector Pulse Width Modulation) is adopted.
- Communication parameters: UART baud rate is 115200, and Mid Capacity Data Transmit Protocol is used for data transmission.
- Microcontroller parameters: RV32IMAC core, 144MHz frequency, 64KB FLASH, 20KB SRAM.
- Using space vector pulse width modulation
- Torque control without current sensor
- Rotational speed closed loop control
- Rotation angle closed loop control
- Automatic phase sequence detection and correction
- Current loop closed loop control
- Sensorless FOC algorithm
- EDA Tool: KiCAD 7.0.5 (VC++ 1936, 64bit)
- Compiler tool chain: riscv-none-embed-gcc 8.2.0
- Programming tool: OpenOCD 0.11.0+dev-gfad123a16- (2023-05-05-13:43)
- Integrated development tools: CLion 2023.1.3 #CL-231.9011.31
- Software development tools: Qt 5.14.2 (MinGW 7.3.0 64bit)
- Operating system and tool chain:
- Win10 + MinGW + CLion + riscv-none-embed-gcc + OpenOCD
- Ubuntu22.04 + make + cmake + riscv-none-embed-gcc + OpenOCD
Please refer to the wiki page of this project for getting started.
You can visit Github Page to learn about the usage of functions and variables in the code.
Please report bugs and request features using the Issue Tracker and follow these request:
- Please check if an existing Issue contains your question or request before posting it.
- The discussion of non-running bugs can be started in Discussion.
The source code is released under a AGPL-3.0 License.
Affiliation:AcmeTech
Author: Zhu Yanzhen
Maintainer:YanzhenZhu, 2208213223@qq.com
The product has been tested under Windows 10 and Ubuntu 18.04 and 20.04. This is research code, expect that it changes often and any fitness for a particular purpose is disclaimed.