Gaugette

Building gauges and gadgets with Arduinos, Raspberry Pis and Switec stepper motors.

Jan 15, 2012 - 2 minute read - Comments - Switec X25 Arduino

Motor Acceleration and Deceleration

My first cut at the Switec X25 library stepped the needle at a constant speed. You can see the constant speed motion in the original video.

I’ve updated the library to support acceleration and deceleration, partly because it seems more aesthetically pleasing, and partly because I have a notion that I should be able to reach faster peak speeds by ramping the speed up. Motion is now specified by 4 parameters: minimum speed, maximum speed, acceleration, deceleration.

For now I’ve used floating point calculations to compute each step period standard Newtonian velocity/distance/time calculations. This works okay, but is unnecessarily compute-intensive.

The Switec X25 library supports multiple motors and no doubt this computation will become a factor when I try to drive more than one motor, so I’ll have to address that at some point.

One interesting aspect of the control logic is that the calculations are done at the start of each step, in distance-domain rather than in time domain like most simulations. This means the calculations must be done more frequently at higher needle speeds. This is going to set an upper bound on maximum step rate.

When it does become an issue, I think I could replace the entire floating point calculation with a small table of pre-computed (step-count, step-period) pairs with little perceptible difference.

Initial Results X12 Quad Driver Chip

comments powered by Disqus