March 11, 2012

SkeinForge, Marlin for CNC Work

So I’ve built a CNC Mill. Now, I’m figuring out how to use it. I like to draw in OpenSCAD, and then I use Marlin/SkeinForge as my control software, and I run OS X ( Macintosh ). This causes a few problems.

1. There’s few G-Code generators that work on Mac.

2. SkeingForge seems to default its F speed as IPM( which makes sense — that’s a common convention ), but Marlin interprets it as mmPM( which is 25.4 times slower ), which is common in 3d printing. This means motions are too slow to be useful ( barely even visible ). This is easily fixed by removing the G-Code header, which homes and sets to mm. The default unit in Marlin is very happy with skeinforge once you make this change.

3. SkeinForge generates negative G-Code. As in, move negative units, assuming 0,0,0 is the center of the machine. The problem with this is that Marlin assumes 0,0,0 to be the lower left corner. So, nothing can move more negative than this value.

In other words — this scenario doesn’t work without changes. But, I’ve mostly figured it out.

This will come very close. You’ll need to open the GCode file and remove the homing commands and the M108 code. Replace M101 and M103 with M104 S210.0. In theory, M103 should be replaced with M104 S0.0, but Marlin is meant for printing, so it executes this code at the wrong time on the motion path. I would add G1 X160 Y160 Z25 to the the end of the GCode file — this will move the toolhead out of the way, and turn it off.

I’ll have to make a couple of changes to Marlin. M101 and M103 should execute M104 commands. The various shut-down commands should be executed via timer thread. M84 should call kill(). But the changes are minor. I think I can make them compatible with printing, so that the same code will do both printing and milling.