I have brushless motor and I wish to limit the acceleration rate, to limit inrush current.
The motor works in closed loop reading the hall sensors, so I would have to reduce the voltage to keep the acceleration within a given rate. A kind of PID loop.
Any ideas how to implement this? I can imagine I could cut power to the motor once a certain acceleration was reached, but that would be a bit crude.
Assuming you are controlling the speed via PWM? If so, it's pretty simple. Just run a loop and increment the PWM byte each time the loop is executed. Insert a delay in the loop (e.g. 500 millis) to get the desired effect.
In the world of variable speed drives, that's a speed ramp.
You need a background rtc clock running at a say a 10 ms cycle. If your motor speed is represented with 10 bits and a you want a ramp rate of zero to full speed in ten seconds, increment your speed every clock cycle at the rate of 1024 * 0.01 counts per clock. You'll need to round up or down since you want to do all this with integers and check for under and overflow, limiting the ramp generator output to zero to 1024 counts.
You can use other schemes such as delta rpm per second or seconds per thousand rpm, whatever makes sense for your motor and application.
Another nice feature that is trivial to add is current (or torque) limited speed ramping. Once you hit a limit, stop ramping, holding at the current speed until acceleration catches up with inertia. You should also provide a deceleration ramp rate as well to prevent bus voltage rise.
At a 10 millisecond clock rate, you'll want your routines to be small and fast. At 100 ms, things will start to get choppy with current spikes possibly causing trouble due to large step changes in reference. You could also cheat with a simple r/c filter on the dac output
This is a brushless DC. If I set a delay on the code the motor will stall.
How is the 3-phase generated? It has to be by a clock. Are you unable to set the clock at a low frequency and gradually increase it to the desired speed? The 3-phase frequency determines speed, and if there is PWM involved, it would control the amplitude of the sine wave. The speed is limited by the torque constant KV which controls the inductance and torque of the motor.
The solution given by avr_fred works like a treat, but for some reason my post didn't go trough.
Its a 6 step and its generated by the hall sensors on the motor.
Higher winding currents (PWM) return higher speeds just like in a brushed DC.
Hi,
I am trying to implement your method of acceleration control. I am not sure how to increment the speed after every clock cycle. can you help me with that?
thank you
avr_fred:
In the world of variable speed drives, that's a speed ramp.
You need a background rtc clock running at a say a 10 ms cycle. If your motor speed is represented with 10 bits and a you want a ramp rate of zero to full speed in ten seconds, increment your speed every clock cycle at the rate of 1024 * 0.01 counts per clock. You'll need to round up or down since you want to do all this with integers and check for under and overflow, limiting the ramp generator output to zero to 1024 counts.
You can use other schemes such as delta rpm per second or seconds per thousand rpm, whatever makes sense for your motor and application.
Another nice feature that is trivial to add is current (or torque) limited speed ramping. Once you hit a limit, stop ramping, holding at the current speed until acceleration catches up with inertia. You should also provide a deceleration ramp rate as well to prevent bus voltage rise.
At a 10 millisecond clock rate, you'll want your routines to be small and fast. At 100 ms, things will start to get choppy with current spikes possibly causing trouble due to large step changes in reference. You could also cheat with a simple r/c filter on the dac output