How to enable regenerative breaking?

Hi, new here. I am working on using a odrive board as charge controller for a hydropower turbine . So my hoverboard motor is going to actually be a generator. I saw in other post that it “should” be safe to accidentally back power the odrive from the “motor” EMF as long as staying below 56V and not issuing any startup commands. I’ll do my best to always have the 48V battery connected, but comments appreciated.

My real question is how to enable regenerative breaking instead of brake resistor. I see it mentioned many places to be a supported feature, but don’t see the command?

odrv0.config.brake_resistance = 0
odrv0.config.max_regen_current = xxx

After setting the brake resistance to zero I can no longer set velocity. I have regen current to 10A. Does it refer to motor current or Ibus?
Is there anything else I need to do? I have tried both dynamic and save/reboot of break res

It refers to Ibus.
If you have the parameter, make sure you have dc_bus_max_negative_current > 0
What errors do you get? dump_errors(odrv0)

Also which firmware are you using?

I try to enter command odrv0.config.dc_bus_max_negative_current = 1
but get error: Attribute dc_bus_max_negative_current not found
So I may have got the syntax wrong…

axis: Error(s):
motor: Error(s):
fet_thermistor: no error
motor_thermistor: no error
encoder: no error
controller: no error

Firmware is 0.5.1 and board is v3.6

I guess you’ll have to set config.dc_max_negative_current more negative than your expected regen current

My setup works now, thanks for the help.

Can you briefly explain the interaction of these parameters and if my understanding is correct:

odrv0.axis0.motor.config.current_lim (M0 peak current in windings)
odrv0.config.max_regen_current (current from windings or ibus, DC or AC?)
odrv0.config.dc_max_negative_current (max DC current backfeeding into power supply)

Why do we need both “regen” and “negative” entries, one of them seem redundant?


basically we don’t start running the brake resistor until we have at least max_regen_current being generated to the bus. And then if the brake resistor saturates, we allow up to dc_max_negative_current before we throw an error.

I’m not sure it’s a great system but it sorta makes sense lol