Enhanced Lasers

Paul De Groot

Issue 2, August 2017

What if you could take a cheap laser cutter/engraver unit, then design a plug-in replacement so as to increase accuracy and improve performance? Paul did...

We all know that you tend to get what you pay for. So Paul wasn’t terribly surprised when his cheap K40 laser cutter/engraver didn’t quite perform to his liking. But rather than chalk it up to experience and put up with low quality output, Paul decided to develop a solution.

How long did you have the K40 before you realised it wasn’t really up to the tasks you were hoping to put it to use on?

Actually from day one when I got the machine. There were no instructions, and the dongle I mistook for a USB stick with software that I couldn't find. The eBay seller did give me some links with Chinese software LaserDRW/Moshidraw. Unfortunately I could not cut a decent frame for a project since I had to design it within LaserDRW. Next to this I never managed to get the engraving to work at all. First thing I did was to find the K40 community on Google+, who all said the controller was rubbish and suggested I replace it with a decent DSP controller (i.e. expensive!).

Hours of real-world testing was done.
Hours of real-world testing was done.
Testing prototypes.
Testing prototypes.

So it seems the community identified that the bones of the units are actually quite good; it’s the controller that’s letting it down. What were the problems you were having with the original unit?

The software/operation of the machine was causing me grief. The X-Y axis gantry hardware is pretty sound. The power supply is very basic with no over-current protection, so you can easily damage it when changing the stepper electronics. For example the 24V can only deliver 1A, and anything above that will blow up the rectifier, which is simple to fix.

At least the hardware is sound; since that’s the bones of what you’re putting your money into. How did you go about upgrading the original controller hardware?

I did extensive research into existing solutions, but no one had a complete E2E turn key solution, so I decided to use an Arduino UNO as a starting point. I started with a Vero board using the existing connectors from the original M2Nano controller. That worked straight away so I used it for a few weeks and decided that it was very much an ugly tarball that needed a clean up for future reliability. PCBWays was offering PCBs for just USD45 including postage, and just for my own use, I wanted to get it nicely installed, so I decided to design a new PCB shield, which worked very well. Then other people started to ask for one, so I gave the remainder away for free. My next issue was engraving; 8 bits (256 values over the full power range) did not allow many grey levels. So my next logical step was to help people to achieve better engraving quality. To do this, I created a new controller board to replace the Arduino UNO.

We hate ugly tarballs in our hardware too. Have you upgraded steppers and other hardware, or simply the controller?

It’s a complete solution based on the ATmega328PB (different AVR from the UNO), with a shield plus StepSticks stepper driver boards. The old Chinese M2Nano controller is in the bin...

The prototypes saw several iterations.
The prototypes saw several iterations.
Cutting complex plastics is also possible.
Cutting complex plastics is also possible.

Sounds like a good place for it. Did you have any unexpected hurdles along the way?

The biggest hurdle was to design a new controller that would run the open source Grbl with the laser features. I had to port the Grbl code, modify it to allow 10bits engraving, and then reassign the function pins since the first USB/UART occupies the 10bits PWM port. Fortunately, the 328PB has two USB/UART ports, so I moved the communication to the second USB port so as to get access to the PWM port. The shield has three jumpers that allow you to select the appropriate PWM pins, so the shield is compatible with the standard UNO and my new controller.

Gerbil - we love it! What specs have now improved as a result of the changes?

The next hurdle was to find the right combination of PWM settings: frequency 50Hz to 50kHz, phase correct, phase and frequency correct PWM or fast PWM. I tested about 60 combinations, of which only four worked. The best frequency for the CO2 tube was about 160Hz, and I made sure that the PWM has a base PWM train signal, so as to keep the gas excited and energised at all times during the engraving. This prevents the latency in igniting the laser operation, and extends the lifespan of the tubes (not being switched fully on and off); all big laser manufacturers use this this energising trick. Furthermore, the zero position of the machine had to be changed from top/left to bottom/left to be compatible with Inkscape and the G-code sender (CNCjs). Additionally, I had to extend the resolution of the engraving Inkscape plug-in (from 250dpi to 381dpi) in order to match the engraving quality. I also had to rewrite the G-code generation to make it compatible with Gbrl’s G-code dialect. By the way, I call the controller “Gerbil” after Grbl’s firmware. Americans at the Bay Area Maker Faire suggested that name when I presented the controller in May. You can read more about this faire in my blog.

Standard Grbl allows AMASS (adaptive smoothing algorithm), which means it runs at big steps for straight lines, but increases its step resolution for arcs and curves. So basically the K40’s motion system has improved just by using Grbl firmware. My added value to this is the laser resolution. I allow 10bits engraving, which allows precision engraving over a tiny range of the laser power (2mA range is divided in 256 grey levels while the laser range is 0 to 20mA).

Wow - 256 grey levels is amazingly fine for a cheap laser cutter - that’s awesome! If you had your time over, or were creating a V2.0 of this project, is there anything you would change?

I have used it for over a year now and it’s been extremely reliable. So I decided to do a Kickstarter (see Resources below) but ran into the cost of the project. My new shield now uses only SMD components, which reduces the cost of assembly. That’s the only way to make it economically viable. Also I would like to incorporate the G-code sender into the Inkscape plug-ins, so people don’t have to use two programs; instead they’ll have an integrated toolchain (requested at the Maker Faire by some makers).

The precision and grey detail now possible is stunning.
The precision and grey detail now possible is stunning.


  1. Inkscape to produce laser engraving and cutting G-code files.
  2. A G-code sender to send those files to the controller.

If the Kickstarter is a huge success I might do this as a stretch goal.

That’s great you’ve had feedback from real users at the Maker Faire, and have actual information in which to base your Kickstarter on. What unexpected challenges did you face designing Gerbil?

Lots of people could not get the ATmega328PB to work properly because the original full swing on board oscillator of the AVR has been replaced with a simpler circuit to make room on the chip die for the additional registers and functions. So simply replacing an old AVR from an Arduino UNO with the new AVR does not work. I tried that many times until I read the avrfreaks forum. The solution was a better designed external xtal (oscillator) circuit close to the chip according to the forum, so that’s what I did. Most of the remainder circuits are identical to the UNO except for the USB chip from FTDI. I want to make the USB driver install as easy as possible for my users who are mostly makers, hobbyists and mums/dads garage businesses with few IT skills.

I ordered ten fully assembled controllers from PCBWay and amazingly they all worked on arrival. I sent them to beta testers.

My new batch is hand soldered boards just to test the BOM since the first batch parts were ordered by PCBWay. Also the Arduino IDE did not natively support the 328PB but that’s solved now with the latest IDE version.

Sounds like you've overcome those issues for sure. Tell us what you're working on now?

At the moment I am working purely on the logistics of the Kickstarter. Creating and testing the BOM. Ordering the SMD components and testing that it all works. Then I’ll start working with a manufacturer to produce the end-stop conversion brackets, I’ll flash the boards, test it again, and then pack it up for shipping. After that I’ll shoot a video to explain the project. This has been a very challenging element for me, as I don’t have any media experience; so it feels pretty clumsy.

Well, at the time of writing your Kickstarter has just launched, and it’s already off to a cracking start. We wish you the best with it, and look forward to hearing about all the K40 owners benefiting from the integration of Gerbil to their units!

CREDIT: Original illustration by Thomas Bewick

Reading & Resources:

Paul De Groot

Paul De Groot

Business Architect, Sydney