EmanuelFeru 3c8a035b2e Updates on BLDC controller
- added possbility to switch the Control mode while motor is spinning
- added support for Cruise control: activated by b_cruiseCtrlEna, where the target to set is n_cruiseMotTgt. (Needs small aditional handling on the application firmware to set the n_cruiseMotTgt properly to the current operation speed, immediately after activation via b_cruiseCtrlEna).
- extended Phase current measurements z_selPhaCurMeasABC : {iA,iB} = 0; {iB,iC} = 1; {iA,iC} = 2
- added interface for external motor angle measurement from as sensor, e.g., encoder. The selection can be done via b_angleMeasEna.
2020-10-11 20:58:03 +02:00
2020-10-11 20:58:03 +02:00
2020-10-11 20:58:03 +02:00
2020-09-01 17:38:14 +02:00
2020-09-01 17:38:14 +02:00
2020-09-01 17:38:14 +02:00
2020-09-01 17:38:14 +02:00
2020-10-11 20:58:03 +02:00
2020-09-01 17:38:14 +02:00
2020-10-11 20:58:03 +02:00

bldc-motor-control-FOC

License: GPL v3 paypal

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:


FOC Architecture

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

FOC architecture

The FOC algorithm architecture is illustrated in the figure below:

FOC algorithm

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.

Schematic representation of the available control methods

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.

Parameters

The controller parameters are given in the following table:

Parameters table


Contributions

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:

paypal


Description
Field Oriented Control (FOC) for BLDC motors
Readme GPL-3.0 22 MiB
Languages
C 74.2%
MATLAB 25.8%