John L Errington MSc

John Errington's Experiments with an Arduino

Controlling DC motors

Motors with and without brushes

1: Unidirectional On/Off control

The simplest form of control system can often be achieved with a simple switch or relay. However it introduces two important factors; firstly, what happens when you remove the drive current to a motor.

The windings of the motor are inductors, and store energy. When the supply to the inductor is interrupted the energy has nowhere to go, resulting in a negative voltaage spike.

If you dont deal with this either the switch will arc (or if its a semiconductor it will fry) or the winding insulation will break down. The energy HAS to have somewhere to go.

 

This can be provided as shown here (left) by:

adding a series capacitor and resistor across the terminals (interference suppressor) OR

by including a SNUBBING DIODE. This is wired so that it is reverse bioased when the motor is running, but conducts when the negative spike begins, and "shorts it out".

The other factor to consider is that the motor may act as a generator if the shaft continues to spin.

Here the motor current is being switched by a transistor. The transistor is turned on by a positive voltage applied to R1. When this current ceases the mottor stops running. As before Diode D1 prevents a voltage spike that would damage the transistor.

As the transistor is driven hard ("saturated") the voltage across it will be only around 0.3 - 1.0V so a 2A motor would only produce 2*1.0 = 2W so a small power darlington (TO220 - shown right) will be fine.

Suppliers often have selectors that let you choose the parameters you need. For this circuit I chose a power darlington type BDX33C (shown RIGHT) which has Icmax=10A, Vcemax=100V, Pt = 70W (on heat sink) and Hfe > 750.

We need a base current of 2A / 750 = 3mA so R1 = (5V - 1.4V) / 3mA = 1.2K

R2 is there to remove base current when TR1 is off - 10K is fine.

2: Proportional speed control without feedback

The speed of a dc pm motor depends on the load, and the supply voltage, as shown here.

If the no-load speed is 10,000 rpm with a 10V supply, then it will run at 6000 rpm from a 6V supply.

So we can control the speed by reducing the voltage applied to the motor. This is easily done but has the disadvantage that the maximum available torque (driving power) is also reduced.

We'll come back to this graph.

Suppose we have a 12V supply. In the absence of a voltage V1 the darlington transistor TR1 (BDX33C again) is off, and no current flows. R1=10k makes certain there is no base current. R2 can be quite small - e.g. 470 ohms. Now if we apply a voltage - say 5V - to the input the emitter voltage will rise to 5 - 2*0.75 =3.5V and the motor will turn. Increase Vin, the motor voltage increases.

Connect Vin to the positive 12V supply and you get 12 - 1.5 = 10.5V at the motor.

The no-load speed is proportional to Vin. However, when the motor is running at low speeds lots of voltage is dropped across TR1, wasting battery power and producing lots of heat.

This approach works fine - but there is..

A better way - Pulse Width Modulation (PWM)

We can use the simple circuit we saw above to turn the motor supply on and off. If we do this repeatedly, we see the motor pulsing, going, stopping, going ..

If we speed it up the pulses smooth out, and the motor turns at a speed determined by the "mark to space ratio" of the pulses. So we can use "pulse width modulation" to control the motor speed. This has two main advantages; firstly that the full torque is available; and secondly that there is very little power dissipated in the control transistor, as it is always "fully on" or "fully off".

In this figure you can see a power MOSFET can be used to turn the motor on and off. If driving from a digital circuit you will need to choose a logic level operted MOSFET

The FQPF 13N06L will take 10A and 60V - price 0.62p Mouser. R1=1k, R2=10k

This diagram shows some examples of different mark to space ratios.
"Mark" is when the signal is high, i.e. full voltage; and "space" when it is at zero.
The motor receives pulses at regular intervals, so when the mark to space ratio is very low (as shown left, 10%) the motor can be seen to "pulse" or vibrate. You can improve this by using faster shorter pulses. However every time the transistor switches some power is lost - so its a compromise, depending on the inertia of the load on the motor.

Bidirectional control - forward and reverse

Only PMDC motors can be made to rotate in reverse by changing the polarity of the supply. To do this we need more switches, in the form of an "H Bridge". The diagram and truth table show the result of various switch positions.

h-bridge

S4 S3 S2 S1 Result
0 0 0 X open circuit: motor freewheeling
0 0 1 0 open circuit: motor freewheeling
X X 1 1 short circuit!
0 1 0 0 open circuit: motor freewheeling
0 1 0 1 dynamic braking
0 1 1 0 drive reverse
1 0 0 0 open circuit: motor freewheeling
1 0 0 1 drive forward
1 0 1 0 dynamic braking
1 1 x x short circuit!

 

Here you see the switches set for forward rotation. Current flows through S1, the motor, and to ground via S4.
If S1 and S2 (or S3, S4) are both closed there is a short circuit condition. This must be avoided.
When S1 and S3 (or S2 and S4) are both closed the motor is effectively "shorted out". The motor is thenbraked to a halt (regenerative braking). With large motors and loads, and electronic switches (transistors of any form) this condition should also be avoided as excessive currents can destroy the H bridge.

Semiconductor H bridge ICs provide additional circuitry to prevent unwanted and damaging conditions. For "low power" applications the L298 IC can supply up to 4A at 40V. For more demanding applications an H bridge of discrete MOSFETs can be driven from an H bridge driver IC such as the HIP 4081.

H bridges are best suited to use in PWM systems as described above.

More information here

Control with feedback

When a load is applied to the motor it slows down to provide the needed torque. We can measure the speed continuously with a variety of sensors; for example we can use an optical encoder, hall sensor and magnet, or a tachogenerator. Perhaps the easiest way to do this is with a microcontroller such as an arduino. The controller senses the motor shaft speed, and changes the control signal to the motor to keep it at the chosen value. See Servo control