# Actuators and power electronics

## What is an actuator?

An actuator is a mechanism that is designed to turn energy of some kind into movement or mechanical force in a controlled way. In robotics, actuators are the components that cause a robot to move – e.g. motors, pistons, etc. Electrical, hydraulic and pneumatic actuators are all widely used in robotics, but in this module we focus almost exclusively on electrical devices. The following are the four types of actuator we use most frequently in the robotics lab.

• Permanent magnet DC (PMDC) motor
• Geared PMDC motor
• Stepper motor
• Servo motor

## Permanent magnet DC motors

Most of the small continuous rotation motors that we use in the robotics lab are permanent magnet DC motors. These use permanent magnets in the stator to set up a strong magnetic field in the vicinity of the rotor. There is a winding on the armature with many turns. When a current is driven through the armature winding, it interacts with the magnetic field causing the armature to rotate. If the direction of current in the armature was always the same, the armature would simply rotate until it had lined itself up with the permanent magnet’s field. However, current is typically supplied to the rotor via brushes that make a sliding (and conduction) point of contact between the supply voltage and the armature. Which brush makes contact with which end of the armature winding determines the direction of current, resulting in a periodic reversal of current in the armature, ensuring that it will rotate continuously rather than coming to rest in line with the permanent magnetic field.

Here are a couple of brief but informative articles on DC motors.

This interesting video from Microchip explains commutation in brushed DC motors:

A geared DC motor is simply a DC motor with a gearbox attached. Typically, DC motors are designed to run at high rotational speeds and exert relatively low torque. By attaching a gearbox to a DC motor, the speed of rotation delivered to whatever the motor is driving is reduced. However, the torque is also increased.

## Stepper motors

Some more interesting videos from Microchip

There is a good animated graphic of a 4-phase stepper motor at the top right corner of the wikipedia page on stepper motors.

## Transistors

Before explaining the various actuator control circuits that appear in the example questions below, it is worth taking a moment to review some of the basic operating principles of BJTs (bipolar junction transistors). To keep things simple I have chosen to use only BJT transistors here, but of course MOSFETS are also widely used. Regardless of the specific type used, the purpose of each transistor in the circuits below is basically just to control (switch on and off) the current supplied to a motor.

Designing analog eletronic circuits using transistors can seem complex and intimidating, and indeed it is a very subtle art in many situations. However, using a transistor to switch something like a motor on and off is a piece of cake and should be approached fearlessly!

The BJT transistor is a 3-terminal component, which comes in two different basic varieties, NPN and PNP. We’ll look at the NPN variety first, then identify what’s different for the PNP. The three terminals of an NPN BJT are the base, collector and emitter.

• Emitter: All the circuits below will use NPN transistors in what is called the common emitter configuration, which simply means that the emitter is always connected to ground.
• Collector: The load current (i.e. the current powering the motor) flows from the power supply, through the motor, into the collector, and finally through the emitter to ground. So the main current flows through load, into the collector and out of the emitter.
• Base: This is the terminal that lets us control the amount of current that is allowed to flow into the collector. When no current at all is flowing into the base, no current is able to enter at the collector either. However, when we inject a small current into the base a large current is admitted into the collector. The larger the base current is, the larger current is allowed into the collector.

The base and collector currents combine within the device and together flow out through the emitter to ground. The ratio of the collector current to the base current can be several hundred to one, which is what makes the BJT transistor so useful. The ratio of collector current to base current is often referred to as the forward current gain of the device and is usually denoted by the letter β.

Basically, we are using the transistor as a sort of a switch in the motor circuit. To turn on the motor, we close the switch by injecting a small current into the base. To turn off the motor, we open the switch by stopping the base current.

How do we know how much base current is required to completely switch on the transistor? Well, it depends on the value of β and the required collector current. The value of β is different for every transistor. Even for an individual transistor it changes as the circuit voltages and other conditions around it change. However, you can get a rough idea of the value of β from the manufacturer’s data sheet (N.B. It may be referred to there as hFE rather than β). Whatever the required collector current is (i.e. how much current you want to supply to the motor) should be divided by β to find the minimum base current, $I_{b_{min}}$:

$I_{b_{min}} = \frac{I_C}{\beta}$

How do we set the base current? Well, the base and emitter act very much like the terminals of a normal diode. When the base voltage is less than about 0.6V, almost no current at all flows (just like a diode). As the base voltage increases above that point, the base current starts to increase dramatically. For this reason, we usually place a resistor in series with the base to keep the current within safe limits (just like we would do with an LED for example). If we wanted to turn on an NPN transistor by setting the base current $I_b = 1{\mbox mA}$ using the 5V output from a dsPIC, here’s how we could calculate the required base resistor value, $R_b$:

$V_{R_b} \approx 5 - 0.6 = 4.4$

$R_b = \frac{V_{R_b}}{I_b} = \frac{4.4}{1\times10^{-3}} = 4.4{\mbox k\Omega}$

## Example Questions

Question:
Explain the basic principles of operation of a servo motor. Identify some possible applications.

In principle, any motor that uses closed loop control to regulate its own performance is a servomechanism. Typically however, the term servo motor refers to a device that facilitates position control (linear or angular) through some form in internal negative feedback control system.

The following is an example of how a servo operates:

1. A controlling device (e.g. a microcontroller) delivers a set point to the servo, e.g. through a PWM signal.
2. A position sensing mechanism is fitted inside the servo. In the case of an angular rotation servo, this could be a potentiometer attached to the rotor of the device.
3. A feedback control system inside the servo senses the error between the current position and the set point and drives a dc motor in whichever direction reduces the error.

Servos are typically used where reliable position control is desired. Some example applications are:

• flaps on aeroplane wings,
• pan and tilt mechanism on a CCTV camera,
• revolute joints in a robot arm.
• Explain servo motor.
Question:
A pair of 5V servo motors have been used to construct a rudimentary SCARA mechanism. Each servo has three wires: 5V, 0V and a PWM control signal input. Show how a dsPIC can be connected to the servos to control the mechanism.

Two servo motors controlled by a dsPIC using PWM.

Question:
Explain the basic principles of operation of a stepper motor. Identify some possible applications.

A stepper motor is a brushless, synchronous electric motor. It contains a number of windings (e.g. two or four), each of which energises a different toothed electromagnet that encircles the rotor. When one of the windings is energised, its teeth become magnetic, attracting the similarly spaced teeth on the outside of the rotor, thus pulling the rotor into line with the active winding. The teeth associated with each winding are slightly offset from those of the other windings, so that when the current is switched from one winding to another, the rotor is forced to rotate through a small angle (the step angle) to bring its teeth back into alignment with those of the active winding. By energising the windings of the stepper in the appropriate repeating sequence, continuous rotation of the rotor can be achieved.

Because the rotor moves in discrete steps, stepper motors are ideal for positioning tasks where accuracy and repeatability are desired. Even when used open loop (i.e. without actively monitoring the actual rotation of the rotor, one can be reasonably sure that the stepper motor has rotated through exactly the desired angle, provided that it was not physically overloaded to the point of slipping.

Question:
Design a transistor-based circuit to allow a dsPIC microcontroller to switch a 12-volt DC motor on and off. Assume that the dsPIC supply voltage is 5V, the motor supply voltage is 12V, the rated current of the motor (which will not be exceeded under normal operating conditions) is 1A and a transistor with a forward current gain β = 200 is available.

The desired collector current is 1A, since that is the rated current of the motor. To get some idea of the required minimum base current, we divide this by the nominal current gain, β.

$I_{b_{min}} = \frac{I_C}{\beta} = \frac{1}{200} = 5\mbox{mA}$

This is comfortably within the limit of what a dsPIC digital output can source, so a single transistor stage will be perfectly adequate. In fact, to be on the safe side, I’m choosing to provide double the minimum base current just in case the individual transistor has a lower β value than expected.

• When the base-emitter junction is fully conducting, we know that the voltage drop across it will be not much more than 0.6V.
• The digital output of the PIC will be 5V when it is high.
• We desire a base current of 10mA.

Therefore, we can calculate $R_b$ as follows:

$R_b = \frac{V_{Rb}}{I_b} = \frac{5-0.6}{0.01} = 440\Omega$

Unidirectional on-off control of a DC motor by a dsPIC using a BJT transistor.

The

Question:
Explain how your circuit from the previous question can be used to perform unidirectional variable-speed control of a permanent magnet DC motor.

A slightly modified version of the circuit from the previous question is shown below. The critical difference is that the base of the transistor is now driven by one of the dsPIC’s PWM outputs, so rather than being on continuously, it is constantly being switched on and off. As in the above circuit, the freewheel diode is necessary because the motor is an inductive load which means that any sudden interruption of its current could lead to large voltage spikes. When the PWM signal is high the transistor is on and the diode is reverse biased. However, when the PWM signal goes low, the transistor switches off and the diode provides an alternative route for the motor current so that no large voltages are generated.

The speed of the motor is controlled by varying the duty cycle of the PWM signal. During the ‘on’ phase of the PWM cycle, the motor is speeding up. Durign the ‘off’ phase, the motor is slowing down. However, compared to the time taken for the motor to visibly speed up or slow down, the PWM period is very short, so all that is really apparent is the average speed which varies with the duty cycle.

Unidirectional speed control of a DC motor by a dsPIC via PWM.

Question:
Design a transistor-based circuit to allow a dsPIC to perform bidirectional control of a 5V DC motor using two digital output pins. You may assume that supply voltage of the dsPIC is also 5V. Show what motor state results from each possible combination of outputs on the two dsPIC pins.

H-bridge transistor circuit for bidirectional control of a DC motor by a dsPIC.

Question:
Explain how your circuit from the previous question can be modified so that a 12V motor can be used, while the dsPIC supply voltage remains at only 5V.

Modified H-bridge transistor circuit for bidirectional control of higher voltage motors by a dsPIC.

Question:
A two-wheeled rover bot is controlled by a dsPIC microcontroller. Each wheel is driven directly by a geared DC motor. To allow the robot to move forwards, backwards or turn in either direction it is required that the direction of movement of each of the two motors be controlled independently. Show how this can be achieved using an L293D IC to interface the dsPIC to the motors.

Of course, we don’t always use discrete transistors to control our actuators. It is generally more convenient to use one of the integrated circuits that have been designed for this purpose. The one we use most often in the robotics lab is the L293D. This chip contains four half H-bridges. Here’s a link to the L293D data sheet.

The diagram below shows how it can be used to facilitate bidirectional control of two dc motors by a dsPIC. The triangles inside the L293D are just generic driver symbols, but in reality they are half H-bridges.

For the upper motor:

• When RD0 = 0V and RD1 = 0V, the motor is stopped.
• When RD0 = 0V and RD1 = 5V, the motor goes forwards.
• When RD0 = 5V and RD1 = 0V, the motor goes backwards.
• When RD0 = 5V and RD1 = 5V, the motor is stopped.

The lower motor behaves similarly.

Question:
The same robot as in the previous question now requires further modification to allow independent speed control of each of the two motors. Show how the circuit can be easily modified to facilitate this.

The L293D chip provides two ‘enable’ pins, each of which either activates or deactivates one pair of outputs. This provides a very convenient way to periodically interrupt the supply of power to a motors using a PWM signal. The enable pins have internal pull-ups so that when they aren’t connected, they do not affect the output at all. However, when one of the enable pins is pulled down to 0V, it brings the corresponding pair of outputs to 0V as well. It is conventional to use two ordinary digital outputs (e.g. RD0 and RD1) to start and stop a motor and to control its direction. Meanwhile a PWM signal connected to the corresponding enable pin allows the motor’s speed to be controlled just my varying the duty cycle.

### 2 Responses to Actuators

1. parn says:

As show the circuit diagram H-bridge for 12V driving, I have tried that thing with Va and Vb 5V from digital pin Arduino.
I found the result is only +12V, but -12V not working.

2. batchloaf says:

Hi Parn,

Presumably, you mean this circuit?

When you say -12V, I’m assuming you just mean that the direction of the 12V potential difference between the motor terminals is reversed? Just to be clear, no point in the circuit will ever be at -12V relative to 0V (the earth connection at the bottom rail of the circuit).

There’s really no difference between the two sides of the H-bridge, so it’s difficult to see how you could get 12V one way but not the other way, unless there’s something wrong with one side of the H-bridge.

Here’s a few things you could check:

1.) Are both Arduino outputs definitely functioning? Maybe try disconnecting the Arduino from the H-bridge and testing its digital outputs in isolation. For example, try connecting an LED (with current limiting resistor in series) to each one to check that it switches on when you expect it to.

2.) While the H-bridge is disconnected from the Arduino, you can test it in isolation also. Try connecting one input of the H-bridge to 5V and the other to 0V and see what happens. Then try reversing them and see what happens then.

3.) If you have a digital multimeter with a transistor checker (the function is usually labeled something like hfe), you can try checking each of your transistors to make sure it’s functioning correctly and that you haven’t mixed up the PNP with the NPN or anything like that.

Hope that helps to track down the problem.

Ted