Page 1 of 1

Setting Acceleration with 1067

Posted: Thu Apr 09, 2020 8:38 am
by AdamLee
Good day, reader!

I'm trying to rip out some custom ramping code and replace it by setting the acceleration on our stepper through the API.

We've got the rescale factor set to drive off of RPM, so setting the velocity to 1 = 1 RPM. I'm a little bit confused by the language in the API documentation:
The rate at which the controller can change the motor's Velocity.
Units for Position, Velocity, and Acceleration can be set by the user through the RescaleFactor.The RescaleFactor allows you to use more intuitive units such as rotations, or degrees.

The default units for this motor controller are 1/16steps per count.
So you can probably guess I'm confused what value to plug into the setAcceleration method. What is a count? Would it essentially be RPM/s in our instance? So, for example, right now we're getting 1 RPM every 10s. Would I simply pass in 0.1?

Re: Setting Acceleration with 1067

Posted: Mon Apr 13, 2020 2:11 pm
by jdecoux
"counts" in that sentence are whatever unit you are using.

If your rescale factor is set to RPM, then setting acceleration to 0.1 will mean your motor will accelerate 1RPM every 10 seconds (up to your target velocity).

Re: Setting Acceleration with 1067

Posted: Wed Apr 15, 2020 7:50 am
by AdamLee
Thanks! That works like a charm.

One thing I noticed is that it doesn't decelerate. It doesn't look like there's any way to control this in the API. Can anyone just confirm for me whether that's possible or not? I honestly think for our application it isn't necessary since we aren't dealing with a lot of momentum but of course since that logic was built into our custom software package people are inquiring about it.

Re: Setting Acceleration with 1067

Posted: Fri Apr 17, 2020 10:56 am
by jdecoux
The acceleration and deceleration are both specified by the acceleration property.

To extend the above example, an acceleration of 0.1 will take 10 seconds to reach 1 RPM from 0RPM, and will also take 10 seconds to decelerate from 1RPM down to 0RPM.

Re: Setting Acceleration with 1067

Posted: Wed Apr 22, 2020 8:14 am
by AdamLee
So the acceleration is definitely working but if I reduce the target velocity it drops immediately.

This line is doing all of the velocity setting (javascript):

Code: Select all

phidget.setVelocityLimit(rpm);
The setup for the channel is here:

Code: Select all

  phidget.onAttach = () => {
    eventEmitter.emit('stepperfound');
    return phidget.setVelocityLimit(0).then(() => {
      phidget.setCurrentLimit(parseFloat(env.phidgetStepperCurrentLimit));
      phidget.setRescaleFactor(parseFloat(env.phidgetStepperRescaleFactor));
      phidget.setAcceleration(0.1); // 0.1 RPM per second
      phidget.setControlMode(1); // 0 for step, 1 for velocity
      phidget.setEngaged(1);
      connected = true;
    }).catch((err) => {
      logger.error(err.message);
    });
  };

Re: Setting Acceleration with 1067

Posted: Mon Apr 27, 2020 10:11 am
by jdecoux
Are you using the latest firmware for your 1067? I know some bugs were fixed a while ago that had to do with acceleration and run mode on the 1067.

Re: Setting Acceleration with 1067

Posted: Tue May 19, 2020 1:58 pm
by AdamLee
I finally was able to get this device offline and update the stepper board firmware and it fixed the issue - thanks!