Motor/encoder calculations - Accell, Decell and Stopping Distance


I have a motor with an quadrature encoder attached. Reading the encoder, I can get the counts okay.

I would like to be able to go to a certain position (count), using a set max speed, a set acell and decell rate, possible a S curve for smooth operation, including some sort sort of correction in case of over/under shoot. I have searched this site but not found anything. Google hasn't produced much either. Either some very theoretical paper or nothing complete

Any suggestion appreciated


You could use the AccelStepper library, keep track of the encoder counts while in your loop, then correct / stop / restart if what you expected to see isn't what the encoder says it sees.

Good luck!

Well, from what I can gather, I properly need to update speed/count/corrections every 1mS or so. It seems that generally a PI function is used, instead of a PID, when it comes to motor control.

I'll spend some time trolling through PIC, Freescale, etc website looking for papers. Some of the specific motor control chips may have some S/W that I can look at.

Thanks for the AccelStepper suggestion. Their site has some good stuff and the forum is usefull :-) in case someone else is looking, here is the link