Regenerative Braking

Hi everyone interested in the regenerative braking topic!

Some progress on this:

I have implemented a first version of the code that allows control of the FETs in the ways discussed.

I’ve implemented it into the API, and into the hardware drivers for STM32 and RP2040 so far. Other MCU types will gradually follow once we confirm it works as expected.

Note that on STM32 this works with Software 6-PWM, and not with HW 6-PWM. So you have to avoid using the negated PWM channels.
On RP2040 there is only SW 6-PWM and it works with this.

You can find the branch containing these changes here:

https://github.com/runger1101001/Arduino-FOC/tree/braking

And there is some very initial code for a BrakingBLDCMotor in this branch:

https://github.com/simplefoc/Arduino-FOC-drivers/tree/braking/src/motor

Usage instructions to follow once I have a chance to put together a test setup and actually try it out… but in the meantime anyone interested could take a look, give feedback, and perhaps even test it out with their setups.

The same implementation on the PWM side will also enable us to do Hi-Z mode in block commutation, enabling BEMF voltage measurements on the phases. This in turn opens the door to “sensorless” commutation based on BEMF readings.
So that’s another avenue to explore at some point :slight_smile:

And in further good news, my driver board from AliExpress “has arrived in my country or region” :smiley: Lets see how long it now takes to get to me!

4 Likes