The first method is called wave drive. In this
mode, a single coil is activated, attracting the
magnetized rotor to it. By switching the coils in
sequence — A, B, /A, /B — we get a full revolution
in full steps.
The second method is called full-step drive. Like
wave drive, this uses full steps but note that two
coils are engaged at the same time causing the
magnetized pole(s) of the rotor to be oriented
between them. The doubling of active coils gives
full-step drive more holding torque than wave drive.
Finally, there is half-step drive. If we interleave
the steps of wave drive with the steps of full-step
drive, we double the number of steps, increasing
the positional resolution by a factor of two. That
said, half of the steps engage a single coil; hence, it
doesn’t have as much torque as full-step drive.
Beyond half-step driving there is micro-stepping.
This gets a little hairy because there needs to be
proportional current control between adjacent coils.
Luckily, there are a variety of chips that provide micro-stepping control for virtually any processor, and
companies like SparkFun and Pololu sell breakouts for
them. We’re going to stick with basics, driving the stepper
coils directly through an appropriate interface.
John is going to be using an EFX-TEK HC- 8+ for his
project; this controller has N-channel MOSFET (
open-drain) outputs which means he’ll have to use a unipolar
stepper motor. This motor will have the four coil
connections, plus one or two common wires that will be
connected to the power supply used to run the motor.
If you’re going to roll your own and are working with
a small motor, a chip like the L293D works nicely, and is
compatible with unipolar (five or six wires) and bipolar
(four wires) motors. Figure 4 shows the circuit
which can be easily assembled on a solderless
breadboard if you’re using the new Parallax FliP
module. For those with a Propeller PDB, the
L293D is on the board (Figure 5). Controlling
the Enable pin is optional; if you’re limited to
four I/O pins, connect the 10K resistor on the
Enable line to Vdd instead of ground. This will
keep the chip enabled at all times.
Building the Stepper Object
Let me start by clarifying terms — as I use
them, anyway. An object is a reusable file with
data and the interface code (methods) to deal
with those data. In an embedded processor,
Newcomers often build code into an application that
should be turned into an object. I think this comes from
the misunderstanding by some that an object requires a
cog. This is not the case. Simple objects are, in fact, just a
collection of useful and related methods. My jm_time and
jm_io objects, for example, do not require a cog to be
started. If you find yourself copying and pasting code from
one application to another, you might consider creating an
object from that code.
Okay, let’s get started — with the start() method. The
To post comments on this article and find any associated files and/or downloads, go to
September 2017 11
■ FIGURE 4.
■ FIGURE 5. Stepper control via L293D.