Posts: 12
Joined: Fri Dec 14, 2012 3:42 pm

drive multiple heavy duty stepper motors

Sun Feb 10, 2013 7:08 am


I want to make a CNC m/c driven by up to 4 to 6 heavy duty 24v steppers(xyz axes +tool changers).

Is there a detailed tutorial (schematic, part numbers) to help make stepper motor drivers controlled by a raspberry pi? Preferably via I2C, to leave some gpio pins free for other purposes. External power is must as they need to be heavy duty steppers.
If there isn't 1 tutorial, pointing me to multiple part tutorials ( making stepper drivers enabling/driving thru i2c, driving via external power ) would help.

User avatar
Posts: 41
Joined: Tue Feb 19, 2013 3:04 pm
Location: UK

Re: drive multiple heavy duty stepper motors

Tue Feb 19, 2013 3:27 pm

Hi there,
glad to see someone out there with some initiative - designing something useful for the PI.
I am doing almost the same thing (making a 3d printer).
I would recommend using "EasyDriver" ( which costs only £10.
It can be used to control almost any stepper motor - 4,6,8 wire; bipolar/unipolar etc.
Half-stepping, full-stepping, micro-stepping are all compatible.
Just pulse EasyDriver and the stepper will move forward another step.
I'd recommend soldering SJ2 closed so it will accept a 3.3v pulse (handy, huh?).
Hope this helps, and good luck with your project.
It takes two keys to unlock the door of success: Imagination and Determination; the latter is ten times greater than the former.

Posts: 74
Joined: Fri Aug 24, 2012 12:58 pm

Re: drive multiple heavy duty stepper motors

Tue Feb 19, 2013 5:49 pm

I keep pointing people to this one for stepper projects:

It can handle that voltage and can take movement commands via SPI. Trouble would be CNC cutting implies coordinated motion that's difficult to get from 3 or four drivers that share a bus.

Posts: 12
Joined: Fri Dec 14, 2012 3:42 pm

Re: drive multiple heavy duty stepper motors

Wed Feb 20, 2013 2:32 pm

Thanks mayannaise & photomankc for your reply.
To your pointers to easydriver & L6740 breakout, I had looked at online information on it and its more powerful v2 ( big easy driver) - The main issue I saw was
1. they can drive a max of 2A per phase - a decently capable stepper( 46Kg-cm -NEMA 34) I looked at runs at 4.2A per phase.
2. The latter is quite expensive, when compared to the price of the RPi itself. I am sure the price is warranted given the number of features, it still does not fit my needs.

Is it hard to build your own stepper motor driver to custom specifications? I am a complete newbie to electronics, RPi is my first attempt, but I think I can pick up what I need to learn given the extremely helpful RPi community & Youtube University.
The closest I came to seeing a coherent write up that explained a lot of what I was looking for was .

Would greatly appreciate any detailed pointers, or your steps in building a stepper motor driver ( for driving a 4A+ per phase unit, and if possible 110VAC and/or 24VDC )- & through it a heavy duty CNC /3D printer in detail.


Posts: 1956
Joined: Fri Feb 24, 2012 1:01 pm
Location: UK

Re: drive multiple heavy duty stepper motors

Wed Feb 20, 2013 3:17 pm

saranga2000 wrote:46Kg-cm -NEMA 34
This isn't a hobbyist project - these are quite expensive, when compared to the price of the RPi itself, as you say.

Reality check :o I suggest you have a look at a CNC mill someone else has built, and find out what motors they used. Then find out what the bits cost. I'm sure it'll be a lot more than you were expecting...

Posts: 74
Joined: Fri Aug 24, 2012 12:58 pm

Re: drive multiple heavy duty stepper motors

Wed Feb 20, 2013 4:28 pm

I have built my own CNC milling machine from a manual BF-25 mill. I'll tell you right now that building your own stepper drivers to handle 4, 5, or 6A current levels is not easy or cheap. I went down that road for a while and by the time you have torn your hair out and smoked a few parts the cost of a decent commercial driver board will be money well spent. Once you get into driving those currents there is not a lot of integrated help on the market. You will have to build it from components and that is not really a beginner-level electronics project.

Don't want to be a negative Nancy here but honestly, if the intention is to ever have a mill that actually makes things, trying to build a stepper driver by hand for NEMA23 or better steppers is how many projects end up in the trash bin.

Edit to add: The whole project easily cost 1.5x my original estimate of $2000 and took 6x the amount of time I thought it would. If I ever get another mill it will be a Tormach or a NovaKon turn-key because I will not be doing that project a second time.

Posts: 12
Joined: Fri Dec 14, 2012 3:42 pm

Re: drive multiple heavy duty stepper motors

Thu Feb 21, 2013 6:16 am

Thanks Ravenous & photomankc for your replies.

I guess its a good thing I reached out here and got your feedback, before I started purchasing parts.

Btw, Ravenous, the Nema34 is listed for US$90 on an online site, and the other axes can be of lesser torque. So the sum total I thought shouldn't cost more than US$1000 max pessimistic estimate. Using linear sliders, and carpentering parts.

Also, photomankc, shouldn't the circuit I pointed to earlier ( ) be able to handle 4A per phase loads as is? The datasheet for the TIP120 - seems to indicate continuous collector current of 5A. ( ... P120.shtml)

Posts: 1956
Joined: Fri Feb 24, 2012 1:01 pm
Location: UK

Re: drive multiple heavy duty stepper motors

Thu Feb 21, 2013 12:29 pm

Ah, well if you need only one of those monsters then things should be simpler. Successive stages of the machine could run from smaller steppers. (I am just guessing, but maybe you could start with the two smallest stages and see if you can make an X-Y machine of some sort. Then with that experience you'll be ready to take on a bigger stepper & controller for the next axis.)

Your budget sounds more realistic than I guessed too. With a machine of this sort you could use the raspi but I'm sure it'll be the cheapest thing on the whole final system :)

Bytheway though the circuit should work (given power, heatsink, etc.) you might want to look at the Linux CNC people (there is a forum out there somewhere) and see if microstepping will be needed too. Photoman mentioned co-ordinated motion, this is probably what he meant - if you're cutting metal or even hardwood, you probably want the motions to be very slow and controlled to reduce vibration & chatter. Not that I know anything about that sort of cutting.

At university I was once shown around an engine plant and saw a three-axis stepper driven thing somebody had built for them as a custom job. It was phenomenally expensive - mostly design/consultancy fees I suppose, but being the nineties it seemed pretty high tech. It wasn't even cutting - it was just pushing platinum (!) wires into wax forms for investment castings...

Posts: 74
Joined: Fri Aug 24, 2012 12:58 pm

Re: drive multiple heavy duty stepper motors

Fri Feb 22, 2013 6:26 am

It might be a bit easier to give some advise if you indicate what the machine would be doing? What it would be built from? Is it cutting wax, cutting plastic, cutting wood or metal, engraving, makeing PCBs, something else? All would have different expectations.

The circuit you linked is a very basic drive that would give you only the most "it moves" basic motion that's possible. The right transistors or MOSFETS would handle the current.... that is correct.

Almost all commercial drives are capable of much better microstepping motion which creates more fluid movement and cuts down on the resonance issues that steppers suffer from. They also permit the use of much higher voltage because they 'chop' the current to prevent the coils from overheating but the high voltage allows the coils to saturate faster. Thus you can turn the motor faster than you can at low voltage.

As a practical example my machine runs on 48V and 5A despite a motor voltage rating of something like 5 or 6V. The drives are micro-stepping at 8 microsteps per physical motor step. The result is smooth motion, clean cuts in aluminum and 200in/minute rapid rates. If I cut the voltage to 24V the rapid speed drops to under 100, past that the motors stall because the drives can not get current into the coils completely before it is time to change it all up for the next step pulse. Lower the voltage to the motors rated voltage and all the machine would be good for would be warming up the room.

If I drop to full or 1/2 step operation instead of 8 micro-step then the motors sound awful at cutting speeds of around 8 to 14in/min and in aluminum that is where I spend a lot of time. The cuts look like crap because the motors are not moving smoothly and they can stall out from their own resonance when the conditions all conspire just right.

This is why I say that in the scheme of things, the $50 to $60 per axis cost for even a basic commercial driver like the Keling 6050 is just money well spent. For anything but the most trivial uses, a home-grown full/half step driver built by hand is likely to just be a paper-weight. Without knowing what you want this machine to do though I could be over complicating things. It the forces are low or the work area is small then maybe you'd get by with simple home-built stuff.

Posts: 12
Joined: Fri Dec 14, 2012 3:42 pm

Re: drive multiple heavy duty stepper motors

Sat Feb 23, 2013 1:52 pm

Thanks photomankc, Ravenous for your replies.

To be honest, I don't have any specific use case for the CNC I was thinking of making. My only motivations are:
1. Build a CNC using RPI: stumbled on a lot of DIY CNC videos, articles on servos/steppers etc and its fascinating.
2. It not be a toy: that I make and keep aside after playing with it for a few days after bldg it.

Photomankc: do you have a blog where you have described bldg your 2500$ CNC, including parts etc. The main reason I thought of bldg my own stepper driver are:
1. I live in India , don't have easy access to spark fun, maplin, amzn,RadioShack etc, its usually easier to build things from parts myself or i d end up paying high prices ( import duty etc)
2. Its more fun, but more importantly if something goes wrong I have depth to fix it.

Re: micro stepping , the same article I pointed to, shows how to use a stepper IC ucn5804, to make things simple. . if I put tip120 after the if, shldnt I be able to drive 5a motors and get all complex features like micro stepping ?

Also, if some one could point out two things it would be extremely helpful:
1. How to use external power to drive the load ckt? For eg. The stepper or even a simple led- specifically, do the gnd of external power and the RPI/pic gnd need to be connected? If yes, do I need to put a high resistor between the stepper/led and RPI/pic gnd so that the high load voltage/current doesn't fry the pi? A simple ckt dia would be very helpful.
2. The enema 34 stepper I saw online was AC driven. How to drive an AC load ckt with a smaller DC logic ckt?

Posts: 14
Joined: Thu Mar 08, 2012 7:27 pm
Contact: Website

Re: drive multiple heavy duty stepper motors

Sun Feb 24, 2013 11:28 pm

I have comparable objective, albeit only 3 step motors, 2 heavy duty and one small 5V or so.
However, customized acceleration / deceleration required to avoid jerky movement.

There are several comparable products fit into purpose:
L6470 dSpin Motion Controller (2 x 1.5A motors) ... od_84.html

Sparkfun L6470 Stepper Driver Breakout

Polulu DRV8825 Stepper Motor Driver Carrier, High Current (md20a)

Powerlolu Stepper Motor Driver up to 10A + EasyDriver ... rup-to-10a

All of them seem to require Arduino but I don't think its a big issue to make it work with RaspberryPi, the last is not so good for direct control of step motors due to latency issues (please correct me if I'm wrong here).

Any suggestion(s) are greatly appreciated.

Posts: 1
Joined: Thu May 23, 2013 9:59 pm

Re: drive multiple heavy duty stepper motors

Thu May 23, 2013 10:05 pm

Appears that the Powerlolu is the only open source answer on this one.

Posts: 1
Joined: Mon Jun 09, 2014 3:12 am

Re: drive multiple heavy duty stepper motors

Mon Jun 09, 2014 4:03 am

it is very easy

use a pic microprocessor for each driver

attach directly to driver chips

here is picture of 1/3rd of a synchronized 3 axis controller, the pi can just send movement commands via rs232

programing pics is easy, i havent finished any firmware yet but it wont be hard
the gcbasic demo for rs232 input is a buffer, so that can be used to get commands into the chip
a word variable input buffer separated from the main command with a comma is usefull
can make it print feedback with hserprint command
if you are going to code anything in python then gcbasic will be easy

use hardware for sync, interrupt ports can be used to sync movment starts

you can technically use one pic for all 3 motors, it can talk while it waits between transitions, triggerd by timer interupt

idk what the performance would be like, also you can use common pwm for all 3 axises with the hpwmout command in gcbasic its very easy

rs232 can que movement commands into an input buffer, which you can display for human interface purposes

use py-serial or something like it for the pi, honnestly i didnt plan on using the pi for this untill seeing the post

definantly use laser keyboard for operation so it looks cool as shit

once you have this you can script movements, you will need to improve the code for microstepping and other crap like that
i think it is ideal to use 3 separate chips, they can all listen to the same wire and be addressed separatley with a special sequence of characters or something, cause its 5v signals

ok so the site says 64kib maximum, im not sure if that even means i can upload a 64kb file, but the pics are pretty nasty when made to be 64kb so i didnt bother uploading them, but they are cool let me tell you.... by description

it is a pi, in a nice clear box with a 7 inch lcd attached to the not-hdmi video out
with a usbrs232 converter and a usb laserkeyboard/mouse device for input

the rs232 connects out to 5v level rs232 on the pic directly, also the usb gives the juice to the pic too

the pic is run solely by a 20mhz crystal oscilator which runs straight off the 5v coming from the usb connector
(oh yeah dont short anything out accidentally to 12v, you will fry the pic and if you dont use a diode you will burn the pie too)

it directly drives 5v signal lines going into 3 full hbridge motor driver chips but because i am using a 3phase motor i am using half of each hbridge for each phase cause thats all i had and i dont like spending money on projects

the hbridges are directly powerd by a dc power supply of 12-whatever volts

they should be pwmed but right now im not doing that but i will later

its just a single wire and some code to add to enable pwm controll, its also necessary

if you skip out on the pwm then your motor will spaz out at the lowest operating voltage, cant go below 12v or the drivers shut off

so pwm is the only way to make them not spaz out at 12v and no or light loads

also there are bootstrap caps all over the drivers directly solderd dead bug style in order to make it like 100khz later on when i do that

you seriously need an encoder for more reliable operation but you can totally get away with feedbackless operation if you mess with the code for a specific application

ok so thats all you have to do to have a totally custom 3 axis cnc system

oh and you have to code a front end to play macros and do other cool stuff like bidirectional communication and operational logic and to display a really cool UI to show you all the datas and coordinates and stuff

i personally like using autohotkey to code the frontend for the computer
its very easy for a compleet noob like myself to control hardware via putty but python is definantly much better and also there is no autohotkey for the pie

also you cant do bidirectional communication with autohotkey without wasting like 50% of your ultra modern cpu polling the serial port

also its better to use a pic18f252 or similar model cause you can run it at 40mhz, 10mhz instruction and get better resolution

it could also be a good idea to plug 4 pics together, use one as a master and do raw hardware control with the interupts and 8 bit bus as data transfer lines

sorry about the pics, i swear i have them and im not making all this up but theyr bigger than your old A.I.M. Icon so i cant upload them

User avatar
Posts: 134
Joined: Fri Aug 23, 2013 3:37 pm
Location: Loon Lake, WA USA
Contact: Website

Re: drive multiple heavy duty stepper motors

Mon Jun 09, 2014 2:32 pm

The Big Easy Driver might give you enough torque but if it where me I'd look at Gecko Drivers and NEMA 34 stepper motors. I would also consider a higher DC voltage, somewhere around 30 to 48 VDC. The regular easy driver at sparkfun won't give you the current (and thus the torque) you want for milling of harder (steel) material. If you just want to machine plastic and maybe aluminum it might do ok.

Posts: 89
Joined: Sun Jul 01, 2012 12:48 am

Re: drive multiple heavy duty stepper motors

Sat Jun 14, 2014 1:32 pm

I've done this with a custom built driver board. I did it for the challenge and fun, but also because I needed to drive higher amperage than the drivers I could find at reasonable price.

There is a whole thread on this forum, with video, schematics, and code. It's not easy to link to on my phone, but search the forum for this thread:

Using RPi.GPIO to drive stepper motors

The board I built could drive 4 steppers or more, and has inputs for limit switches and more.

Kevin. (I have updated code if you do go forward... Minor improvements)

Posts: 1
Joined: Thu Jun 19, 2014 4:26 am

Re: drive multiple heavy duty stepper motors

Thu Jun 19, 2014 4:47 am

I'm using one of these ... oard-kits/ Driver kits to build my router using 34 and 23 size motors. It is a constant current chopper driver just like the gecko drives. You have to limit the current to 3A but the voltage can be as high as 42VDC. It is a unipolar driver board and will not drive bipolar motors so keep that in mind. The interface is parallel port so using a Pi will take some adaptations. The other caveat is these are sold as a kit only though it is a high quality kit with excellent instructions. I am using it with a Windows computer but it will interface with EMC ( I believe the name is ) on Linix.

Posts: 221
Joined: Sat Dec 07, 2013 1:12 pm

Re: drive multiple heavy duty stepper motors

Thu Jun 19, 2014 10:26 am

Suggest you read through the LinuxCNC threads, but to summarise, you need hard real-time performance to control steppers directly, and you won't get that from a Pi alone. I am currently investigating running the GRBL G-code interpreter on a Gertduino so all the Pi has to do is feed G-code down a serial link, that looks promising, but I'm in no hurry to finish that project, so don't expect updates on progress.

Return to “Automation, sensing and robotics”

Who is online

Users browsing this forum: ironlady, YaCy [Bot] and 16 guests