Arduino cnc program

Hi everyone I am new to arduino programming and i wanted to ask some questions. I would like to build a 2 axis cnc machine. I found this easy circuit that uses 2 easydriver and arduino uno.

  1. http://www.instructables.com/files/orig … 5K2LOU.pdf

  2. http://www.instructables.com/files/orig … 5MHM8Z.pdf

The problem that i have is that i don’t know how to write the program to control the stepper motors whit the pc.

Is there a piece of code out there that i could use for my project?

http://bit.ly/1guWsym

First link… Add “arduino” to get thousands of links.

I’ve actually got a CNC I’m refitting with an arduino controller (saves about 30 pounds of antiquated computer hardware) and these days it seems like pulling teeth to try and get any foothold on where to start figuring out how to make it work. I’ve been doing solid modeling for two decades now, small time machining off and on for most of that time, and programming Arduino for a couple of years now, and simple searches give me the runaround these days. It’s not just as simple as it used to be to find anything technical and useful on the internet anymore.

I’ll chime in with what I’ve learned and know from experience. You will need:

-Drawing/CAD/CAM files for the parts you want to make with the CNC, or better yet, a program/application for designing what you want to make (Computers can’t read your mind)

-Understanding of what ‘G code’ is. This is the most common language for CNC equipment. Your files or program will need to be converted into a stream of G-code, if they aren’t in this format already, and have something to handle feeding the G-code to the Arduino/CNC if your software doesn’t do this already.

-G-code interpreter coding for the Arduino that converts the G-code to stepper axis controls and mandrel control.

My ‘google-fu’ has suffered with the onset of social networking… everything on most search engines is now geared around advertizing, dumbed-down consumer use stuff, and whatnot. By the time you get a decent search string going, I generally break over into info for those who are already subject matter experts, or sneering remarks toward those that aren’t gurus. There’s no middle ground these days, it seems like. Wikipedia is still a good source to learn about the basics, though, like what G-code is, how CNC works, etc. I’ll post more as I learn, wading through the mess of cyberspace-trash. :confusion-scratchheadyellow:

codlink:
http://bit.ly/1guWsym

First link… Add “arduino” to get thousands of links.

Great job creating a sense of community here.

TrollHammer:
Great job creating a sense of community here.

If the shoe fits...

TrollHammer, since you are quite new here and I see that you are willing to try helping our beginners, I will let you in on some things.

Sparkfun, in my opinion, is a DIY (Do It Yourself) site that is targeting beginners in electronics among other things. Notice how I stated “DIY.” There a few members here that give there time and knowledge for free. I myself spend a couple of hours on here daily to help people that really want to learn and not just someone that wants it handed to them. As long as a poster is trying to learn, we have no problem giving them the next step to take.

The first step to learning is though their search engine of choice, like Google. I see you stated that you have a hard time finding the right information from Google. I, myself, don’t seem to have that difficulty, as well as others here. If I type in “Arduino CNC machine,” I literally get hundreds of useful links. The first page 99.9% of the time has exactly what I need. I actually taught myself about electronics and Arduino through Google and by searching, I came across Sparkfun and have seen this company grow and learn with me. So I know it’s absolutely possible to learn most of what a person needs to know to start a project and finish it by using nothing but Google.

So, the point is, the ‘teachers’ of this forum are not going to spoon feed information to anyone.

TrollHammer:
I’ve actually got a CNC I’m refitting with an arduino controller (saves about 30 pounds of antiquated computer hardware) and …

Two topics here ...
  1. I think any further discussion of “community” doesn’t belong in this thread. Perhaps another one, or PM’s, but let’s not derail the OP too much more.

  2. RE: the old 'puter … while I can see the space savings, is there any other reason (other than just for fun) to “Arduinofy” your existing mill ? I’d like to hear your workflow. As I (vaguely) understand it …

  • generate a 3D model of the final piece. Save this in some common file format.

  • some other program takes that file and operates on it to produce the G code that the CNC controller can understand.

  • give that G code file to the controller to run the mill.

  • much debris is flung about and the final piece pops out of the CNC machine.

I can see the Arduino doing (?only?) the last operation. You still need a PC for the 1’st and I’m unsure about the 2’nd … PC or possibly Arduino ??? I would think (??) that the G code would be specific to the machine used (?and bit used in the actual milling?) or is that detail left to the controller ? IOW what does the Arduino have to bring to the CNC party ? Should it be Uno or ARM ?

As I mentioned in passing in another thread I’m thinking of buying myself a new toy, either a 3D printer or a hobbyist level CNC machine (or perhaps a laser cutter), more for the learning experience than any planned practical use. So I’m curious about their real day-day operation. As I think the OP would be. (just barely dodging my own derailing post there !)

Mac’s right, apologies about the derailment.

I know the Arduino Mega specifically is a common processor for DIY 3d Printers. There are lots of open-source printers with the AVR controller processing g-code to the steppers. I would like to think that a cnc mill would be possible if not easy to implement into a cnc machine. I remember searching Google trying to find info on 3D printers and ran across some DIY mills where the frame is made of Balsa wood. You may even find code for it as well.

It seems like it would be much easier to run [LinuxCnC on a [BeagleBone Black and poof! 95% of the work will already be done for you.](https://www.sparkfun.com/products/12076)](http://www.linuxcnc.org/)

lyndon:
It seems like it would be much easier to run [LinuxCnC on a [BeagleBone Black and poof! 95% of the work will already be done for you.[/quote]

Wow, thats quite the powerhouse!

Do you have experience with LinuxCNC? My main experience is with Solid Edge, and most of my workpieces are in that environment. Im wondering hiw different it is and how involved it is to work with the Beagle (I barely have Arduino under my belt).](https://www.sparkfun.com/products/12076)](http://www.linuxcnc.org/)

No, I haven’t used either yet. I just got the Beaglebone and have been thinking of building a CNC lathe for quite a while. It’s a very back burner project though.

Didn’t see the other posts!

Mee_n_Mac:

TrollHammer:
I’ve actually got a CNC I’m refitting with an arduino controller (saves about 30 pounds of antiquated computer hardware) and …

Two topics here ...
  1. I think any further discussion of “community” doesn’t belong in this thread. Perhaps another one, or PM’s, but let’s not derail the OP too much more.

Agreed.

Mee_n_Mac:
2) RE: the old 'puter … while I can see the space savings, is there any other reason (other than just for fun) to “Arduinofy” your existing mill ? I’d like to hear your workflow. As I (vaguely) understand it …

  • generate a 3D model of the final piece. Save this in some common file format.

  • some other program takes that file and operates on it to produce the G code that the CNC controller can understand.

  • give that G code file to the controller to run the mill.

  • much debris is flung about and the final piece pops out of the CNC machine.

That’s what I understand.

Mee_n_Mac:
I can see the Arduino doing (?only?) the last operation. You still need a PC for the 1’st and I’m unsure about the 2’nd … PC or possibly Arduino ??? I would think (??) that the G code would be specific to the machine used (?and bit used in the actual milling?) or is that detail left to the controller ? IOW what does the Arduino have to bring to the CNC party ? Should it be Uno or ARM ?

If I understand correctly, G-code is a standard ([http://en.wikipedia.org/wiki/G-code](http://en.wikipedia.org/wiki/G-code) that machinists can understand interchangeably throughout most NC and CNC machinery (lathes, mills, grinders...). While a Mill G-code file would not produce anything usable on a Lathe, the string of commands use the same formatting and what each command means is universal, but if a machine doesn't have a feature the command won't necessarily do anything (Part of this is guessing, since I'm not that far into the project, but I'm going off of what was explained to me)

I found an old school desktop CNC mill on Ebay a few years back and have been poking around with it when I get a chance. The company isn’t around anymore that I can find (D & M Machining), and it was produced in the late 80s or early 90s as far as I can figure. It used an internal 80286 and a floppy drive to load the ‘firmware’, and an external computer would send G-code over serial to the internal computer, which would convert the G-code to X, Y, and Z. It came intact with the floppy and a DOS software package was archived a few years ago, but after looking through the machine it seems I would be much father ahead to replace what amounts to a PC with an Arduino board.

The mill has stepper controllers for X, Y, and Z that have clearly labeled Wago connections for Step and Direction, a controller board for the spindle (that apparently is not easy to interface to more than on/off, according to other’s overhaul threads in other forums with this machine). Everything is cleanly broken out and easily accessible, basically needing a controller with enough I/O to attach the front control panel, limit switches, and control cards. I figured it would be far easier to use an Arduino type controller with USB than to try to resurrect the 286 and hope the floppy drive continued to function, figure out drivers that would work with modern software, etc.

Mee_n_Mac:
As I mentioned in passing in another thread I’m thinking of buying myself a new toy, either a 3D printer or a hobbyist level CNC machine (or perhaps a laser cutter), more for the learning experience than any planned practical use. So I’m curious about their real day-day operation. As I think the OP would be. (just barely dodging my own derailing post there !)

I’ll have to poke around and find that. I’m actually planning on using mine to make parts for my tinkering on other projects (everything from camera mounts to airsoft equipment and robotics). I also plan to add an extruder to one side of my spindle and a laser to the other side.

codlink:
Mac’s right, apologies about the derailment.

I know the Arduino Mega specifically is a common processor for DIY 3d Printers. There are lots of open-source printers with the AVR controller processing g-code to the steppers. I would like to think that a cnc mill would be possible if not easy to implement into a cnc machine. I remember searching Google trying to find info on 3D printers and ran across some DIY mills where the frame is made of Balsa wood. You may even find code for it as well.

I did eventually find a solid route to go. “GRBL” http://dank.bengler.no/-/page/show/5470 … checkpoint appears to be useful, and I will be exploring this route.

TrollHammer:
It came intact with the floppy and a DOS software package was archived a few years ago, but after looking through the machine it seems I would be much father ahead to replace what amounts to a PC with an Arduino board.

I’m not sure what benefit you think there is in replacing the PC with an Arduino. Especially if the PC is working, what you have amounts to a turnkey system ready to make parts. Hell, if you want to sell it, let me know. I just gave away a working industrial robot arm because I didn’t have an immediate use for it and I didn’t want it rotting away in the garage. But a desktop CNC mill I can use :slight_smile:

If all the hardware works (even if you have to replace the PC), I would suggest you take a look at [Mach3. I think they still have a free version available and from what I have heard about it, it’s very good.](http://www.machsupport.com/)

lyndon:
I’m not sure what benefit you think there is in replacing the PC with an Arduino. Especially if the PC is working, what you have amounts to a turnkey system ready to make parts.

Hmm… maybe I’ll have to throw it back together and see if the floppy will read. I’m not holding my breath, though, the floppy disk is 20 years old, and I have not found a replacement. Without the disk, it’s a brainless 286 electrically connected to a pile of motors and hardware. I probably would have tried it but the console needs repair (power switch, if I remember right). I’ll keep you in mind, though, if I decide I never want to make a mill, 3D printer, or laser cutter.

Arduino is just what I’m comfortable with and have, and I know a local guy that already made one. Ill probably look at the Beaglebone on paper to see how much learning I would have to do to get LinuxCNC and the board to play nice together.

lyndon:
If all the hardware works (even if you have to replace the PC), I would suggest you take a look at [Mach3. I think they still have a free version available and from what I have heard about it, it’s very good.[/quote]

Thanks for the tip, I’ll download it tonight and check it out.](http://www.machsupport.com/)

So far, this is what I’ve come up with for controls and references:

Found this thread http://www.cnczone.com/forums/benchtop- … ation.html on my mill. I haven’t found a single reference to anyone NOT retrofitting it, and most replace all electronics instead of keeping the steppers. Depending on funds I might just do the described parallel-breakout control with what’s already attached, and upgrade the steppers and controls to 3D printing compatible stuff, especially since I plan to add an extruder or two down the road.

-LinuxCNC for control software. The site doesn’t appear to be up at the moment, but the thread seems to imply that the software can aid in controlling stepper controls via parallel port.

(down the road)

-RAMPS or Ultimaker shield on a mega (though it seems like an UNO should have enough I/O for the mill, but I guess the extruder adds a bit more, so I guess I’m stuck buying the higher priced board.) 5 channels aught to be enough to run X Y Z, spindle (which might actually be run by a mosfet output on the board I’m looking at), and single extruder. $21-45 plus $45 for a mega

-A4988 stepper controllers (these seem small, but seem to be universally accepted by the local Makerspace 3d printing group). $9 each

-Upgrade steppers. A local guy found a place that has them in stock for about $3 each, if they will fit mine.

-Home made extruder (free, as it seems I have the parts for one laying around the garage)

I’m hoping that this will give me a full CNC machine and a 3D printer for fairly inexpensive. My D&M4s Mill seems to be plagued by the same issues that most others have: leaking power supply components in the motherboard, ancient brains, missing parts, and potentially weak steppers (I guess the perm magnets lose their magnetism over the course of two decades). Mine seems to be older yet than most on the thread above: many were running 386 based machines in a blue color scheme, while mine is a 286 in tan and brown.