CNC Router : DIY Motor Drivers

Stepper Drivers

Diy Drivers

Driving a stepper motor is unfortunately not as simple as a DC motor, the bipolar motors I used have two windings that you energise in a certain order to make the motor move one step. CNC software however sends just two signals, step and direction, so to interface the stepper motors with the parallel port you need to make some drivers. Version 1 of my drivers I decided to design and make myself, mainly to practice my PCB manufacturing skills, I would only recommend making your own boards if you really want the full home made experience because they do not run as well as purchased drivers and in the end they didn't even turn out to be cheaper (good experience though).

After a lot of research it seemed the easiest driver chips about for bipolar stepper motors are the L297 and L298N, these allow you to drive steppers up to 36V 2A per winding and allow half-stepping which will double your resolution. The circuit is even nicely provided in the L298N datasheet, you can sink multiple boards together to use the same clock source which is meant to ensure that each board runs at the same speed (this didn't seem to work for me, I blame noise due to my dodgy PCB manufacture). The circuit below is right out of the L298N datasheet, unfortunately I lost the eagle PCB files for these boards when I blew up my laptop during my Fuzzy Urn project (I don't plan to make any more).

You can see in the photo above the big heat sinks and fans, these may seem like overkill but those l298N chips get really really hot running at 24V for long periods of time, these drivers also produced a loud high pitched whine from the stepper when holding the motor still.

Driver Schematic

Driver Schematic

Parallel Port Breakout Board

As these drivers can be operating at some fairly high voltages and currents it is a good idea to isolate them from the PC's parallel port, no point killing your computer if something goes wrong. For isolation I decided to use a very basic opto-isolator chip on each I/O line, I used the 4N25 opto-isolator in the default configuration right out of the datasheet I made a quick schematic of one input line, R1 is a current limiting resistor and R2 is a pull down resistor so pick the values accordingly. When wiring up the parallel port plug make sure you use the correct output pins, I used pins 2 - 9 as they are connected to the parallel ports data line and are non-inverting, just google the pinout for more information.

Breackout Schematic


Power Supply

For the main power to the stepper motors I purchased a 24V switched mode PSU from http://ausxmods.com.au/ I chose a switched mode PSU as they can supply a high current, they have over current and voltage protection built in, and they actually seem cheaper than buying the transformer and building a PSU yourself. I actually don't remember why, but I also built a high current 24-12V regulator board, It is actually only used now for the fan and power supply for my new breakout board, the circuit includes a standard 12V linear regulator and two high current pass transistors, the schematic is shown below. You will probably need heat sinks on both the regulator and the transistors especially if you are drawing 10A from this thing, just make sure you do NOT short the heatsink tabs between the regulator and transistors, you will break something, the regulators tab is connected to ground and the transistors tabs are connected to the collector or 12V (guess how I figured that out).

You can see my complete power board in the photo above, to give me on/off control of the router I have got a relay+transistor controlled mains plug on the left hand side of the board, this is switched throgh the breakout board along with the motor drivers, the mains input also has an emergency stop button just in case.

Power Board

Power Board

12V 10A Regulator

Power Board