Disclaimer: I am a beginner, myself, with Arduino, CNC's, and power tools.
So there have been a lot of posts already about building CNC machines in which the stepper motors are controlled by an Arduino. I know this because I've spent the past 3 days reading and trying to understand them. What I'm going to try to do here is consolidate what I think I've learned in a way that a beginner can understand. I will also ask the questions that I feel are left unanswered for beginners like me. My ultimate goal is to build the cheapest possible desktop CNC machine with the least amount of tools and skill. Things I'm clueless about will be highlighted in red and will hopefully be answered in the responses to this thread.
Part I
Step 1: Build a CNC Stage
This what will translate your material in 2-3 dimensions and press it against the cutting tool. There are tons and tons and tons of guides/instructions/kits out there to build your own cnc stage. Here are some resources:
http://buildyourcnc.com/default.aspx
...(there are tons of websites out there if you AltaVista them)
But lets assume that you can't cut paper straight and the only tools in your house are the hex keys from your Ikea purchases. Not to worry, there plenty of kits that come with all the parts already cut and ready for you to assemble. The absolutely cheapest that I could find was the kit from Zen Toolworks ($350 with shipping), but it is also the smallest having a range of 7x7x2in. It comes with the stepper motors you need to drive stage, which are actually fairly powerful for the size of the stage. Here are some options for ready to assemble stages:
http://www.zentoolworks.com/
http://www.zenbotcnc.com (not the same cnc or company)
lumenlab.com - lumenlab Resources and Information.
....(the more you pay, the more you eat)
I went with the Zen Toolworks Small CNC because of the cost and my needs. It makes no difference to the arduino which stage you pick so long as we tell it the movement characteristics.
If someone knows of a cheaper option that requires no cutting/drilling, please post a reply.
Step 2: Stepper Motor Driving
Stepper motors are not like DC motors where you can just hook up a power line and they'll spin. They work with a series of coils that must be driven on and off in the correct order to step the motor forward or backwards. In order to drive the motors, we will need a ...wait for it...stepper motor driver. The driver takes signals from your Arduino and converts them to steps for your motors. Since you have three stepper motors (one for each axis) you need three stepper motor drivers.
When I first started looking for drivers I was tempted to buy the EasyDriver from Sparkfun, but then I read about how they are typically under powered for most CNC projects. The motors from the Zen Toolworks kit require a maximum of 1.3A. I found this thread started by aventgps where he describes his own machine and on page two his stepper motor drivers using a L293D:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1258354000/15
I found a similar design here using a L293A or SN754410:
http://www.contesti.eu/opensource/xyz-dc-motor-controller
More info here:
http://www.tigoe.net/pcomp/code/circuits/motors/stepper-motors
This second project seems very promising as a one stop shop for your Arduino CNC needs, except for the fact that all of the arduino code is offline. Also notice the temperature sensor and fan control. I'll talk about why this project won't need such things further down.
In the end I decided to go with the beefier but similarly priced L298N which can handle 2A (which would be good if I ever decide to upgrade my system). You could also stack two of the SN754410 on top of one another, but you will have to wary of thermal management. These chips all have the same interface, so wire them according the to provided diagram.
http://www.newark.com/texas-instruments/sn754410ne/ic-motor-driver-half-h-1a-dip-16/dp/08F8145
aventgps diagram shows how to connect the 4 wire stepper motor and the contesti.eu page covers how to connect a 6 wire stepper motor. The Zen Toolworks motors are Nema 17, 2 Phase, 4 wire.
Note: You will see stepper motors referred to as Nema 17 or Nema 23. This does not tell you what internal configuration your motor has. This is the chassis design and size. So a CNC stage that takes Nema 17 motors, physically has the mount for that size stepper motor, but not all Nema 17 will provide the same power or will be 4 wire, 6 wire,8 wire...etc.
Step 3: Power Supplies
You will need at least two power supplies.
- One power supply will be 5V and will power your Arduino and stepper motor drivers.
- The second power supply will also be hooked up to the motor drivers, but this will be the power that is delivered to the motors to physically move them.
To be honest, this is where the knowledge out there runs thin for me. The motor driver (L298N) can take any where from 4.5 to 46V (check the datasheet of your driver).
I figured out how to size your power supply:
The coil resistance determines the maximum current: Imax=Vmax/R. You want Imax to be less than what your driver and motor can handle and not overheat. The maximum speed of a stepper motor is limited by its inductance: dI/dtmax=Vmax2/L. The rate of change of current is L X R. Anything above Vmax2 is a waste.
Vmax = Imax*R
Vmax2 = L2R (L is in mH)
Vmin = IR
Vmin < V < Vmax || Vmax2
So pick a power supply that can provide the desired current you want flowing though your motor, "I", at a voltage, "V", between Vmin and Vmax or Vmax2, whichever is lower. Imax is determined by the maximum either your motor or driver can handle, whichever is lower. V must also be between the max and min your driver can handle.
Step 4: Limit Switches
Your system, for the most part, runs blind. It steps the motors without any regard for the actual position of the cutter head. So if you were to start your system with the cutter head 1 inch away from the edge of your stage limit, and you told the system to move 3 inches in that same direction, the system would reach the end and keep stepping away, potentially damaging your stage. To solve this problem, we place limit switches at the extreme ends of the range of the stage. When the stage runs into these switches and triggers them, it tells the code to stop moving in that direction (or to quit all together). You can buy limit switches anywhere, or you can make your own using metal plates, screws, and wire. When the screw on the stage touches the metal plate on a fixed point, it completes a circuit and acts the same as any store bought switch. You'll need 6 switches at a minimum (2 for each axis).
When we wire these switches to the Arduino, we have three options as to how we do it:
- Each switch gets its own pin on the Arduino (digital or analog).
- This will take up the most number of pins.
- The benefit will be that the you will know exactly which axis has reached its limit and in which direction.
- All switches are connected to a single pin directly (digital or analog).
- This takes the least amount of pins and work.
- You will not know which limit switch was triggered but you do know the stage must stop whatever it was just doing.
- All switches are connected to a single analog pin using voltage dividers.
- Takes up no digital pins.
- You know which switch was triggered.
Option 3 seems like a no brainier to me. The layout would go something like this:
5V----5k ohm---analog pin ---SW1---1k ohm---SW2---1k ohm---....---1k ohm --- SW6
Step 5: Cutting Tool
This is what you will mount to your stage to cut your material. This is very open depending on your needs. Zen Toolworks sells their own mount and motor:
http://www.amazon.com/Spindle-Zen-Toolworks-Machine-Holders/dp/B0039HCK6S
But you can use any dremel or power tool you can mount on there. However you mount it, make sure it is sturdy and does not move. People have used zip ties.
Step 6: Arduino
Buy one and learn how to program it. If you used Option 3 on the limit switches, you'll have plenty of I/O lines with any of the ATmega328 options.
Step 7: Extra Bits
You are going to want 1-3 relays so that the Arduino will be able to toggle the power on and off for the stepper motors. You'll want 1-3 transistors so that the Arduino doesn't power the relays itself. Follow this if needed:
http://tronixstuff.wordpress.com/2010/04/20/getting-started-with-arduino-chapter-three/
You'll want relays that can be triggered with the 5v available instead of 12v.
Get some perfboard for soldering everything, or just soldering everything into a ball. So long at the the stepper drivers get sufficient cooling, it makes no difference.
That is it as far as hardware goes.