Introduction: 2 Input Stepper Driver

Picture of 2 Input Stepper Driver

hi again,
this is my third project, it turned out very useful,so i'd like to share it with people.

overview:
i have a parallel port with only 6 functioning data outputs.
so i think twice before i do something.
for example,controlling two stepper motors at once.or sixteen at once etc..
there are probably tiny chips out there that do what my device does,but i like designing stuff.

this device accepts,only two inputs, a clock line (pulse), and a direction line for our motor.
and magically,it outputs the right sequence of bits to drive the motor with its four outputs.
i use it with my parallel port,but it can also be driven with a 555 timer,or any other clock source.

Step 1: Step1

a disclaimer,
this device is tested on my system,and works with the parts that i have, and i don't have extensive electronics knowledge ,so be careful before you hook this up to your computer,and do your math twice. i can't be held responsible for any damage to your equipment or if you hurt yourself.
i have a very old computer that i don't care about,and many transistors to burn.so i simply build the circuit,and try it out.
luckily this circuit turned out great,and powerful.

a little theory:
i have two kinds of steppers,4 cables and 6 cables.however they both require 4 control cables.
the stepper is a great toy to play with,but it won't start directly right after you apply some voltage.
you have to send the data in a sequence.so that the coils start making the armature turn.
here is the sequence i found out thru trial and error,plus some google search.

o1 o2 o3 o4
0 0 0 1
0 0 1 1
0 0 1 0
0 1 1 0
0 1 0 0
1 1 0 0
1 0 0 0
1 0 0 1

while it is easy to create this sequence thru the parallel port using four outputs,we can create it using only two cables. one for the pulse, and the other for the direction.
go to step 2 to see how


Step 2: Step 2

i spent some time thinking on how it could be possible to drive my stepper with only two cables.
then i could use the rest (i have 4 more good outputs remember), to address switches,and boom,i have 16 motors running with only 6 cables (in theory)
i have already built a 2 bit data select device prototype designed to work with this baby.
so i can control 4 motors with 4 cables. (2 for addressing,2 for this device i'm about to reveal)

at the heart of the device is a 4029 4bit up/down counter.
the counter creates a sequence on its four outputs,counting from zero to fifteen(in binary mode),
of fifteen to zero.
it has the four output lines we need,but not the right sequence.
let's examine the sequence:

o4o3o2o1
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
10 1010
11 1011
12 1100
13 1101
14 1110
15 1111

as you can see,this is nowhere near our desired sequence.
if you go back and look at my previous sequence table required by the motor,
you will notice we have eight different output states from 0001 to 1001

if you're familiar with binary(because we are dealing with only 2 states,1 and 0,true or false,on or off),you will realize that in order to get 8 different states,
we have to solve this equation
2n = 8

n turns out to be 3 in this case.
so,in theory i should be able to create these eight consecutive binary outputs shuffling a three digit binary number.

Step 3: Step 3

Picture of Step 3

our counter has four outputs,that is four binary digits.
in binary mode (not decimal),the three digits from right to left repeat themselves after eight counts.
so the last three digits remain the same when we're counting from zero to seven,
or eight to fifteen.
we can use these three outputs to create our sequence.they will keep repeating in the same order forever.

the rest is very simple.
for example for the very first number 'zero',that our counter throws at us,
we have to create '0001'
easy,
0000 ?=> 0001
dcba 4321
now remember we don't care about the fourth digit,
then,
000 ?=> 0001 output
cba 4321

so in order t get output 1 high,
we need, NOT a and NOT b and NOT c
therefore,
output1 is 1 when a'&b'&c' is 1

we will have a table,of all these conditions once we write the logic statements for each member of our output sequence.

notice,the second count,which is 0001 must turn on output1 and output2 at the same time.

output1 and output2 is 1 when a&b'&c' is 1

to do this,i used general purpose diodes.

while the output of the first statement is directly connected to output1,
output of the second statement is connected to output1 and output2
to prevent unintended triggering,i simply placed diodes between the statements which trigger more than one output.

we will have only two inputs,one will be connected to pin 15 of 4029 (CLK)
and the other to the pin 10 of 4029 (1 up/ 0 down).

the outputs are more than strong enough to drive the steppers that i have,but i recommend using them as triggers.

the whole thing is easier to understand once you see the schematic.
i just wanted to go over the theory here.

parts used here are:
(8) NPN 2N3094 transistors
(8) 4001 diodes
(4) red LEDs (i was out of diodes,LEDs worked just fine for this application)
(1) 4029 4bit up/down counter
(1) 4009 hex inverter
(3) 4081 quad 2 input AND gates

total cost:
$7-$10

i will try to post a video of the device running soon

please feel free to make suggestions,criticize,or ask questions.

Comments

crysisatutz (author)2011-06-01

I think you mean:
2^n = 8 => log_2 (2^n) = n = log_2 (8) = 3 <=> n = 3

Electricdreamer21 (author)2008-12-26

ok so wears the chip dieagram so someone could build one for there self its kind of hard to know wear everything goes

laci37 (author)2008-12-07

You could upload a bit better image, the resolution is very low.

westfw (author)2007-09-25

Are you set on designing your own circuit or do you want pointers to other circuits? Your approach, where counted states are translated to different bit patterns, is a pretty classic approach to such problems. You MIGHT get a simpler circuit by using a shift-register instead of a counter, since the output somewhat resembles shift register outputs anyway. The usual stepper sequences are 4 steps; you seem to have a "half step" sequence that adds quite some complexity. Is that intentional? (In fact, there's a "simple" drive pattern that just has a single 1 circling a 4 bit shift register.) You should have base resistors before the transistors. 2n3904s are pretty wimpy for stepper drivers. You need protection diodes on the transistor outputs to keep the back EMF from the motor coils from frying the transistors. NPN transistors pretty much need to switch "low side", with the load between +V and the transistor, with the transistor emitter connected directly to ground.

dvlfrnd (author)westfw2007-09-25

Thank you very much for your reply westfw. i actually built the circuit and it works fine to my luck. the circuit isn't intended to drive the motor directly,its purpose is to create the sequence i wanted.i use its outputs to trigger other gates to drive the motor. so i have 2 different modules in my mind,this for the sequence and a simple one to drive the motor.i'm currently using 4 2n3904's on another circuit,which are being triggered as gates to drive the motor,but i appreciate it if you could recommend me a better transistor to use. while it gets very hot in the process,this circuit still can directly drive the stepper that i have, at an acceptable torque.but you are definitely right,i will add protection diodes and base resistors as soon as i can. the sequence is intentional.i found out by trial and error,that those half steps create a smoother,stronger motion in my case.and it is that sequence that made things complex. I also built a much simpler circuit that uses capacitors to create the half stepping effect,but i need to experiment more on it to get the values right. other than that,it looks promising.i'm planning to use the 2 bit data selector that i made to drive it. Thank you again

westfw (author)dvlfrnd2007-09-25

2n2222a transistors have considerably higher current ratings than 3904s, but motor drivers traditionally start looking at "power" transistors or darlingtons like the TIP series (or IC-based transistors like ULNxxxx)

Micro-guy that I am, I can't help but notice that a microcontroller would make the whole thing (except the power section) a lot more obvious and perhaps cheaper (assuming software and development environment is free.) (PIC16F54 = $1, ULN2803= $0.75, drives two steppers... (digikey Q 1 prices.))

dvlfrnd (author)westfw2007-09-25

i'm going through a learning process, i build these things out of curiosity,and to understand the inner workings of single chip solutions. i don't feel too comfortable with electronics yet,once i feel more or less complete with the theory and concept of the electronics world,i will start using more compact solutions. i already have 2 pic16f84's and 2 at90s2313's, but i don't want to start with them without having a solid foundation. i know there exists enough knowledge in google,to build something and run it smoothly without actually knowing anything about it as long as you're good at following instructions,however my primary goal is to learn,rather than making something that works for school or any other reason. it might sound weird,but that's how i am, i learned assembly before i learned C++ . Thank you for your reply, i added the 2n2222a and ULN to my shopping list.

westfw (author)dvlfrnd2007-09-25

That's fine. It's just that one of the turning points in my life was when I realized that I could program most of the electronics projects I had ever built on a general purpose piece of hardware, instead of having to build separate specialized hardware for each one. And I'm happy to pass on that thought when it seems appropriate :-)

dvlfrnd (author)westfw2007-09-27

Thank you westwf, i totally agree with you,that turning point probably boosted your productivity,and helped you finish what you started,sooner and better,adding a huge amount of desire and motivation for other projects,and i hope to get there soon :)

About This Instructable

11,076views

17favorites

License:

More by dvlfrnd:2 input stepper driverhow to make a simple 2 bit data selector
Add instructable to: