A brushless DC motor controller with DRV8350RS gate driver, three-phase current sampling, and SPI absolute position encoder implementing FOC torque control.
- 3 phase brushless DC motor controller
- input voltage: 12 - 50 V
- maximum current: 10 A without heat sink, 50 A with heat sink
- temperature: 0 - 70 ℃
- PWM frequency: 40 kHz
- current loop frequency: 20 kHz
- PID position and velocity loop frequency: 4 kHz
- communication: CAN 2.0
Warning These files are still under development and undergoing testing. While we do aspire to produce a design that others can easily fabricate, we do not yet recommend making them for yourself!
Go to motor_controller_conf.h
and set FIRST_TIME_BOOTUP
to 1. Upload the program to the board, and then power-cycle the board.
The MCU should configure the Flash option bytes to boot from Flash regardless of the BOOTx pin mode.
Set FIRST_TIME_BOOTUP
to 0 and reflash the program.
Set LOAD_ID_FROM_FLASH
, LOAD_CONFIG_FROM_FLASH
, LOAD_CALIBRATION_FROM_FLASH
, and SAFETY_WATCHDOG_ENABLED
to 0. Upload the program to the board to update contents in the user settings section in Flash. Selet the correct motor type in "Motor Selection" section.
Then, set LOAD_ID_FROM_FLASH
, LOAD_CONFIG_FROM_FLASH
, and LOAD_CALIBRATION_FROM_FLASH
. Run calibration to get the correct calibration data.
For deployment, set SAFETY_WATCHDOG_ENABLED
to 1.
The controller is disabled.
The motor is disabled.
All low side MOSFETs are opened, and the motor phases are shorted to ground. The motor have high impedance.
It's a good idea to switch to this mode before switching back to idle mode to avoid sudden collapse of the robot.
The motor performs self-calibration.
Closed-loop current control. User sets controller.current_controller.i_q_target
and controller.current_controller.i_d_target
.
Closed-loop torque control. User sets controller->torque_target
.
Closed-loop velocity control. User sets controller->velocity_target
.
Closed-loop position control. User sets controller->position_target
.
Open-loop phase voltage control. User sets controller->v_a_setpoint
, controller->v_b_setpoint
, and controller->v_c_setpoint
.
Open-loop alpha-beta frame voltage control. User sets controller->v_alpha_setpoint
and controller->v_beta_setpoint
.
Open-loop d-q frame voltage control. User sets controller->v_d_setpoint
and controller->v_q_setpoint
.
For debugging.
TBD. Still need to be finalized.
Emergency stop.
contains device id and version
device_id = data[7:0]
firmware_version = data[63:32]
safety watchdog heartbeat message.
write: [torque_limit, position_target]
read: [torque_measured, position_measured]
write: [position_ki, position_kp]
read: [0, velocity_measured]