Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Reversible stepper motor driver

Not open for further replies.


New Member
I have just made my first unipolar stepper motor drive circuit using a 555 to clock a 4017 decade counter wired to count up to 4. The output of it drives 4 mosfets hooked up to the wires of the motor. It works great, but it can only go in one direction without me switching the order of the wires.

I'd like to make a reversible stepper motor driver with two inputs to step it in either direction, but I can't figure out a way to do it without using a chip designed for it or using a microcontroller. I'd like to use common components for this.

Any circuit ideas to do this would be appreciated :)
You could use a 4 pole relay to do the switching for you like this...

**broken link removed**

If you dont have a 4 pole relay you can also use two double pole relays or use four single pole relays.

If you prefer to go solid state you could use a MAX333 Quad SPDT analog switch IC.

**broken link removed**
I had a need to pulse some stepper motors back and forth too.

I found a circuit that consisted of an exclusive-or 4070 (4 gates) feeding into a
4027 J-K (dual) gives four outputs Q, Q\, Q and Q\
feeding the coils via a ULN 2003 on the end. Oh and one of the J-K outputs fed back to one of the Ex-ORs

I added a 555 for the clock. The direction of the stepper was changed by pulling the input to one of the Ex-OR's either high or low.

The same idea is shown on this page (more or less) but with 74 TTL family
**broken link removed**
While using a relay like that is a good method, it will not immediately reverse the motor, it will lose a step or two and I can't think of a way to wire it so this doesn't happen.

My knowledge of digital logic is kind of weak, so it will take me a bit to puzzle through and understand that circuit. Would it's reversal take place immediately, that is to say, with proper input of the clock and direction lines would I be able to energize coils in the sequence 1-2-3-2-1-2-3 (or similar) if I wanted?

This is going to be for a basic CNC router my science club is constructing, so I need to have exact control over where the x and y stepper motors are at any time. That's why the relay method (though temptingly simple) wouldn't work for me.
For something that precise , in which every pulse is significant, you'd need a clocked logic circuit controlled by a pre-programmed microcontroller.
You probably should just bite the bullet and buy a microcontroller. It may sound more complicated but it lets you solve hardware problems with software- and you'll probably end up with a much cooler CNC machine.

As for the logic approach, you can make anything with logic gates - the first Cray super computer was made using only NAND gates. However whether or not it will be an easy and solid solution is another question all together.

You didn't mention CNC in the original post I thought you were just experimenting or playing around with logic gates and counters.

Out of curiosity how are you going to control the X & Y steppers
you mention 2 inputs (00, 01, 10, off, fwd, rev) ?

Don't forget you may need to synchronise with your clock too

You must be programming something with coordinates etc?.

I have to agree with the others it would be easier to program a microcontroller to control the steppers

Is the CNC... a learning project ? If so electronics, software, hardware\mechanical, all the above or something else ?
Time constrained?
Well I guess I´ll have to break down a work out a microcontroller solution, logic circuits have never been my strong point. Plus if the torque of the motor is sufficient I would like to run it in half step mode rather than two step, so that if will have twice the resolution, and I think it would be a bit of a challenge to think up a circuit for that. This is a project that is mainly for the fun and challenge of it, but it will be handy for certain things, like etching plexiglass, something my brother and I have done a bit of.

I plan to have this thing controlled by a computer, probably through the parallel port since it´s already at 5v and 0v logic levels, and I already know how to program for it. I now think the best way to wire it would be a clock and direction input for each motor´s controller. I plan to do most of the work on the software side to simplify the electronics I have to put in it. At most I will have the drive circuit for the stepper motors controlled directly by the (optoisolated) parallel port, or possibly though a shift register, and a simple interface for manual direction and speed control of the router.

Thanks for the help and suggestions :)
As long as you are using a microcontroller you might as well move the motion control intelegence into the micro. Windows can do some screwy things with your timing. Besides programing on your micro can be done with C - something that will be easy to learn if you can program on the computer.

The serial port (RS232) is the prefered way to talk to micros. It is used by standard C libraries (printf) to talk to the host computer from the micro. The MSCOMM object can be used to send serial commands in VB. Hyperterminal can also be used to send/recieve commands through the serial port. The UART on the micro can talk to the serial port through a level shifter like the MAX 232 or equivalent - easy to put together.

Hope ths helps.

I am experimenting with a stepper driver chip UCN5804B from Allegro. It is as easy as pie to control this from a parallel port and it can handle 1.25 A directly. Try it, you do not need a microcontroller for that. You can get the datasheet from Allegro.
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips