if (speed_ramp)
{
speed_ramp = 0;
temp_speed_ramp = (output + results);
//CAlculate Acceleration
if ((output_speed > (temp_speed_ramp))&(output_speed>0))
{
output_speed--;
}
// Set maximun speed to 1350/9 = 150Hz
else if ((output_speed < (temp_speed_ramp))&(output_speed<1350))
{
output_speed++;
}
to regulate the speed of a brushless motor.
In order to provide both feedback and a speed ramp the code above checks for a flag that is true every 1/10 of second (that works fine)
The problem is that at no load the motor has 5 or 6 oscillations when it gets to the speed point until it stabilizes.
I would be looking to know if someone has an idea on how to improve this. Some PID kind of code or similar.