Get yourself a new laser cutter? Plug it in just to find out that it either doesn’t work or do what you thought it should? Let’s upgrade it!
One of the simplest things you can do to improve the capabilities of your cheap, Chinese laser cutter, sometimes known as a K40, is to upgrade the electronics. The control board it comes with is pretty horrible and not very easy to work with. It is designed to work with proprietary software such as MoshiDraw which is meant namely for raster engraving. This is fine if all you plan on doing are laser-etched phone cases, but not for much else.
By replacing the control board and electronics, you will be able to do accurate vector cutting and engraving as well as raster engraving with the right software.
This how-to is assuming you have the K40 version with the analog ammeter (the “old-fashioned” current meter) and the potentiometer. This how-to would likely be mostly applicable for the version with the digital power selector as well.
Parts and Materials
To follow this tutorial, you will need the following. I’ve included links to less common items that the average person may not already own and can’t find at local shops easily. Feel free to substitute any of these; these are just what I used for my build.
Control Board Upgrade:
- 1x Arduino Uno + GRBL-compatible stepper shield
- There are different types of stepper drivers available but it doesn’t really matter that much which type you pick. Our application doesn’t need high torque or super high resolution.
- 6x 2.54mm Jumpers
- You will need these if your stepper shield doesn’t come with them (most don’t).
- 1x Solderable Breadboard
- 1x 2N2222 BJT Transistor
- 1x 5mm LED
- 1x 1x 330 Ohm and 1x 150 Ohm Resistors
- 22AWG Hookup Wire
General Tools and Supplies:
- Soldering Supplies
- Masking Tape
- Electrical Tape
- Sharpie/Permanent Marker
- Computer with the Arduino IDE installed and an internet connection
Downloads and Software You’ll Need
To make a functional laser cutter, the main things you are going to need are below. Everything as follows is free and open source.
- Arduino IDE
- This is what we will use to program and configure our control board
- GRBL Firmware
- This is what will run on our control board
- You want to use version v1.1 or higher
- Laserweb
- This is optional, but it is what I use to generate the path file (called a gcode file) that tells the laser what to do.
- This software can also be used to move the laser head for general testing.
Label Your Wires!
Before you take apart your laser, it is important to label a few wires. Simply take a piece of tape and folder over the wire to make a “flag” and use a permanent marker to write on it what it is. You can see in the picture what the board usually looks like with the silk screened connection labels. Find and label the following:
Wires in the Power and Control Bundle
These are usually four blue wires into one connector. You can find out what they are by looking at the silk screened labels on the original control board. If you are unsure, already took the connector of the board (and lost said board), or just want to double check, you can check the voltage between the chassis of the laser power supply and the pin on the connector (or the wire if need be).
- 24V Wire
- 0V Wire
- 5V Wire
- Laser Control Wire
- This will measure at or close to 5V. If you are manually trying to figure out if a wire is 5V or the laser control signal you can try the following:
- Place a thick piece of wood or ceramic tile under the laser head and shut the cutting chamber door.
- Set the laser power to its highest setting and press the laser enable button (latches down)
- Connect the wire to the chassis of the laser power supply through a 10k ohm resistor
- If the laser fires (or you see the current meter jump a small amount), that wire is the laser control wire. Otherwise, it is the 5V wire.
- This will measure at or close to 5V. If you are manually trying to figure out if a wire is 5V or the laser control signal you can try the following:
Stepper Motor Wire Bundles
You don’t need to label the individual wires, but you do need to mark out which stepper motor cable bundle goes to which motor. The “X” axis motor is the one that will move the laser head from left to right. Likewise, the “Y” axis motor is the one that will move it back and forth.
Create the Laser Logic Board
When the GRBL firmware (the software running on the Arduino) wants to turn on the laser ON, it sends out a 5V signal. Unfortunately for us, the K40 laser power supply looks for a 0V signal to know when to turn the laser on. Rather than tweak the firmware to reverse the signal (GRBL isn’t exactly user-friendly), we are going to make a simple sinking logic inverter circuit.
The laser firing signal itself is being held to 5V through an internal pull-up resistor. What this means is that to fire the laser, we need to “sink” the signal to ground. We can do this by using the circuit below. When the PWM pin is given 5V by the Arduino, it will cause the transistor to conduct electricity which will cause the laser firing signal to go to 0V (firing the laser). I’ve also added an LED path to the circuit so that we can see when the laser is supposed to be ON.
Connect the PWM pin to D11 on the Arduino, the LASER_ON pin to the laser firing signal wire (on the laser power supply), and GND (ground) to both the 0V of the laser power supply and to ground of the Arduino.

Flash and Configure GRBL
The heart of our laser lies in the GRBL firmware. While there has been a port of Marlin by a user named “Turnkey Tyranny” for laser cutters for a couple years, I find that the newer version of GRBL (which has a laser mode) works a lot better. The main reasons I prefer GRBL to the Marlin port:
- GRBL is 100 times easier to configure. The Marlin port, unless it has been cleaned up recently, has a million 3D-printer specific settings that make it difficult to determine which of the items you actually need to tweak for your system. GRBL on the other hand is designed to be as bare bones as possible and the same applies to the settings.
- GRBL doesn’t require any special plugins to work well like the Marlin port does. Simply boot up software like Laserweb and you are ready to go. Marlin, on the other hand, requires a special (and somewhat confusing) Inkscape plugin to function correctly.
- Most of the settings you’d want to change are broken out natively in the EEPROM which means you can change all of the required settings for our needs without changing the source code.
If you haven’t done so already, download the GRBL firmware (version 1.1 or higher). You can find that here: https://github.com/gnea/grbl
Follow the instructions on the GRBL wiki (found here) to install it on your Arduino.
After installing it, you will need to change some of the configurations in order to use it with your K40. Below is the configuration that has worked for me on three separate builds (one for myself, one for my makerspace, and one for a friend). To change a setting, open the serial console in the Arduino IDE, set the line ending to “newline” and type $OPTION=VALUE. For example, you might type “$100=158” (without quotes) and then press the enter key. (In the event the table colors don’t render on your browser, the columns are from left to right: Option #, Meaning, Default Value, Our Value).
K40 GRBL EEPROM Configuration
Option | Meaning | Default Value | Our Value |
---|---|---|---|
$0 | Step Pulse (us) | 10 | |
$1 | Step Idle Delay (ms) | 25 | |
$2 | Step Port Invert mask | 0 | |
$3 | Direction Port Invert Mask | 0 | |
$4 | Step Enable Invert, bool | 0 | |
$5 | Limit Pins Invert, bool | 0 | |
$6 | Probe Pin Invert, bool | 0 | |
$10 | Status Report Mask | 1 | |
$11 | Junction Deviation (mm) | 0.010 | |
$12 | Arc Tolerance (mm) | 0.002 | |
$13 | Report Inches, bool | 0 | |
$20 | Soft Limits, bool | 0 | |
$21 | Hard Limits, bool | 0 | |
$22 | Homing Cycle, bool | 1 | 0 |
$23 | Homing Dir Invert Mask | 0 | |
$24 | Homing Feed (mm/min) | 25.000 | |
$25 | Homing Seek (mm/min) | 500.000 | |
$26 | Homing Debounce (ms) | 250 | |
$27 | Homing Pull-Off (mm) | 1.000 | |
$30 | Max Spindle Speed/Laser Strenght (1/10 rpm/%) | 1000 | |
$31 | Min Spindle Speed/Laser Strength (1/10 rpm/%) | 0 | 50 |
$32 | Laser Mode, bool | 0 | 1 |
$100 | X Steps/mm | 250.000 | 158.000 |
$101 | Y Steps/mm | 250.000 | 158.000 |
$102 | Z Steps/mm | 250.000 | 158.000 |
$110 | X Max Speed (mm/min) | 500.000 | 50000.000 |
$111 | Y Max Speed (mm/min) | 500.000 | 50000.000 |
$112 | Z Max Speed (mm/min) | 500.000 | 50000.000 |
$120 | X Accel (mm/sec&2) | 10 | 300 |
$121 | Y Accel (mm/sec^2) | 10 | 300 |
$122 | Z Accel (mm/sec^2) | 10 | 300 |
$130 | X Max Travel (mm) | 200.000 | |
$131 | Y Max Travel (mm) | 200.000 | |
$132 | Z Max Travel (mm) | 200.000 |
Hooking Up the Arduino Control Board
With the laser logic board done and the wires labeled, “all” we need to do is wire things up to the Arduino control board. Most of this is relatively easy, just take your time. UNPLUG YOUR LASER FROM THE WALL BEFORE GOING ANY FURTHER!!!
1) Place the 2.54mm Jumpers on the Stepper Shield and Mount the Stepper Drivers
Under where the stepper drivers go are three pairs of pins. These are the microstepping mode selection jumpers. In a nutshell, if you leave all of these populated, you’ll get a lot of torque on the stepper motors but not great resolution. The end result is some fairly choppy and loud movement that results in jittery cuts and engravings. To fix this, populate all of the jumper pairs with the jumpers. Technically speaking, you only need to populate the X and Y sets, but I personally populate all of them if only to have extras leftover if I need them later.
Add the stepper drivers onto the motor shield. Make sure you line up the Enable/EN pins, otherwise you’ll blow the motor drivers. It wouldn’t necessarily be a bad idea to only mount two at a time (one for X, the other Y) and save the others for a rainy day. If your steppers came with heatsinks, install those as well.
2) Solder in the Laser Logic Board
If you haven’t done so already, solder the three wires to the laser logic board. These would be PWM, LASER_ON, and GND.
The PWM wire gets soldered from the logic board to pin 11 (D11) on the Arduino. I’d recommend soldering this to the stepper shield.
The LASER_ON wire should be connected to the laser control wire you found earlier. Use a bit of electrical tape or heat shrink to protect the connection.
The GND wire can hang free for now. It will eventually go into the GND/0V screw terminal of the stepper shield.
3) Wire in the Stepper Power
The stepper motors take a fair amount of power to move cleanly. Strip the end off the 24V wire from the laser power supply and screw it into the positive/+/Vcc pin of the stepper motor shield. Do the same for the 0V wire on the laser power supply into the 0V/GND terminal, but this time also place the 0V wire from the laser logic board into the 0V/GND terminal as well.
4) Add the Stepper Motors
Fit the X and Y stepper motor connectors into their respective places on the stepper shield. You may need to bend the male headers slightly one way or the other to get these to fit on well. Don’t worry about which direction these go quite yet, just make sure the wire colors are in the same direction for both connectors.
5) Testing
Place the stepper shield onto the Arduino and place the Arduino on a non-conductive surface (like a piece of wood or tile). Double check any of your connections and then close any open doors and plug in the laser. Disconnect any USB connections, turn on the power switch, and wait a few seconds. Listen to make sure there aren’t any pops or miniature explosions. If all seems well, power down the machine and take a quick look at your circuits for anything burned or damaged. If this goes well, you are ready to connect the system to your computer.
Testing the Configuration
With everything mostly complete, it’s time to test out our GRBL configuration and our stepper wiring.
- Plug the Arduino into your computer with the Arduino IDE installed.
- Connect the serial console and set the line endings to newline.
- Manually move the head of the laser about center in both the X and Y directions.
- Type the following and press enter: G0X50
- The laser should move to the right 5cm. If not, power down the laser, remove the X stepper cable from the stepper shield, and plug it in “backwards”.
- If the Y axis moves instead of the X axis, swap the X and Y stepper cables.
- Type the following and press enter: G0Y50
- The laser should move forward/up 5cm. If not, power down the laser, remove the Y stepper cable from the shield, and plug it in “backwards”
The laser should now have the stepper motors wired correctly. If you typed in any of those commands and it didn’t move, you may need to make sure your stepper motor was wired correctly into the connector in the first place. “Google” stepper motor wire colors to try to get a good idea of what that should look like. One thing to note is that with any cheapo product, the wire colors may not line up, so there may be some experimentation required to get your laser head to move.
The last bit of testing is to make sure your laser head is moving the correct amount and that your steps/mm configurations are correct. One way to do this:
- Type the following in the serial terminal and press enter: G0X0Y0
- Manually move the laser head to the far left and place a piece of masking tape onto the top of the X axis rail.
- Manually move the laser head close to the center of the X axis rail and use a permanent marker to mark its location on the X axis rail.
- Type the following in the serial terminal and press enter: G0X100
- Mark the new location of the laser head and measure it. You should get 100mm (plus or minus a bit of human marking error).
- If your length is more than a couple millimeters off, count the number of teeth on your drive pulley and then use the Prusa calculator to determine what values should go it $100 and $101.
[…] Looking to upgrade your laser cutter? Check out my post here: http://www.foxrobotics.com/2018/03/19/upgrading-a-k40-laser-cutter-part-1-control-board-upgrade/ […]
Hello! Great post! There are so few people using the Arduino as a controller for the K40. This is very helpful and I will be using it in my build. I was wondering if you use an LCD screen with this? Could you go over how to wire it into board? I am new to the arduino world. Thanks!!
I’m not currently using an LCD screen at all with this, but I do have a mod in mind (and parts for it). I’ll see if I can work that in and do a blog post about it. Are you thinking something like a RAMPS style control screen? Or something else?
Hello! Great post! There are so few people using the Arduino as a controller for the K40. This is very helpful and I will be using it in my build. I was wondering if you use an LCD screen with this? Could you go over how to wire it into board? I am new to the arduino world. Thanks!!
Thanks for the post Austin. Will be upgrading soon as well as the lens and mirrors. Should do the trick!
Would it be possible to post some pictures of how it was after it was done?
Does this give full 8-bit grayscale raster? Is PWM controlling laser power, or just on/off?
This can do grayscale raster if you are willing to play with the settings in your cam software (like LaserWeb).
Does the 5V wire that was disconnected from the original board get used or capped off ?
Do you have a better photo(overhead style) of all wires plugged into the arduino board by chance? also happy new years and thank you for the writeup!