My current project is a small stepper-driven X-Y table which will be controlled from a PC. Most CNC software outputs data through the parallel port using two lines per axis (step and direction), so I needed a circuit that would translate this into individual signals for each phase. The only circuits I could find used microcontrollers. Because I do not have access to a programmer, I decided to design a circuit using only commonly available parts.
Lots of great information about steppers is already available on the web, so I won't
repeat it here. I recommend these two links.
I decided to design it as a sequential state machine. The circuit needs to move through a set of eight distinct states, forward or backward depending on the direction input. Those states are as follows:
The first step in designing the circuit was to generate a truth table relating the current output state to the next state. This corresponds to the four AND gates in the circuit.
Input Output abcd efgh 0000 xxxx 0001 1001 0010 0011 0011 0001 0100 0110 0101 xxxx 0110 0010 0111 xxxx 1000 1100 1001 1000 1010 xxxx 1011 xxxx 1100 0100 1101 xxxx 1110 xxxx 1111 xxxx
The x's stand for "don't care" and indicate an excluded state. They can be considered either one or zero, whichever leads to simpler logic. By examining the truth table, you can see that output e is high only when inputs b and c are low, or simply e = b'c'.
The boolean expressions for all four outputs are:
e = b'c' f = c'd' g = a'd' h = a'b'
Since the complements of a, b, c, and d are available at the Q' outputs of the flipflops, the basic circuit is very simple. However, it does not address two issues, direction control and excluded states.
To add direction control to the circuit, I used a 74LS157 quad 2-to-1 data setector/multiplexer. It has two sets of four inputs and one set of four outputs, which carry the data of either one of the sets of inputs depending on whether the data select pin is high or low. The first set of inputs is connected to the AND gates so that signal pass straight through the 74LS157 as in the original circuit. The second set of inputs is wired to the AND gates so that each D input of the flip-flops gets the output of the AND gate that was meant for the flip-flop directly after it. This shift causes the circuit to run in reverse.
This circuit looks good, but there is one problem. In the truth table I started from, I ignored all of the invalid output states. This leads to very simple logic, but when power is applied, the flip-flops will start in a random state. All is well if they happen to power up in one of the valid halfstepping states (from the first table) but if they do not (they usually start as 0000), the circuit won't work. To illustrate the problem, here is the truth table with the x's filled in according to the boolean expressions above.
Input Output abcd efgh 0000 1111 0001 1001 0010 0011 0011 0001 0100 0110 0101 0000 0110 0010 0111 0000 1000 1100 1001 1000 1010 0000 1011 0000 1100 0100 1101 0000 1110 0000 1111 0000
If you follow the states in the truth table, you will notice that all of the invalid states lead to 0000, and 0000 leads to 1111. The result is that if the flip-flops begin in an invalid state, the circuit will end up cycling between 0000 and 1111. I tried replacing the x's for state 0000 with various valid states, but doing so makes the logic much more complicated.
The solution was to interchange the Q and Q' outputs of one flip-flop and invert the data input. This means that when the flip-flops are reset, they go into the state 1000 instead of 0000. Rather than adding another IC, I used a 2N3904 as an inverter.
I built two copies of the circuit on a general-purpose PC board and used SI-7300 modules to actually drive the motors. The SI-7300's, salvaged from LaserJet III's, are PWM constant current driver chips that can handle up to 3 amps. This setup easily doubled the performance of a fullstep controller with simple transistor outputs that I had tried before.
I used a 74LS08 quad AND gate, a 74LS175 quad D FF, and a 74LS157. The circuit should work fine with other locig families, but I have never tried it. One last issue is power-on reset. The 74LS175 needs to be cleared to make sure it starts in a valid state. In my X-Y table, the computer handles this, but if you are going to use it as a stand-alone unit, add a RC delay to the circuit to hold the MR' input low for a brief period of time after power is applied.
In my quest for a halfstep controller, I also designed the circuit below. Inputs A(LSB) through C(MSB) are connected to an up/down counter. I chose not to use this circuit because it required more parts and parts that i didn't have in my junkbox.
I hope someone is able to use this information. If you have questions, comments, or design suggestions, you can reach me at firstname.lastname@example.org