Easy to build CNC Mill Stepper Motor and Driver circuits

 by Tom McGuire
Featured
C:\Projects\Milling\Mill_Drive\Schem-PCB\CheapStep_r1.jpg
KCAM LPT Port Set.JPG
C:\Projects\Milling\Mill Blog\PortSetup.jpg
C:\Projects\Milling\Mill_Drive\Pictures\IMGP0801c.JPG
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 go.

So it's time to drive the motors. And here I've put together a circuit that I think is the absolute cheapest and easiest way to control stepper motors with step and direction signals. It works with many of the free or low cost softwares that produce step and direction signals through the parallel printer port. I'll explain how it works but for those of you who just want to get on with it... The_Next_Step

But I would suggest for those of you who are unfamiliar with circuits to do it on a bread board (see pictures). This way you can easly correct any mistakes and try different things.

This schematic is just to control one motor so for the milling machine you need 3 of these circuits and 3 motors.
From Left to right and top to bottom. I try to draw schematics so that positive voltages are toward the top and ground or negative volge is toward the bottom. Inputs are to the left and outputs to the right. Fist off the voltage that you are going to use to run the motor needs to be stepped down and regulated for the logic chips. I used a 6.2 volt Zener to do this because it's low enought for the logic chips to receive the signals from your printer port and high enough for the outputs to drive many of the standard power FETs, so you may not have to use logic FETs like the schematic shows. So the resistor R1 drops the voltage, the Zener diode regulates it to 6.2 volts and the capacitor C1 filters out any noise from the motor, and this voltage powers the two IC's.
The first IC (CD4516) is called an up/down counter. One signal from the printer port will tell the counter if it will count up or down and the other signal, called step, will increment or decrement the counter by one count. Now were only going to use two outputs from the counter Q1 and Q2. With this binary counting method there are only 4 combinations of output from the counter: 00, 01, 10, and 11. These lines are fed to the A and B inputs of the other IC (CD4028) which decodes these combinations to 4 seprate outputs.
I did a trick here using the C input to work as an Enable input. If the Enable(optional) is connected to the parallel port and the computor tells it to shut off all of the outputs to the FETs will go low(Off). So the four outputs of the decoder drive the FET transistors and the FETs drive the four poles of the motor.
Now everybody wants to know what the light bulb is for. Its not so much whether you use a bulb or a resistor, its that a bulb comes with a socket. You can get these wedge base light bulbs from 1 watt to 20 watts. Start with may be a 4 watt bulb and if you find you need a little more beef you just pull it out and put in a 10 watt bulb. It's really handy. And I found it's good to have some voltage drop there as kind of a ballast for the motor windings. The diodes catch some of the current that comes out of the motor each time the FET transistors turn off. The diode feeds this current back to the supply.
When you get the circuit up and running find a power supply that puts out more voltage than you really need and then change out light bulbs till you get it running smoothly. Some of my stepper motors are 5 or 6 volt and some are 12 volt but it all works out.
 
Remove these adsRemove these ads by Signing Up

Step 1: The Circuit Board of Appeals

C:\Projects\Milling\Mill_Drive\Schem-PCB\CheapStep3D_PCB.JPG
OK here's what your all looking for. I made a simple PC board layout that includes 3 motor driver circuits connected to a 25 pin D sub Parallel printer port connector. Here's a picture of the layout. At the top of the picture you see a place for a voltage regulator. You can use that or you can put a resistor and Zener Diode in its place(like the schematic shows). On the right edge is a place for the 25 pin D-sub connector that connects to the parallel printer port. You just jam the PC board between the two rows of pins and solder it.
On the left side are places for the lamp sockets. You need to look over the schematic to see where some of the parts go but it's all there.
1-40 of 1323Next »
dirver says: May 18, 2013. 1:19 AM
Hi,
Small error in Port Setup printscreen of Tom.
Option 1: set pin 14 Reverse = True (instead of False)
Option 2: set pin 4, 7 and 14 on NU (as Enable is optional). You can than use pins 4,7 and 14 (reverse=true) for something else.
See pictures.
Regards,
Dirk
kcam2.JPGkcam1.JPG
sonnbonics says: Aug 9, 2012. 12:11 PM
Could I make 5 of these and control a 3D printer?
dirver in reply to sonnbonicsMay 16, 2013. 2:31 PM
Multiply the schema for 5 motors instead of 3.
Could be done.

What software and mechanics will you use ?
Regards,
Dirk
sonnbonics in reply to dirverMay 16, 2013. 10:01 PM
well, i have since bought a 3d printer, but i use pronterface. you think it would work?
dirver in reply to sonnbonicsMay 18, 2013. 12:44 AM
Sonnbonics,
I've looked further and in KCam4 you can only connect 4 motors.
X, Y, Z and A.
And yo have to check if there are pins available on your parallel-port
Pins 1, 16 and 17 are available in the KCam4 software but you have to check if they are hardware available.
Also you have to check if Pronterface is capable of stearing your motors via the parallelport AND via pins (not bit's = processor needed).
This last one can be probably done by exporting to KCam4 and use KCam4 for driving your motors.
Why you need 5 motors ?
X, Y, Z = OK, the spindle you can mis-use to control the fluidwire.
Therefore you need 4 outputs.

Regards,
Dirk
dirver in reply to dirverMay 18, 2013. 1:00 AM
Sonnbonics,

Just tested the following:
Tom has foreseen pins 4, 7 and 14 as pen-enable (optional).
If you put NU in the port-setup of KCam4 in the place where you could enter 4, 7 and 14 everything is still working (because of the flag Motor Enable --> Always On).
Therefore you can use pins 4,7 and 14 (wrong IO-address in KCam4 !!!, &H37A instead of &H378) to control your 4th motor.

Succes,
Dirk
dirver in reply to sonnbonicsMay 16, 2013. 10:36 PM
Sonnbonics,

What is the brand and type of the 3D printer ?
So I can see more specs.
A 3D printer is probably just a bunch of steppermotors which work with special software (like e.g. Pronterface).
Is a bit a X-Y-Z-milling machine but with a fluid instead of a spindle with drill ?? Or am I wrong ???
Regards,
Dirk
sgaspe says: May 21, 2012. 8:05 PM
I used 2N60 as the FET. But it seems like didn't working. Please let me know what is the best FET for use. My motor drives using 12V.
dirver in reply to sgaspeMay 16, 2013. 2:37 PM
RFP12N01L Fet's.
Regards,
Dirk
SpiderSpartan says: Jun 16, 2012. 1:47 PM
Can anyone tell me if Xenon or Halogen bulbs would work as the light bulbs in this circuit or would there be too much delay in those? Thanks.
dirver in reply to SpiderSpartanMay 16, 2013. 2:37 PM
Why use expensive bulbs ?
The bulbs mentioned are simple car or bicycle ones.
Depends on the powersupply voltage.
Regards,
Dirk
mastertiger says: Jul 8, 2012. 11:46 AM
i make this circuit for my cnc machine
i use 60n06 as mosfet
stepper motor 4.6A
i use power supply 17v
i make limitation circuit for current
but i have two problem
1- 60n06 Heated so much i put heatsink but nothing change
2- voltage across motor is only 1.4v
i don't know why
i use 17v supply voltage
please help
dirver in reply to mastertigerMay 16, 2013. 2:36 PM
Measured out the ic-pins as mentioned in the guideline ?
Your ic's should have 3V -> 5V input to work (see datasheet).
If not, check your power supply and part R1 (resistor 1K).
Regards,
Dirk
Tutorial Master says: Sep 12, 2012. 2:56 PM
Hi,
how powerful are the steppers?
dirver in reply to Tutorial MasterMay 16, 2013. 2:28 PM
Here in Belgium, they can lift 1 full package of 24 bottles of Belgium Beer.... ;-)
Depends on the motors and powersupply, not the circuit.

Regards,
Dirk
brcoenen says: Sep 21, 2012. 11:05 AM
Hello, can some one tell, or show me, how the lamp connects to the circuit on the pcb, i don't see it on any of the pics of pcb's or finished boards. I just see it standing there all by its self.

Thank you
dirver in reply to brcoenenMay 16, 2013. 2:26 PM
+ from the pcb to lamp 1, mass from lamp 1 to motor 1.
+ from the pcb to lamp 2, mass from lamp 2 to motor 2.
....
Do not want to be smart and put all together.. does not work !!! Tried this before :-(
So you need: 3 x 5 wires per motor + 2 for the spindle = 17 wires.

Regards,
Dirk
wl888 says: Oct 13, 2012. 10:16 PM
Tom or anyone with the answer please

firstly thanks for your Instructables.
have built the stepper control your design rev 2/11/07...cheep stepper. CD4516 and CD4028.

have built two boards so far.
for both boards, on slow clock test runs fine in forward, but misses Q4 output on the CD4028 every 2nd pass in reverse (tested with LED's) ie: direction to ground.
Apart from this every thing else works ok.
have You come across this before ? , if so, what is the cause / fix.

Regards
Doug
dirver in reply to wl888May 16, 2013. 2:22 PM
Doug,
Already replaced the CD4028 ?
Also checked the pcb ?
Re-tip the solderpads whith your solderpin.
Perhaps a very small mistake ?
Regards,
Dirk
brcoenen says: Jan 7, 2013. 6:32 PM
Just wondering, is there a parallel port mode that i should be setting the port to? I thought at one time as reading through all the posts I saw someone say something, but don't remember what it was, have read alot of posts, and with the little inconsitant errors and non workings i have had to finally get to a motor move I have to ask.
dirver in reply to brcoenenMay 16, 2013. 2:21 PM
Nothing to set, just check the base io-address of your LPT1 port.
Mostly 37xBh.
This must be the same as in KCam4.
Regards,
Dirk
pinkugkc says: Jan 16, 2013. 9:34 PM
there is no need any programming on microcontroller???
dirver in reply to pinkugkcMay 16, 2013. 2:19 PM
Correct, just see the settings (pin's) on the KCam4 screen Port-setup.
KCam4 just puts pin's high/low. That's all.
The high/low's are translated to on/off trought the fet's.
No programming involved.
Simple.
Regards,
Dirk
CANNONMAN1 says: Feb 6, 2013. 8:25 AM
HELLO, GETTING READY TO ORDER PARTS AND NEED TO KNOW IF THERE IS SPECIFIC PART NUMBER/MAKE ETC. FOR THE N CHANNEL LOGIC MOSFETS. WANT TO MAKE SURE I GET THE CORRECT ONE AS THEY ARE PRETTY COSTLY.
THANKS, ED
dirver in reply to CANNONMAN1May 16, 2013. 2:18 PM
Ed,
Use the RFP12N10L Fet's.
Perfect for the job.
Regards,
Dirk
axlrus says: Apr 30, 2013. 11:35 AM
What voltage should i use for light bulbs????? My motors are 6v, and power suply 24. 12v bulbs got realy hot, and with 24v bulbs motors run powerless. What happens there, and how to calculate proper resistor to replace the bulb. Thanks
dirver in reply to axlrusMay 16, 2013. 2:16 PM
If your motors are 6Volt than put max. 6Volt to the pcb.
Otherwise (perhaps already) you may crash the motors.
As Tom mentioned,use a simple powersupply (3 - 4,5 - 5 - 6 - 7,5 - 9 - 12) Volt switchable.

Regards,
Dirk
sanjaysy says: May 6, 2013. 4:18 AM
I built using PDF files from your instructable. it looks like +ve & -ve terminals have been connected using 1K resister, where are circuit says +ve & +ve terminals are connected with Zener & capacitor in parallel with 1K series resister. do i looking at the right bottom.pdf. i'm a mechanical engineer & limited knowledge of electronics, your help will be highly appreciated.

Attached a sketch with markups.

Thanks in advance.

regards,
sanjay
Capture.JPG
dirver in reply to sanjaysyMay 16, 2013. 2:14 PM
Sanjay,

You mixed up the R1 (1K resistor) with C6 (capacitor 220uF).
Regards,
Dirk
slh1 says: Mar 22, 2013. 10:46 PM
Hi mister! Is it possible to connect your driver to the 4-lead 2-phase bipolar stepper motor? since I could only find this type of motor in my area. Thanks
addi125 says: Dec 23, 2012. 3:50 AM
will this works with 4 wires stepper motor?
andrewuk says: Dec 21, 2012. 2:40 AM
Great intractable! But have you created a board yet for sub adaptor?
Avadhut.Deshmukh says: Oct 13, 2012. 10:00 AM
I am using stepper motor Nema23Part
No.: 57BYGH420
Frame Size: NEMA23
Step Angle: 1.8 degree
Voltage: 3.6V
Current: 2.0 A/phase
Resistance: 1.8Ohm/phase
Inductance: 2.5mH/phase
Holding torque: 12.6Kg-cm 132oz-in , with unipolar (For Bipolar connecting, the holding torque is 185oz-in)
Rotor inertia: 300 g-cm2
Detent torque: 0.4 kg-cm
Number of wire leads: 6
Weight: 0.7KG
Length: 56mm !

does it hold Nema23 ?
brcoenen says: Sep 25, 2012. 1:17 PM
Hello, can someone tell me if C7 is the the 220uF Cap? If i understand it rite, from what i read, all the rest are .1uF.
mnikolic says: Sep 9, 2012. 8:00 AM
Please, can someone help me! I made this circuit and it is excellent, it works with KCam, but I want to work with Mach3/ Why it is not possible to connect with this programe. Please sent me answer on vilan86@gmail.com

Thank you in advance!!!
grzegor41 says: Sep 4, 2012. 12:52 AM
As high power motor can be used in the electronic circuit, so as not to have to replace the values ​​of the individual circuit elements.?
maikeru86 says: Aug 27, 2012. 6:57 AM
Hi all, could someone please help me out with a relatively simple question?

I built a circuit board am I'm quite sure its exactly the same, I've tested it and it seems to be working fine.

My question is, when I load up Kcam, and switch on the single step mode and bring up the parallel port I/O display window (the window showing the high or low state of the pins) to test the board, It shows that the step bit is always on high state. when I click on a direction it briefly switches to low state then goes back to high state and remains there. Even if i invert the bit it remains the same.

Should it not pulse i.e. go to high state briefly when a button is clicked and then switch off again?? has anyone experienced this problem or is this the correct way to drive the motors.

I'm not sure what the specs of my motors are yet and thus cannot test if they work, but the output pins on the board do switch in the correct order and thus believe that the reason for my motor not responding is because of this.

Any help would be greatly appreciated!
mganpate says: Aug 9, 2012. 12:38 PM
i Have question about the will be used in small wind turbine. its yawing system purpose getting the wind direction purpose. if you possible this system tobe apply its with out vfd through its yaw gear box sytem Motor to be used this our our
below specification of motor

05 hp
240VDC
1500rpm
pmdc

we are making the pm dc steeper motor system with out vfd.

kindly suggest.

Regards
Mahesh Ganpate
altempowerltd
india


shlxtn says: May 20, 2012. 8:47 AM
HI
I am asking about computer safety ?.
It will not burn cpu or ram or any part of my computer,by residual current from motor?
t hank you
dpsilver in reply to shlxtnJul 31, 2012. 5:49 PM
you should be be able to use supression diodes to prevent this reverse emf from reaching the computer if it gets that far, or even opto isolators but the simplest ting to do is to use a parallel port on an expansion card
1-40 of 1323Next »
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!