Driving a CNC machine directly from an STL file with a DAGU Spider controller
November 13, 2012
I want to drive a CNC milling machine using only an Arduino processor and an STL file. The STL format was chosen because it is very simple for me to understand and almost all 3D CAD software can export an STL file.
In my forum post here: http://letsmakerobots.com/node/34958 the feedback I go was basically.
- Arduino processor not powerful enough
- Why bother, free software available
In short, I think the Arduino is powerful enough if the code is only processing the model one slice at a time. The machine is much slower than the processor.
As for why - I like a challenge and I want to simplify the software toolchain. I don't want to have to delve into the depths of some freeware to tweak it to work with the next piece of freeware to work with my machine. I admit this project will really test my programming skills. It will be mostly floating point 3D trigonometry.
My Arduino code will already be optimized for my machine. You just need to tell it basic information like what material you are cutting so it can adjust the cutting tool speed and depth of the slices. If it can read an STL then it will work with almost any CAD software.
I have already designed my controller but it will be a few weeks before I have the sample PCB. While I wait I am starting with the basics using a Spider controller that's been fitted with an ATmega2560 MCU so that I have more memory to work with. I am using a Micro Magician just to provide 3.3V for the SD card. The LCD is 128x64 pixels.
First Goal: Reading the SD card and select the file you want from the directory displayed on a graphics display LCD. I am just learning to use the GLCD and SD card libraries so this will take a while.
I have loaded 11 test files on the SD card. Most are simple shapes drawn on Google Sketchup and exported using a pluggin by Jim Foltz. Jim tells me his STL exporter follows the protocol described in Wikipedia.
There are 3 files draw in Solid Works. These are very large complex models. One has over 80,000 triangles in it. This will be a good test of my code where I can experiment with optimizing my code.
I finally got a few days to work on the code but I've run into some problems with the SD library. I've got my code so you can scroll up and down through the directory and select the file you want but after scrolling up or down 24 times it seems the "rewindDirectory()" command stops functioning. For now this is not a big problem as I only have a small list of files in the root directory.