This is only a preview of the March 2008 issue of Silicon Chip. You can view 32 of the 104 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. Articles in this series:
Items relevant to "12V-24V High-Current DC Motor Speed Controller, Pt.1":
Articles in this series:
Items relevant to "A Digital VFO with LCD Graphics Display":
Items relevant to "A Low-Cost PC-to-I²C Interface For Debugging":
Items relevant to "One-Pulse-Per Second Driver For Quartz Clocks":
Purchase a printed copy of this issue for $10.00. |
Want to control a really big DC motor? This circuit can
handle 12V or 24V DC motors at currents up to 40A.
12V-24V High-Current
Motor Speed Controller
This 12V or 24V high-current DC Motor Speed Controller is rated
at up to 40A (continuous) and is suitable for heavy-duty motor
applications. All control tasks are monitored by a microcontroller
and as a result, the list of features is extensive.
T
HIS COMPLETELY NEW speed
controller is based on a PIC16F88
microcontroller. This micro provides
all the fancy features such as battery monitoring, soft-start and speed
regulation. It also monitors the speed
setting potentiometer and drives a
4-digit display board which includes
two pushbuttons.
The 4-digit display board is optional
but we strongly recommend that you
build it, even if you only use it for
the initial set-up. It unlocks the full
features of the speed controller and
allows all settings to be adjusted. The
microcontroller will detect whether
30 Silicon Chip
the display board is connected and if
not, the speed controller will support
only the basic functions. In this simple mode, it will function as a simple
speed regulated controller with automatic soft-start and with the speed being directly controlled by a pot (VR1).
All the other settings will be the initial
defaults or as last set (with the display
board connected).
When connected, the 4-digit display
allows you to monitor the speed and
the input voltage (useful when running
from a battery). It also enables you to
navigate through the various menus
to adjust the settings.
The circuit can run from 12V or 24V
batteries and can drive motors (or resistive loads) up to 40A. Furthermore,
this is our first DC speed controller
(except for out train controllers) incorporating speed regulation under load.
In other words, a given motor speed is
maintained, regardless of whether the
motor is driving a heavy load or not.
Monitoring the back-EMF
In speed controllers which do not
have good speed regulation (ie, the vast
majority of designs), the more a motor
is loaded, the more it slows down. In
order to provide speed regulation, the
siliconchip.com.au
Pt.1: By MAURO GRASSI
circuit must monitor the back-EMF
of the motor, since this parameter is
directly proportional to its speed.
As a result, our new speed controller
monitors the back-EMF of the motor.
“Back-EMF” is the voltage generated
by any motor to oppose the current
through the windings. EMF stands for
“electromotive force” and is an obsolete term for voltage. Back-EMF is directly proportional to the motor speed
and so by monitoring this parameter,
we have a means of controlling and
maintaining the motor speed.
In practice, the main control loop
of the microcontroller tries to match
the speed of the motor (back-EMF) to
the speed set by the pot or recalled
from a preset memory. If the measured
speed is lower than the set speed, the
duty cycle of the pulse width modulation (PWM) signal used to drive the
power Mosfets that control the motor
is gradually increased. In other words,
siliconchip.com.au
if the speed tends to drop, more power
is fed to the motor and vice versa.
The frequency of the pulse width
modulation can be set from 488Hz to
7812Hz. This is a useful feature since
different motors will have different frequency responses, as well
as different resonant frequencies.
This is important to reduce the
audible buzzing from the pulse
width modulation, as these frequencies are well within the
range of hearing.
By now you’re probably wondering how the microcontroller
monitors the back-EMF of the motor, considering that the motor is
continuously driven with pulse-width
modulated DC. The answer is that the
micro periodically turns off the PWM
signal to the motor for just enough time
for the back-EMF to stabilise. This
“window” needs to be wide enough
to ensure that we are measuring backEMF and not the spike generated by
the last PWM pulse. On the other
hand, we don’t want the window so
wide that the maximum power to the
motor is significantly reduced or that
the motor noticeably slows.
The compromise value is that the
motor is monitored for 200ms every
7.4ms (ie, about 135 times a second),
as shown in the scope diagrams in
this article. As a result, the fact that
we do monitor the back-EMF around
135 times a second means that the
power applied to the motor is slightly
less than the theoretical maximum,
although this effect is negligible.
A low-battery alarm is also incorporated to warn when the battery level
drops below a preset value. This is
especially useful for applications like
electric wheelchairs.
There are also eight memory speed
settings. All settings are persistent,
meaning they are retained in nonvolatile memory.
Soft start
When the motor is switched off,
perhaps by an external switch in series
with one of its terminals, the voltage
at the drain of the Mosfets will be
0V (this is due to the voltage divider
used to scale the back-EMF voltage
to within the operating range of the
microcontroller). The microcontroller
converts this analog value to a digital
value using an on-board ADC (analogto-digital converter).
The firmware detects this 0V con-
Main Features
•
•
•
•
•
•
•
•
•
•
Good speed regulation under
load
Automatic soft-start and fast
switch-off
Eight memory settings
4-digit 7-segment display
Variable frequency for pulse
width modulation (PWM)
Battery level meter
Low-battery alarm
Persistent settings & defaults
Rated up to 40A continuous
current
12-24V DC input voltage
dition and sets the duty cycle of the
PWM to 0%. This ensures that when
the motor is switched in, its speed will
increase gradually from the stationary
state to the desired speed setting.
Turn-on currents for motors can be
very high and it is desirable to reduce
these surge currents as much as possible. That is why the automatic softstart feature has been incorporated into
the firmware. It will ensure that the
motor is brought up to the set speed
gradually.
Fast switch-off feature
Another feature that has been incorporated into the firmware is the
so-called “Fast-off” feature. This
means that the duty cycle of the PW
modulation is set to 0% (turning off the
motor) whenever the selected speed
setting of the pot goes to 0%. Rather
than decreasing the speed gradually,
setting the pot to its lowest setting
turns the motor off immediately.
This design also incorporates our
extensive experience with previous
speed controllers featured in SILICON
CHIP. As a result, it uses four highcurrent Mosfets to do the switching
(pulse width modulation), uses very
wide tracks on the PC board and heavyduty (40A) terminal blocks to carry the
heavy currents.
User interface
Two pushbuttons on the display
board are used to navigate through
the menus, while the pot is used both
to vary the speed and to vary certain
settings.
March 2008 31
Parts List
1 PC board, code 09103081,
124mm x 118mm
2 heavy-duty PC-mount terminal
blocks (3-way) (Altronics P2053)
1 8-pin DIP IC socket
1 18-pin DIP IC socket
1 SPDT toggle switch (S1)
1 50A 5AG fuse (Jaycar SF1976)
1 60A 5AG fuseholder (Jaycar
SZ2065)
1 12-way pin header (Altronics
P-5502)
1 PC-mount mini piezo beeper
(Jaycar AB3459 or equivalent)
1 220mH inductor (L1) (Jaycar
LF1276 or equivalent)
1 10kW 16mm PC-mount linear
single-gang pot (VR1)
1 500W horizontal trimpot (VR2)
Semiconductors
1 PIC16F88-I/P microcontroller
programmed with 0910308A.hex
(IC1)
1 MC34063 switchmode DC-DC
converter (IC2)
1 BC327 PNP transistor (Q1)
3 BC337 NPN transistors (Q2-Q4)
4 IRF1405 N-channel Mosfets
(Q5-Q8) (Jaycar ZT2468)
1 1N4004 diode (D1)
1 1N5819 Schottky diode (D2)
2 MBR20100CT 20A diodes
(Jaycar ZR1039) OR
1 40EPF06PBF 40A ultra-fast
diode (Farnell 910-1560) (D3)
5 1N4745 16V 1W zener diodes
(ZD1-ZD5)
2 1N5364BG 33V 5W zener diodes
(ZD6-ZD7) (Farnell 955-8217)
1 3mm red LED (LED1)
Capacitors
1 2200mF 50V low-ESR electrolytic (Altronics R-6207)
The two pushbuttons are sensitive
to two types of presses, short and long.
A short press is of the order of half a
second or less while a long press is
one around one second.
To change a setting, a long press
is usually needed. This prevents
unwanted changes to the settings,
which are stored in EEPROM and thus
recalled at the next switch on.
Because of the capabilities offered
by the PIC microcontroller, we have
32 Silicon Chip
1 470mF 16V electrolytic
1 100mF 63V electrolytic
1 100mF 25V electrolytic
1 10mF 25V electrolytic
3 4.7mF 16V electrolytic
1 220nF 100V MKT polyester
1 100nF 100V MKT polyester
3 100nF monolithic
1 470pF ceramic
Resistors (0.25W, 1%)
2 33kW
1 100W
2 4.7kW
1 56W
1 3.6kW
1 22W 1W
6 1kW
4 15W
2 470W
3 1W
Display Board
1 PC board, code 09103082,
73mm x 58mm
1 200mm length 16-way rainbow
cable
1 12-way pin header (Altronics
P-5502)
2 12-way header plugs (Altronics
P-5482) (to terminate cable)
1 SPST PC-mount momentarycontact switch, yellow (Jaycar
SP0722; Altronics S-1097) (S2)
1 SPST PC-mount momentarycontact switch, red (Jaycar
SP0720; Altronics S-1095) (S3)
1 16-pin DIP IC socket (optional)
1 100nF monolithic capacitor
Semiconductors
1 74HC595 shift register (IC3)
4 BC337 NPN transistors (Q9-Q12)
4 7-segment common cathode
red LED displays (Jaycar
ZD1855; Altronics Z-0190 )
Resistors (0.25W, 1%)
4 470W
8 39W
been able to incorporate a large number of features into the firmware, as
described in the separate panel later
in this article.
Circuit description
The circuit for the speed controller
is shown in Fig.1. As noted previously,
it can work with 12V or 24V batteries
but has been optimised for operation
at 24V. Within the circuit itself, there
are two separate voltage rails: +5V for
the microcontroller and +16V for driving the gates of the Mosfets. Both are
derived from the +24V input supply.
The main input supply is filtered by
a 2200mF low ESR capacitor, to minimise high-voltage transients which
can be produced by the inductance
of the battery connecting leads. This
capacitor is absolutely vital to the
proper operation of the speed controller at high currents.
S1 is the power switch and diode
D1 protects the low-power part of
the circuit (IC1 & IC2) from reverse
polarity. A 22W 1W resistor, a 33V
5W zener diode (ZD7) and a 100mF
capacitor also protect the MC34063
IC from transients on the supply rail.
The filtered supply is then fed to
the MC34063 (IC2) which operates
in a standard step-down converter
configuration to provide the +5V rail.
Three 1W resistors between pins 6 & 7
are used to set the maximum switching current. The output voltage is set
by the voltage divider associated with
trimpot VR2.
Only about 200mA is ever drawn
from this supply and most of this is
used to drive the display.
IC1 is the heart of the circuit and
is the popular PIC16F88 microcontroller which incorporates a number
of peripheral functions. Of these, the
timers, hardware PWM (pulse width
modulation) and three ADC inputs
are used.
The three ADC inputs used are at
pins 1, 2 & 18. As these need to be
within the 0-5V range, voltage dividers
consisting of 33kW and 4.7kW resistors
are used to scale both the input voltage
rail (which could be as high as 29V)
and the back-EMF from the motor, to
be fed to the ADC inputs at pins 1 &
18. The ADCs convert the monitored
voltages to 10-bit values.
The +16V rail is used as the gate
drive supply for the Mosfets and is
derived from the 24V supply via a
1kW resistor and a 16V 1W zener
diode (ZD1). Bypassing of this rail
is particularly important and is accomplished using 100mF and 100nF
capacitors near ZD1 and adjacent to
the transistors Q1 & Q2.
If the battery supply is to be 12V,
the 1kW resistor feeding ZD1 should
be reduced to 100W. In this case, the
supply will actually be between 12V
and 14V (depending on the actual battery voltage); still enough to provide
adequate gate drive for the Mosfets and
siliconchip.com.au
siliconchip.com.au
March 2008 33
Fig.1: the circuit uses PIC16F88 microcontroller IC1 to provide PWM drive to power-Mosfets Q5-Q8 which in turn control the motor. The microcontroller also
monitors the back-EMF from the motor, to provide speed regulation. IC2 is a DC-DC switchmode converter and this provides a +5V rail to power IC1.
a
f
DISP 3
a
a
b
g
e
f
g
e
c
d
b
f
g
e
c
C
B
E
C
Q10
b
f
C
Q11
E
E
g
e
d
B
8x 39
a
c
d
Q9
DISP 4
b
c
d
B
C
Q12
16
Vdd
15
Qa
1
Qb
SRClr
2
Qc
3
Qd
IC3 Sck
4
Qe 74HC595 Rck
5
Qf
OE
6
Sin
Qg
7 Qh
Vss
8
100nF
10
+5V
11
12
13
10
9
8
7
6
5
14
4
B
11
12
2
3
470
E
470
Q9–Q12: BC337
470
470
B
E
SC
2008
CON2
1
(TO MAIN BOARD)
DISP 2
DISP 1
C
DC MOTOR SPEED CONTROLLER
S2
S3
DISPLAY BOARD
Fig.2: the display circuit interfaces to the microcontroller & uses a 74HC595 shift register (IC3) & transistors Q9Q12 to drive four 7-segment LED displays. Switches S2 & S3 are used to control the display & for software set-up.
ensure minimum heat dissipation (low
on-resistance).
The PWM output of the PIC16F88
(adjusted by firmware) appears at pin
6 and drives transistor Q3 which then
drives complementary transistors Q1
& Q2. Q1, Q2 & Q3 thus provide buffering and voltage level translation for
IC1’s PWM output to drive the gates
of Mosfets Q5-Q8 via 15W resistors.
Note that these resistors need to be
relatively low in value (ie, 15W) in
order to ensure quick charging and
discharging of the gate capacitances.
That’s because the gate capacitance
of these Mosfets can be quite high, of
the order of 5000-10,000pF each. If the
gate charging time is too long, the Mosfets will spend too much time between
the on and off states and this will lead
to much higher heat dissipation.
In fact, the gate voltage transitions
need to be very fast, of the order of 1ms
or less. This has been accomplished,
as shown by the oscilloscope screen
grab of Fig.4.
The specified Mosfets are from International Rectifier, type IRF1405. This
is a 55V 169A N-channel Hexfet with
an exceptionally low on-resistance
(Rds) of 5.3 milliohms (5.3mW) typical.
Their pulse current rating is a stupendous 680A.
The IRF1405 is specifically intended
for automotive use, in applications
such as electric power steering, anti34 Silicon Chip
lock braking systems (ABS), power
windows and so on and is therefore
ideal for this speed control application.
Why four Mosfets?
In fact, since the ratings of this
Mosfet are so high, you might think
that just one device on its own would
be enough to handle the 40A rating of
this speed controller project. So why
are we using four Mosfets in parallel?
As always, real world use brings us
down to earth. For a start, we are using
these Mosfets without heatsinks, apart
from the vestigial heatsink effect of
their being bolted to and connected to
the copper side of the PC board – not
much heatsink benefit there. Their
thermal characteristic is 62°C per watt
(junction to ambient), assuming that
are mounted in free air (which they
are not).
Assuming an ambient temperature
of 25°C and an on-resistance of 10mW
(conservative), we can approximate
the temperature of the Mosfets at
their highest operating current (10A
per Mosfet for a total of 40A). At 10A
and 10mW on-resistance, the power
dissipated is: 102 x .01 = 1W
This means that the temperature of
the case will be approximately: 25 +
62 x 1 = 87°C
This means that at full current, the
Mosfets will be very hot to the touch.
Careful: they will burn you. Our measurements produced a top temperature
of around 77°C after a test period of
half an hour.
In practice, even with much higher
ambient temperatures, the Mosfets
should not get quite this hot because
in “real world” operation, the speed
control is not likely to be providing
full power to the motor on a continuous basis. At 24V and 40A, the motor
would have 960W applied (ie, more
than 1HP) and this equates to relatively
high power operation.
Protection
Zener diodes ZD2-ZD5 are included
to protect the Mosfets from excessive
gate voltages. In normal circuit operation, these zener diodes do nothing.
Additional protection for the drains
of the paralleled Mosfets is provided
by 33V 5W zener diode ZD6, in parallel with a 100nF capacitor. The zener
is there to clip any residual voltage
transients which get past the 2200mF
low-ESR input filter capacitor.
The Mosfets are further protected by
fast-recovery diode D3 and its parallel
220nF capacitor. These parts are wired
across the motor terminals and are
used to suppress the high back-EMF
spikes caused by the armature inductance when the motor is switched off
by the Mosfets.
These components are crucial to
siliconchip.com.au
Fig.3: the yellow trace is the voltage waveform at the
drain of the Mosfets, when a motor is connected. There
are narrow spikes up to 31.7V when the Mosfets switch
off due to the inductance of the armature. The small
windows where the Mosfets are switched off to sense the
back-EMF of the motor can also be seen. The two vertical
cursors show that the period between such intervals is of
the order of 7.6ms. In other words, the speed of the motor
is monitored at 131Hz.
Fig.4: the yellow trace is the voltage waveform at the
drain of the Mosfets, while the purple trace is the gate
drive. The gate drive goes as high as 15.3V. The rise time
of the gates is 526ns while the fall time is 92ns. When
switching the Mosfets on and off, it is necessary that the
transition be fast, ideally under 1ms, otherwise the Mosfets
will dissipate more heat than is necessary. To ensure fast
switching of the Mosfets their gate capacitance needs to be
charged and discharged very quickly.
Fig.5: the yellow trace shows the voltage waveform at
the drain of the Mosfets when a motor is connected.
The irregular waveform corresponds to the back-EMF
monitoring. The Mosfets are then off and the voltage is
then directly proportional to the speed of the motor. The
window is narrow enough so that the motor’s deceleration
is negligible. Turning off the Mosfets to monitor the backEMF is asynchronous to the PWM driving the Mosfets.
Fig.6: the yellow trace is the voltage waveform at the
drain of the Mosfets and the purple trace is the waveform
at the gate of the Mosfets when a motor is connected.
Again, the irregular yellow waveform (arrowed)
corresponds to the period when the Mosfets are switched
off to sense the back-EMF and hence the speed of the
motor. You can see from the purple trace that the gate
drive during this time is 0V.
the operation of the speed controller.
Without them, the high voltages generated can and probably would destroy
the Mosfets.
Other protection measures
As already mentioned, diode D1
provides reverse polarity protection for microcontroller IC1 and the
switchmode supply (IC2). Zener diode
ZD1 is self-protecting in the case of
siliconchip.com.au
reverse supply connection. However,
if the supply is reversed, there will
be a heavy conduction path via fast
recovery diode D3 and the internal
substrate diodes in the four power
Mosfets. If you are lucky, the 50A fuse
will blow before the Mosfets are damaged but there is no guarantee of this.
SO DON’T REVERSE THE BATTERY
CONNECTIONS!
In a similar vein, if the outputs are
shorted while power is applied, high
current will flow through the Mosfets.
Again, if you are lucky, the 50A fuse
will blow before the Mosfets go up in
smoke. In reality, the 50A fuse is there
to stop a fire! SO DON’T SHORT THE
OUTPUTS TO THE MOTOR.
If the motor is under heavy load and
becomes stalled, high currents will
flow in its armature. Depending on
the motor’s rating, this may or may not
March 2008 35
This view shows the fully
assembled main board. The
assembly details are in next
month’s issue.
Fig.7: the yellow trace shows the voltage waveform at the drain
of the Mosfets, the purple trace shows the voltage waveform at
the gates and the cyan trace shows the voltage waveform at the
PWM output of the microcontroller. Note that transistors Q1-Q3
provide voltage translation by stepping up the 5V output from
the microcontroller to 12-16V. This higher voltage is needed to
ensure that the Mosfets are fully turned on.
blow the fuse. If the fuse does not blow
during stall conditions of the motor,
the Mosfets should survive although
they may get very hot.
Warning buzzer
If the circuit is overloaded, the
battery voltage should drop to the
point where the warning buzzer will
sound.
LED1 and its 470W current limiting
resistor are switched by a high level
on the output of pin 3 of the microcontroller. This is configured as a
simple digital output. It also turns on
Q4 and the piezo beeper. This output
is controlled by the firmware and can
be disabled.
A 1kW pull-up resistor is used on
pin 4 (reset) of the PIC16F88-I/P. This
ties the reset pin high which means
that the microcontroller is reset only
at power-on.
Finally, the rest of the outputs of
the microcontroller, namely pins 7-17,
are used to drive the optional display
board.
Display board
Fig.2 shows the optional display
board circuit. It connects to the main
board via 12-pin header CON1 and a
ribbon cable.
The display board consists of two
pushbuttons, four 7-segment displays
which are multiplexed by the firmware, four transistors and some resistors, as well as a 74HC595 shift register
(IC3).
Pins 1 & 2 of 12-way connector
CON2 supply +5V to the display board.
Pin 3 is connected to a digital input
The optional display
board is connected
to the main board
via a 12-way ribbon
cable. It displays
the motor speed as
a percentage of full
speed and is used for
the software set-up.
36 Silicon Chip
of the microcontroller and is pulled
high by a 1kW resistor on the main
board. Conversely, it is pulled low by
the display board. This is used by the
microcontroller to detect whether the
display board is connected or not.
Pins 4-7 of CON1 are used to drive
the transistors Q9-Q12 on the display
board. These transistors switch the
7-segment display cathodes.
Pins 8-10 of CON1 are respectively
the CLK, DATA and OUTPUT ENABLE
lines and these go to the 74HC595 shift
register (IC3). The microcontroller
drives these lines to load a new 8-bit
value into the shift register. The outputs of the shift register are connected
across the four 7-segment displays and
drive the anodes.
Finally, pins 11 & 12 are connected
to pushbuttons switches S2 & S3 on the
display board. They are also connected
to digital inputs on the microcontroller (which have internal pull-ups
enabled) and these inputs are used to
monitor the pushbuttons.
Next month, we will cover the
construction and troubleshooting of
the speed controller. In the meantime,
take a look at the “Software Features
& Set-up” panel on the facing page.
siliconchip.com.au
DC Motor Speed Controller:
Software Features & Set-up
T
HE STRUCTURE of the firmware
for the DC Motor Speed Controller is shown overleaf in Fig.8. The
transitions between the various
menus are made using the switches
on the display board and are indicated with labelled arrows.
There are four possible switch
presses, either Short or Long and
either the Left (L) or Right (R). Thus,
for example, “Short R” refers to a
short press of the right pushbutton.
Main menu
The Main menu is as shown in
Menu 1. It consists of the letter ‘P’
(for “percentage”) and three digits
with a decimal point indicating the
range 00.0% to 99.9%. The percentage value indicates the fraction of
full speed the motor is currently
running at.
In this mode, the motor’s speed
can be adjusted by varying the pot.
The letter ‘P’ will flash while the
motor’s speed increases or decreases
to the new setting. When the current
speed reaches the speed set by the
pot, the letter ‘P’ will stop flashing
and there will be a short beep (if
enabled).
Since there is a small periodic
window when the pulse width
modulation is turned off by the
firmware in order to read the backEMF, at full speed the reading will
not indicate 99.9% but will achieve
its maximum at around 98% or so.
Monitoring the input voltage
From the Main menu, press “Short
R” once and you will be taken to the
display shown in Menu 2. It consists
of a ‘b’ (for “battery”) followed by
three digits with a decimal point indicating a level from 00.0V to 99.9V,
to monitor the battery. For good
voltage accuracy, it is important that
the +5V supply rail be precisely set
using trimpot VR2.
In practice, with the supply rail
to the microcontroller set at 5V, the
level will not register any higher
than around 40.1V. This is because
the voltage divider used to derive
the voltage reading consists of 33kW
and 4.7W resistors. The relatively
high series resistance of 37.7kW was
chosen to avoid damaging the input
of IC1 if the input voltage goes any
higher than around 40V.
To go back to the Main menu, either press “Short L” or press “Long
R”. If you press “Long L”, you will
set the low-battery alarm level to
91.6% of the current voltage input
level (and then return to the Main
menu). This is a shorthand way to
set the low-battery alarm level when
you know that the batteries are fully
charged.
For a typical 12V battery, they are
fully charged at around 13.8V (with
charger connected) and should not
be discharged beyond 11V.
Press “Short R” to go to the lowbattery alarm level menu.
Setting the low-battery alarm
From the Main menu, press “Short
R” twice. You will be taken to the
low-battery alarm level menu as
shown in Menu 3.
It consists of an ‘A’ (for “alarm”)
followed by three digits which indicate a level between 00.0V and
41.6V. This will show the current
setting of the low-battery alarm or
rather, the voltage level below which
the alarm will sound (if enabled).
Whenever the input voltage is
below this level, the display will
flash (with increasing frequency as
the voltage drops) while if the alarm
sound is enabled, there will be a
flash from LED1 and a beep.
To set the low-battery alarm level
. . . continued next page
Looking for real performance?
NOT A REPRINT – Completely NEW projects – the result of
two years research & development
•
•
•
•
160 PAGES
23 CHAPTE
RS
Fr om th
e pu bli sh
Learn how engine management systems work
Build projects to control nitrous, fuel injection and turbo boost systems
Switch devices on and off on the basis of signal frequency, temperature and voltage
Build test instruments to check fuel injector duty cycle, fuel mixture and brake and
coolant temperatures
Mail order prices: Aust. $A22.50 (incl. GST & P&P); Overseas $A26.00 via airmail.
Order by phoning (02) 9939 3295 & quoting your credit card number; or fax the details
to (02) 9939 2648; or mail your order with cheque or credit card details to Silicon
Chip Publications, PO Box 139, Collaroy, NSW 2097.
siliconchip.com.au
er s of
Intellig
I SBN
9 780
95
$19.80 (inc
GST)
turbo tient
mer
095 852
294 - 4
8 52
29
46
NZ $22.00
(inc GST)
TURBO
& nitrou BOOST
s
fuel cont
rollers
How en
g
managemine
ent work
s
March 2008 37
DC Motor Speed Controller: Software
Features & Set-up . . . continued
press “Long L”. The ‘A’ will start
flashing and then the low-battery
alarm level can be modified by adjusting the pot setting. To turn the
alarm off completely, simply set the
level to 00.0V.
When you have reached the required level, simply press any button and the level will be recorded
(and stored in EEPROM). Then there
will be a beep (if enabled) and you
will be taken to the Main menu.
Note that the motor will be turned
off automatically when setting the
low-battery alarm level.
Setting the PWM frequency
From the Main menu, press “Short
R” three times. You will be taken
to the frequency menu as shown in
Menu 4.
This consists of an ‘F’ (for “frequency”) followed by three digits
with a decimal point indicating a
level between 0.48kHz and 7.81kHz.
This is the current PWM frequency.
As the frequency increases, the
resolution of the PWM setting decreases.
At 0.48kHz (actually 488Hz) the
resolution is 10 bits. This decreases
to six bits at 7812Hz. Thus, the resolution is at worst six bits or 64 levels
and at best 10 bits or 1024 levels.
While in this menu, press “Long
L” and you will be able to set the
frequency. The ‘F’ will start flashing
and then the frequency will be modified according to the pot setting.
When you have reached the required frequency, simply press any
button and the level will be recorded
and stored in EEPROM. Then there
will be a beep (if enabled) and you
will be taken to the Main menu.
Note that the motor will be automatically turned off when setting
the frequency.
Enabling & disabling
audible cues
From the Main menu, press “Long
L”. You will be taken to the settings menu as shown in Menu 8. It
consists of ‘A’ (for alarm) followed
by either ‘0’ or ‘1’ (0 = disable, 1 =
38 Silicon Chip
enable) and a ‘b’ (for beep) followed
again by either ‘0’ or ‘1’ (0 = disable,
1 = enable). In this menu, pressing
“Short L” will toggle the alarm setting (enable/disable) and pressing
“Short R” will toggle the beep setting
(enable/disable).
When the alarm setting is disabled,
there will be no beeping when the
input voltage falls below the alarm
level. There will still be a warning
flashing on the display, however.
To disable the latter, simply set the
alarm level to 00.0V. When the beep
setting is disabled, audible beeps
emitted by the firmware at certain
points (as when setting certain values or when the desired speed is
reached) will be blocked.
If you do not want any beeping
from the piezo buzzer, simply set
‘A’ to 0 and ‘b’ to 0. In this menu,
pressing “Long L” will take you to
the Reset Menu, as explained below.
Pressing “Long R” will take you back
to the Main menu.
Reset menu
From the Main menu, press “Long
L” twice. You will be taken to the
Reset Menu as shown in Menu 9.
It consists of the letters ‘CL’ (for
“clear”) followed by two digits and
a decimal point of the form X.X.
The X.X represents the current
version of the firmware, which
for this release stands at 3.0. It is
possible that future releases of the
firmware will add new features or
refinements to critical sections of
the code.
While in this menu, press “Short
L”, “Short R” or “Long R” to go back
to the Main menu.
Note, however, that pressing
“Long L” will reset all settings to
the default values and the speed
controller will lock until power is
turned off. When a power-on reset
next occurs, the default values for
the frequency, low-battery level
alarm and audible beeps will be
restored.
This feature is useful for initialising the firmware variables and for
making sure that you begin from a
known state. Most of the time, it will
not be used.
Memory speed mode
From the Main menu, press “Short
L” to enter memory mode. The display will be as shown in Menu 6.
It consists of the letter ‘C’ (for
“constant”) followed by a digit from
1-8 (indicating one of the eight available memories), in turn followed by
two dashes.
Now adjusting the pot will select
one of the eight memories. When
the pot becomes stable for a short
period, the speed of the motor will
be set according to the current value
of that memory.
The display will change as shown
in Menu 7. This display still consists
of the letter ‘C’ followed by the number of the memory but it will then
have a decimal point followed by
two digits representing the speed
percentage from 00% to 99% (the
first two letters will flash until the
set speed is reached).
Adjusting the pot will now change
the selected memory and the speed
setting will be recalled from one
of the eight stored memory speed
settings (after a short beep, if enabled).
To go back to normal mode, where
the motor speed is controlled directly by the pot, simply press any
key, long or short.
Setting the memory
To set one of the eight memory
speed values you press “Long R”
from the Main menu. The display
will change as shown in Menu 5. It
consists of the letter ‘C’ (for “constant”) followed by a digit from 1-8
(indicating one of eight memory
settings) and two dashes.
Now adjusting the pot will select
one of the eight memory settings to
store the current value of the speed
of the motor.
When the pot becomes stable for
a short period, the speed of the motor will be stored at that particular
memory. This can be recalled later
by entering memory mode, as explained in the previous section.
There will be a short beep (if enabled), indicating that the value has
been stored and you will be taken
SC
back to the Main menu.
siliconchip.com.au
siliconchip.com.au
HALT STATE.
TURN POWER
OFF AND
BACK ON TO
RECALL DEFAULT
SETTINGS.
LONG L)
MENU 9: LAST TWO DIGITS SHOW
THE FIRMWARE VERSION. PRESS
LONG L TO RESET ALL SETTINGS
TO DEFAULT VALUES.
(PRESS
(PRESS
SHORT
L)
(INACTIVE OR
ACTIVE POT)
(PRESS ANY
KEY OR
INACTIVE
POT)
(SET
FREQUENCY
WITH
POT AND
PRESS ANY
KEY TO
(PRESS
RETURN
LONG L)
TO MAIN
MENU)
(SET ALARM
LEVEL WITH
POT AND
PRESS ANY
KEY TO
RETURN
(PRESS
TO MAIN LONG L)
MENU)
MENU 5: SET MEMORY MENU. CHANGE MEMORY
NUMBER BY VARYING POT. ONE OF EIGHT
MEMORY PLACES CAN BE CHOSEN. CURRENT
SPEED IS STORED IN THE CHOSEN MEMORY.
(PRESS
LONG R)
SCREEN SHOWING THE LOW BATTERY WARNING.
IT SPELLS “Lo” FOR LOW BATTERY.
MENU 7: SHOWS THE MEMORY NUMBER
CURRENTLY RECALLED AND THE CURRENT
SPEED AS A 2-DIGIT PERCENTAGE.
MENU 6: RECALL MEMORY
MENU. CHANGE MEMORY
NUMBER BY VARYING POT.
THE STORED SPEED WILL
BE RECALLED.
(PRESS
ANY
KEY)
(PRESS
SHORT
R)
(PRESS
SHORT
R)
(PRESS
SHORT
R)
MENU 4: CURRENT FREQUENCY
IS SHOWN IN KILOHERTZ.
MENU 3: CURRENT ALARM LEVEL IS
SHOWN IN VOLTS.
(PRESS ANY
KEY EXCEPT
LONG L TO
RETURN
TO MAIN
MENU)
(PRESS
LONG
R OR
SHORT
L)
MENU 2: INPUT VOLTAGE
IS SHOWN. USEFUL FOR
MONITORING BATTERY
(PRESS LONG L TO
LEVEL.
SET ALARM LEVEL* )
(PRESS
LONG
R OR
SHORT
L)
Fig.8: this diagram shows the structure of the firmware for the DC Motor Speed Controller. The transitions between the various menus are made using the
switches on the display board and are indicated with labelled arrows.
(PRESS ANY
KEY EXCEPT
LONG L TO
RETURN
TO MAIN
MENU)
(PRESS
LONG L)
MENU 8: DISABLE OR ENABLE
AUDIBLE CUES. 0=DISABLED,
(PRESS
1=ENABLED. A=ALARM,
LONG L)
B=GENERAL BEEP. PRESS SHORT
L OR R TO TOGGLE SETTINGS.
(PRESS
LONG R)
MENU 1: MAIN MENU. SPEED SHOWN AS
THREE DIGIT PERCENTAGE.
VARY SPEED WITH POT.
* ALARM LEVEL IS SET TO 91.6% OF CURRENT
INPUT VOLTAGE.
March 2008 39
|