Enable invert ir2104

Hello.
I use the eg2134. 6 pvm driver. It does not have an enable input. I thought that if I use 6 PWMs, then when the motor stops, all 6 outputs will have 0. But as it turned out, the bottom three have 1.
Mit freundlichen Grüßen
Iurii

If you need the motor freewheeling, I guess you could disable the driver.
Velocity 0 means that the driver will hold the motor at 0 rad/s

Try calling motor.disable()… this should do what you want.

If you just set the target to 0, it stops the motor, but it also tries to keep the set-point. So it will oppose any motion, and return to its position in position mode, or just try to stop the movement in velocity mode.

I often see a mention of the motor.disable() function. But I haven’t found an example of how to use it anywhere.

Unfortunately my driver does not have an input pin to enable|disable

Then I am sorry to say with IR2104 you can’t disable the drivers… maybe for the next iteration, include a connection to the SD pin…
In the meantime, if you’re good at soldering you could solder a wire between the pins…

To answer your other question, if you had the shutdown pin, it would be simple - if you want the motor to disable when the set-point is 0, then just add some code in the main loop:

motor.move();
motor.loopFOC();
if (motor.target == 0.0f && motor.enabled==1)
  motor.disable();
if (motor.target != 0.0f && motor.enabled==0)
  motor.enable();
1 Like

Thanks.
I’ll try it tomorrow. It’s already night)).

I will talk to Antun, and we will think about whether it makes sense / is possible to make the disable() function also disable the low side FETs in 6-PWM mode when there is no extra enable pin… it would be a good functionality, I think.

Gute Nacht!

1 Like

I think you could cut the power to your motor driver with a relay/mosfet - if that’s fast enough fir you.

Seems like disable() just needs to be split into two functions, freewheel() and passiveBrake(). Personally I would expect disable() to disable all FETs, thus being equivalent to freewheel mode… but if that’s not how it is, then we need less ambiguous function naming.

2 Likes

Hello Runger. Today I tried your example. After the motor stops, the rotor rotates freely, which means that all the field-effect transistors are closed. But there is no possibility to restart the engine. My input is enably inverted, so I changed 0 to 1 and got a rotation with very strong noise
motor.move();
motor.loopFOC();
if (motor.target == 0.0f && motor.enabled==0)
motor.disable();
if (motor.target != 0.0f && motor.enabled==1)
motor.enable();

I thought so too. That’s why I used the 6 pwm driver. But unfortunately the mosfets of the lower side remain open

      • regenBrake() (hmm it won’t make + sign, just those dots and a square)

PWM low side FETs —> boost voltage to battery charge voltage. Best done w. Voltage divider (voltage sensor) on buzz but should in theory work knowing the motor constants…

Does regen really need a separate mode? It would be best if it could be done automatically anytime voltage is being applied in opposition to motor rotation.

Yes I believe so, since it is acting as a boost converter, the PID loop, controlling the PWM has to be activated. In a sense it’s 3x boost converters. If done right, any BLDC could be mounted with blades and be converted to a wind-turbine, but gearing it up would most likely have better performance. 6pin pwm control is mandatory, High-side off, while low side triggers the spikes raising the cap voltage :+1: badabing badabum

Edit: There are of course details to consider. The wind-turbine / generator should match the target rpm and the target charging voltage, like always it helps to be specific.

When the batteries are fully charged, one either has to stop making electricity or start producing hydrogen, unless one can sell it on the grid.

1 Like