Instructables

$5 stepper driver

Note: I recently redesigned and improved the stepper driver, as this has no microstepping, current limiting, and is prone to change direction erratically.  The improved version is here:  http://www.instructables.com/id/45-better-stepper-driver/

I have wanted to make a 3D printer or a CNC for quite a while, but as I don't have a lot of money, nor can I frequently order components online, I always ran into one obstacle.  Almost all projects required stepper drivers with step-direction control.  Those sorts of parts aren't avaliabe at stores, and the cheapest and most popular are around $15 a piece.  I don't want to spend nearly that much on a single component that could fry in a second, so I decided to make something a little cheaper and more expendable.  I ended up deciding on making my driver with an attiny and separate H-bridge chip.  It uses an attiny85, and the ever-common L293 motor driver.  together, they cost less than $5, and need almost no support circuitry. 
 
Remove these adsRemove these ads by Signing Up

Step 1: Other parts

All parts except the attiny and L293 are optional, but highly recommended.  In quantity, most cost as little as a few cents. 
1x >47uf capacitor-the bigger the better
8x ~1k ohm resistor-doesn't have to be 1K, any value 330-2K2 will probably work
1x 1N4001 diode-or any diode that can take >=1 amp, again, the bigger the better
protoboard-you could free-form it, but it's best to use protoboard/perfboard. 
header pins-if you want to breadboard with the driver or make it easy to replace.  I didn't use them, but its generally a good idea to do so. 
IC sockets-for the two chips, one 8 pin, one 16 pin.  Again, I didn't use them, but highly recommended. 
Finially, you will need an arduino.  Any flavor, homemade or whatever, as long as it has serial and an atmega it will work. 
GingerDan922 months ago

Do you know if this will work with an Arduino Mega im using it to control 3 motors?

jduffy54 (author)  GingerDan922 months ago
If you mean to build three of these drivers and connect it to a mega, yes, that would work, though I would recommend the "$4.5 better stepper driver" instructable, because, as the name implies, it's much better and slightly cheaper. If you meant replacing the attinies with a mega, you could, but you'd have to modify the code, and I would suggest adding other features like microstepping and current control.

Yeah im just making three of these drivers to connect to one mega :), thanks ill give it a look

jatinbatra3 months ago
I'm unable to understand the schematics.
As per your advice I have got a pre boot-loaded Atmega328p chip, but have failed to get better drivers like A4983 . All I have right now is L293D , so Can I use Arduino , Atmega 328 p and then further grbl controller to control my stepper by sending Gcodes ?
If so is the case please explain me how Arduino and Atmega will be connected as that is not much clearer with the pictures you have uploaded.
I'm pre-assuming the following steps that I need to do to run atleast one motor :
-Make sure grbl firmware is already uploaded to arduino
-Program i.e. upload the "Real Code" (as per step 5 of your instructable) to ATmega328p
-Connect L293d as per data sheet to four wire bipolar stepper wire and ATmega328p (or ATtiny2313, as in your instructable)
-Open grbl controller and viola , your motor should be running up.


Now it would really be a favor if you could just let me know the proper connection of Atmega328 with Arduino (i.e. the inputs )
jduffy54 (author)  jatinbatra3 months ago
That could work, but as I've had some problems with this driver, I would modify the code significantly. This driver uses an attiny 85, which does not have enough pins to drive the four motor wires plus two inputs, so I made one pin do double-duty. It works most of the time, but occasionally, the direction spontaneously flips. Since the 328 has tons of pins to spare, you could make a better driver. The code for the $4.5 diver with the L2619 is "bettter", and can be quickly adapted for a different processor and driver. If I have the time, I'll re-write some code, and make a diagram, but I'm occupied for most of the next few months, starting saturday.
If I can't get to it, just use the stepper librairy for arduino, and write a program that counts up or down on the interrupts, using another pins input for direction.
jduffy54 (author)  jduffy543 months ago
Actually, immediately after posting that I noticed that no, the 328 cannot use the same code, even should you want to, as it does not have any analog pins and interrputs on the same pin, which is required for this code.
jatinbatra3 months ago
Hey Hi, the schematics are not very clear , from where you got the schematics , I saw the data sheet of L298 and to me it seems very much similiar to l293D , except for the fact that L293D has 16 pins.Moreover both the pins have 4 inputs .
Your both the drivers are awesome , you must include a video running all four motors for the 3d printer with grbl or any other software you use , it would be a great learning experience for noobs like me .
jduffy54 (author)  jatinbatra3 months ago
I would not use the l293 or 293d as neither has current regulation, and thus neither can do microstepping, unless complemented with a chip that can (an a4989 should actually be able to do so).
If you can get some a4989s, you should definitely use those, as their performance will be much greater than my driver.
Also, what is unclear about the schematic? It seems fairly straightforward, it needs an oscillator resistor, connections to current sense resistors, an h bridge and power.
Rahul Mitra4 months ago
Can i use atmega8 in stead of attiny??? if yes then how?
jduffy54 (author)  Rahul Mitra4 months ago
I would think so, though I haven't tried it. You would want to use different code, as the code for this specific project uses a single pin for step and direction, which makes it prone to read direction incorrectly. I have another instructable which uses an attiny 2313, and more importantly, separate step-dir input pins.

http://www.instructables.com/id/45-better-stepper-driver/

Using this instructable: http://www.instructables.com/id/Arduino-on-all-sorts-of-Atmels/step1/A-list-of-that-Atmels-can-be-programmed-with-this-/

You should be able to use the same code on your atmega without a problem. If you want to use L293 instead of L2619, then just change out the line in the code in "void count" that checks the analogRead pin, and replace it with "if (digitalRead(directionpin)==0){" replacing "directionpin" with the pin number you chose.
I would, however, suggest using the same controllers, as though it SHOULD work, I have no idea if it will.
Using numbers to indicate which pins are connected is a bit confusing as they could be pin numbers, which is what I thought at first. Usually we use small letters to do this (a) to (a) (b) to (b) ,etc. Just for future reference. Thanks for the 'able & the clarification ! CHEERS!!
Can't follow your schematic at all & a Google search for L298 doesn't have same DIP package or pinout. Can you please clarify ?
jduffy54 (author)  Lectric Wizard9 months ago
In the schematic, anywhere where a wire goes to a box with a number, just put a jumper between the two boxes. If it's something else thats confusing, then could you please clarify what you're asking about?
jumpers 5,6,7, and 8 go to the stepper.
Could it be a L293 IC ?
jduffy54 (author)  Lectric Wizard9 months ago
Yes, it is a 293. For some reason I can never remember which one it is. I'll change it in the instructable presently.
jduffy54 (author)  jduffy549 months ago
It's changed now. Thanks for pointing that out.
jduffy54 (author) 9 months ago
Thanks much!
tgferreira1849 months ago
http://www.instructables.com/id/OA7UYG1H143LO81/?editMode=true
take a look
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!