Just a quick post to say that Simen has begun documenting grbl. For a quick start guide, head over to http://dank.bengler.no/-/page/show/5471_gettinggrbl
 
 
Picture
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.

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: The arduino that is connected to and 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.....
 
We're Back! 05/03/2010
 
I've been debating now, for the past few weeks at least, how exactly to carry on with this blog. Up to now, the blog has mainly been about my adventures with Arduino and creating a DIY CNC. A pretty cool topic I may add :-)

However, it's summer here! And during the summer I like to be outside. This makes it difficult to work in my basement on the CNC machine. So, should my blog go silent? After giving it some though, I have decided to blog about what I'm doing, be it CNC arduino related or not. So if you don't want to read about my adventures in mountain biking or a Monday morning jog with my dog, that's OK with me. I understand. But, this is "eds life daily" so I probably should be blogging about my daily life...

Now, in terms of my CNC machine and arduino programming, I'm taking a short break from that. Maybe in a few weeks I'll get back on it, or a rainy day here and there, but for the most part my free time will be consumed by outdoor activities and family time.

Here's a slideshow of my newest mountain bike:
 
 
After a few hours of work tonight, I managed to mate the NES controller with my mill. Seems to be a match made in heaven. The video is below for proof and the code is below that if you want to try this out for yourself (it's very easy).

I'm planning to make this a permanent feature of my mill. In order to give it a cleaner appearance (instead of just shoving wires into the controller), I've ordered a set of NES controller sockets from parallax which I will be mounting in my case.

A couple of notes:
1.) The code is terrible, I will try to clean it up and re-post sometime soon.
2.) This is a very easy project, If you're trying to interface your easydrivers with a 3 axis mill, a homemade bot, or anything else and want to add NES controller pad capabilities, give this a look. You'll be surprised.
3.)The X axis on my machine is terribly loud. I need to fix that it....
nes_stepper.pde
File Size: 5 kb
File Type: pde
Download File

02/24/2010 - EDIT: An updated version of the code used to drive 3 Easy Drivers via and Arduino and a classic NES controller. Not a whole lot of changes to the original, just a little bit cleaner, more concise, and thoroughly commented.
nes_stepper_cleanedup.pde
File Size: 4 kb
File Type: pde
Download File

 
 
As mentioned yesterday, driving the mill with an N64 controller seems like an awesome idea. Today, I set to work trying to figure that out. I was almost immediately sidetracked
As luck would have it, my stash of NES controllers (qty: 2) were in the same location as my stash or N64 controllers! I couldn't resist.

Shapeoko needs a "joystick". All CNC machines have one. They are either software controlled (buttons on screen) or hardware.  They are necessary to move the gantry out of the way and to "home" your machine to the material. I have an old joystick from an arcade I build a few years ago that I have been planning to use.

However, one of the problems using a traditional joystick is that it takes up one port for each direction you are trying to capture. So in our case we would want: Forward, Back (Xaxis), Left, Right (Yaxis), Up, Down (Zaxis). That's 6 inputs we would need!

The NES controller doesn't need one output for each button because it's digital. What's that mean? Good question. Here is how I understand the NES controller to work: The chip inside the controller is polling the status of the buttons at a rapid rate. When the buttons are not being pressed, the result of the poll looks like "11111111" (one bit for each button). After the controller is done polling, it sends that string to the console (in our case the Arduino) which is then interpretted by the program into whatever the button are mapped for.

If you press a button then the string changes to reflect it. For instance if you press the select button the string changes to 11011111. The cool part about this is the arduino need only use 3 ports to interface with all 8 buttons! The three ports are for "Clock", "Latch", and of course data. The data wire is where all the action is! Clock and latch are there to keep the timing correct.

To be honest I don't completely understand how it works, but I figured it out enough to capture the inputs with the Arduino and light up the corresponding LEDs! I would like to say, as a side note, working with a "digital" also prevents you from having to debounce the button pushes. Because that debounce logic is already in the chip that's doing a2d inside the controller! we're just taking the "clean" data :)

Here's a quick video of the setup in action. The code is below if you want it.
Now that the buttons are mapped and I feel pretty confident about capturing button presses, I am going to get to work on writing the code to control the step/dir functions of the easy drivers.
simplenes_led.pde
File Size: 3 kb
File Type: pde
Download File

 
 
Here's a video of shapeoko + grbl parsing gcode being streamed from my Dell Mini9. (You can download the gcode below.)

Clearly something is not right. However, the job will run identically, which makes me think that it's a simple software tweak as opposed to something more devistating like a hardware problem.

Another positive sign is the fact that the z-axis height seems to be working just fine. This particular g-code calls for a clearance height of 6.25mm and a target depth of -1mm. Both of which seemed to be consistent throughout the job.
helloworld.gcode
File Size: 11 kb
File Type: gcode
Download File

 
 
Here is a short video of ShapeOko drawing a box via grbl and hyperterminal. There is still a lot of work to do before this project is "production" ready. But it's really nice to make some progress every once in a while.

The current setup includes:
CNC Controller: Arduino running grbl
Stepper Controllers: Easy Drivers
Stepper Motors: 65oz/in bipolar
Linear Rails: Salvaged from previous builds
Power Supply: 24v 150W
Frame: Custom Designed Laser Cut 1/4" MDF (from ponoko.com)
Z Axis Mount/Slide: 3D Printed Custom Design (from shapeways.com)

If anyone has an idea as to what is causing the wobble in the y-axis, please let me know. I'm open for suggestions :)
 
 
After a busy holiday season, it looks like we're back to work:

eps files have been uploaded to Ponoko, and can be found by searching for "ShapeOko". From there you can order. It wasn't exactly necessary but removes one step of the process for anyone looking to build their own mill. Instead of having to upload the files, you can just add them to your cart, and go. Also, the files are freely available to anyone either through ponoko or through the forum here.

Does anyone have experience releasing something under an open source license of an sort? After giving this some though I'd really like to get an official release method but don't really know where to start. Suggestions are welcome.

Machine progress update:

  • grbl is loaded on my arduino!
  • replicatorG is loaded up and (hopefully) configured correctly on my PC.
I will have some time tonight to test this out, so everyone please keep your fingers crossed. I'll report back tomorrow.
 
 
I have managed to find some time during the holiday season to work on the mill. Here's a recap:
  • Soldered the EasyDrivers down to a protoboard, and ran the appropriate wires, bringing out the power, step, and dir from each one. I'll get a picture of that up soon.
  • Still working on configuring grbl. I've email Simen again trying to clarify a few things. Hopefully he gets back to me soon.
  • Posted the updated set of drawing files on the forum (including STEP, DXF, PDF, and the EPS nest.
  • Posted link to shapeways
  • Looking at embedding a 3D model using Autodesk's Project Freewheel
  • Used myNesting to product semi-efficient nests. They are in beta now, so all of the nests are free! A very good service if you're looking for a simple nesting solution.
 
 
There's something wrong with the X axis. Unlike the Y, it's very difficult to move. Well, not very difficult but more difficult than the Y. I think there may be a bit of a design flaw... stupid designer.

From what I can tell, there is some friction between the X-axis-rail-mount-plates (the ones slotted end to end) and the X-axis-cross-plate (the one that the X-axis acme nut mounts to). I'll try taking some sandpaper to it and if that doesn't work, perhaps the dremel? Someone also suggested I use wax.. i don't even know where I'd find wax though. Also, I should have boxed in the X-axis cross plates because there is flex when the nut is being driven.

I'm going to move forward and continue with the current iteration. After the new power supply is delivered and the EasyDrivers are installed, I'll see where we're at. But, I'm afraid I'll have to make some changes to the design and re-order all of the parts from ponoko. It's not the end of the world but I hate the fact that I didn't get it perfect the first time...

Though, I should be used to that by now.

On a different note: When I started this project I was certain that a computer would be running the machine. However, I've been using the arduino to test the motors and when I get the 2 additional EasyDrivers I'm planning to run them through their paces with the arduino as well. I keep thinking how awesome it would be to use the arduino permanently as the controller. Yes, replace a full PC with a tiny arduino! My machine has a very small footprint to begin with, and I keep thinking how cool it would be house *all* of the controls in a tiny matching box! I don't even know if that's possible, but wouldn't it be sweet!

I'm imagining something like this: Obviously, do the CAD/CAM on a workstation but save the G-code to an SD card. Then, insert the SD card into the arduino, turn the arduino on, it would then look for a specific text file. Parse the file and run the machine! I know it's a lot harder than that and I'm doubting there would be enough room on the arduino to store the code to both control the reading of the SD card and parse the file and run the machine.  Either way, a guy can dream right?