Go Down

Topic: Stepper Driver (Read 15996 times) previous topic - next topic


Right, So I'm actually waiting for my Uno in my start kit but want to try to get a couple of things sorted in my head until it arrives.

I will be learning Arduino (hardware and software) from 0 knowledge - got to start somewhere, but have done exhaustive googling on certain things to do with steppers.

I under microstepping, how it works, that its slower and that you have to send combinations of high + low to the coils to achieve it - and typically the chip gets very hot in the process.
My project - when I have enough knowledge will be to control a stepper motor - capable of microstepping with the cheapest circuit possible (cheaper than a sparkfun easydriver). I have determined that the cheapest way is through an l293d chip and a very minimal amount of components (arduino help pages - bipolarsteppercircuit).
The other option which interests me is the a3967, capable of 1/16 microstepping (not sure I'll want it this fine - perhaps half or a quarter)
What is the simplest circuit I can produce for this, I've checked out the data sheet and it seems too simple? Just a couple of capacitors and resistors and hook up to ground, 5v, enable, step and dir. Is it that simple?
Would that be overlooking anything - such as frying anything?
I want to control VERY cheap stepper motors, unipolar or bipolar, with probably a large angle. I want to make a small plotter for as cheap as possible. Accuracy is of course important but a compromise will be made between price of the steppers and their performance (I expect I will be buying many steppers)

I know I should be waiting till I know more, but I just want to try some things out on a breadboard - whilst learning through the tutorials - I have done minimal PIC work - with steppers.

Any help is appreciated :)


Cheap ... and you're using an Arduino?  Well for protyping. (that is with a ;) or two)

Anyhow, your question is so openended at the moment I can think of too many answers. And I played a bit with the concept (cheap Stepper control) in my mind, too, some time ago. And my conclusion (for what it is worth) is that all I need externally is the driver transistor/MOSFET, the rest I want(ed) to do in software. Keep in mind though, as "robtillaart" (another forum users) has as his motto: In theory there is no difference between theory and practice, however in practice there is ...

A unipolar stepper only requires four drivers (ie transistor/MOSFET, possibly with a resistor) - cant get much cheaper than that. Oh and the flyback/backpulse Schottky diodes if the stepper is "big". And 4 pins on the Arduino.

Software wise it is "easy" to drive the lines for full and half step. Quarter and other microsteps requires either a more sophisticated driver circuit to supply half-current or a PWM-like. Ah- the Arduino has that, too. I just have not tried it. Well, I did a quicky-test of a unipolar stepper with full&half and the software worked.

A Bipolar stepper must use two H-bridges. Again, it can be made with 2x4 transistor/MOSFETs (and diodes) if you trust your software skills never ever to send a signal that make a short from PWR to GND. Otherwise a simple inverter in the circuit can guarantee that, and then you only need two pins to control each H-bridge. Same considerations for the quarter/micro steps as for Unipolar.

Lastly, there is the concern of power. To get the steppers to react faster/stronger you want a larger voltage, but to avoid sending too much current you need to current limit. That is where the fancy motorcontrol chips start earning their worth. Maybe the PWM of the Arduino can be good enough.

and a note on mechanics (for your plotter):
Anything that is not driven directly from the stepper is liable to mechanical slack or backlash. Your mechanical design is more important then the electronic/software if you want the plotter to draw accuratly. Doing that cheap is the real challenge. I have dissambled a few scanner/kopiers and the ingeniuity in the cheap designs to overcome this is interesting. F.ex. like a scanner only needs to be accurate when moving in one direction (it wont scan on the return stroke), or by including more feedback measurments of actual position (seen in most inkjet printers)


Msquare - thank you so much for the detailed information, really helpful!

I am using Arduino because of the libraries and I will eventually make a really cheap clone to control the drivers. I want to drive 4 steppers (I have no preference on whether its unipolar or bipolar - again best performance for price). So I will need to use the 2 pin approach for the drivers, so I can have other fancy things like optical switches (probably not independent of each other).

So you are saying a unipolar is a lot simpler of a circuit? The impression I get is bipolar is more suitable for the task. The difference between the two examples provided on the help pages is very small, in terms of price so I thought perhaps best to go the bipolar route?
http://www.arduino.cc/en/Reference/StepperBipolarCircuit <- you say I need two H-bridges but only one is used here?

With the current limiter - I haven't actually looked at this - this may be one of the things I've overlooked - I'll look into the cheapest implementation on this. Luckily I wont need much torque so maybe I can get away with a lower voltage.

Your point about mechanics is very true, this is the area where I wont be skimping at all. I will be using the standard timing belt implementation. That being said - I will be going as cheap as I can.
The good thing is I don't have to get it right first time - I will be experimenting lots (an expensive project perhaps with hopefully a cheap outcome - thats the goal!)

Thanks for your help, I'd really appreciate if you could elaborate and poke holes in my project - I don't like surprises :P


My favorite references for the steppers : here and here (the last is by GrumpyMike a helpful & productive user of this forum)

The L293D you refer to is described as "Quad Half Bridge" on the datasheets which means two full H-bridges in the circuit shown. I have used the L298N (the D/N suffix is a package difference) or plain transistors in my circuits.

Both uni- or bi- steppers are "simple" for their circuits, but twice the component count for a bipolar, unless you use a "good" chip then it is just a count of 1 (well, they usually require som external capacitors...). You can connect a unipolar as a bipolar, some people say that gives more torque. YMMV.

OK, by now the Arduino has arrived, hasn't it?


Torque is a good thing, so I guess I want half stepping instead of micro stepping and to run a unipolar stepper on a bipolar circuit, to get as much torque I can at a good speed. Do you think half stepping will be good enough - the angle will probably be quite high in the stepper as it will be cheap - it certainly wont be 200 steps. Timing belts help increase the resolution, I'm just not sure by how much yet, perhaps will find out during experimenting.

Which do you think is best for the price - l293d or a3967? I haven't come across anyone using l293d with half stepping without a pretty expensive number of components - PminMo has one for example.

Thanks for the links the GrumpyMike's was really informative, about how stepping actually occurs. Though more information is needed to actually send a movement with micro steps, I feel.

Sorry for all the questions.

My Arduino should arrive in the next few days :)


I think you are getting to the point where 1 ounce (28g) of experiment wil outweigh a pound (453g) of theory

If your are going to do some level of multiple unit production (your posts seems to indicate this) then I definitly would buy components for trying several circuits. Especially as you do not yet (as I understand it) hold a stepper in your hand.


May 08, 2011, 01:44 pm Last Edit: May 08, 2011, 01:46 pm by yydoctt Reason: 1
You're right I do need to get experimenting - especially since there are so many options.
I have used stepper motors before, controlled using C and a PIC, but never with anything other than full stepping. For that I made a really simple circuit but it was for a very different application.

You're completely right there is a massive difference between theory and reality, so I will order lots of things to try out, namely the l293d and a3967/77. The main point of me starting a topic was finding out if the circuit can be as simple as the datasheets/arduino help pages suggest. Which I think the answer is, yes: in theory - go test it out! :)

And no this is not going into any kind of production, small nor large scale. This is a self-project, I want to have fun with it!

The problem is I dont have a great supply, being in Hong Kong and not able to reach SSP very often. So I think I will order those chips and just a random assortment of components (my starter kit has a small variety) and get to SSP when I can for additional items.

So thanks for you help, I will go play when my arduino arrives :)


May 10, 2011, 03:14 pm Last Edit: May 10, 2011, 03:24 pm by focalist Reason: 1
I'm in the process of building a wall plotter based around an Arduino and two salvaged steppers from a printer.  In terms of design, they've got it right-- the issues will not be software, they will be in tweaking the mechanical design and electronics.  This morning, I'm looking into whether or not the stepper controller I built from 3904's (two wire interface design, unipolar steppers) is actually fully switching the output transistors on, or if I need to add some decoupling.. I've got a bit of jitter on the steppers.  I've not even begun the polar-to-cartesian coordinate conversion code (I'm using a suspension head), but I'm not really concerned about it at all.. code is easy to modify, a lot easier than de/resoldering..

My question is what is the specific need for microstepping?  I'm just wondering if a reduction gear might be a better solution, in that a reduction gear gives you both accuracy and torque at the expense of speed.  An output gear with a decent ratio might give a workable solution, and allows you to use less expensive motors with less drive circuitry.  If you are looking to do this "on the cheap", do what I did: go to the dump.  Find the oldest and heaviest printers you can (dot matrix ideally), the older Digital, Epson, and IBM/Lexmark printers have several high-power steppers and a couple of low-power ones to boot.  Even better, the boards contain the original driver circuits, usually H-Bridges or Darlington Arrays- and you KNOW they are within spec for driving the motors- if Epson did it, so can you.  Try to stay away from the newer desktop inkjet printers, they are built with much cheaper components.. but I have two CNC-grade steppers from a Lexmark printer that would cost at least twenty bucks each that came from one junk printer.  You can't get much cheaper than FREE...

Just a thought!



Hey thanks for the reply - I've had a look at your blog, really interesting! Similar type of project too - though you clearly know exactly what you're doing - whereas I don't have a clue!

I'm not sure that I need microstepping - I have a supply of timing belts with pulleys so I will test out a few configurations.
Salvaging things is a great way to save money - but the purpose of my project is to do it cheap whilst still buying everything off the shelf - no shortcuts and no used eBay/dump goods, unfortunately (not that Hong Kong has easy access to either).

I will be trying the simplest of circuits, If I need microstepping I will reconsider my options. The reason I think I might need half-stepping is because of the huge angle that my cheap stepper motors will be.
So I will be making a circuit using the l293d - without microstepping - this driver will cost barely more than the chip!
If that doesn't work well then I will use the a3967 - simplest circuit possible - and keep expanding on it until its at a reasonable level of accuracy (at plotting).

Perhaps you could share what circuit you have made and how much it would cost if bought new?

Thanks for your response, I'm going to keep following your blog!


May 11, 2011, 01:43 pm Last Edit: May 11, 2011, 01:54 pm by AgeingHippy Reason: 1
Hey yydoctt

I know the project you are looking at... reprap.

FWIW there is a lot in it to get going and if you are considering writing your own firmware as well you are potentially aiming *very* high, given that building a 3D printer with pre-assembled electronics and pre written firmware in itself is already a huge project.

You could look at the pololu stepper driver boards...

Anyway, perhaps you have FREECYCLE in Hong Kong? If so join up and keep a look out for printers as someone else said before. I have pulled a couple of stepper driver chips form an old printer, although they are only half-stepping...

I don't think you want to go the rout of using h-bridges for stepper controll. That is a hack and you may not get the accuracy you may actually be looking for. Having said that, I guess you could always upgrate your electronics as your project proceeds.

As for using weaker stepper motors and gearing... I think you will again lose accuracy due to backlash on the gears.

For retrieving components (such as stepper driver chips from old printers) a heat gun as a good investment. There is a video of some dude using a heatgun to reclaim components but I am not sure where I found it. Maybe Hack A Day.

Good luck. It certainly is a fun project. I learned loads :)


May 11, 2011, 03:05 pm Last Edit: May 11, 2011, 03:07 pm by yydoctt Reason: 1
Hi, not sure where you got that idea - perhaps a search for my username - but no this project is not for a reprap. It's much simpler, its a plotter, which I will then test some heads with (no Z-axis). I am however looking to get a 3d printer (not design a new one - just weighing up my options - between ultimaker and reprap - It's just so hard to source things over here otherwise I'd be in the middle of a reprap build for sure).

As I mentioned to focalist, this plotter project is going to be designed to be REALLY cheap but not using dumps, freebies or eBay - paying RRP for necessary components. I'm not sure why I've set this task, perhaps so it is easily repeatable?

As for using weaker stepper motors and gearing... I think you will again lose accuracy due to backlash on the gears <-- I plan on using timing belts as I have a vast supply of belts, pulleys, bearings and other power transmission components - This is what Hong Kong is good at!
I don't think you want to go the rout of using h-bridges for stepper controll. That is a hack and you may not get the accuracy you may actually be looking for. Having said that, I guess you could always upgrate your electronics as your project proceeds. <-- this worries me - what would you suggest - polulu steppers cost more than the project is aimed to be total at. Easy drivers are also pretty pricey. They claim that you can make them for $4 but I priced it myself and was closer to $10, otherwise I'd go this route for sure.
Do you have any suggestions - I'm a bit lost as I think generally the feedback I've received from friends and from this forum is I may be disappointed using a simple circuit for any type of CNC motion - but then again noone has actually confirmed this. I'm definitely going to test it out but was hoping for some pointers.

Also do you own a reprap? I'm looking to print some parts out for this hobby project and for a different work project - so would like one ASAP - just researching the different ones (have you seen the resin curing one - amazing!)


Yo yydoctt

lol - not so sad as to do a search on your name :) ... I saw you had some posts in the reprap forum and recognised the name.

I do have a Reprap printer. It took me about 8 months to get it up and running, although I did move in the middle and everything was packed away for about 4 months.

It's printing fine, although I still need to do some finetuning and would prefer to change my nozzel arrangement at some point. The finer detail is a bit hit and miss... and I don't yet have a heated bed so only working with PLA.

As for electronics advice. I cannot give much as all I know is what I have learned from the reprap build and even then I got pre-made components. I am learning though, and am slowly learning about arduino (breadboard style - much cheaper) and various electronic bits.


This is a follow up to the Easy to Build Desk Top 3 Axis CNC Milling Machine Once you get the machine all put together its time to make it ...


Ageing hippy - I'm going to have to get a RepRap I think, I've got a plan to befriend an American to source all the electronics for me. I think I can source the rest.
Which extruder are you thinking of? I see Wade's is the most popular but saw a post about the Universal extruder printing parts almost as well as an up! printer.

Ruben Johnson - Not sure what you're getting at but the problems with those cheap builds is the electronics cost more than the hardware. I've costed a few of these builds and its not as cheap as they let on.. Unless you're thinking of one in particular which succeeds?


May 13, 2011, 06:34 pm Last Edit: May 13, 2011, 06:39 pm by focalist Reason: 1
I went through quite a few sites in reading up and then building the stepper controller, and ended up with a circuit from this blog:


I'm sure it's more expensive to build out of discrete components, and also note that I'm not even half-stepping, I'm doing this with 7.5degree steppers (48 per rev).  In my case, the "accuracy" is defined by the size of the spool that winds the line... but it is still essentially a gear, it performs the task the same way...  If I were to set out to do it cheap off the rack, I'd probably go with UL2003's.  They seem popular and cheap.

If you decide to build the circuit, I'd recommend using at least 2n2222's or better, as 3904's are very low-rated for current!

Go Up