Andrew Burks

Stepper Motor Driver – NAND Gates Print This Post

by aburks on Jul.11, 2010, under RobOrchestra, Robotics Club, Vibratron

The Problem

I still need to find a cost effective way of turning a bipolar stepper motor on and off using just one pin.  I want to have the ability to use a powered brake, and I want to be able to use half-stepping control of the motor for smoother rotation.

Half-stepping gives the motor higher resolution, which is good for my application because one full step cycle is enough to move a single ball through.  The 4-stage process from before turns into an 8-stage process when you change to half-stepping.

t=0  A=1  B=0  C=0  D=0

t=1  A=1  B=1  C=0  D=0

t=2  A=0  B=1  C=0  D=0

t=3  A=0  B=1  C=1  D=0

t=4  A=0  B=0  C=1  D=0

t=5  A=0  B=0  C=1  D=1

t=6  A=0  B=0  C=0  D=1

t=7  A=1  B=0  C=0  D=1

t=8=0

The Solution

I noticed that in half stepping (and full stepping) if you view the logic for each of the four wires as a wave, they are always 90 degrees out of phase and have a specific shape.  I wanted to create four unique signal lines, one for each of the four wave patterns, and transmit this signal to each of the 30 stepper controllers.  At each controller, I should be able to choose either some default value (like a powered or unpowered brake) or let the motor run off the signal.

Because my focus was centered on the powered brake, my initial idea was to take my on-off line at each motor and perform a logical AND with three of the four waves and a logical OR with the other wave.  The OR would drive its input high while the AND would drive its inputs low.  This solved my problem, but unfortunately I couldn’t find a chip with an AND and an OR circuit on it.

You can build any logic gate with a combination of NAND or NOR gates.  It takes two NAND gates to build an AND gate, and three NAND gates to build an OR gate (and vice-versa when building from NOR gates).  They sell IC’s with 4 NAND gates in them, so I really wanted to find a way to do my OR operation with only 2 NAND gates.

Eventually I realized that if I negated the signal wave coming from the Arduino (by using 1 NAND as an inverter) and then performed a NAND operation with the wave signal and the on-off signal I got the exact output I wanted!  of course, if I had just used an AND on each of the four inputs, I would have an unpowered brake and less of a headache.

I made this circuit on a protoboard, and tested it with both full and half stepping.  It worked like a charm.  The next step is to see if half-stepping combined with a smaller diameter wheel will be able to push balls along without jamming.  Here is the protoboard layout:

Pros

This setup allows for full and half stepping.  It costs less than the shift register design, about $2 per unit (only $0.75 from the two NAND ICs).  Each of the four inputs is completely isolated from the others, so the wiring is simpler (which makes the PCB layout easier).

Cons

There are now 4 common signal wires instead of just one.  These 4 wires will need to be jumped from board to board, potentially requiring some sort of transistor to keep the voltage from dropping as it moves across the boards.

More Photos

:, , , , , , ,

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!