# How is precise control over motor as in Segway achieved?

When I read about Segway I always wonder how such precise control over the wheel motors can be achieved.

I mean if the rider wants to go one foot forward, then one foot back, he leans forward, the motors start rotating the wheels, then he leans back and the motors change direction instantly and then when he's back he stands straight and the motors stop.

Again, to achieve balancing motors will rotate in perfectly controlled manner at whatever speed is needed to balance the Segway.

From my experience with electric motors found on various stuff like power tools and sewing machines those are pretty hard to control precisely. For example, when a variable speed drill is started it just accelerates at whatever rate and actual rotation rate will largely depend on the load - whether I drill wood with a 2 millimeters bit or hard steel with a 10 millimeters bit.

How do systems like Segway achieve such precise control over electric motors?

# By using closed-loop motion control and a lot of math.

"...variable speed drill is started it just accelerates at whatever rate and actual rotation rate will largely depend on the load..."

What we need here is something that would regulate the rotation rate for us and eliminate its dependence on foreign load. Something like a government, they are good a regulating things...

A GOVERNOR is a part of a machine by means of which the velocity of the machine is kept nearly uniform, notwithstanding variations in the driving-power or the resistance.

I propose at present, without entering into any details of mechanism to direct the attention of engineers and mathematicians to the dynamical theory of such governors.

- James Clerk Maxwell. On Governors, Proceedings of Royal Society, vol. 16 (1867–1868)

The motion control systems in a Segway "govern" motor speeds and positions by "closing the loop".

Open-loop

Closed-loop

One small part of the loop found in a Segway.

Pretty much everything that requires precision movement incorporates a feedback loop into a control system. This feedback can be things like the feedback from stepper motors, or encoders, or accelerometers, or what ever the designer can imagine to be able to help them know what their system is doing.

There is lots of research and engineering that goes into how to optimize these systems for the application that they need.

One of the simplest control systems that people can understand is cruse control in a car. There are basically 3 things that are usually taken into account when designing the systems.

1. Overshoot. In the terms of the car, this is if you are at a different speed then your cruse control is set at, how much over the speed can the system go and be considered acceptable. Is 1 MPH ok? How about 2?, etc.
2. Ripple. Once you get to your set speed, how much are you ok with it varying. Lets say it is set at 65 MPH, are you ok with it going up to 70 and then down to 60 or would you rather it stay +/- 0.5 MPH
3. Settling/Rise Time. If your car is at 45 MPH and you want it to be at 65 MPH, how fast do you want it to get there?

Changing one of these effects the others. In the case of the Segway, they have refined their control system well enough to be able to do what you see it doing. Not an easy task at all though.

• give us some links to more information about these things so the OP can dig in immediately if they would like to. I also think since the segway knows the orientation of the segway from the gyros it just constantly tries to stand it up straight. I think this is easier to do then many of the control systems I have seen. May 21, 2011 at 12:54

According to this thread they use stepper motors. That is, those found in printers, disk drivers, etc, but obviously as quite beefy versions, combined with accelerometers and some smart controller logic.

• Bottom of the thread you linked says they're servos and the guy who said they're steppers said he was just guessing. May 19, 2011 at 13:35
• Probably brushless servo motors. Actually steppers are also brushless motors, only ones with an inordinately high number of poles and low efficiency compared to the ones used in closed-loop servo systems. May 20, 2011 at 6:30