go away spammer

Author Topic: Controlling Motor Speed  (Read 2202 times)

0 Members and 1 Guest are viewing this topic.

Offline jonagikTopic starter

  • Full Member
  • ***
  • Posts: 63
  • Helpful? 1
Controlling Motor Speed
« on: December 16, 2012, 08:21:55 PM »
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  :)

Offline jwatte

  • Supreme Robot
  • *****
  • Posts: 1,345
  • Helpful? 82
Re: Controlling Motor Speed
« Reply #1 on: December 16, 2012, 11:19:20 PM »
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.


Offline uaefame

  • Jr. Member
  • **
  • Posts: 10
  • Helpful? 0
Re: Controlling Motor Speed
« Reply #2 on: December 20, 2012, 12:27:31 AM »
I was thinking about an encoder
attached to the motor

Offline jwatte

  • Supreme Robot
  • *****
  • Posts: 1,345
  • Helpful? 82
Re: Controlling Motor Speed
« Reply #3 on: December 20, 2012, 11:28:02 AM »
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.

Offline jonagikTopic starter

  • Full Member
  • ***
  • Posts: 63
  • Helpful? 1
Re: Controlling Motor Speed
« Reply #4 on: December 21, 2012, 11:33:40 PM »
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.

Offline jwatte

  • Supreme Robot
  • *****
  • Posts: 1,345
  • Helpful? 82
Re: Controlling Motor Speed
« Reply #5 on: December 22, 2012, 12:33:19 AM »
A potentiometer is only barely good enough for a hobby servo used for little RC cars. I don't know of one that covers the entire range of movement, even -- you'll have a "dead zone" where there is no output. It is also usually noisy, because it relies on a mechanical wiper moving over a resistive material, and it also will wear out over time.

An optical encoder is a LOT better. It may have some sensitivity to dirt and grime if you don't get an enclosed one, and it still needs mechanical connections, but optical encoders are used in many industrial control and "pro" servo solutions.

If you can get away with it, absolute magnetic encoders can be fully contactless, and can give as good resolution as optical, if not better. From what I hear, they are generally less plug-and-play, though, requiring calibration after set-up before they can perform right. I have not used one myself (other than as integrated in servos like the Dynamixel MX-64T.)

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,944
  • Helpful? 99
Re: Controlling Motor Speed
« Reply #6 on: December 22, 2012, 08:03:16 AM »
A method to get more resolution from an optical encoder to have it attached to the motor shaft before the reduction gears. So that it is turned at a fast rate than the gear reduction output shaft.

Shaft speed is then measured by either counting time periods (hardware timer in the processor) between encoder ticks or by counting the number of encoder tick within a set time period.

For absolute shaft position the total number of encode ticks are counted and keep track of. If a Quadrature output encoder is used then the direction of the shaft's rotation is also know.

 


Get Your Ad Here