CNC Machine Control


#1

After using Octoprint to control my 3D Printers, I would be really interested in using it to control my CNC machine. Has anyone done this? Any reason why it wouldn't work?

Just researching at this point, but I might be interested in helping development of doing this.


#2

There are some people doing this out there. And there's at least one plugin tailored for this on the repository:

But you'll probably have to expect some tinkering. OctoPrint at its core still expects a 3d printer on the other end and has corresponding UI concepts.


#3

I ran a (huge) CNC machine at a manufacturing plant for about a year. I personally like the idea of using OctoPrint for something like this but I'll throw out some thoughts that come to mind.

I'm thinking that CNC work is inherently more dangerous throughout, as compared to 3D printing. You usually have a big red STOP button to immediately abort a job which is going badly. (And when I say "badly" there were times when it would catch on fire in a spectacular way since the built-in vacuum system is perfect for "fanning the flames", so to speak.)

The drill would spin at 10,000 RPM. If you accidentally created an absolute-versus-relative GCODE command mistake, the drill would literally plummet through the part, the sacrificial wood stock and into/through the platform itself. Imagine a drill bit breaking apart at 10K RPM when it runs into something unforgiving. At all times, you should consider CNC a dangerous hobby.

Now in the world of add-on plugins and testing them on your CNC, I would suggest that you include a "dry run" in which the drill isn't turning and you don't have the production block loaded onto the platform. You get to watch the assembly move through its toolpaths once to make sure that it's not going to crash into the platform.


#4

I've been doing CNC for over 20 years so I have seen all the issues. What I am looking for isn't for running single parts where you haven't run and tested the g-code, but I do a lot of ganged parts over and over again where the machine can run unattended similar to a 3D printer. Currently the machine is hooked up to a Windows based machine, which I am increasingly becoming unhappy with thanks to Microsoft. IMHO Windows is no longer suitable for machine control.

While the computer controls the CNC, it still has a Red Stop Button that is wired directly into the machine.


#5

Fair enough, then and we're in agreement regarding the reliability of the Windows (10) operating system.

The z-offset configuration on the average 3D printer seems to be something which is done whenever your replace the bed (which rarely happens). For CNC work, you routinely change the z-offset to match the stock that you've now placed on the bed.

In a similar fashion, the default X/Y home position on a 3D printer is "set in stone", if you will. It's defined by the bed dimension itself. In CNC, the stock itself defines the home position for X/Y. So I'm not sure what's necessary for Grbl. Presumably it uses the concept of two or three offsets from the stock home position to the underlying bed's home position. Or perhaps you have to calibration every job start. I couldn't tell you but it appears to be necessary for success.

Marlin (the firmware) has support for CNC toolpaths throughout.

From this video/instructable, the guy appears to have succeeded (minus OctoPrint) to do what you're trying for.

Reviewing the plugin's code, it feels a little light to me. The entire project weighs in at 12 commits in total. May 2017 and a little work in 2018. The author appears to be working the latest issue, so that's good.

It may be worth the effort.


#6

I assume you have looked at LinuxCNC.


#7

I've been using cncjs for driving a little diode laser I've got.

It works pretty well for that and as soon as I get my cnc router up and running again, I plan on using it for that.


#8

CNC g-code for my Snapmaker works fine in Octoprint except that the viewer doesn’t work. I know there’s no concept of a layer in CNC, but it would be really helpful to be able to see an x,y bounding box and origin point for positioning the origin relative to the work piece.


#9

It felt like there was on a 3-axis CNC machine. The toolpaths looked to me like a reverse timelapse of a 3D print, to be honest.


#10

I'm taking a stab at getting the "grbl support for Octoprint" running on my custom printer running grbl v1.1 and Octopi on a 3B+. The Rπ "sees the controller and sets up the serial port but then hangs after the M5 "Hello" command. Since the grbl firmware is set up to boot in a locked "Alarm" state until a homing cycle ($H) is completed, I assume Octoprint is timing out? A few options come to mind.

  1. Disable the homing cycle safety lockout in grbl firmware
  2. Reconfigure the Rπ serial port connection protocol to ignore the "error:9"
  3. Have the Rπ issue the $H homing or $X unlock command.
    I'd prefer #3 but not having much experience with the software or coding in general, am not sure how to do it. BTW, this is not a CNC so no dangerous tool heads flying around. Thank you for any suggestions!

Changing monitoring state from "Offline" to "Detecting serial port"
Serial port list: ['/dev/ttyUSB0']
Connecting to: /dev/ttyUSB0
Changing monitoring state from "Detecting serial port" to "Opening serial port"
Connected to: Serial<id=0x6c3b4fd0, open=True>(port='/dev/ttyUSB0', baudrate=115200, bytesize=8, parity='N', stopbits=1, timeout=10.0, xonxoff=False, rtscts=False, dsrdtr=False), starting monitor
Starting baud rate detection
Changing monitoring state from "Opening serial port" to "Detecting baudrate"
Trying baudrate: 115200
Send: M5
Recv:
Baudrate test retry: 4
Send: M5
Recv: Grbl 1.1g ['$' for help]
Changing monitoring state from "Detecting baudrate" to "Operational"
Recv: [MSG:'$H'|'$X' to unlock] Asking to for user to run homing cycle or override
Recv: ok
Recv: error:9 G-code locked out during alarm or jog state
Changing monitoring state from "Operational" to "Error: 9"
Changing monitoring state from "Error: 9" to "Offline (Error: 9)"
Closing down send loop
Connection closed, closing down monitor