I'm not sure if this is more of a software or electronics question, but software seems more appropriate.
I was wondering what the best practice for setting the speed
of a motor is. By speed I mean angular velocity, and the situation is one where there is perhaps 10-bit angular position sensing (e.g. a potentiometer attached to the axis of a motor).
The obvious way would be to apply negative feedback to poll for position at some frequency, record the time interval to get the average speed over that interval, and use negative feedback to change the average speed by changing the pulse-width of the motor. The only problem I see with this (and I'm not sure how much of an issue this is in practice) is that the speed is potentially not very accurately set. Of course, the accuracy is dependent on polling frequency, position resolution, etc. But what I'm wondering is, given an ATMega8 or similar and sensing in the order of 10-bit, is this generally an effective method and, if not, what is a better method?
Additionally, there are cases where I might want to set speed such that a final position is reached over some interval of time (but perhaps with non-constant speed to get there). i would imagine in this sort of case, the method for setting speed changes a little such that the accuracy of the final position is increased (such as applying negative feedback to the speed history
, not just the most recent average speed). What is the best practice in this case?
Thanks in advance for your help. Hopefully I was clear enough