speed changes are accomplished via a timer interrupt or
loop with delays between steps. This is where controlling
stepper motors can get more involved than other types of
motors. They have an advantage when used for position
control and open loop control but require the use of a
timer interrupt using an interrupt service routine (ISR) or
a delay.
Newer stepper motor drivers such as the EDE1200 and
the SparkFun Easy Stepper board provide the necessary
timing for waveform generation. The EDE1200 even
provides a clock using an external crystal to drive the
stepper motor at various speed increments. On the
microcontroller, we have the ability to generated delays
using the Easy C Professional or PIC18 C Wait(n) functions,
where n is the number of milliseconds to delay.
VEX Stepper Motor Controller Firmware
In order to make the stepper motor move at the
selected speed and in the desired direction (clockwise or
counterclockwise), you just download and run the
stepper1.hex application on the microcontroller using the
Intellitek Easy C professional or IFI bootloader application.
Listing 1 shows the details of how the stepper motor is
driven to run in half step and full step modes in the
selected direction. I used Easy C Professional for the
example in Listing 1 which shows you how to move the
stepper motor using the full step mode with a
microcontroller and a ULN2803A driver.
We also provide the hex file for those readers who do
not use Easy C Professional. This example is very easy to
port to Easy C, Robot C, and PIC18 C with WPILIB. The
simple stepper motor command messages are formatted
and sent to the controller so that it can move the stepper
motor the selected number of steps
in the desired direction. To make the
stepper motor move in the reverse
direction, just reverse the direction
of the outer stepper motor
command loop by modifying the
stepper1.c application. The complete
source code is available for
download from the SERVO website
download page.
Bill of Materials
TABLE 1. Bill of materials required to build the
stepper motor experiment setup.
ITEM
QTY
1
1
2
1
White Breadboard
3
1
4
4
5
1
6
1
DESCRIPTION SOURCE
VEX Controller Innovation First, Inc. www.vexforum.com
RadioShack
www.radioshack.com
ULN2803A SparkFun www.sparkfun.com
LEDs RadioShack www.radioshack.com
Package of
Jumper Cables
SparkFun
www.sparkfun.com
Stepper Motor
Bipolar (six wire)
All Electronics
www.allelectronics.com
pull out of the controller.
Conclusion
Using simple hardware with some firmware, precise
and repeatable movement is possible for your next robotics
or automation project using the information that I provided
here. Stepper motors need not remain a mystery to use if
you build the stepper motor controller. In addition, you will
learn just how stepper motor based devices such as
printers, plotters, and scanners work. The Hero 1, on the
other hand, demonstrates how very complicated animation
sequences (such as picking up a can of soda) can be carried
out using stepper motors.
This controller is the first step towards precise position
or motion control afforded by more expensive commercial
controllers. In Part 2 of this article, I will show you more
applications for the ULN2803A including driving relays and
solenoids, and more advanced VEX stepper motor
applications. Until VEX time. SV
The parts required to build the
VEX user interface circuit are shown
in Table 1. Other than the
microcontroller, the other
components are relatively low cost
and can be found at All Electronics
or SparkFun. The jumper cables
make it very easy to connect the
stepper motor to the VEX controller
but should only be used for the
experiment since they can easily
SERVO 10.2010 73