Hi! I'm rebuilding my CNC machine again and I want to use arduino this round. It has been several years since I’ve dabbled in arduino and the whole landscape has changed, so I'd like some advice!
My first generation I built several years ago using an arduino with some software I forgot the name of, but the machine had a variety of problems (mostly that the driver chips I was using kept burning out because they couldn't handle the amperage I needed to power the steppers).
When I built my second generation machine, I switched to a professional driver using a pirated copy of Mach3 as a gcode interpreter to send step pulses to the stepper driver. This has several problems: one, it isn't a legal copy (at the time I wasn't willing to spend several hundred dollars on old software that requires an ancient OS and a parallel port). Two, Mach3 only runs on Windows XP; I had to actually buy a junk PC off of craigslist that was old enough to run it. Finally, I am completely limited to what Mach3 can and can't do and do not have the ability to hack it to my preference. Even doing a zero plate calibration requires macros in an confusing and virtually undocumented macro language.
So, now we're on to my third machine, which is currently in design phase. I have most of the specialty hardware ordered or arrived and I am getting ready to drive down and buy the steel framing I’m going to weld together. However, it is quickly becoming clear to me that in order to complete the design, I need to begin stress testing the load and speed capabilities of the stepper motors on test jigs with the driver I want to use, just to make sure my drive system can handle the weight of the steel framing and heavy spindle.
So...I need an arduino up and running as quickly as possible with my target software so my stress tests will use the software package that my production environment will use.
My background and proficiencies:
I am conversive enough in C and arduino to use existing code and compile to an arduino, and to make small changes as needed on a trial and error basis. I am not proficient enough to generate a ton of hardware-level unique code, but I am pretty good at adapting existing solutions and figuring out how to make things work together with research and trial and error.
I am at most a hobbyist in software development; scripts and little else. I am most proficient in scripting with Ruby, and in fact wrote a plugin to interpret Sketchup geometry into gcode paths. I use this mostly to build telescopes.
Goals: (aka the "ideal" machine capabilities)
I want to use an arduino to interpret gcode, drive stepper motors, and run a variety of sensors for calibration, sanity checks, and limit switches.
Interface: I need to be able to interact with the arduino through a network. Either wifi or LAN is fine. I want to stream gcode directly from my laptop or home PC. (My home PC is a short drive away from my workshop, but accessible via long-range directional cantenna. I want to be able to load gcode into, and activate, the machine from my home computer.)
Steppers: I’ll need to drive 4 axes (8 pins total). The new machine will have two Z-axis spindles, which I’ll handle the gcode for on my end. The power will be delivered by drivers that come bundled with the steppers, all I need is to send direction and pulse for each stepper.
Spindles and vacuum: Several pins will need to be allocated to turning the spindles on and off, activating cooling, and activating vacuum. Probably no more than 4 or 5.
Limit switches: I will need 6 limit switch pins. Technically I should only need 4, but I’m going to overkill with one limit switch on each end.
Z plate: I’ll need a pin open for a z-plate at some later date. Basically just a switch.
Manual controls: I would like to be able to directly hardware control the machine, although this isn’t critical. It would involve two pins per axis, for a total of 8. All of the above can probably be handled by any off-the-shelf arduino software that is designed for CNC or 3D printing. However, I want to add some MORE stuff to mine to correct for some problems I keep encountering with my old machines. Specifically, I have ruined a lot of wood and wasted a lot of time because my motors seized up and then broke a bit, or offset the entire run by an inch and ruined a dozen pieces, so I want two redundant layers of feedback that I can use to correct for errant motor behavior.
Range finders: I want to get an approximate non-relative position in the Z1, Z2, X, and Y axes. This means a total of 4 range finders. These will be used to guess initial conditions after a fresh startup and pre-calibration, and to slow down the machine before it hits the limit switches during fine calibration. I have no idea how many pins this will require. (Ultrasonic should work fine, although I’d prefer laser.)
Rotary encoders: I want a rotary encoder on each axis to very accurately measure relative position changes. I will be using this to instantly hard stop the machine if a motor seizes and set the machine to re-calibrate the axis before continuing. No more destroyed wood stock! I am only concerned with the X and Y axes; the Z1/Z2 axes are a bonus but not critical, because a laser rangefinder would be accurate enough.
The thing is, I actually know very little about rotary encoders. Given a starting point I can work it out, there’s plenty of material available, but I think they need 5 pins each. So...minimum 10, possibly 20 if I include the Z axes.
- Power/activation: I want to be able to remotely fire up the power supplies at the outlet level. As in, actual physical power switches. The idea is that, from home, I can fire up the machine from a near-zero-power state to fully functional. NO IDEA how to do this. Suggestions? So...adding up everything, that means I need an arduino that has a minimum of 34 pins, but 50+ would be better, and has LAN or wifi access.
Given my requirements (34+ pins, lan/wifi, the ability to run existing CNC software that someone has written for arduino), what arduino should I pick that has the capabilities I need?
Any suggestions on CNC software (gcode -> stepper pulses) that would work on said arduino, that I could modify to add in all that extra stuff I want to do?
Any unforeseen hurdles or suggestions from people who have done this before?
How would I go about letting this little arduino power up all the machine power supplies at the outlet switch level?
Any rangefinder suggestions? (Ultrasonic/laser?)
Thanks in advance for any feedback!