John L Errington MSc

John Errington's Experiments with an Arduino

Controlling DC motors

Servo mechanisms

What is a servo mechanism?

servomechanismA servo mechanism consists of a motor, motor control system, a sensor, and a user input called the "SET POINT". The set point may be a motor speed, or the position of a driven component such as a rudder. All servo mechanisms have these basic parts.

The purpose of this system is to ensure that the load is driven correctly according to the users requirements.

A simple example is the positioning of a print head in an inkjet printer. The controller sets a desired position for the print head, a motor drives it on, and a sensor checks the position. When the desired position is reached the motor stops.

What makes a servo system different is what happens if there is a problem. As the inkjet priter ages the load on the motor increases - due to wear in the drive chain, dirt on the slides etc. The motor turns more slowly. If there was no position sensor the head would be misplaced. But because there is a sensor the drive to the motor is maintained until the desired position (set point) is reached. It gets there more slowly - but it still ends up in the right place.


Parts of a servo mechanism

Here you can see a typical servo system. The motor is coupled through a drive chain (shaft, gearbox,etc) to the load. Electric motors provide high speed at low torque, so its usually necessary to couple the output through a gearbox, to increase the troque and reduce the speed. Position and/or speed (velocity) sensors "feed back" information to the control system. This is compared with the desired "set point" established by the control input.

The usual way of providing velocity feedback is with a "tachogenerator" - this produces a voltage that is proportional to the speed at which it is driven.

The position sensor will often be an optical or magnetic sensor. These are robust and do not require contact with the drive, so friction and wear are not a problem. Optical sensors are capable of finer resolution, but need to be kept clean, while magnetic sensors can work in dirty environments.

More about these sensors later.

Example of servo mechanism: anti-lock braking system

absThe anti-lock braking system found on modern cars is an example of a servosystem. Here we will just focus on the sensor and actuator for this system.

A hydraulic system drives the brake shoes to slow down the wheel. The speed of rotation is monitored by a magnetic "Hall Effect" sensor, placed very close to a toothed wheel that is attached to the hub.

In normal use when braking the wheel slows down progressively. Whenit loses adhesion with the road. the wheel slows down extremely quickly. With ABS this change is detected, and the brake pressure momentarilty released. so the wheel does not "lock up" and skid.

This use of a hall sensor is very common, especially on automobiles and other "dirty" environments where optical sensors would fail.

Servo control

We have seen that a servo system comprises a motor or "actuator", one or more sensors giving information about the result, and a control system that uses this "feedback" to ensure the desired result is achieved. Lets look now at the control system. This consists of an amplifier, to drive the motor; and a "summer" that adds together the input signal and the feedback signal. The + sign shows a positive input to the summer, and the - a negative input. The output from the summer is (+ input) + (- sensor signal).

servo controllerSuppose our motor is at rest. The signal from the input is zero, and from the sensor is zero.

Now an input of 5.00 is applied, demanding a motor speed of 5000rpm. The motor starts and accelerates the load. The speed rises. When a speed of 5000rpm is reached the signal from the sensor is 5.00.

The output from the summer is (+5.00) + (-5.00) = 0

The load speed is correct so the drive to the motor is cut off. When the load speed falls (due to friction etc) the snsor signal falls to 4.99. The output from the summer is now (+5.00) + (-4.99) = +0.01 and a little power is sent to the motor. If the speed continues to fall the drive is increased until a speed NEAR the desired speed is reached.

The graph and table below show the behaviour of a simple servo system with a speed sensor (tachogenerator) providing a feedback signal.

signals in servo system
time demand (blue line) result (green line)
0 at rest  
20 motor speed 5000 motor speeding up
30   overshoot
40-50   hunting - around 5000
50 slowly to 4000 over 10 sec slowly to 4000 over 15 sec
60 motor speed 4000 still slowing
65 motor speed 1000 motor slowing
75   negative overshoot
85 stop motor positive overshoot
95   motor stopped.

You can see the motor speed does not match the demand exactly. The main reason for this is that while the input signal can change VERY quickly from 0 to 5V the motor needs time to get the load up to speed.(see math below)

Other differences include "overshoot", "gain error", "hunting"

Overshoot (seen at t=30) is when the output goes from less than the set speed to more than the set speed.

When the speed is at the desired value the motor speed can vary slightly. if its a little too slow the system feeds power to speed it upto the right value. It overshoots, and the system reduces the power. This "fidgeting" around the correct value is called "hunting"


(Math here) The energy E needed to spin up a flywheel from rest is E = 0.5 I ω ^2
where I is the moment of inertia and ω is the new speed. (in radians/sec)

Lets look at spinning up a lathe chuck t0 400 rpm. 400 rpm = 400 * 2 * pi / 60 = 42 radians per second.

I = 0.5 m r^2. so a 10kg chuck of 0.2m dia has I = 0.05

E = 0.5 * 0.05 * 42^2 = 44.1 Joules. To get this up to speed in 10 seconds uses 5 watts. In 1 second - 50 Watts!


1: Speed

Perhaps the easiest way to sense rotational speed is with a tachogenerator. The output voltage of a permanent magnet type generator is proportional to the shaft speed. Tachogeneratos are characterised to give an exact value eg 5V / 1000 rpm. This means at 2,200 rpm the output voltage will be 5v * 2200 / 100 = 11.0V

optoencoder"Incremental optical encoders" shown here use a metal disc with holes, or a glass disc with clear and opaque sections to interrupt a light beam . A photosensor produces a train of pulses. This can be fed to a "frequency to voltage convertor" to produce a voltage dependent on shaft speed.

The same technique can be used as described above with a toothed steel wheel and magnetic sensor. Deending upon the demands of the application, a variable reluctance, inductive proximity, or hall effect sensor may be chosen.

2: position

Optical encoders can also be used to measure the position of a slide or shaft to extremely high accuracy. Here a series of photodiodes is placed in a line along the axis, and the code read out defines the shaft position. These sensors are called "absolute optical encoders".

Different codes are used depending on the application. The disk on the left is binary coded, with 8 bands, offering a resolution of 360/256 = 1.4 degrees; while the disk on the right uses "Gray code"with 10 bands giving a resolution of 360/1024 = 0.35 degrees.

Each circle of bands needs its own photodiode.

Another sensor used for position measurement is the RVDT or LVDT (a type of electrical transformer used for measuring angular displacement)

Using laser interferometry it is possible to achieve accuracies down to 10nm.