Software > Software

Controlling Motor Speed

(1/2) > >>

jonagik:
Hi,

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  :)

jwatte:
Yes, what you're describing is generally "how it's done" -- sometimes with the addition of already knowing things about the motor, the load, and the controller, to get a good "best guess" for the first iteration.

Also, to get to a specific position at a specific time, you'd typically use a PID controller. Read the Wikipedia article if you haven't encountered those before. This translates to both a desired position and desired velocity being inputs to the speed determination, and the desired speed & velocity must also follow an acceleration/decceleration curve to make movement smooth.

uaefame:
I was thinking about an encoder
attached to the motor

jwatte:
The original question already included a sensor attached to the motor.
You don't use a potentiometer for that, though; you typically use either an optical encoder or a magnetic encoder of some sort. Absolute or relative have different use cases.

jonagik:
So is an optical encoder (an absolute optical encoder in my case, since position is more important than speed) the best way to go? I would have thought that an optical encoder would either be low resolution or expensive compared to a potentiometer.

Navigation

[0] Message Index

[#] Next page

Go to full version