This is only a preview of the July 2021 issue of Silicon Chip. You can view 41 of the 112 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Items relevant to "20A DC Motor Speed Controller":
Articles in this series:
Articles in this series:
Items relevant to "Model Railway Level Crossing":
Items relevant to "Silicon Labs-based FM/AM/SW Digital Radio":
Items relevant to "Advanced GPS Computer – Part 2":
Purchase a printed copy of this issue for $10.00. |
BY JOHN CLARKE
20A DC
Motor
Speed Controller
This small but powerful speed controller has a 20A rating and is packed with
features. It suits a wide range of applications, and is simple to build and use.
Features include low-battery protection, soft starting and adjustable pulse
frequency. It can handle DC motors that run from near 0V up to 30V.
T
here are a great many applications
for DC motors where speed control is desired or necessary. Since DC
motors can be run directly from batteries, they are used in golf carts, electric scooters, bikes and skateboards,
remote-controlled cars and boats – the
list goes on.
In most of those applications, you
need a way to control the speed of the
motor. Going flat out all the time isn’t
always a good idea!
A speed controller like this one is
the ideal solution. It can handle DC
motors with a rated voltage of up to
24V (30V maximum) and continuous
currents up to 20A.
The controller is presented as a bare
electronic module built on a PCB that
can be installed within a standard UB3
plastic case if required. It includes
heavy-duty terminals for the power
supply and motor connections, plus
additional terminals for the speed
control potentiometer that mounts
off the PCB.
The motor driving components are
mounted on substantial heatsinks for
cooling. The adjustable features like
soft-start rate and feedback gain are
set using onboard multi-turn trimpots
with voltage test points. An onboard
LED indicates the speed setting, as
26
Silicon Chip
well as faults like low battery or motor
disconnection.
Speed controller design
While we have published many DC
motor speed controllers in the past,
this version has more features and
better performance. The motor speed
is controlled using Pulse Width Modulation (PWM). That means that the
motor is driven by a series of on and
off voltage pulses rather than a variable
DC supply, making it more efficient.
Speed control of the motor is done
by varying the pulse width. The ratio of
the pulse width to the interval between
pulses is the duty cycle. A low duty
cycle will only provide a voltage to the
motor for a small portion of the time,
and the motor runs slowly.
As the on-pulse duration increases,
this greater duty cycle makes the motor
run faster until it reaches 100% duty
cycle and is driven continuously.
Oscilloscope traces Scope 1 & Scope
2 show how this PWM scheme works.
In Scope 1, the top (yellow) trace is
the gate drive signal for Mosfets Q1
and Q2. When it is high, the motor is
powered. In this case, the duty cycle is
very low at about 9.5%, so the motor
runs slowly. The lower cyan trace is
related to the motor current. This is
Australia’s electronics magazine
used to maintain motor speed with a
variable load.
Scope 2 has the same two traces,
but this time the duty cycle is much
higher, and the motor runs faster. The
motor is loaded less than in Scope 1,
so the current reading is lower despite
the higher duty cycle.
What’s new
One of the problems with controlling DC motors using PWM is
that the motor can make extra noise
due to the motor windings and other
mechanical parts vibrating at the PWM
frequency. This can be alleviated to
some extent by adjusting the PWM
frequency to produce minimal noise.
That noise tends to be reduced as
the PWM frequency is increased, and
is mostly eliminated at PWM frequencies above 20kHz (around the upper
limit of human hearing).
But increasing the frequency can
cause problems too. It becomes harder
to maintain the motor speed against
a varying motor load using the traditional back-EMF feedback system.
Very high PWM frequencies can also
cause a loss of motor torque.
These problems and solutions are
described in more detail in the separate section entitled “PWM motor
siliconchip.com.au
driving pitfalls at higher frequencies”.
This controller gives you the ability to adjust the PWM frequency
beyond audibility while addressing
the problems of limited low-speed
motor torque and control at elevated
frequencies.
Other features that are incorporated
include soft starting, low-voltage cutout, LED status indication and optional
motor disconnected detection. These
features are easy to set up and adjust
via trimpot adjustments.
Features
Soft starting
•
•
•
•
•
•
•
•
•
•
•
This is where the motor is slowly
increased in speed, up to the setting
of the speed pot. Soft starting reduces
the surge of current and rapid build-up
of motor torque compared to applying
power suddenly. The PWM duty cycle
is ramped up over a longer period, so
the motor starts more smoothly.
The maximum soft-start period is
two seconds for the full range from
0% duty to 100%. This period can be
adjusted from between zero and two
seconds in 255 steps.
Soft starting can be initiated in several ways. It applies when the controller is initially powered up, or when the
speed control is started from the fully
off position, and finally, after returning
to regular operation from low-voltage
shutdown.
•
•
•
•
•
•
•
•
•
•
DC motor PWM drive
Can drive motors rated up to 24V and 20A DC
Motor and controller supply voltage can be separate
16 PWM frequency choices
Motor load feedback control & gain adjustment
Adjustable soft-start rate
Motor speed curve adjustment
Under-voltage cut-out with LED indication & adjustable hysteresis
Duty cycle LED indicator
Optional motor disconnect detection
Specifications
Speed adjustment range: 0% to 100% duty cycle
Motor supply: from near-zero to 30V maximum
Controller supply: 10.5V to 30V maximum (5.5-26V with ZD1 linked out)
Speed indication: LED1 brightness varies with PWM duty cycle
PWM frequency: 16 steps from 30.6Hz to 32.4kHz (see Table 1)
Soft-start rate: 0-2 seconds in 255 steps for 0% to 100% duty cycle
Speed curve adjustment: minimum speed can be set to 0-33% duty cycle
Under-voltage (UV) threshold: 0-30V in 29.6mV steps
UV hysteresis: 0-5V in 29.6mV steps
UV indication: LED1 flashes on for 65ms at 1Hz
Motor disconnection detection: motor is shut down if monitored current
drops to zero while driving motor; indicated with 2Hz/50% duty cycle LED
flashing
• Speed pot disconnection detection: indicated with a dimly illuminated LED
Scope 1: a pulsewidth modulated
(PWM) drive
signal at a low
duty cycle, about
9.5%. Current has
little time to build
during each pulse,
so the motor runs
slowly.
Low-voltage detection
The low-voltage detection feature is
included to prevent over-discharging a
battery supplying power to the motor.
Most batteries, including lead-acid
and lithium chemistry types, will be
damaged if discharged beyond a certain voltage.
This features switches off the motor
drive at a pre-set threshold voltage.
This is indicated with a 65ms flash of
the indicator LED at 1Hz.
The voltage must be below the threshold for more than ten seconds before the
drive to the motor is switched off. This
prevents any nuisance low-voltage trips
that would otherwise switch off the
controller due to a short-term voltage
drop when the motor starts up.
Once shut down, the voltage needs
to rise above the low-voltage detection
threshold by a certain amount before
it will start up again. This hysteresis
prevents constant switching on and off
as the battery voltage recovers with the
motor load removed, only to switch off
again once the motor restarts.
siliconchip.com.au
Scope 2: another
PWM drive signal,
this time with
a duty cycle of
35.5%. This is
roughly equivalent
to driving the
motor at 1/3 of the
supply voltage, so
it will run faster
but not nearly at
full speed.
Australia’s electronics magazine
July 2021 27
Motor disconnection
The optional motor disconnect
detection prevents the motor from
starting up if it is disconnected and
then reconnected while the speed setting is above zero. When the motor is
detected as disconnected, the speed
potentiometer needs to be wound fully
anticlockwise and the motor reconnected before it can run again. The
disconnected state is indicated with
the indication LED blinking at 2Hz.
Separate supply voltage
Another feature is the ability to separate the controller’s supply voltage
from the supply to the motor. This
means that the motor can be run from
a much lower supply voltage than
that required to operate the DC Motor
Speed Controller.
So while the DC Motor Speed Controller requires a supply of at least
10.5V to operate (up to 30V), the motor
can be run using a separate supply
from near 0V up to 30V. The 30V limit
is sufficient to allow for just about any
24V battery; eg, a fully charged 12-cell
lead-acid battery is around 29V.
You can use the same supply for both
the controller and the motor, provided
the voltage is in the 10.5-30V range, and
that voltage is suitable for the motor.
Circuit details
The full circuit for the DC Motor
Controller is shown in Fig.1. It is based
around an 8-bit PIC16F1459 microcontroller, IC1, which provides the
PWM drive signal and monitors the
battery voltage, motor current and the
voltage from several trimpots and the
speed potentiometer. IC1 also monitors rotary switch S1, which selects
the PWM frequency.
IC1 has two PWM outputs, and we
use both. One is at pin 5 (PWM1) and
the other at pin 8 (PWM2). These PWM
outputs have different functions, but
provide the same PWM frequency and
duty cycle most of the time while the
motor is being driven.
The PWM1 output is used to drive
Mosfets Q1 and Q2 via gate driver
IC3. IC3 is an MCP1416, designed
to provide a high-current drive with
fast rise and fall times to the Mosfet
gates. This ensures that they switch
on and off quickly. Each Mosfet gate
is isolated from the other using a 10W
resistor. The resistors also prevent
Mosfet switching oscillations at the
gate threshold.
28
Silicon Chip
These Mosfets are logic-level types
that fully conduct with a gate voltage
of 5V. Non-logic-level Mosfets typically require at least 10V for full conduction. The two Mosfets are connected in parallel, and so share the
load (motor) current.
Low-value resistors are placed
between the source of each Mosfet
and ground, with Q1’s source resistor being used to monitor the current.
The source resistor on Q2, while not
used for load current measurement,
is still necessary. That’s so that the
total on-resistance of Mosfet Q2 and
its source resistor matches Q1 and its
source resistor.
Since the Mosfet on-resistance is
typically 0.014W, the 0.01W source
resistor for Q2 helps maintain even
sharing of the load current between
the two Mosfets. Without it, Q2 would
carry about 2/3 of the load current and
Q1 only 1/3.
Diode D1 is included between the
positive supply and the Mosfet drains
to clamp the induced voltage spike
when the motor’s drive is switched
off. This diode is effectively connected
across the motor terminals. It is a dual
10A schottky diode that can conduct
20A continuously when the diodes are
connected in parallel.
Paralleling the diodes ensures
nearly equal current sharing. That is
possible because the two diodes are
on the same silicon die, and therefore have the same characteristics and
operating temperature.
The motor supply is connected to
the GND and motor supply + terminals on screw connector CON1. This
positive supply is fed to the motor
via fuse F1, an automotive blade-type
fuse with a rating selected to suit the
motor. Three 470μF 35V low-ESR
electrolytic capacitors bypass the
motor supply after the fuse. These
are to provide a high short-term peak
current supply.
Feedback control
Many DC motor speed controllers
monitor motor back-EMF (electromotive force) to determine when variations in the load might reduce the
speed of the motor. This back-EMF
is the voltage generated by the motor
when the supply to it is switched off
and the motor is still turning. The
induced voltage reduces when the
motor slows under load.
Speed control is maintained by
Australia’s electronics magazine
increasing the PWM duty cycle to
increase motor torque and speed when
its speed drops. But we don’t use the
back-EMF sensing method for reasons
described under the section “PWM
motor driving pitfalls at higher frequencies”. Instead, we monitor its
current draw.
When Mosfets Q1 & Q2 are conducting, the voltage across Q1’s 0.01W
source resistor is proportional to the
current being drawn by the motor.
When the Mosfet is off, there is no
voltage across this resistor. So we use
a sample-and-hold circuit to capture
the voltage while Q1 is conducting.
Mosfet Q3 and the 100μF capacitor
form the sample-and-hold buffer. The
gate of Q3 is driven by the PWM2 output of IC1, which follows the PWM1
output. So when Q1 and Q2 are on,
so is Q3, and the 100μF capacitor
charges or discharges so that its voltage approaches that across the 0.01W
current sense resistor.
When Mosfets Q1 & Q2 switch off,
so does Q3, isolating the 100μF capacitor from the 0.01W resistor to prevent
it discharging during the off-time.
The reason we use the separate
PWM2 output to drive Q3 has to do
with the case when the motor is off.
In this case, the PWM1 output has a
duty cycle of 0% (ie, it’s held low), but
PWM2 is programmed to produce a
60μs pulse every 13.4s. This switches
Q3 on momentarily, discharging the
100μF capacitor via the 0.01W resistor.
This on-duration is extended if the
capacitor needs to be discharged from
a higher voltage, especially when the
motor is turned off by reducing the
speed control. Without this, the 100μF
capacitor slowly charges via leakage
current from amplifier IC2, causing the
motor to start rather abruptly.
IC2 is an instrumentation amplifier and provides amplification of
the small voltage across the shunt
for current measurement. Its gain can
be adjusted from between 611, when
trimpot VR6 is at minimum resistance,
and about nine times when the trimpot
is at its maximum of 50kW. This caters
for the wide range of motors that could
be used, ranging from those drawing
less than 1A up to 20A.
The output from IC2 is monitored by
the AN9 analog input (pin 9) of microcontroller IC1, which uses its internal analog-to-digital converter (ADC)
to convert the voltage from IC2 into a
10-bit digital value (0 to 1023).
siliconchip.com.au
Fig.1: microcontroller IC1 monitors the positions of speed pot VR1 and trimpots VR2-VR5 via five analog input pins. It
also reads the position of BCD switch S1 (used to set the PWM frequency) using four digital inputs. A PWM waveform
is produced at pin 5, which drives Mosfets Q1 & Q2 via driver IC3; those Mosfets switch current through the motor. The
motor current is converted to a voltage using a 10mW shunt; this voltage is amplified by IC2 and measured at pin 9 of IC1.
Speed control
Potentiometer VR1 is the main
speed control. The voltage at its wiper
varies with its rotation, and is fed to
analog input AN5 (pin 15) of IC1. This
is converted to a 10-bit digital value,
indirectly controlling the PWM duty
cycle applied to the Mosfets.
Motor load compensation is performed by increasing the duty cycle
of the PWM signal depending on
the motor load, based on the motor
siliconchip.com.au
current. The amount of feedback
applied is adjusted by setting the gain
for IC2, as described above.
Supply voltage monitoring
The motor supply voltage is monitored at analog input AN10 (pin 13)
of IC1. The supply voltage is reduced
to one-sixth (1/6) of its full value by
a 10kW/2kW voltage divider. So for a
0-30V motor supply, the voltage at
AN10 is in the range 0-5V.
Australia’s electronics magazine
This voltage is filtered using a
100nF capacitor to prevent noise
from altering the result of the ADC
conversion.
Setting adjustments
This voltage is compared with the
under-voltage threshold setting voltage at the AN7 input, pin 7, set by
trimpot VR4. This trimpot is connected across the 5V supply, allowing
a voltage range adjustment from 0-5V.
July 2021 29
PWM motor driving pitfalls at higher frequencies
When using PWM to drive a DC
motor, the average motor winding current varies depending upon the duty
cycle. Since torque is proportional to
the winding current, the motor speed
can be easily controlled.
In theory, the motor speed is not
affected by the frequency; it is only
the duty cycle that matters because
that sets the average current through
the motor windings. Higher PWM frequencies will result in less ripple in the
motor current, but will not affect the
average significantly.
But there are cases where higher
frequencies can affect the current at
lower duty cycles, to the point that
the motor will refuse to turn at all with
lower duty cycles. There is much confusion over the reasons for this and
what to do about it.
We trawled the internet trying to find
a good explanation of this phenomenon, and most of the information we
came up with was misleading or incorrect. So we performed several experiments to find out for ourselves.
The bottom line is this: if you are
using a half-bridge or full-bridge to
drive a DC motor, it will behave pretty
much as theory predicts. The motor
current varies almost exactly linearly
with the PWM duty cycle, regardless
of frequency.
That is what you would expect if you
model the motor as an inductance in
series with a resistance. If the inductance is L and the series resistance
is R, the motor winding impedance is
then R + 2π × f × L. The current for a
sinewave at any given frequency f is
then V ÷ (R + 2π × f × L).
A PWM signal comprises a DC component (the average level, V × duty
cycle) plus AC components at the
switching frequency f, and its squarewave harmonics at 3f, 5f, 7f etc. The
exact mix of harmonics varies with
the duty cycle.
As the current decreases with
30
Silicon Chip
increasing frequency, the winding
inductance attenuates the AC components of the PWM signal. The motor
windings act to smooth out these ripples, but the inductance has no effect
on the direct current level; it is solely
determined by the supply voltage, duty
cycle and motor winding resistance.
Our tests bear this out. But like many
simpler designs, our motor speed controller does not use a half-bridge or
full-bridge design and therefore does
not produce a square wave across the
motor windings.
The motor’s positive terminal is connected to V+, and the negative end is
periodically pulled down to 0V when
Mosfets Q1 & Q2 switch on.
Some of the time, we have V+ across
the motor. But the rest of the time,
when Mosfets Q1 & Q2 are off, the
winding inductance and back-EMF pull
the motor’s negative terminal above
the positive terminal. The voltage is
clamped by diode D1 to around 0.5V
above the positive voltage.
So there is a negative voltage across
the motor when the Mosfets are off,
rather than 0V, and a significant recirculating current flows through diode
D1. This causes the motor winding
current to decay significantly faster
than in the half-bridge or full-bridge
case described above.
You can see this if you compare
Scopes 3 & 4. These show the same
unloaded DC motor being driven at
the same PWM frequency (3.92kHz)
and same duty cycle (10%) but with
half-bridge drive in Scope 3 and
single-ended drive in Scope 4. The
yellow trace shows the applied voltage, while the green trace shows the
current through the motor windings.
The rate of current rise and peak
current are similar between the two.
But when the high-side Mosfets switch
off and the low-side Mosfets switch on
in Scope 3, you can see a exponential
decay in the motor winding current.
Australia’s electronics magazine
The current flows throughout the
whole cycle until it starts rising again
on the next cycle.
In Scope 4, with the current recirculating through the diode during the
off-time, it decays exponentially (but
faster), then linearly, reaching zero
before the next cycle. Therefore, the
average current is much lower, around
half (a reading of 400mV vs 800mV),
despite the duty cycle being the same.
Scope 5 shows the same half-bridge
drive scheme used in Scope 3, again
with a 10% duty cycle, but at a much
higher PWM frequency of 31.4kHz.
The average current is only a little bit
lower, reading about 750mV compared
to around 800mV, due to the Mosfet
‘dead time’ being more significant at
this higher switching frequency.
Scope 6 shows the same singleended drive scheme as in Scope 4,
but this time at 31.4kHz. The current disparity has increased further
– the average winding current is
now only 286mV. So the effect of the
single-ended drive scheme on motor
current is worse at higher frequencies.
With the single-ended drive scheme,
the average motor current for low duty
cycles is less than expected, and this
effect increases at higher frequencies.
So it is a good idea to increase the minimum duty cycle at higher PWM frequencies to compensate, which is the
reason for trimpot VR3 in this design.
The magnitude of this effect can
vary with the motor, too. Larger motors
with a higher inductance will tend to
suffer more from reduced current (and
torque) at low duty cycles with higher
PWM frequencies.
In practice, the easiest way to
compensate for this effect is to tune
the minimum duty cycle setting (by
adjusting VR3) until you get satisfactory speed control at the lower end of
speed pot VR1’s range. If this cannot
be achieved for a given motor, try a
lower PWM frequency.
siliconchip.com.au
Scope 3: the voltage across the motor (yellow) and
current (green) with a half-bridge at 10% duty cycle. The
motor inductance limits the current rise and fall times.
The current does not fall back to zero before the next
pulse, despite the relatively low duty cycle; the winding
inductance sustains it.
Test point TP4 is included so the set
threshold can be measured.
To make setting up easier, the voltage at TP4 is one-tenth the undervoltage threshold. So if you want the
under-voltage threshold to be 11.5V,
set the voltage at TP4 to 1.15V.
The voltage at the AN7 input
is converted to a digital value
and multiplied by 1.6666, so
the scale matches the dividedby-six motor voltage.
The motor supply has to drop below
this threshold for 10 seconds before
the drive to the motor is switched
off. When this happens, LED1 flashes
momentarily each second.
Typically, a battery will recover a
little when the motor drive is switched
off; the battery voltage will rise once
there is no load. To prevent the motor
from switching on again due to this
effect, we add hysteresis.
The motor supply will need to go
above the low voltage threshold plus
the hysteresis voltage before the motor
drive will be re-enabled. In practice,
the battery needs to be charged before
the motor can run again.
This hysteresis is set using trimpot
VR5 and can be monitored at TP5.
The TP5 reading is the full hysteresis
voltage (not 1/10th as it is with the
threshold measurement at TP4). So if
you want a 1V hysteresis, adjust VR5
until TP5 reads 1V.
Scope 5: switching back to half-bridge driving but bumping
up the frequency to 31.4kHz, you can see that the average
current value is hardly affected. The current level averages
higher during the off-time due to the shorter off period.
siliconchip.com.au
Scope 4: like Scope 3 but we have switched from a halfbridge driver to a single Mosfet with a recirculating diode,
as used in this (and many other) Speed Controllers. This
dramatically affects how the current tapers off at the end
of each pulse, so the motor current is much lower with
low duty cycles.
The soft-start period adjustment is
with VR2, measured at TP2. This voltage is monitored at the AN6 input, and
sets the maximum rate at which the
motor speed increases.
The maximum time to reach 100%
duty cycle from zero is two seconds,
with 5V at TP2. A 2.5V setting will
give a one-second soft-start period,
and so on.
VR3 is the speed curve adjustment
trimpot, with corresponding test point
TP3. This is monitored at the AN4
input of IC1, pin 16. This allows the
speed pot to be used over its entire
range when the PWM frequency is set
relatively high, and can also compensate for the fact that motors can require
Scope 6: the single-ended drive with the higher frequency
suffers from the same rapid decay in current as shown in
Scope 4, except this time the average current is even lower
as it has less time to build during the shorter on-pulses.
Australia’s electronics magazine
July 2021 31
Power supply
The DC Motor Speed
Controller with speed control
potentiometer VR1 attached for testing.
a duty cycle well above 0% before they
start spinning.
As described in the separate panel
labelled "PWM motor driving pitfalls
at higher frequencies", in some cases,
driving a motor with a high PWM frequency can mean that the motor will
not start until the duty cycle is at 20%,
or even higher.
The curve adjustment sets the initial duty cycle when the speed potentiometer is rotated just clockwise from
fully-anticlockwise. This adjustment
removes the dead zone from the speed
pot. The curve adjustment range is
from almost zero to a 33% initial duty
cycle.
Whenever the curve setting is nonzero, the software within IC1 expands
the speed control range so that the
maximum duty cycle is still achieved
when VR1 is fully clockwise.
Operation at low frequencies can
also be optimised using the curve
adjustment, with jumper JP1 inserted
to pull the normally-high RA5 digital
input low (pin 2). Without the jumper
inserted, the RA5 input is pulled high
via an internal pull-up current.
The curve adjustment when JP1
is inserted allows for better feedback control at very low duty cycles.
The adjustment reduces the motor
snap-on effect, where the feedback voltage suddenly rises with an
increase of the PWM duty just off
from zero. This adjustment sets a
feedback offset value so that feedback is ignored below the specified
speed setting.
Trimpot VR3 is also used to enable
or disable motor disconnection detection. This is done by splitting VR3’s
range into two halves, 0-2.5V and 2.55V. From 0V to 2.5V, motor disconnection checking is disabled. Above 2.5V,
motor disconnect detection is enabled
32
Silicon Chip
and the curve adjustment is reversed,
with fully clockwise giving the same
effect as fully anti-clockwise.
When the motor current feedback is
below a set value for more than about
200ms, the motor is determined as
being disconnected. In this case, the
PWM duty cycle is set to zero and the
LED flashes at 2Hz.
The motor will only start again after
it is reconnected, and the speed pot
is firstly wound fully anti-clockwise.
This prevents erratic operation due to
loose wires etc.
Motor disconnect detection is
optional because, unless the motor is
set up correctly when used at high frequencies, false disconnection events
can cause nuisance shutdowns. This
can occur if the curve is not adjusted
correctly, with a sufficiently high
duty cycle at the start of the speed
pot rotation.
PWM frequency options
Switch S1 is used to select the
frequency of the PWM drive for the
motor. This is a 16-position rotary
BCD (binary-coded decimal) switch.
There are four switch terminals
labelled 8, 4, 2 and 1 plus a common
connection, which we have connected
to ground.
The other switch terminals connect
to the RA1, RB6, RB7 and RB5 digital
inputs of IC1, respectively. All of these
pins except for RA1 are configured
in IC1 to provide a pull-up current.
The RA1 input does not have such an
option, so an external 10kW pull-up
resistor connects to 5V.
These pull-ups hold the inputs high
(at 5V) whenever the switch does not
connect that terminal to ground. The 16
possible combinations are decoded in
IC1, and the required PWM frequency
is selected (see Table 1).
Australia’s electronics magazine
Power for the controller is connected via the CON1 terminals
between GND and the controller supply positive input. The supply current passes through zener diode ZD1,
and the input of regulator REG1 is
bypassed with a 470nF capacitor.
REG1 is a low-dropout automotive 5V regulator. It is capable of
withstanding a reverse polarity voltage, so it provides the circuit with
reversed-supply protection. The maximum recommended operating voltage
at the input of REG1 is 26V. So for use
at up to 30V, ZD1 drops the voltage at
the input by around 4.7V.
The dropout voltage for REG1 is
typically 0.5V. That means it needs
5.5V at the input to ensure that the
output is regulated. The addition of
ZD1 means that the minimum recommended voltage for the controller
is 5.5V + 4.7V = 10.2V. We round this
up to 10.5V to be safe.
Note that the controller and motor
positive supply connections are separate, so the motor can be run at a different voltage if required.
That means the motor supply could
be outside the controller’s range, and
the circuit will still work as long as an
appropriate controller supply voltage
is applied. The two supply inputs can
also be tied together when the motor
supply voltage is within the controller’s suitable range.
Table 1: PWM frequency options
BCD switch
setting (S1)
PWM frequency
0
30.6Hz
1
61.3Hz
2
122.5Hz
3
245Hz
4
367.6Hz
5
490Hz
6
980Hz
7
1.96kHz
8
2.97kHz
9
3.92kHz
A
5.88kHz
B
7.84kHz
C
11.8kHz
D
15.7kHz
E
23.5kHz
F
32.4kHz
siliconchip.com.au
Construction
The DC Motor Speed Controller is
built using a double-sided, platedthrough PCB coded 11006211, measuring 122 x 58mm. Fig.2 shows the
assembly details.
Start by installing the two 10W
surface-mount resistors and the two
0.01W resistors, all near Q1 & Q2. Now
fit IC3, the surface-mounting Mosfet
gate driver. Take care when soldering this; you might need a magnifying glass and a separate work light.
Solder pin 1 first and check that the
remaining pins are aligned correctly
before soldering the remainder.
Zener diode ZD1 can now be
installed, taking care with its orientation. Follow with the seven throughhole resistors. Table 2 shows the resistor colour codes, but you should also
check each one using a digital multimeter (DMM) before mounting it.
Once these parts are in place, install
the socket for IC1. IC2 can be mounted
using a socket, or you can solder it
directly to the board. Make sure each
is orientated correctly.
Now is a good time to fit Mosfet Q3,
the LED and the two-way header for
jumper JP1. Make sure LED1’s longer lead (anode) goes into the hole
at the left, marked with an “A”. You
could mount a two-pin header there
instead, or solder a twin-lead cable to
the board so that the LED can be chassis-mounted.
The polyester capacitors can then
be inserted; it's easiest to install the
electrolytic types after all the semiconductors. Follow with the trimpots,
which are all multi-turn types. Orientate them with the adjustment screws
positioned as shown. BCD switch S1
can now be installed, with the orientation dot at the lower right.
The 3-way screw terminal block
(CON2) is next on the list. Make sure
it is correctly seated against the board
and that its openings face outwards
before soldering its pins. CON1, the
6-way screw terminal barrier block,
can then go in. Note that Altronics
state these are 15A rated; however,
the Dinkle data for these DT-35B07W-XX terminals rates them at
20A, so they are suitable for this 20A
controller.
The fuse holder is next. You can fit
a monolithic holder or two separate
fuse holder clips. If using individual
clips, it might be a good idea to insert
a fuse before soldering to ensure they
are lined up correctly.
You can install PC stakes at test
points TP1-TP5 and TP GND, or leave
them off and probe the PCB pads
directly with multimeter probes.
Installing the semiconductors
Regulator REG1 is mounted horizontally on the board. It is installed by
first bending the leads to pass through
their mounting holes. REG1’s tab is
then secured to the PCB using an M3
x 6mm machine screw and nut, after
which the leads are soldered.
Mosfets Q1 & Q2 and schottky
diode D1 are mounted vertically and
fastened to separate small heatsinks.
The three heatsinks must be installed
first, by soldering their locating pins
to the relevant PCB pads. Make sure
that the heatsinks are properly seated
against the PCB before soldering them
in place.
Then slide Q1 & Q2 into their
mounting holes and, using silicone
washers and insulating bushes (see
Fig.3) to isolate each from the heatsink, fasten them using M3 x 10mm
machine screws into the tapped holes
on the heatsinks. Tighten the screws
firmly, then solder their leads. Diode
D1 is mounted similarly.
Now install the leftover electrolytic
capacitors, taking care to orient them
correctly. Finally, use your multimeter to confirm that the metal tabs of
D1, Q1 and Q2s are isolated from their
heatsinks.
Testing
Before inserting IC1 into its socket,
check the regulator operation by
applying 10.5-30V between the 0V and
the controller positive supply terminals on CON1.
Table 2: resistor colour codes
Fig.2: the Speed Controller PCB is relatively compact and uses just five SMD
parts: four resistors and Mosfet driver IC3. Mosfets Q1 & Q2 and diode D1 attach
to PCB-mounting heatsinks for cooling. During assembly, watch the polarity of
the three ICs, diode ZD1, the electrolytic capacitors and BCD switch S1.
siliconchip.com.au
Australia’s electronics magazine
July 2021 33
The disadvantage of back EMF based speed feedback
Typically, a DC motor acts as a generator when the power is switched off. When
using PWM drive, this generated voltage or back EMF (Electromotive Force)
occurs repetitively when the driving Mosfets are switched off. But the induced
voltage is not developed immediately after switch-off; it does not happen until
the stored charge in the inductance of the motor windings dissipates.
In many speed controllers, the back EMF voltage is used to stabilise the
speed with varying load. As the motor is loaded, the speed and back EMF
reduce, and this change is used to provide feedback that increases the PWM
duty cycle to maintain speed under load.
However, with higher PWM frequencies, the back EMF voltage appears much
later in the PWM cycle; sometimes, it is not developed until after the Mosfets
are switched on again, so it is impossible to sense the back EMF.
Compare scope grabs Scope 7 & Scope 8. They are the same except that
the PWM frequency is just under 3kHz in Scope 7 and nearly 12kHz in Scope
8. You can see the back EMF ‘shelf’ appear about 80μs after switch-off in
Scope 7, but it is barely visible in Scope 8 and would not be present at all with
a higher switching frequency.
The lack of back-EMF at high PWM frequencies means that we need to use
a different way of detecting motor load. The easiest alternative is to measure
the motor current. We only do this while the motor is driven by amplifying the
voltage across a low-value shunt resistor in series with the motor.
Using feedback control based on measuring current, the PWM duty cycle
can be increased whenever the motor is loaded. This tends to overcome the
shortcomings of low torque at high frequencies and lower duty cycles, to
some extent at least.
Scope 7: with a
PWM frequency
just under 3kHz,
there is sufficient
time for back-EMF
sensing. The motor
voltage shoots up
immediately after
the Mosfets switch
off, then falls back
to a lower plateau
once the magnetic
field has decayed
and back-EMF
starts to become
dominant.
Scope 8: with a
PWM frequency of
nearly 12kHz, the
back-EMF voltage
is barely visible
just before the
start of the next
pulse. It would
be impractical to
sample the backEMF voltage at
this frequency
for this motor,
and impossible at
higher frequencies.
34
Silicon Chip
Australia’s electronics magazine
Measure the voltage between REG1’s
metal tab and its right-most lead. You
should get a reading close to 5V (4.75
to 5.25V). If not, check that the input
voltage at the left lead of REG1 is at
least 5.5V.
If this reading is correct, switch off
the power and install IC1, making sure
it is oriented correctly, and none of its
leads fold under the body. If you used
a socket for IC2, plug it in now.
At this stage, it is a good idea to wire
potentiometer VR1 to CON2. You will
also need to insert the fuse to continue
testing. The fuse should be rated to
suit the motor; if it is a 1A rated motor,
install a 1A fuse; for a 20A motor, use
a 20A fuse etc.
Next, wind the curve adjustment
trimpot VR3 fully anti-clockwise. You
can find this position by winding at
least 20 turns anti-clockwise or until a
faint clicking sound is heard. When the
circuit is powered, the voltage reading
between TP3 and GND should be very
close to 0V.
Low-voltage cut-out testing
When power is applied, the LED
will flash at 1Hz because there is no
power connected to the motor supply.
Trimpot VR4 sets the low-voltage
cut-out. With a multimeter connected
between TP4 and TP GND, adjust VR4
for one-tenth of the desired low cutout voltage. So for a low voltage cutout at 11.5V (a safe level for most 12V
lead-acid batteries), adjust TP4 until
you get a reading of 1.15V.
Adjusting the hysteresis is similar,
using trimpot VR5 and measuring at
TP5. The hysteresis is the voltage measured at TP5 (not 1/10th as before). So
for a 1V hysteresis, set TP5 to 1V. Hysteresis can be set for up to 5V, but 1V
is a reasonable starting point. With the
recommended 11.5V cut-out voltage,
that means the battery voltage needs
to rise above 12.5V (about half-charge)
before operation resumes.
If you have an adjustable power
supply, the low-battery cut-out can be
tested. Connect this supply between
the motor supply positive and 0V, and
rotate VR1 fully clockwise. The LED
will light up when the supply voltage is in the operating range and flash
when a low voltage is detected.
Set the supply to more than the low
voltage cut-out setting plus the hysteresis setting, so the low-voltage cut-out
will not initially activate. Then reduce
the voltage to the cut-out voltage. Note
siliconchip.com.au
that the low-voltage protection will
take about 10s to occur once the supply
is below the threshold. LED1 should
then flash at 1Hz.
Slowly increase the supply to just
over the threshold plus the hysteresis
setting value (12.5V in our example),
and LED1 should light fully. If necessary, adjust VR4 & VR5 to get it to cut
out and in at precisely the voltages
you require.
Soft-start setting
Adjust VR2 for the required softstart rate. Typically, 5V at TP2 is suitable giving a maximum two-second
soft-start period. You can reduce this
for faster starting, or disable soft starting with 0V measured at TP2.
Curve adjustments
VR3 sets the curve adjustment.
This is off when VR3 is wound fully
anti-clockwise, with 0V at TP3. Rotating VR3 clockwise will increase the
curve adjustment. For settings above
2.5V, see the optional motor disconnection detection section below.
As mentioned earlier, the curve setting provides high-frequency operation improvements when JP1 is out
of circuit or low-frequency operation
improvements with JP1 inserted.
With JP1 out, VR3 increases the minimum duty cycle for low settings of
VR1. To make the adjustment, rotate
speed potentiometer VR1 slightly
clockwise from fully anticlockwise,
giving a reading of just over 20mV at
TP1. Then adjust VR3 clockwise until
the motor just starts to run.
Adjust the gain control (VR6) for best
motor control for maintaining motor
speed under load. Clockwise will
give more gain, and anti-clockwise
will set a lower gain. Setting the gain
too high can cause the motor speed to
become unstable.
Set the PWM frequency to a value
that you find best for the motor. This
will be a compromise between motor
control performance and the amount
of PWM noise made by the motor. Very
low frequencies can cause the motor
to run coarsely. Very high frequencies will improve smoothness, but can
reduce torque at lower settings unless
the feedback control is adjusted to give
better performance under load.
Adjust the response trim pot, VR3,
to give the best speed control range for
VR1. When the PWM frequency is low,
you might find that the motor speed
siliconchip.com.au
Parts List – 20A DC Motor Speed Controller
1 double-sided, plated-through PCB coded 11006211, 122 x 58mm
1 UB3 Jiffy box (optional) [Jaycar HB6013, HB6023, Altronics H0203]
1 6-way 20A* PCB mount barrier screw terminals, 8.25mm pitch (CON1)
[Altronics P2106]
1 3-way screw terminal with 5.08mm spacing (CON2)
1 10kW linear potentiometer (VR1)
1 knob to suit VR1
1 two-pin header, 2.54mm pitch, plus shorting block/jumper (JP1)
3 TO-220 silicone insulating washers and bushes
1 20-pin DIL IC socket for IC1
1 8-pin DIL IC socket for IC2 (optional)
3 TO-220 PCB-mounting heatsinks [Jaycar HH8516, Altronics H0650]
1 4-bit BCD switch (S1) [Jaycar SR1220, Altronics S3001A]
1 20A blade fuse holder (F1) [Altronics S6040]
1 blade fuse to suit motor (up to 20A)
4 M3 x 10mm panhead machine screws
1 M3 nut
4 6.3mm-long M3-tapped standoffs and 8 M3 x 6mm screws (optional; for
mounting the board)
6 PC stakes (optional)
* Dinkle specifies these as 20A-rated; Altronics state 15A
Semiconductors
1 PIC16F1459-I/P microcontroller, DIP-20, programmed with 1100621A.hex (IC1)
1 AD627ANZ instrumentation amplifier, DIP-8 (IC2) [element14, RS]
1 MCP1416T-E/OT Mosfet driver, SOT-23-5 (IC3) [RS Components 668-4216]
1 LM2940CT-5.0 regulator, TO-220 (REG1) [Jaycar ZV1560, Altronics Z0592]
2 STP60NF06 N-channel Mosfets, TO-220 (Q1,Q2) [Jaycar ZT2450]
1 2N7000 N-channel small signal Mosfet, TO-92 (Q3)
[Jaycar ZT2400, Altronics Z1555]
1 3mm high-brightness LED (LED1)
1 4.7V 1W zener diode (ZD1)
1 MBR20100 dual 10A schottky diode, TO-220 (D1) [Jaycar ZR1039]
Capacitors
3 470μF 35V low-ESR electrolytic
1 470nF 63V MKT polyester
2 100μF 16V electrolytic
9 100nF 63V MKT polyester
Resistors (all 1/4W, 1% metal film axial unless otherwise stated)
1 100kW
3 10kW
1 2kW
1 1kW
1 330W
2 10W M3216/1206 surface mount
2 0.01W M6432/2512 3W surface mount
[RS Components Cat 188-0753, Vishay WFMA25120100FEA or equivalent]
4 10kW top adjust multiturn trimpots (3296W style) (VR2-VR5)
1 50kW top adjust multiturn trimpot (3296W style) (VR6)
can increase sharply when winding
VR1 up from zero, especially when
there is high feedback gain. Adjusting the response using VR3 with JP1
inserted can reduce this snap-on effect.
Start from 0V (at TP3) and adjust VR3
until the motor runs well at low duty
cycles, without the snap-on effect.
Motor disconnection detection
If you want this option, the curve
adjustment trimpot (VR3) is set in the
opposite manner. There is no curve
adjustment when VR3 is fully clockwise (5V at TP3), and the curve adjustment increases as VR3 is wound further anti-clockwise. It is usable down
to 2.5V at TP3.
SC
Australia’s electronics magazine
Fig.3: this side view shows the detail
of how the TO-220 package devices
are mounted to the heatsinks. The
hole in the heatsink is pre-tapped. The
heatsinks are connected to ground
via the PCB and mounting pins, so
you need the insulating washers and
bushes.
July 2021 35
|