This is only a preview of the December 2021 issue of Practical Electronics. You can view 0 of the 72 pages in the full issue. Articles in this series:
|
Electronic Building Blocks
By Julian Edgar
Quick and easy construction
Great results on a low budget
Standalone programmable stepper motor controller
H
ere’s a stepper motor controller that is truly
standalone – it doesn’t even need to be connected to
a PC for programming! The controller board measures just 100 × 55mm. It costs about £20 – cheaper when on
special – and is available from a range of sources including
Banggood and AliExpress (search under ‘DC8V-27V Programmable Stepper Motor Driver Controller Board Step/Angle/
Direction/Speed/Time Adjustable 42/57 Phase’).
The board has no less than five seven-segment LED displays,
nine momentary push buttons and two individual LEDs. It is
a bipolar driver, so has four connections to the stepper motor.
However, it can also work with six-wire stepper motors, with
the central connections of each winding unused (see Fig.1 for
the stepper motor wiring connections). The board will work
on a wide range of voltages (8 – 27V) and can supply up to 2A.
But it’s the programming (all achieved via the push buttons)
that’s quite fascinating – see Fig.2. From left to right, the small
buttons, and their associated LED displays, are:
1. Memory sequence (up button)
2. Rotational angle (up/down buttons)
3. Forward/reverse (toggle button)
4. Speed (up button)
5. Delay timer (up/down buttons)
This standalone programmable controller is a very easy way of
getting a stepper motor up and running. Speed, direction and
rotational angle can all be set, and the module has the ability to
store nine programs that can be run automatically in sequence.
On-board programming
The two large lower buttons are (left) single trigger and (right)
continuous loop.
Let’s look now at the programming. (We’ll leave out the
‘memory sequence’ for now – just set it to 1 in initial testing.)
The ‘rotational angle’ display and up/down buttons set the
rotation that the stepper motor will undergo when the system
is run in single-trigger mode. The instructions (mostly not in
English) suggest that this display shows degrees (ie, 360° in
a full circle) but testing at different speeds and with different
stepper motors showed that this didn’t always match reality.
However, for a given rotational speed and stepper motor, the
buttons can be used to set the rotational angle of the motor with
Left: The module works from 8-27V and can deliver 2A. Note that
even when not turning, stepper motors use current (that is, in their
‘hold’ position). Thus, it’s important when using a stepper motor
for which no specifications are available (eg, a salvaged motor) to
ensure that neither the stepper motor nor the board’s output driver
(located on the back of the board, with a small attached heatsink)
get overly warm when the motor is being driven – even when it is
not turning. Right: The rear of the board. Note the terminal strip
for the power and stepper motor connections. The small heatsink
at left is just stuck on – it can easily be swapped for a larger one.
64
Practical Electronics | December | 2021
A
A 2
C
F o u r - w ir e S M
A 1
S i x- w i r e S M
A 1
M
A
M
A′
A 2
C
B
D
B
B′ D
B 1
B 2
B 1
B 2
Fig.1. Use this diagram to work out how to
connect 4- and 6-wire stepper motors to
the module. Note that in 6-wire designs,
two of the connections are unused. If you
have a stepper for which no wiring details
are available, use you multimeter to work
out which wire is which – the maximum
resistance across any two leads indicates
the two ends of a winding. Swapping A1
with A2 or B1 with B2 just causes the motor
to reverse – no damage will occur.
good repeatability. (That is, just adjust
the display so that you get in testing the
rotational angle you want to achieve, and
that angle will occur each time.)
The next button toggles between
forward and reverse. ‘0’ on the display
indicates forward and ‘1’ indicates
reverse. Two LEDs at the edge of the
board light when the motor is turning –
the upper one for forward and the lower
one for reverse.
The next button – speed – allows the
speed of the motor’s rotation to be set at
nine different levels. Oddly, the higher
the number, the slower the motor’s
rotational speed. At its slowest speed,
the motor turns very slowly – some
motors with a distinct cogging action
and others quite smoothly.
Finally, the far-right display shows
seconds delay, with the up/down buttons
allowing timed delays from 0-99 seconds.
So, let’s imagine we have the stepper
and power connected to the board.
We have the rotational angle set to 45,
forward/reverse to 1 (forward), speed
to 6 and delay to zero. Now when we
press the single trigger button at left, the
stepper motor will moderately quickly
turn through about 45°. Set the speed to
1 and it will turn very quickly.
OK, so what about the delay function?
Let’s now set that to 5 – ie, a five-seconds
delay. Now a press of the single trigger
button will cause the stepper to turn,
but the timer deactivates the operation
of this button until – in this case – five
seconds has passed. Ah, but what if
instead of pressing the single trigger
button, you press the continuous loop
button? Now, every five seconds, the
stepper motor will rotate by about 45°.
Memory sequence control
You can see that we now have control over
direction, speed, rotational angle and, in
a continuous loop, the pause before it
repeats. Now let’s add LED display 1 to
the mix – the memory sequence control.
Pressing its associated button causes the
digit to flash 1, 2, 3, up to 9. When the
digit is flashing, whatever you set the
other buttons to (ie, direction, speed,
angle and timing) are memorised as a
program. So if the first digit is flashing
‘1’, the program created by the other
buttons is stored as ‘1’. You can create
up to nine programs, and then when
the continuous loop button is pressed,
the programs are served in sequence. So
you can see that you can have up to nine
sequences of movements, each having
possibly different speeds, directions and
rotational angles.
The programs are retained in memory
with the power off, but when power is
re-applied they need to be triggered by
pressing the continuous loop button
to start the sequence (ie, the sequence
doesn’t immediately start when power
is turned on).
Position feedback? Nope…
When using this controller with a
stepper motor, it’s important to note that
there’s no position feedback. That is, if
the motor stalls (eg, because something
jams) then the controller won’t be able
to correct for this. Therefore, in practical
terms, the motor and driving current
need to be sized so that the load can be
easily handled.
Uses
Well, what can we use this module
and a stepper motor to achieve? First,
it’s an ideal board for beginners who
want to easily drive a stepper motor.
Since no code is needed, someone with
very little knowledge can quickly get a
stepper motor up and running – cleaning
a model car windscreen
with an oscillating wiper
or even just spinning a
D C +
personalised sign back
D C –
and forth! I can also see
M e m o ry
R o ta tio n a l
T im e r
F o rw a rd / S p e e d
se q u e n ce
a n g le
A 1
d e la y
r e ve r se
the controller being used
A 2
to rotate a display item
B 1
on a shelf – turning a
F o rw a rd
special piece of jewellery
B 2
C o n tin u o u s
S in g le
R e ve r se
lo o p
or a fossil by 5° every 90
tr ig g e r
seconds, for example.
But my pick is its use
Fig.2. Function of the single/seven-segment LEDs and buttons. in a model railway layout
Practical Electronics | December | 2021
While stepper motors are widely available
new, they can also be easily obtained from
a range of discarded consumer goods –
from air-conditioners to printers. Salvaged
steppers often come with reduction
geartrains, as pictured here.
or similar. The amusement rides in a
model fairground – eg, the rides that
swing back and forth like giant seesaws –
could be easily driven by a tiny, toothed
belt from a stepper motor located under
the baseboard. The module allows easy
programming of the angle of rotation,
direction and speed of movement –
perfect in this application. It would even
be easy to use the sequence of programs
so that the swinging of the ride gradually
got bigger and bigger after it was started.
Stepper motors
A few other things to note. Stepper
motors are salvageable from a wide range
of discarded consumer goods – from air
conditioners (they move the internal
cooling vanes on oscillating models) to
printers. So, if you’re working to a tight
budget, collect those discards! If you do
this, you’ll also find that many of the
stepper motors have geartrains attached.
These reduce the rotational output speed
(ie, they gear-down the stepper motor
speed) which will give both more torque
(twisting force) at the output and allow
you to use a faster programmed stepper
motor speed, so smoothing its action.
(Don’t forget when programming the
module that the angle of rotation of the
output will also be a lot less with the
geartrain in place.)
Cheap but very cheerful
Look, this module is not perfect. It would
be very useful if the timed period were
longer than 90 seconds (an additional
mode going to 90 hours would be very
handy). Also, because it doesn’t have
any specific tuning controls for different
stepper motors, the controller won’t
work as smoothly with all steppers as
a properly optimised control system
would – and in fact, with one small
stepper motor, I found it wouldn’t work
at all. However, if you can see yourself
using a stepper motor in your next
project, this is the easiest and quickest
way of getting it up and running!
65
|