LPKF to GRBL Conversion

Retrofitting a $2,500 PCB mill with Raspberry Pi and Arduino

Similar projects worth following
I was blessed with a retired LPKF Protomat C40 PCB mill. Unfortunately, it is a very dated piece of hardware, and doesn't seem entirely functional. The motors are fine, though, so why not replace the antiquated control board with something more modern, simpler, and a lot cheaper?

The Situation:

I have a PCB mill. It is pretty antiquated (it has a DB-25 RS-232 port!) but otherwise perfectly sufficient for my needs. Unfortunately after working with LPKF support to sort out a DB-25 to DB-9 adapter and hooking up a USB/RS-232 adapter, I determined something was still wrong. Typing HPGL commands into PuTTY I was able to move the plotter anywhere I needed, at different speeds, in curves, arcs, and circles, and even adjust the height of the spindle. Unfortunately any time I tried activating the spindle the whole machine would stop dead, and ignore all input until a power cycle.

Either my chain of adapters was wrong, or the machine's logic board is damaged somewhere. I had the thought of putting an Arduino between my PC's USB and the mill's RS-232, then having the Arduino control the spindle and filter out spindle control commands while passing the rest to the plotter. Then I thought about making the Arduino translate from G-code (what most PCB software uses) to HPGL (the old pen plotter protocol used by the mill) to improve compatibility.

The Project:

Then I thought "Why not just have the Arduino control all 4 motors and use a Raspberry Pi to convert gerber files to G-code?" So that's what I'm doing.

Research and Planning:

First objective was to get an Arduino to understand G-code so I could use existing CNC software. Fortunately, the geniuses behind GRBL (Github) have already perfected this and managed the shoehorn it into an Arduino Uno.

With the commitment to use GRBL, I sought out how to drive the bipolar stepper motors from the Arduino in a way that is supported by GRBL. The X and Y motors are bipolar stepper motors by Vexta. I couldn't find any documentation on them, but I do know that they are bipolar stepper motors with quadrature encoders. LPKF was kind enough to attach them from the exterior of the machine vie DB-15 connectors, so I'll stick with those. I don't want to make any irreversible changes to the machine if I can avoid it.

As it turns out, GRBL is built with Pololu-style stepper motor drivers in mind. The genius at has already perfected the open source GRBL Arduino shield for CNC. Since I can't make decent PCBs of my own (yet!) I elected to buy his kit.

The Goals:

  1. Get the mill to accept G-code commands over USB
  2. Use the Raspberry Pi as a remote interface and controller for the mill
  3. Avoid any permanent changes or damage to the mill
  4. Mill a PCB

  • Electronics Progress, but Stonewalled by Manufacturers

    Steven Gann10/18/2016 at 00:46 7 comments


    I have received the DRV8825 drivers from China, and the CNC shield kit from New Zealand. Also, it has come to my attention that an earlier version of the shield was featured on Hackaday back in 2013! Anyway, fantastic quality and simple assembly process. The documentation was a bit vague, and the assembly instructions on Protoneer's website didn't quite match the actual product (newer revision of the PCB, website needs update), but it was simple enough to work out.

    Setting up the software was bit trickier. I ended up install Grbl through the Arduino IDE method instead of burning a straight *.hex file, mostly out of convenience. I also created my own fork of the Grbl repository to document any modifications I make to the firmware.

    Grbl is only half of the software, though, so that still left me with the PC/RasPi-side of things. For testing the hardware from Windows, I went with Candle, which is has a very intuitive interface. Once I get a bit farther with the mechanical parts, I plan to bring in GRBLWeb, which can even run on a Raspberry Pi 1 and provides a slick web UI for uploading G-code and such. Hopefully I'll be able to integrate a full Gerber>>G-code>>Grbl toolchain into a single UI. Writing an Altium plugin to automatically send Gerbers to be milled might be pushing it, but it's definitely a stretch goal.


    While LPKF has been reasonably helpful, they refuse to give me any technical information on the stepper motors used in the Protomat C40. I contacted the company that manufactured the motors themselves, but was informed that they were a proprietary design manufactured for an OEM (i.e LPKF) so they couldn't share any technical information.

    Tomorrow, I'm going to crack open the Protomat and start probing with an oscilloscope. The X, Y, and Z motors all work fine, so I'll get them moving and see if I can probe the operating voltages from there. Worst case scenario, I guess I could replace the steppers with something cheaper but better documented.

    The motors are VEXTA C7391-9212, if anyone has any information. They are also marked as bipolar, so once I figure out a safe operating voltage then driving them should be no problem.

View project log

Enjoy this project?



Marcel Chabot wrote 03/13/2023 at 22:01 point

Good day! I have a C30 mill and am starting down the same path you are traveling. I'm wondering if you have made any additional progress? Thanks in advance for any details you have.

  Are you sure? yes | no

Steven Gann wrote 03/20/2023 at 18:30 point

Hello! I'm afraid not. After the last update I went to probe the motors and apparently created a short between the motor driver and earth. I never got around to revisiting it and finally sold the machine to someone with more free time. Good luck!

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates