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.
Some more interesting videos from Microchip
- What is a stepper motor?
- What is a permanent magnet stepper motor?
- Unipolar and bipolar stepper motors
There is a good animated graphic of a 4-phase stepper motor at the top right corner of the wikipedia page on stepper motors.
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, :
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 using the 5V output from a dsPIC, here’s how we could calculate the required base resistor value, :
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:
- A controlling device (e.g. a microcontroller) delivers a set point to the servo, e.g. through a PWM signal.
- 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.
- 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.
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.
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, β.
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 as follows:
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.
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.
- 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.
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.