LinuxCnc Raspberry Pi for MPCNC

I’ve been working on developing a setup for the MPCNC using a Raspberry Pi 4 and LinuxCNC. It looks quite doable now that LinuxCNC has Raspberry Pi GPIO as a HAL driver. I like some of the features LinuxCNC has to offer such as true real-time control so a pause will actually be immediate. The emergency stop can be handled by LinuxCNC so I don’t actually have to kill power and can know where the stop happened. With the number of GPIO pins on a Raspberry Pi I should easily be able to incorporate cool features like a tool changer (maybe a project for this summer), spindle control, power control, 4th axis, etc.

Getting the drivers to work with a stepper controller was a bit of a challenge but I’ve got one working now and have ordered a RAMPS board to run some TMC2209 drivers for the project. If I was less concerned with my time I’d just cut my own PCB but that would take me a lot more time as I’d have to design, cut, and solder the PCB. A RAMPS shield saves me that time and costs under $15. I’m leaving my SKR controller in place for now but hope to use it to build another CNC (probably the low rider) for a friend.

Other than the display, it actually looks to be price comparable to running a Marlin based setup. It can be run headless as using VNC gives the ability to run it from another computer but I do eventually want to incorporate a touch screen. I also think a 15"+ touchscreen controlled MPCNC would just look cool in my garage so it will happen just for the cool factor.

I don’t see that many others here have tried going this route but I’ve got a few reasons. I’m a Linux fan, I’d like to be able to incorporate encoders on the steppers for feedback, and I’m interested in contributing to the MPCNC project in areas I have the ability to contribute. I do see some people using their MPCNC with LinuxCNC with older computers and a parallel port but not the Pi, especially a Pi using GPIO. In fact I don’t see much on the LinuxCNC forums about using a Pi and GPIO so this will help that development project as well.

I know other have discouraged using closed loop steppers and I understand why. The MPCNC isn’t strong enough to handle just ripping through heavy duty material however in some cases I’ve had some missed steps that have caused issues that could be avoided if the controller knew it had happened. Most of the time its small imperfections but when carving something large it gets frustrating when a few missed steps ruined a cut because of a layer shift. Those can ruin a bigger project, once there’s a shift issue it becomes a feedback loop that get worse every pass. A good example is hitting a knot in a board when pushing through is all that needs to happen but shifts in the cut repeatedly make the end product unusable.

In my experience most of those cases could be fixed with a closed loop (or slowing down the cut but until you’ve failed you don’t know that you have). With LinuxCNC I think most of this can be dealt with without having to write tons of new software or use true closed loop steppers that will rip a machine apart. I belive I can use an encoder to pause (or temporarily slow) a job (I still have some research and probably coding to do to make this happen) instead of ripping the machine apart.

I’ll post updates once I get a working system going. I plan to post a Raspbian image on github once I get a full system up and running. I’m fairly new to CNC and not a “real” software developer but I’ve hacked together a lot of code over the years and most of it is actually used in a production environment.

In the mean time, if anyone is interested or has any questions I’ll be more than happy to share. If anyone else is interested in contributing please let me know. I’m very new to LinuxCNC and just discovering some of its strengths but it looks so much more powerful and robust than Marlin or Grbl. I hope to have a beta system up within a month or so as my seasonal business begins to slow down.

13 Likes