Instructables

Easy To Build Stepper Controller from Recycled Materials

Featured
*****You can see more of my projects and updates to my current projects on my website: Colvins.ca*****

***For Support on this Project, Please use the forum on my website. Just go to http://colvins.ca and click the forum link on the side bar.***

I am 14 I have always wanted to build a cnc machine but because inexpensive parts are hard to find in Canada I have had trouble trying to build a decent cnc controller. The purpose if this Instructable is to show that anyone can build a cnc controller using an old scanner. The scanner I used was an old OpticPro scanner. I had previously extracted the stepper motor and experimented with it but not considered it for a cnc controller. All of the controllers on the Internet had a large number of expensive transistors or were ridiculously complex. I finally stumbled across this controller and realized I could build it. By reusing the parts from the old scanner and making the case from recycled cardboard, I am cutting back on my impact on the planet. Also, because this controller is so simple, it only needs one power suply, so, it only needs 1 12 volt (for both the logic and the motors), instead of 1 5volt (for the logic) and 1 12 volt (for the motors). This saves energy, especially when you run it for a long period of time.

If you don't already know what a cnc machine is, it is a machine that uses special motors called stepper motors to moce an object a percise distance. The difference between a stepper motor and a regular DC motor, is that stepper motors "Step", not spin. if you don't understand, refer to this artical. There are two types of stepper motors. There is Bipolar, and Unipolar. Bipolar motors have 4 wires. Unipolar motors can have 5, 6 and 8 wires. The difference between these two types of motors is that unipolar motors have 4 coil inside that, when energized in a certain order, allow it to step forward and backwards. This makes them easy to control and is why we are going to use them in this instructable. Bipolar motors only have two coils that can be energized in forward, or reverse. To drive a bipolar motor you need two H-bridges. Because of this, bipolar motors motor controllers are much more complex.

Step 1: Required Parts

The parts that are required for this project are:

In the scanner:
-1 stepper motor
-1 uln2003 chip
-2 steel rods
For the enclosure:
-1 cardboard box
The tools:
-Hot glue gun and glue
-Wire cutters/strippers
-Scissors
-Soldering tools
-Paint
For the controller
-1 DB25 port (recycled from previous project)
-some wire
-1 dc barrel jack (recycled from old RC car)
For the test rig
-1 threaded rod
-1 nut to match your threaded rod
-various washers and screws
-scrap wood (recycled from previous building projects)
For the control computer:
-1 old computer (I used an old laptop)
-1 copy of TurboCNC (get it here)

Step 2: Get Parts from Old Scanner

The first step to building your cnc controller is to extract your motor and control board. I did not take any pictures of this step because every scanner is different, but it is usually as simple as removing the glass and taking out a few screws. The two parts you are looking for are the stepper motor and the control board, but also keep the nice metal rods so that you can use them to test you motor.

Step 3: Remove Chip from Control Board

The next step is to locate the uln2003 chip on your stepper driver. If your board does not have one, you can order one online for about 50 cents. If your board has a uln2003, you must desolder the chip from the board. This step can be a bit tricky, but is not that hard. First, try to remove as much solder as you can using your desoldering pump. Once you have removed the solder, use gentle, prying force with the tip of a screwdriver. Carefully touch the tip of your iron to each pin, still applying force with your screwdriver.

Step 4: Soldering

Picture of Soldering
DSC02695.JPG
DSC02683.JPG
DSC02698.JPG
Now you need to solder the chip into your blank proto-board (I got mine at The Source).
Solder each pin to the board. My board had two power rails running up the center of the board, so I soldered the positive pin on the uln2003 (see schematic from here and pictured below) to the one of the rails and the negative pin to the other rail. Then, you must solder pin 2 on your parallel port connector to pin 1 on the uln2003. Solder pin 3 on the parallel port to pin 2 on the uln2003, pin 4 on the parallel port to pin 3 on the uln2003 and pin 5 on the parallel port to pin 4 on the uln2003. Now solder pin 25 on the parallel port to the negative rail on your circuit board. Now, solder the motor to the driver. Hooking up the motor to the board requires some trial and error. I just soldered wires so that I could use alligator clips. You could also use screw terminals or something similar. Simply solder a wire to pin 16, 15, 14 and 13 on the uln2003. Then solder a wire (preferably black) to the positive rail. Your driver is almost done. Finally, solder your barrel jack (I recycled mine from an old RC car) to the power rails on your circuit board. To prevent my wires from breaking off, I put hot glue over them.

Step 5: Install Control Software

Now for the software. The only software that will work with this driver that I know of is Turbo CNC. Download it from http://www.dakeng.com/turbo.html . Un-zip it and burn it to a cd. Now, on the computer that you are going to use as your controller, go to your c: // drive and make a folder called "tcnc". Next, drag the files from the CD to the folder you just made. Exit all windows. You have now installed Turbo CNC.

Step 6: Configure Control Software

Click start and shut-down. Then check the box that says "Restart in MS-DOS mode". You will get a command prompt. At the Prompt, type "C:\tcnc\TURBOCNC". Then you will get a screen like the one in image 3. Press any key. Now you are in the main program menu. Press F1, and then use the arrow keys to select the "Configure" menu. Use the arrow keys to select "number of axis". Press Enter. Enter the number of axies you will be using. I only made one driver, so I selected "1". Press enter to continue. Now press F1 again and navigate to the "Configure" menu. Select "Configure axes", then press enter twice.

You will see a screen that looks a little confusing. Do not worry, it is not that bad. Press tab until you get the box that says"Drive Type". Press the down arrow to select 'Phase. Press tab again to select the Scale box. If your computer has a mouse in dos (mine does not), click the calc button. If yours is like mine, you can simply run the program off a computer running Windows XP or Vista by double clicking on the TURBOCNC file. Then, follow the above steps.

To use the calculator, you must find the number of steps per revolution that your motor takes. Google your motor's part number and look for how many degrees per step it takes. Then, divide 360 by the number of degrees per step to find your steps per revolution. For example, my motor turns 7.5 degrees per turn, so I divided 360 by 7.5 to get 48. Punch that number into your scale calculator. Leave the rest of the settings the same. Press ok, and then copy the number in the scale box to the scale box on the other computer. Next, change the value in the acceleration box to 20, as the default 2000 is way too fast for your system. Change the value of the start velocity box to 20, and the value of the max velocity box to 175. Change the value of the fast jog box to 175. Press tab until you get to the "Last Phase" option. Change its value to 4. Press tab until you get to the first row of x's. Copy the following into the first four boxes:
1000xxxxxxxx
0100xxxxxxxx
0010xxxxxxxx
0001xxxxxxxx
Leave the rest of the boxes as they are. Select OK. You have now set up the software.

Step 7: Build a test axis

Picture of Build a test axis
The next step is to build a simple axis to use as a test system. Cut 3 pieces of wood and clamp them together. Draw a strait line on the wood to keep your holes strait. Drill two holes on the line. Finally, drill 1 hole centered below the line. Now you can un clamp your wood.

Place the two rods through the holes on the line. Screw a small screw into your rods to keep it in place. Slide your second piece of wood onto your rods. Mount your motor to the final piece of wood. It does not matter how you do this, be creative. I used two pieces of 1/8 threaded rod to hold mine in place. Now slide your wood with the motor attached to it on the other end of your rods. Screw the rods onto the wood. Slide your threaded rod through the third hole on your first piece. Screw your nut onto the rod. Slide the rod up to the second piece of wood. Turn the rod until it slides through the holes and up to the motor's shaft. Using aquarium air hose and zipties, connect the motor shaft to the threaded rod. To attach the nut to the 2nd piece of wood, I used various screws and nuts to hold my nut in place, but anything should work. Finally, cut a piece of wood the size that you want your stage to be. Screw it onto the 2nd piece of wood. Make sure that your stage is level. Mine was not, so I used washers as spacers. You have now built an axis for your motor.

Step 8: Conect and Test Motor

Now you need to connect the motor to the controller. First, connect the common wire (refer to your motor's datasheet) to the wire that you soldered to positive. Connecting the next four wires is a matter of trial and error. Connect them all and then change their order if your motor is taking two steps forward and one step back or something similar.

To test it, connect your 12 volt 300ma dc adapter into your barrel jack. Then, connect your DB25 port into your computer. Open the attached program in TurboCNC to test your motor wire connections. When you are done testing and changing your connection you should have a fully working axis.

To test the scale of your machine, attach a marker to your machine and run the test program. Measure the line. If yours is 1 inch long, or close to it, then your machine is good to go. If it is off, check your math. If you have made it this far, congratulations, the hardest part is done.
TEST.CNC18 bytes

Step 9: Make the Enclosure Part 1

Building an enclosure is the final step. I chose to make mine out of recycled cardboard because it is better for the environment than buying a brand new plastic one. Also, since the driver is built mostly from recycled parts, it makes sense that the enclosure should be made of recycled material too. My circuit board measured about 2 inches by 3 inches, so I decide to make my enclosure 3 inches by 4 inches by 2 inches to make room for the connectors.

Now you need to cut your panels. Cut two rectangles that are 3 inches by 4 inches, 2 rectangles that are 2 inches by 4 inches and two panels that are 3 inches by 2 inches (see pictures). Now you need to cut the holes for the ports and plugs. Trace your parallel port plug on one of the 4x2 inch sides. Cut it out. On the same side, trace your dc barrel connector. Cut that out too.

What you do in this step depends on if you soldered connectors to your motor connection wires. If you did, mount your connectors on the outside of your blank 4x2 inch panel. If you just used wires, poke 5 holes. Now, using hot glue, glue all of the panels together (except the top one, see pictures). I chose to paint mine silver.

Step 10: Make the Enclousure Part 2

Now you must glue the componants inside the enclosure. Be sure to put lots of glue on the plugs as they will be exposed to lots of force. To keep the box closed, you need to make some latches. You need to cut two tabs out of craft foam. Next, cut two strips of foam and four small squares. Glue two of the squares to each strip as shown in the photos. Glue a tab to each side of the enclosure. Glue the strips to the top of the box. This concludes building the enclosure.

Step 11: Possible Uses and Conclusion

~UPDATE~ I have attached a newer version of the schematic for the 3 Axis Controller.  It is and eagle CAD Board and Schematic. 

Possible uses of this controller could be:
-A cnc machine (build 3)
-Plotter (build 3)
-or anything else that requires a percise amount of movment.

This Concludes my instructable. I hope you found it interesting and helpful. Feel free to modify my design and let me know how it turned out. If you liked my instructable, please vote for it in the Epilog Laser Cutter Contest.

~Update~
Here is the three axis setup instructions and schmatic

To configure the program, follow to above steps, except when you go to enter the number of axis', enter 3. For the configuration, follow the steps above for the first axis, for the second axis, keep it the same as the above steps, except in the first four phase lines, enter the following:

"XXXX1000XXXX
XXXX0100XXXX
XXXX0010XXXX
XXXX0001XXXX"

For the last axis, follow the same steps of the other axis', only copy this into the first four phases

"XXXXXXXX1000
XXXXXXXX0100
XXXXXXXX0010
XXXXXXXX0001"

***For Support on this Project, Please use the forum on my website. Just go to http://colvins.ca and click the forum link on the side bar.***
 
Remove these adsRemove these ads by Signing Up
1-40 of 266Next »
arun kumar21 days ago

i want to drive a S M with following details on it,

model PH 268-21

make VEXTA 2 Phase 1.8Deg/step.

DC 5.4v 1.5A

it should rotate 72Deg per every signal input

signal in put is through a cam (notched) within an opto coupler

can any one help me?

balak953 years ago
do you have to buy the 60$ registration fee for the sortware to work??
murray484 (author)  balak953 years ago
No, the software itself is free. If you would like the source code so that you could modify it to fit your need better (you probably don't need to), then you need to pay the registration fee. But to just use the software as it is written, you do not have to pay the fee.
thanks im ordering my un2003 chips tommorow it should be here on saturday so i can build the cnc over the weekend. I got steppers out of an old brother fax machine will those work.
murray484 (author)  balak953 years ago
It depends. How many wires do they have. How many amps do they draw? The ULN2003 can only handle motors that take 500ma. Also, what is the voltage of the motors. The closer to 12volts they are the better.
one of them is actually the exact same as in the picture...how do you draw in turbo cnc....can you upload something to the software and it will automaticlly cut it out.
murray484 (author)  balak953 years ago
Provided that all of the motors have similar specs, it should work fine. In order to make stuff with the cnc you will need to use a CAD/CAM program to create G-Code files. I personally use MasterCam X4, but that is expensive and most likely out of the question for most people. CamBam is a popular one and there is a free version (available here: http://www.cambam.info/downloads/). To use it, you have to import a DXF file or image, and create a toolpath. There are plenty of tutorials here: http://www.cambam.info/vids/ . You can also use Desk Engrave to do simple text engravings (available for free here: http://www.cnc.yertiz.com/text2.htm) or Ace Converter to do simple jobs from dxf files (available for free here: http://www.dakeng.com/ace.html). If you are looking for a good CAD program, I recommend Google Sketchup. It is super easy to use. The one limitation is the lack of a DXF export option. There is a plugin that will do that for you though (just google sketchup to dxf converter). Another great option if you are a student is to use the free student version of AutoCAD or Autodesk Inventor. (go to students.autodesk.com and create an account).

This should get you off the ground. It may seem complicated at the start, but once you get using it, it becomes quite simple.

Hope this helps.
Draftsight is a great free alternative to AutoCAD. We used this in our drafting class when we could not afford AutoCAD and we actually learned draftsight out of an AutoCAD book because it is that similar.
i have two stepper motors one with 4 wires the other with 6 will these work???
murray484 (author)  balak953 years ago
The one with six will, provided it is not over the current limit of the ULN2003. The one with 4 will not, as it is bipolar, not unipolar.
what is thr highest amp stepper motor i could use that would work...with this chip.
murray484 (author)  balak953 years ago
500ma (0.5A) is the highest that this controller can handle. Also, be sure to heatsink the chip if you use anything between 400-500ma.
is there anyway to run a 1.2 amp stepper on it at 12 vdc.
murray484 (author)  balak953 years ago
To run a motor at that current, you would have to use a different controller. Another simple one is this: http://www.cnczone.com/forums/attachment.php?attachmentid=114905&d=1284895545 where I1-I4 are the inputs from the parallel port, gnd is connected to both the ground of the parallel port and the power supply, Q1-Q4 are the 4 wires on the stepper motor, and the stepper motors + is connected to the power supply's +.

what if i were to use 0.8 amps
murray484 (author)  balak953 years ago
You might get away with 0.8 amps for a while if you used some really big heatsinks, but it would significantly lower the life of your chips.
walter19681 year ago
In your schematic, it shows pins 18-25 grounded. But in your picture and your text, you state only pin 25. Can you clarify this please? Thank you.
jduffy541 year ago
If you replace the
1000xxxxxxxx
0100xxxxxxxx
0010xxxxxxxx
0001xxxxxxxx

section with
1001xxxxxxxx
1000xxxxxxxx
1100xxxxxxxx
0100xxxxxxxx
0110xxxxxxxx
0010xxxxxxxx
0011xxxxxxxx
0001xxxxxxxx

spread over 8 lines , and change "last phase" to 8 (like you did with the four from the instructable), you will double the resolution, without doing anything else!
Hi! I have been successful driving PM motor with this schematic,even using different driver MP4102.
Does anybody know is it possible to adapt this circuitry to work with hybrid motors?
Because they draw current way to much.
I have tried putting light bulb in series on the ground then it gets really weird.
After first jog with turbocnc light bulb lights up then it wont stop even without jogging.

sxyuklad4 years ago
And if my motor is more than 500mA and it is alot more than what a ULN2003 can handle. What should I do? Because when I connect it blows up the chip everytime. Please help.Does the motor coiling start from yellow or black? which is A1, A2, B1 and B2?
1k resistors + 3055 transistors?
Tip142 transistors are probably better for this application
tip142 aka nte270 that is a Darlington transistor? I have used the nte2013 (aka uln2003) with a 1k resistors with no problem.
yes the TIP 142 is a darlington transistor rated at 10 amps(20 amp peak current) at 100 volts
Those must be for the biggie stepper motors......
It isn't so much the size but the current requirements, and the recent "hybrids" really suck the current.
By the same token, I've got boxes of little Nema 23 40 oz steppers that only suck 0.4 amps(400 ma) and by setting my harbor freight minilathe clone(soldby cummins tools) up with the gibs rather loose, I can drive that lathe using those 40 oz stepper motors and this circuit.

And no, I'm not pulling 36" per minute rapid travels or cutting at .015 feed per revolution in hard steel.
Think 5 inches per minute rapid travels as the torque curve of stepper motors starts at it's highest and goes down as the pulses per second increases.

After all, you're not going to built a hurco vertical machining center using this circuit.
This circuit is designed to be built for pocket change and run a little homebrewed cnc mill, router, or lathe for hobby use.
SSPX0070.jpg
Good point. You need to check the specs to see what you have before just randomly using any old part.
gatts zoot6862 years ago
Would you know how to wire this hybrid- http://elabz.com/driving-a-bipolar-stepper-motor-with-arduino-and-uln2803ag/ ??? Cant find a sch for it anywhere. Help would be much appreciated!!!
i think i mucked it up, all the motor did was get really hot
edgukated5 years ago
I removed the circuits from 5 different models of HP scanners. They all have different chip sets and none have a ULN2003 chip. Does anybody have any suggestions how I can find an equivalent chip on these boards? ...timmy
yes
Go to Tayda electronics on eBay I believe their username is tayda2009. That is where I get all my electronics parts, they are cheap because the parts come directly from the source in china bypassing companies like radio shack therefore saving precious money.
I just received an order from Tayda. I ordered on 02 August and received it this morning, 10 August. Not a bad turn around, IMHO.
Did you know that you can buy directly from Tayda's website? Much better than eBay, IMHO.
I've got the same issue, I've been ripping apart scanners, printers, photocopiers. Got lots of unipolar and bi polar motors and plenty of cool steel rods, but no uln chips. Are there any alternatives? I mean something must be controlling the stepper motors.
murray484 (author)  lenny255 years ago
You can buy the chips for $0.50 at most electronics stores. I noticed that most scanners from big companies did not have the chip.
I think that it is worth it to source some ULN2803A chips since they cost about the same but allow you to run the arrays in pairs so you can push up to 1A. The 2803A has an array of 8 instead of the 7 that the 2003A has. You could get away by using 4 2003A chips, but it could get a little kludgey.

You can see a simple 1 axis version implemented like that here.
There's no way without using resistors on the input to assure that the pairs in the array share the current load
Would you mind elaborating on this one, please. I am far from an expert and a little bit more info on this whole thing might prove most helpful.
It's called manufacturing tolerances, and each darlington transistor in that array will be "slightly" different.
And thus the transistor that turns "on" first will take the full current load unless some sort of regulation is supplied to assure that each transistor in the array is "exactly the same"....
And to be truthful, I don't think there's any way to do that as the base leads to each transistor in the array are internal.

This circuit is good for 500ma per phase and there's a lot of small surplus nema 17 and nema 23 stepper that can be used with this circuit, but a lot that can't.
For those that can't, instead of using the ULN2003/ULN2803 just use a set of 4 TIP120's or TIP142's instead of the ULN chips.

look at these links for an idea of how this works and what your ratings will be:
http://www.luberth.com/plotter/TIP120schematic.png
http://www.luberth.com/plotter/tip120pcb.htm
1-40 of 266Next »