motor action is the instigation of motor movement such as
clockwise rotation, counter-clockwise rotation, and halting the
motor. The A3979 command inputs STEP and DIRECTION are
used to invoke motor action. A3979 control actions include
putting the A3979 silicon to sleep, resetting the A3979’s internal systems, or enabling or disabling the A3979’s internal H-bridges. Control actions are also spawned by A3979 command
inputs, which are logic levels applied to the translator command
input subsystem. The A3979 translator also provides some useful output in the form of a HOME signal. HOME is defined in
A3979 terms as the initial state of the translator. The translator
will put the step sequence in the HOME position at power-up.

Picking up on the idea that the A3979 doesn’t need an
IBM mainframe to operate efficiently, all we really need to
control the stepper motor by way of the A3979 is a small
microcontroller, such as the PIC18F2620. The PIC18F2620
hookup details can be seen in Schematic 1. As you can
see, it has more than enough I/O to support the A3979. The
ability of the PIC to clock itself internally leaves two more I/O
lines (RA6-RA7) at our disposal.

There are only eight A3979 translator I/O lines we need
to deal with. The A3979 ENABLE line is optional here and is
put into a permanent enabled state. That leaves us with only
seven translator lines to tie to the PIC. Since the plan is to
cover the top side of the A3979 PCB with a ground plane, all
of the communication lines between the PIC and the A3979
are routed on the bottom side of the A3979 PCB. Note also
that the translator I/O lines are routed as far away from the
power circuitry as possible.

The largest current carrying trace needs to be 0.025
inches wide, which will transfer two amperes. As you can see
in Screenshot 1, that is a tall order in terms of the A3979 pins.
So, we do the best we can and attach the widest trace possible as close as possible to the A3979 motor output pins. It is
important to keep the thin traces as short as possible to keep
the trace resistance to a minimum. Once we have attached a
trace to the A3979 motor driver pins, we can increase the
copper area to accommodate the higher currents we may
encounter at the A3979 motor output terminations. I used
large copper planes instead of traces on the bottom side of the
PCB to connect the A3979’s motor output pins to the four-pin
motor terminal block. Copper planes are one of my favorite features of the ExpressPCB printed circuit board layout program.

The final critical design point is to place the current sense
resistors as close to the A3979’s current sense pins as possible.
We also need to consider routing the current sense resistors’
ground return paths. The ground return paths to the A3979
from the current sense resistors need to be electrically unhindered. I placed the current sense resistors as close as possible
to their respective A3979 current sense pins and used the
vastness of the ground plane as the sense resistors’ ground
return path. The A3979 datasheet says to provide a separate
ground path for each sense resistor. However, from experience
I’ve found the ground plane method to have no adverse
effects on the operation of the A3979 H-bridge circuitry.

Again, I could have saved some board space by
installing fixed resistor voltage dividers for the PFD and REF

34 SERVO 01.2008

potentiometers. Having the pots here allows you to adjust
the symmetry of the stepper motor current waveform (PFD)
and select the amount of current you want to supply to the
stepper motor (REF) with the twist of a screwdriver.

No project of mine would be complete without an RS-232
port and a standard issue Microchip ICSP programming/
debugging portal. Note that I’ve used the ST3232 in a five-volt
configuration in this project. The ST3232 can be used in 3.0
volt and 5.0 volt environments by simply changing the charge
capacitor values. Normally, 0.1 μF charge capacitors would be
surrounding the ST3232 in a 3. 3 volt project. As you can see
in Schematic 1, the 0.1 μF charge capacitors are replaced with
0.33 μF charge capacitors and a 0.047 μF charge capacitor
between the ST3232’s pins 1 and 3.

I used a reflow oven to reflow-solder the A3979 motor
driver board’s SMT components. If you don’t have access to
a reflow oven, you can assemble the A3979 board with a fine
tipped soldering iron. If the reflow process intrigues you, you
may want to investigate the Stencils Unlimited site
( www.stencilsunlimited.com). There you will find all kinds
of SMT soldering aids. The A3979’s pins are fine and require
a stencil setup for reflow soldering. Because I want you to be
able to build the A3979 motor driver board without having
to procure specialized tools, I didn’t go the stencil route this
time and used my Metcal soldering system to manually
connect the A3979 pins to the PCB.

The Metcal ( www.metcal.com) soldering system is a
quick heating precision solder station. If you don’t have
access to hot air soldering equipment, you’ll need to add
some holes to your PCB layout under the belly of your A3979.
The additional holes will allow you to flow solder through
from the bottom of the board onto the A3979’s exposed
heatsink pad, which must be thermally connected to the
ground plane. I’ve included the A3979 motor driver board
ExpressPCB file in the SERVO A3979 project download
package at www.servomagazine.com so you can use it
as a base for your custom A3979 project. The A3979
ExpressPCB file will reveal the presence of the ground plane
passing underneath the A3979 providing a soldering point
for the A3979’s exposed heatsink pad.

Coding the A3979 Motor
Driver Firmware

Everything depends on the PIC18F2620 clock. At power-up, the PIC will default to a 1 MHz internal RC clock as we
have specified that it use its internal clocking subsystem.
Ultimately, we want to run the PIC at its maximum clock
speed of 32 MHz. To do this, we must first load the OSCCON
register with 0x70. This will change the PIC’s internal clock
speed to 8 MHz. Then, we enable the 4x PLL to boost the
clock speed to 32 MHz. This is done by writing a 1 to the
PLLEN bit. Once the clocking has been taken care of, we can
assign the PIC’s port I/O to input or output according to the
port pin’s required usage. For the PIC18F2620, a 1 identifies
an I/O pin as an input while a 0 is used to define an I/O pin
as an output. Here’s the clock and port I/O TRIS code: