This is only a preview of the May 2002 issue of Silicon Chip. You can view 28 of the 96 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 "PIC-Controlled 32-LED Knightrider":
Items relevant to "The Battery Guardian":
Items relevant to "Build A Stereo Headphone Amplifier":
Items relevant to "Automatic Single-Channel Light Dimmer; Pt.2":
Purchase a printed copy of this issue for $10.00. |
Stepper Motor
Controller
By Ross Tester
With so many stepper motors in use
(and disposed of) these days, one of
our most-asked questions is “how do I
use one?” Here’s how . . .
S
tepper motors are everywhere.
For example, every computer
contains several (in the floppy
and hard disk drives – one popular
hobbyist source). They’re used because it is easy to achieve very precise
positional control – far better than you
can achieve with a “normal” motor (if
you can control it at all).
Unlike a conventional motor, where
you simply connect an appropriate
voltage and “away she spins”, stepper
motors require considerably more
effort to get them to work.
So what is a stepper motor?
First of all, think of a conventional
motor. It has two main components –
a stator, which sets up the magnetic
field, and a rotor, which by magnetic
attraction or repulsion turns toward or
away from the magnetic field.
But there’s also a commutator (actually part of the rotor) which keeps
switching power from one coil to the
next, moving the magnetic field as
well, so the rotor has to keep moving,
or rotating. Yes, that’s a pretty simplistic explanation – but will suffice
for our purposes.
Stepper motors are similar in many
respects – they have stators and they
have rotors – but they don’t have
commutators. The magnetic fields
which cause attraction/repulsion, and
therefore turning, are set up externally
by the motor controller.
76 Silicon Chip
A stepper motor operates a little
like a chaser: one stator coil is energised, repelling the rotor. Then that
coil is de-energised and the next one
energised, again repelling the rotor.
Keep this up and the rotor turns continuously.
The rotor may be either a permanent
magnet, a variable reluctance or a
combination of both.
By controlling which field coils
are energised and when, the rotation
and stopping position of the rotor can
be extremely closely controlled. You
will hear stepper motors referred to
as 0.9° degrees, 1.8°, 3.6° and so on.
This refers to the rotation of one “step”
in the motor – a 0.9° motor will have
400 individual steps to make one full
rotation of 360°.
As you can see, 400 steps in one rotation is a lot of steps, especially as each
one can be individually accessed. And
many stepper motors operate through
a gearbox, multiplying that yet again.
The speed of rotation is obviously
directly related to how fast you can
switch current between the coils. At
low speeds, there is no problem – but
as the switching frequency increases,
we can start to get into difficulties.
Loss of power
At low speeds, most stepper motors
are generally quite powerful devices
– ie, lots of torque – especially when
driven by an appropriate supply.
However, most hobbyists tend to
drive a stepper motor from a fixed
voltage supply. This is fine at low
speeds (low frequency) but as the
speed increases, the torque drops off,
often dramatically, due to the impedance of the coils.
There are three main methods used
The stepper motor controller is
shown here with a typical 6-wire
disposals stepper motor.
www.siliconchip.com.au
Fig.1: three ICs, four Mosfets and a handful of other components make up the controller. It can be use in “stand alone” or
computer-controlled modes.
to overcome this reduction in torque:
1 – The use of a higher voltage
switched-mode power supply that
increases the duty cycle at higher
motor speeds.
2 – The use of a higher voltage power
supply along with a power (ballast)
resistor in series with the motor. The
resistor limits the current to that of the
nominal motor current.
3 – The use of a constant current
source that maintains constant current to the motor at all speeds. As
the speed increases, the voltage also
increases.
There are disadvantages in the first
two methods. Switched-mode (some
times called "chopper") power supplies need to be carefully tailored to
suit the specific motor being used and
its torque curve. So it’s hard to make
a “universal” supply.
The ballast-resistor method results
in less current being applied at higher
speeds and is therefore less efficient.
However, the use of a constant
current source ensures the motor current remains constant throughout its
speed range. Although this method
is perhaps wasteful compared to the
"chopper" due to the heat generated
in the driver it requires little or no
setup. In practice this type of circuit
is already proven and is in common
use in industrial drivers.
How it works
This circuit can be used in either
free-standing or computer-controlled
K&W HEATSINK EXTRUSION. SEE OUR WEBSITE FOR
THE COMPLETE OFF THE SHELF RANGE.
www.siliconchip.com.au
May 2002 77
Parts List - Stepper
Motor Controller
1 PC board, 72 x 42mm, coded
K179 (Oatley Electronics)
2 3-way PC-mount terminal
blocks
1 2-way PC-mount terminal block
1 4-way PC-mount header pin
set (or 4 PC stakes)
Semiconductors
1 4093 IC(IC1)
1 4030 (IC2)
1 4013 (IC3)
1 7805 5V regulator (REG1)
4 IRFZ44N Mosfets (Q1-Q4)
Capacitors
1 100µF 35VW
1 100µF 10VW
1 1µF 20VW
2 0.1µF polyester
Resistors (0.25W, 5%)
1 10kΩ
1 1MΩ PC-mounting preset pot
modes. In the free-standing mode, an
internal square-wave oscillator based
on IC1b supplies timing pulses to the
“OSC” output. The frequency of these
pulses (and therefore stepper motor
speed) is controlled by preset pot,
VR1. (A standard 1M linear pot could
be substituted to allow external speed
control at any time).
Either the oscillator pulses or control pulses from a computer are fed
into the “STEP” input which in turn
are buffered and inverted by IC1d, a
4093 Schmitt trigger. This helps prevent false triggering.
Similarly, IC1c buffers and inverts
the “DIR” (direction) input which once
again can be either manually set or
taken from a PC. Taking the DIR input
to +5V causes the stepper to turn in
one direction; taking it to GND will
reverse the rotation.
IC2c and IC2d (4030 exclusive OR
gates) invert the outputs available at
the Q and Q-bar outputs of each of the
flip-flops, IC3a and IC3b.
The incoming step pulses clock the
flip-flops thus toggling the Q and Q-bar
outputs, this turns the MOSFETs on or
off in sequence.
The IRFZ44 MOSFETs have a very
low on resistance and can deliver
5 or 6A each without heat sinking.
For higher current use, small clipon heatsinks could be used or the
78 Silicon Chip
Fig.2: be careful
when soldering
in the ICs: the
tracks are
closely
spaced!
MOSFETs could be removed from
the PC board and placed on a larger
heatsink.
The power supply is a conventional
circuit using a 7805 3-terminal regulator, producing 5V output. A minimum
of about 8 volts DC is required at the
input and the maximum (limited by
the 7805 rating) is 35V.
Construction
All components mount on a single
PC board measuring 72 x 42mm, coded K179. This board is only available
as part of a complete kit from Oatley
Electronics.
It is perhaps easier with this board
to depart from normal practice and
solder in the three ICs first. The reason
for this is that there are tracks going
between the IC pin pads and these
will require very careful soldering
and checking.
Make sure you get the three ICs
in their right places and the orientation is correct (all three face the
same way).
Next, solder in the resistors and
capacitors and use some of the lead
cut-offs for the three links. Solder in
the header pins, the on-board terminal
blocks and finally the regulator and the
four Mosfets. Note that the Mosfets are
NOT oriented all the same way – and
it’s important to keep their drains (the
metal tabs) separated from each other,
especially if you fit heatsinks.
(If you decide to mount the Mosfets
on a larger heatsink for more power
capability, as mentioned above, you
will need to fit insulating washers
and bushes to each Mosfet to ensure
they are electrically isolated from
each other).
Before use, check and double check
your component placement and soldering – especially the ICs as noted
above.
In use
It’s outside the scope of this article to
go into much detail. It’s sort-of like “if
we need to explain then you shouldn’t
be doing it!”
However, a quick note on using
surplus steppers: as you can see from
the circuit diagram, the windings on
most of the steppers you will come
across are centre-tapped. This means
you can usually identify the pairs with
a multimeter, as well as working out
which is the centre tap.
Having got that far, connect up the
circuit with the “OSC” and “STEP”
pins shorted to each other, plus the
“DIR” and “GND” pins to each other. Connect the centre-taps of your
stepper motor windings to the V+
terminals and their pairs to the M1B
and M1A, M2A and M2B terminals
as appropriate. Set VR1 to half-way.
Apply power and see if your stepper
is continuously turning. If not (eg, if it
is “hunting”), swap the M1B and M1A
windings only (leave the M2A and
M2B) and check again. Now it should
be turning. Varying VR1 should vary
the speed up and down.
If it doesn’t work, check to see if
IC1b is oscillating (an analog meter on
a low voltage [<10V] setting connected
between OSC and GND should show
up and down deflection, especially
with VR1 set to its maximum).
If so, check the voltage between
each of the motor terminals and
ground with your meter set to a bit
higher (say <50V) and see if the meter deflects. At the oscillator’s higher
speed range, you probably won’t see
any movement – the meter will read
the average voltage.
If this test proves OK, you probably
have a dud stepper motor!
Computer control
There is quite a range of stepper
motor controller freeware available
on the ’net. Google “Stepper Motor
Software” or words to that effect and
see what you come up with. We have
given a few sources in this article but
www.siliconchip.com.au
Software
Here are just a few of the demoware or shareware downloads available from
the net.
Name:
Download from:
Runs under:
Number of axes:
Features:
Imports:
Name:
Download from:
Runs under:
Number of axes:
Features:
Loads:
Imports:
Exports:
DANCAD
www.metalworking.com
DOS
up to 4
Extensive printable manual with printer port connection diaggrams etc. Able to be configured to suit most applications, (lathe
and mill etc.) including angular and linear axis set up. Dancad is
able to be set up with a tangential knife for sign cutting.
HPGL
KCAM
www.kellyware.com/index.shtml
WIN9X.
3
It gives a 2D or 3D view of the Item to be machined, manual
jogging, controller and table setup to suit most machine tables
including backlash compensation. Tool paths can be programmed in its Gcode editor, or imported as DXF, NC, and PLT files.
Ideal for engraving signs and plates, drill printed circuit boards,
mill parts, plasma cuts, PCB Isolation. Conversion from Gerber
(RS274X) files or plot pictures.
G&M code files,
Excellon ASCII drill files, DXF files DXF, HPGL files PLT,
Gerber files GB0
G&M code files
Name:
Download from:
Runs under:
Number of axes:
Features:
STEPSTER
www.thegallos.com/stepster.htm
DOS
up to 6
Simple to use and set up, Able to be configured to suit most
applications, (lathe and mill etc.), including angular and linear
axis set up.
Name:
Download from:
Runs under:
Number of axes:
Features:
EMC
www.isd.mel.nist.gov/projects/emc/
LINUX
up to 6
Hard to set up. Able to be configured to suit most applications
(lathe and mill etc.), including angular and linear axis set up.
there are lots (and lots!) more.
Most of the software available uses
the same connections to your PC’s
printer port:
Pin
Function
2
X axis step
3
X axis direction
4
Y axis step
5
Y axis direction
6
Z axis step
7
Z axis direction
8
C axis step
9
C axis direction
18-25
GND
The other printer port pins vary
according to the particular software –
www.siliconchip.com.au
they are often used for limit and home
switches.
Depending on the software used up
to 6 motors (with 6 controller boards)
can be controlled just by connecting
the stepper drivers to the printer port
of your computer.
In other words, complete three-directional control is possible (we hope
to have more on this in a future issue).
Where do you get it?
This project is available as a complete kit of parts from Oatley Electronics. Contact details can be found on
SC
page 15 of this issue.
May 2002 79
|