This repository implements Field Oriented Control (FOC) for BLDC motors in Matlab/Simulink. The controller was deployed and tested on a real-time hoverboard embedded platform:
The FOC architecture includes:
- Estimations: estimates the rotor position, angle and motor speed based on Hall sensors signal
- Diagnostics: implements error detection such as unconnected Hall sensor, motor blocked, MOSFET defective
- Control Manager: manages the transitions between control modes (Voltage, Speed, Torque)
- FOC Algorithm: implements the FOC strategy
- Control Type Manager: Manages the transition between Commutation, Sinusoidal, and FOC control type
The FOC algorithm architecture is illustrated in the figure below:
In this implementation 3 control types are available:
- Commutation
- SIN (Sinusoidal)
- FOC (Field Oriented Control) with the following 3 control modes:
- VOLTAGE MODE: in this mode the controller applies a constant Voltage to the motors.
- SPEED MODE: in this mode a closed-loop controller realizes the input speed target by rejecting any of the disturbance (resistive load) applied to the motor.
- TORQUE MODE: in this mode the input torque target is realized. This mode enables motor "freewheeling" when the torque target is
0
.
The C code for the controller is capable for auto-code generated using Matlab/Simulink. The controller is designed for stock hoverboard motors with the motor windings construction as shown here. However, with slight modifications, the controller can be adapted to other available BLDC motors.
To explore the controller without a Matlab/Simulink installation a webview was created. The webview allows to visualize the controller with browsers like: Microsoft Internet Explorer or Microsoft Edgeview.
The controller parameters are given in the following table:
Every contribution to this repository is highly appreciated! Feel free to create pull requests to improve this repository as ultimately you are going to help everyone.
If you want to donate to keep this repository updated, please use the link below: