0

Headless Arduino CNC Controller
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Headless Arduino CNC Controller

by edward.ford on Thu Dec 10, 2009 2:11 pm

I apologize in advance for the length of this message.

For the last 3 years or so (on and off), I have been working on a DIY CNC mill. Lots of people have already done this. It’s fairly common in fact. The goal for mine has been low cost, easy assembly, fairly portable, and high accuracy. You can see my flickr set here (http://www.flickr.com/photos/edwardford) or my website with videos here (http://www.edslifedaily.com/mill.html) to get an idea of size/scale and what it looks like.

After a fair amount of time designing and redesigning, I’m pretty happy with the overall layout and aesthetics of the machine, although I can already see room for improvement. However, the design is far enough along that I am finally getting around to the electronics.

On previous attempts, I purchased full blown 3 axis controllers from the likes of Xylotex and hobbycnc. These pieces of hardware worked as advertised and would be a very good choice for someone looking for a 3 axis controller, although, between $100 and $200, they are fairly expensive. This time around I decided to pick up an EasyDriver from Sparkfun. At a cost of only $15, I thought it may be worth it to experiment and determine if 3 EasyDrivers could be used to control the 3 axis’ of the mill.

After some very helpful advice from the members on Sparkfun’s forum, I managed to successfully get an EasyDriver moving a single axis of my machine around via a simple Arduino sketch. (Ramp up / ramp down, back and forth, etc, etc.) Very exciting!

So all of this is very cool stuff. It’s always amazing to see something you design in your head, physically come together and work! I’m hoping the feeling never gets old :)

One thing has been nagging in the back of my brain since I started using the EasyDriver with the Arduino: Would it be possible to run the mill with the EasyDrivers exclusively from an Arduino?

I am imagining a progression which involves doing the CAD/CAM process on a workstation and saving the gcode to an SD card. The SD card would then be placed into an Arduino. Once the Arduino was powered on, it would search for a specific file, and then start reading/processing the gcode. VIOLA! A completely headless operation!

The image I keep seeing is a PCB with through holes for an Arduino Pro Mini, 3 EasyDrivers (or the components), and screw terminals for a 24v power supply, and an SD card holder.

So: is this possible? From what I can surmise through my non-electrical engineering background, the current problem is the size of the code necessary to read FAT is so large that there isn’t room left for other code. However, if that’s only applicable on the ATmega168 then maybe a solution could be found via the Arduino Pro Mini's ATmega328?
edward.ford
 
Posts: 4
Joined: Thu Dec 10, 2009 2:02 pm

Re: Headless Arduino CNC Controller

by adafruit on Thu Dec 10, 2009 2:53 pm

fat16's lovely fat library is about 11K. a mega might be a good choice if there is parsing to be done.

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Re: Headless Arduino CNC Controller

by aylr on Mon Jan 04, 2010 7:08 pm

You might check out the reprap.org and makerbot.com projects, as the makerbot can read gcode files off an SD card for headless operation. Plus it's built on the sanguino platform. Both are completely open source!
aylr
 
Posts: 1
Joined: Mon Jan 04, 2010 7:06 pm

Re: Headless Arduino CNC Controller

by edward.ford on Fri Jun 11, 2010 11:39 am

Hey all, I know it's been a long time since this thread has been updated but I thought I'd fill in some info instead of leaving this as a dead end to anyone searching for "arduino + headless + cnc".

It's completely possible to run an Arduino based headless CNC machine! Here is the current setup I am using:

Hardware:
1.) SD Shield from SeeedStudio - as a side note: I hesitate to call this a "Shield" as it doesn't repeat the female headers on the top, so by using this you essentially lose access to your Arduino's V and GND ports. You need access to the GND port so you can tie the two GNDs from each Arduino together. I have circumvented this limitation by using two mini bread boards, as shown here: Also, it would be an easy enough fix to replace the current male headers with something like these, but I just have not gotten around to doing that.
Image

It's not the most elegant solution, but it's working.... (as a side note: the USB cable in "master" is just to power the device, not communicate with it. I have since switched to a wall wart!)

Software:
Master Arduino: In my setup, I am calling the "master arduino" the one that parses the gcode. For this I am using a program called grbl. IMO, this is the holy grail of arduino based gcode parsing. you can download it here, or read a little about it here. I actually found it via the contraptor project, here. You can see grbl in action here!

Slave Arduino: This is the arduino that reads the SD card. After pouring over a bunch of different fat libraries for arduino I settled on Bill.Greiman's fat16lib. It was very easy to implement and did exactly what I needed it to do.

I have had some problems overflowing the Master's buffer, but this is mainly due to the fact that I'm having a hard time setting up flow control. What I need to have happen is for the slave Arduino to Serial.print a line and then WAIT until it receives the "OK" from the master. I can't figure out how to do that reliably, so occasionally i overflow the master's buffer.....

Anyway, good luck to anyone's who's working on the same thing!
edward.ford
 
Posts: 4
Joined: Thu Dec 10, 2009 2:02 pm

Re: Headless Arduino CNC Controller

by hjohnson on Fri Jun 11, 2010 3:29 pm

What it seems to me like you might need is some physical hardware flow control, just a wire running between the master and slave independent of the serial line. So maybe the slave would send some data, and wait for a change on the line, whereas the master would wait to receive data, process it, change the line status, rinse, repeat.

Alternatively, you could simply use one arduino mega, which still supports shields, but has way more RAM, EEPROM, flash, pins, timers, etc. Seeing as it costs around the same as 2 arduinos, and doesn't have to talk serial to itself, it may be something to look at.
hjohnson
 
Posts: 78
Joined: Sun Dec 20, 2009 9:17 pm

Re: Headless Arduino CNC Controller

by edward.ford on Mon Jun 14, 2010 3:08 pm

That's a good idea with the hardware flow control! I think it's going to work and I'm trying to get that in place as we speak.

A couple of thoughts on why I'm using two Arduinos.
I agree that consolidating the SD card reading and gcode parsing to one unit would make sense to a certain degree. However, separating functionality makes sense as well. Mainly because there are more tasks to implement than SD card functionality (such as jogging the machine with a controller (such as an NES controller, or WiiMote)). There also needs to be a button to send the unit to home and clear, an E-stop, and probably a small LCD screen showing what's going on, etc.

The biggest most obvious problem of consolidating the duties is the fact that grbl is written in C and (as of this writing) has to be compiled and flashed to the arduino with MAKE, where the Fat16lib is an arduino library..... I understand that one should be able to make these two work together, but I'm not much of a programmer and to be honest it's way out of my league to consider such a project.

As far as cost goes, my plan is to continue refining the process by using my two Arduino Duemilanove but eventually switch to something less costly like two boarduinos.
edward.ford
 
Posts: 4
Joined: Thu Dec 10, 2009 2:02 pm

Re: Headless Arduino CNC Controller

by edward.ford on Thu Jun 17, 2010 11:14 am

@hjohnson: Thanks again for the hardware flow control idea. Its working brilliantly!!!! check it out!

The details are here.

Image
edward.ford
 
Posts: 4
Joined: Thu Dec 10, 2009 2:02 pm

Re: Headless Arduino CNC Controller

by lucy123 on Sun Jan 01, 2012 4:37 am

edward.ford wrote:Hey all, I know it's been a long time since this thread has been updated but I thought I'd fill in some info instead of leaving this as a dead end to anyone searching for "arduino + headless + cnc".

It's completely possible to run an Arduino based headless CNC machine! Here is the current setup I am using:

Hardware:
1.) SD Shield from SeeedStudio - as a side note: I hesitate to call this a "Shield" as it doesn't repeat the female headers on the top, so by using this you essentially lose access to your Arduino's V and GND ports. You need access to the GND port so you can tie the two GNDs from each Arduino together. I have circumvented this limitation by using two mini bread boards, as shown here: Also, it would be an easy enough fix to replace the current male headers with something like these, but I just have not gotten around to doing that.
Image

It's not the most elegant solution, but it's working.... (as a side note: the USB cable in "master" is just to power the device, not communicate with it. I have since switched to a wall wart!)

Software:
Master Arduino: In my setup, I am calling the "master arduino" the one that parses the gcode. For this I am using a program called grbl. IMO, this is the holy grail of arduino based gcode parsing. you can download it here, or read a little about it here. I actually found it via the contraptor project, here. You can see grbl in action here!

Slave Arduino: This is the arduino that reads the SD card. After pouring over a bunch of different fat libraries for arduino I settled on Bill.Greiman's fat16lib. It was very easy to implement and did exactly what I needed it to do.



Anyway, good luck to anyone's who's working on the same thing!



Hi. Thanks for this. I have bought the parts and working on this as we speak. PS happy new year!
lucy123
 
Posts: 2
Joined: Sun Jan 01, 2012 4:35 am

Please be positive and constructive with your questions and comments.