Introduction: Parallel Port 3 Axis CNC Driver, Opto-Isolated, Unipolar Steppers

About: Designing electronic creations from microcontrollers, LEDs and anything else I can pull out of a dumpster and make use of. Check my Profile


Controls 3 Unipolar Stepper Motors, for use with CNC Machines. Simple driver with automatic coil  shutdown, to ensure efficient operation.  Opto-isolated for protection of the P.C. Supports most parallel
port based CNC software, such as KCAM.

Supports up to 20 watts per Phase. Or 2 Amps per phase.

Full Kits with all the parts needed to recreate this Instructable can be purchased on my Website

Get a Full 3 Axis CNC Kit with Driver, Stepper Motors, Power Resistors, all the electronics and wire needed, excluding a PSU.

3 Axis CNC Driver KitAssembly and Testing can be added.

Printed Circuit Boards are Available with Free Shipping

and Programmed PIC Microcontrollers can be purchased

or Grab the a combined PCB & programmed PIC Microcontroller

Included in the ZIP below are the files for the Copper-side, the Top-Side layer, Datasheet and the drill files.

The source code is written in Assembly and can be purchased Here

Those who purchase Kits or programmed PIC will receive the source code for Free.

*UPDATE: Added the HEX files that use the PIC16F876A instead of the 16F870.

Disclaimer: Even though this is opto-isolated there still is a danger to your parallel port if a short were to occur. Recreate this project at your own Risk.


Step 1: Parts & Supplies

Notice 6/21/12: Get A free 3-Month Instructables Membership Code with the purchase of a  CNC Kit with a driver, motors, wire, and resistors. Limited Codes Available. Find it Here

Layout all the Parts:
- PIC16f870 - DIP or a PIC16F876A(must use a different firmware)
- Printed Circuit Board or strip board
- 20 mhz series oscillator, a regular one could be subed, just need to add 2x 22pf caps to gnd
- 12x logic level MOSFETs TO-220 package, i chose IRL630A or RFP12N10L or FDP8878
- 12x 1kohm 1/4w resistors - Brown - Black - Red
- 8x 10k ohm 1/4w resistors - Brown - Black - Orange
- 6x 500 ohm 1/4 resistors
- 12x 1n4004 or better
- Right-Angle Male DB-25
- 1x 7805 Voltage Regulator
- 2x 10uF Capacitor
- 1x 1uF Capacitor
- 3x LTV-827 OptoCoupler or Equiv.
- 1x 28 pin DIP socket
- 1x 8 pin DIP Socket
- 1x 16 pin DIP socket

A Full kit with all the Components, PIC Micro, and PCB Can Be Purchased

or Get a CNC Machine Kit with Driver, Motors, Power Resistors and Wire, It can Be found Here

Optional:
- 4x 4 Pin header
- 4x 4 pin housing
- 1x 2 pin header
- 1x 2 pin housing
- 18 crimps

Notes: Male and
Female DB-25 have different pin outs, and can not be substituted.

Tools:
- Soldering Iron
- Volt Meter/Continuity Tester
- Needle Nose Pliers

Check http://www.chromationsystems.com/partexplain.html Info


Additionally, a power supply will be required. To calculate power supply requirements: Motor Voltage/Motor Coil Resistance = amperage per coil. When full stepping each motor will have 2 coils/phases on at a time so minimum requirement is 6 * amp per coil. Then always use a power supply rated for %150 - %200 higher than the minimum. Switched mode PSUs will work, but will perform extremely bad compared to a capable linear power supply. Linear power supply's can be identified by a large transformer and capacitor probably along with some circuitry, they are more expensive but worth it if you want a nice machine.




Step 2: Resistors and Diodes


R1 - R12 are 1kohm 1/4w

R13 - R19 are 10kohm 1/4w

R20 - R25 are ~500 ohm 1/4w

TOG is a 10kohm 1/4w

D1 - D12 are 1n4004 or better


Place all the resistors and solder them in. Diagram Below
TOG is a 10kohm 1/4w resistor, mounted vertically.

Diodes D1 - D12 are next. Save the extra lead clippings for the jumpers.
These clamp the back EMF, protecting the PSU and logic.

Step 3: Jumpers, Oscillator and Sockets


Jumper points A - P need to be jumped.
( there is no jumpers O, I forgot about it)

Points labeled 1 are jumped to points labeled 2.
Example:
A1 goes to A2
B1 goes to B2
Ect.

Take a look at the diagrams below.

Take a lead clipping from the diodes (which is plenty thick)
Using a needle nose pliers bend the wire into a U shape large enough to bridge the gap.

When placing the jumpers ensure that you keep them away from any other holes or components.

Next Place the Oscillator in the XTAL, it goes in either way.
Make sure this gets a good shiny solder joint.

Sockets are Next

The 14 and 16 pin socket go in as pictured, line the notch on the socket up with the notch on the illustration.

Its not completely necessary but pin 6 on the 28-pin socket (RA4 on the PIC) (see image) should be removed, as there is a positive supply rail routed through it. And make sure to fill in its solder pad and hole with solder.

Then carefully line up all the pins into the holes and push down gently, watching to make sure no pins get flattened.

Step 4: Capacitors, Headers, DB-25


C1 & C2 are 10uF Electrolytic

C3 is a 1uF Electrolytic

Capacitors first, these are polarized so they need to go in correctly.
The white stripe down one side of the capacitor is the negative pin.
In the top-side illustration the black half is the negative side.
*also shown in the image notes below.

Headers SV1 - SV5 are next.
If you are using locking headers consider what way you need the lock part facing.
Otherwise they can go in however.

SV1 is the Y axis motor
SV2 is the X axis motor
SV3 is the Z axis motor
SV4, pin 1&2 is Negative Supply
SV4, pin 3&4 is Positive Supply
SV5 is positive supply for the motors


The right angle, male, DB-25 port is last for this step.
*note: A female port will not work as the pinout is different. If you want to use a female port or a panel mount port, use some solid strand wire to run from the port to the PCB.

A right angle port can be kinda of tricky to get in, but get a thin piece of metal, a tweezers or nail, to pry and direct pins into their holes. Only pins 2-7 and 18-25 are used, so the other ones could be clipped off to make the placement easier.

Keep it flush with the PCB, nice and tight or later plugging and unplugging will damage on the connections. Then solder a few pins to keep it in place.

Flare out the mounting pins as pictured below, and solder.

Finish up the rest of the pins, remembering only pins 2-7 and 18-25 need to be soldered, the rest don't.



Step 5: MOSFETs and 7805


Find the 7805, its in the same package as the MOSFETs but is labeled "7805"

Its place is labeled IC2 in the illustration. The metal tab lines up with the black part in the illustration.
Solder in securely, and make sure that the center pin has a really good solder joint.

Then starting from one end, place and solder the MOSFETs. See the top-side illustration and align the tabs on the MOSFETs with the black part in the illustration.

note: The tabs on the MOSFETs must not touch, as the tab is probably tied to the drain and it will not function correctly. There should be no need to heat sink the FETs.


Step 6: Plug in the ICs, Interconnects


Opto-Coupler's are labeled LTV827

The 16-pin socket., labeled OPTO2, is shared by 2 8-pin opto-couplers.
The dots on the ICs go on the same end as the notch in the sockets.

The other 8-pin opto-coupler goes into the socket labeled OPTO

If you purchased a programmed and tested chip from my Store.
Carefully plug it into the socket, aligning the notch on the socket and the dot on the IC.

Otherwise, program a 16F870 with the HEX file in the .ZIP in step 1.
Check the readme for fuses or the image below.

Step 7: Auto Coil Shutdown


As discussed earlier RA5 is used to toggle the use of the automatic shutdown function.

By default, after a motor has stepped, a timer is started, and about 50 ms after all coils for that motor are shut off. And it will resume normal function the next time it is stepped.

If you do not want the motors to shut off, RA5 must be jumped to GND. See diagrams below.

Also the function can be easily turned off in software, if the source code is Purchased

Step 8: Motors and Power Supply


I am not going to cover motors here there is plenty of great info around on the net and here on Instructables.

Below(the image with blue background) is the the setup for the motors that are included in my Full CNC Kit with Motors, Power Resistors, Wire

All Axis' are have the same pinout, if a motor works on one it will function the same on the others.
A full step means 2 coils are on at once.

Example each bit represents Header 1 - 2 - 3 - 4
1100 - 0110 - 0011 - 1001

This driver does not have any on board resistors or chopping circuitry to regulate current for the motors.

I prefer to place high wattage resistors in line with each motor's V+. Hopefully you can find the datasheet for your motors and find out the required current and voltage for the motor. Then by using a web resistor calculator, you can find the correct ohm and wattage values for your motor.

Each motor needs its own resistor, otherwise it will force multiple motors to share current when multiple are on at the same time.

A 24 volt stepper motor will end up drawing a lot of wattage, be sure you have properly rated resistors to avoid damage.

Some Good Links on Current Limiting:
http://pheattarchive.emporia.edu/projects/stepper/unipolar.pdf

http://www.cs.uiowa.edu/~jones/step/current.html

I have tested this driver with 5 different unipolar motors, they all worked great.


To calculate power supply requirements: Motor Voltage/Motor Coil Resistance = amperage per coil. When full stepping each motor will have 2 coils/phases on at a time so minimum requirement is 6 * amp per coil. Then always use a power supply rated for %150 - %200 higher than the minimum. Switched mode PSUs will work, but will perform extremely bad compared to a capable linear power supply. Linear power supply's can be identified by a large transformer and capacitor probably along with some circuitry, they are more expensive but worth it if you want a nice machine.


Step 9: Limit Switches


While the driver does not use any external inputs from limit switches, they are easy to add without any more components other than the switch.

Take a Look at This PDF, page 6 shows schematics for both active low and active high method. 

The switch connections can be soldered from the bottom of the PCB to its input pin on the DB-25.


Step 10: Interconncts and Crimps


If you are using headers and housings to attach your motors to your driver board. You'll have to select some suitable wire and attach crimps to the ends.

After you've selected and cut your wire attach a crimp to the ends. The crimps then slide into the housings, which attach neatly to the locking headers on the PCB.

Follow my Tutorial for more Info

Step 11: Software & BIOS Setup


This driver has been tested and works great with KCam. But most CNC programs (Mach3) work in a similar way and should also work fine.

Parallel Port is set up as follows, pins referenced are on the DB-25 port.

X Step - Pin 4
X Direction - Pin 5
Y Step - Pin 6
Y Direction - Pin 7
Z Step - Pin 2
Z Direction - Pin 3


Ensure in the BIOS that the parallel port is enabled, address set ( 0x378 is default ), and mode set to EPP or EPP/ECP


A short Tutorial on Setting the Home Point and Eagle CAM Processor Info and more KCAM setup info.

Step 12: Enjoy


This driver was designed for a CNC Machine but it could be used in anything that requires a PC to control 3 unipolar stepper motors.

*UPDATE: New CNC Machine I have built utilizing this Driver.

*UPDATE: Unplugging the PSU from the Driver while the motors are on may cause the PIC to become damaged.

Please ask questions, PM's are best.

Thanks for reading.

If you found this information useful please support current and future projects by shopping at my Store or Donating

Please check out My Profile to view my other projects.