AccelStepper Help for Stabilization

Hi, I was trying to study the Accelstepper library to control a reaction wheel stabilizer. I have strong doubts about reading some library commands such as:
1-maxspeed
2-acceleration
3-moveto
4-setmaxspeed

being a stepper motor I don't have maximum speed and acceleration values, how do I choose these values?

also viewing a similar code taken from Charles Grassin (reaction_wheel/Arduino_ReactionWheel/Arduino_ReactionWheel.ino at main · CGrassin/reaction_wheel · GitHub):

after a PID that measures the angular velocity from an IMU sensor generates a PID to adjust the speed of the structure to zero by imposing an acceleration on the motor, but he specifically formulates this PID as a speed to be imposed on the motor and also this function:



// Set the current speed and direction of the motor
void setSpeedStepper(double targetSpeed){
   if(targetSpeed > 0)
     myStepper.moveTo(1000000);
   else
     myStepper.moveTo(-1000000);

   myStepper.setMaxSpeed(fabs(targetSpeed));
}

Could someone explain to me why it doesn't directly control the acceleration? why does it impose such a high moveto()?

Sure you do. The maximum practically obtainable speed and acceleration depend on the motor, the driver and the motor power supply, and can be estimated by experiment.

why does it impose such a high moveto()

Those values are essentially infinity, and can be changed by subsequent commands.

so to estimate these data through experiments I need an external hw that measures the true rotor speed?

Isn't there a way that I can set a speed to follow via software and then measure via the library whether the motor actually manages to reach it?

so the moveto() written in this way shouldn't be changed right? do I only manage the maximum speed and acceleration?

Yes, you can do everything you want, but a stepper doesn’t sound like the right type of motor for the application.

You may be better off with a dc motor (possibly geared down to the speed and torque figures you need)
Then add some feedback to inform the position of the moving parts to the control algorithm.

I know but for particular reasons I have to use a stepper motor. I would at least like to bring it to the maximum possible performance by controlling it in speed or acceleration

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.