dzid26 / StepperServoCAN

Closed loop stepper motor controller with CANbus capabilities. This Project open source hardware and code, support platformio build and upload firmware.
https://shop.retropilot.org/product/stepperservocan
19 stars 5 forks source link

Backdriving against large torque causes jerky torque reduction #15

Open dzid26 opened 1 year ago

dzid26 commented 1 year ago

With high torque (high current) and backdriving against it, there are two effects contributing to the jerky movement.

  1. In the case of the present current control, PWM to DC filters cause DC offset and more crucially phase delay on the current request. Partially reduced by this.
  2. High motor inductance causes phase delay on the current request

When backdriving under smaller currents, both effects are not as visible as the current can quickly change direction. For larger currents, it takes time for it to change - the phase delay.

When phase delay is large enough more than 90deg, the driving current stop adding to torque generation, and causes rapid torque decline.

The phase delay can be compensated using speed calculation by additionally taking into account motor inductance.

OxygenLiu commented 1 year ago

The present Sine commutation may lose steps when backdriving. SimpleFOC implements a FOC library for closed loop control of stepper motors, as demonstrated here https://youtu.be/zcb86TRxTxc

dzid26 commented 1 year ago

SimpleFOC has all kind of control schemes. I like voltage control the most for our board. For full-blown FOC you would need different hardware with inline current sensing and fast phase current close loop control done by the MCU.

Current hardware is simpler, but I believe this issue can still be solved by using knowledge of motor inductance and sensor delays.

dzid26 commented 8 months ago

Currents data during the snap event: Snap on overload.xlsx

Current changes fast during the snap, because the shaft accelerates rapidly (jerks, snaps).

image

But why does it snap? Either current is not commanded right or it has something to do with large torque ripple under load. (#11) To be investigated...

OxygenLiu commented 8 months ago

looks like some variable is reset or overflow?

dzid26 commented 8 months ago

I don't think so. The current waveworms draw a circle which is correct and impressive given the rate of change of things.

But It could be that the timing is not ideal - but things don't happen fast before the snap occurs.

I am leaning toward that this could be hardware characteristics - the large torque ripple under high load coupled with springiness in the load in my setup and non-linear friction (stiction) in the case of a gearbox.

I think fully solving #11 would fix this too. I would only hope that the torque peaks are aligned at multiples of 90deg and not 45, because in one case we can extract more useful torque and power from the motor, and in the other, we may lose average power.

OxygenLiu commented 8 months ago

The distortion is probably caused by the decay mode and/or back EMF, as proposed by TI in the smart tune method.

Youtube
Technical White Paper, Getting smart about tuning your stepper motor

dzid26 commented 8 months ago

I think I mixed two issues/scenarios here. :(

  1. One could be related to decay modes and distortion - which at higher speed oposing the driving torque, the torque value drops. But it is normal scenario of driving the moror when bemf makes it harder to maintain the high current. Here we are braking, so bemf helps to have high braking current.

  2. At much higher requested torque (say 3Amp) somewhat similar effect can be visible at 0 speed! If the load torque increases, eventually the motor is "giving up" and the torque drops. It's the snap I mentioned last week.

However I think underlying causes are different. Although eventually they may get combined once the speed increases.

For the 2. scenario, (which is more disturbing), the decay mode doesn't play a role. - initially the speed is close to zero (before it snaps and looses torque), and so bemf is close to zero and slow decay will do just fine. It is confirmed by the circle plot above.

Realistically, I think the seconds scenario is caused by nonlinearity if the torque - which in turn is probably amplfied by localized magnetic saturation during high current. - That is the holding torque is probably only high where teeth are aligned and relatively small in-between. (Or opposite way). And so once I go pass the tooth, I loose torque and motor speed goes up due to inertia and springiness of the system. Once it starts rotating, perhaps the torque never comes back due to combination of the 1. scenario.