Electronics Build Guide MKS Gen L V1 and V2
Introduction
This guide will walk you through the steps to build the electronics for a CNC foam cutter. The MKS Gen L boards are highly reliable, and I’ve used them successfully in many projects.
Thanks to advancements in 3D printing, the electronics for a foam cutter are now affordable and easy to source
Advantages:-
- Both 12V and 24V power supplies are supported. If your hot wire is longer than 39 inches (1 meter), you must use a 24V power supply.
- The board also has connections for external stepper driver modules, like the TB6560, allowing you to use larger NEMA 23 stepper motors that need more than 2 amps. The foam cutter works great with NEMA17 stepper motors—mine operates at 0.9 amps using DRV8825 drivers
Disadvantages:-
- It can be a little more expensive than the Arduino Mega 2560 with a RAMPS 1.4
- The USB CH340 driver can be problematic. Read this post for details USB CH340 Driver Problems
Build Guide
Please make sure you have used the recommended parts from the parts list. If you use alternatives, this guide may not work.
Please don’t install the electronics onto the foam cutter until it’s working on the bench. After the bench test, you can do the final calibration and dry run once installed on the foam cutter. The foam cutter will require longer wires than your bench testing, which is usually the source of problems if it doesn’t work correctly when installed
Please note that Homing can’t be tested on the bench. It’s only possible after installation on the foam cutter with all the switches wired.
Step 1 – Connect the board
Connect the board to your computer running Windows 10 or 11. Other users have confirmed it will run on older versions of Windows but I can’t confirm that as I don’t have them anymore.
In Device Manager, ensure you can see the board listed. If you see a yellow warning triangle, you may need to install the CH340 drivers. Use this link https://learn.sparkfun.com/tutorials/how-to-install-ch340-drivers/all if that’s the case.

Step 2 – Firmware
The firmware that works with the Arduino Mega2560 and RAMPS board is the same for both the MKS Gen L V1 and V2 boards.
Download the firmware and software from here and unzip them to your computer. In the location where you unzipped the download, unzip XLoaderXYZA-Mega2560.zip
GRBL Hot Wire Firmware and Software V2.51 1.77 MB 9309 downloads
This is the latest software and firmware for the CNC Foam Cutter version v2.51,…You will have a folder called XLoaderXYZA-Mega2560, locate the XLoader.exe file and run that.
In the Hex File field, make sure it ends with firmware-mega2560.hex

If you have used Xloader before, it remembers the last hex file used. Which may not be this hex file. A few guys have been tripped up here.
Make sure the Device field says Mega(ATMEGA2560). Your COM port may be different to the picture. Just make sure it’s the same as in Device Manager. Also, ensure the Baud rate is set to 115200. Then click “Upload”
If all is well, you will see the number of bytes uploaded. If you do get any errors, check your settings as described above.
Default Settings of the Firmware
| Setting | Value | Description | Notes |
|---|---|---|---|
| $0 | 10 | Step pulse, microseconds | |
| $1 | 255 | Step idle delay, milliseconds | |
| $2 | 0 | Step port invert, mask | |
| $3 | 6 | Direction port invert, mask | |
| $4 | 0 | Step enable invert, boolean | |
| $5 | 1 | Limit pins invert, boolean | Normally Closed Switches |
| $6 | 0 | Probe pin invert, boolean | |
| $10 | 3 | Status report, mask | |
| $11 | 0.02 | Junction deviation, mm | |
| $12 | 0.002 | Urc tolerance, mm | |
| $13 | 0 | Report inches, boolean | |
| $20 | 0 | Soft limits, boolean | Don’t enable only use when homing otherwise, this will cause a jogging error |
| $21 | 0 | Hard limits, boolean | |
| $22 | 0 | Homing cycle, boolean | |
| $23 | 1 | Homing dir invert, mask | |
| $24 | 200 | Homing feed, mm/min | |
| $25 | 100 | Homing seek, mm/min | |
| $26 | 250 | Homing debounce, milliseconds | |
| $27 | 5 | Homing pull-off, mm | |
| $30 | 1000 | Max spindle speed, RPM | |
| $31 | 0 | Min spindle speed, RPM | |
| $32 | 0 | Laser mode, boolean | |
| $100 | 1066 | Axis 1 (X) steps/unit (mm or deg) | |
| $101 | 1066 | Axis 2 (Y) steps/unit | |
| $102 | 1066 | Axis 3 (Z) steps/unit | |
| $103 | 1066 | Axis 4 (A) steps/unit | |
| $110 | 400 | Axis 1 (X) Max rate, unit/min | |
| $111 | 400 | Axis 2 (Y) Max rate, unit/min | |
| $112 | 400 | Axis 3 (Z) Max rate, unit/min | |
| $113 | 400 | Axis 4 (A) Max rate, unit/min | |
| $120 | 16 | Axis 1 (X) Acceleration, unit/sec^2 | |
| $121 | 16 | Axis 2 (Y) Acceleration, unit/sec^2 | |
| $122 | 16 | Axis 3 (Z) Acceleration, unit/sec^2 | |
| $123 | 16 | Axis 4 (A) Acceleration, unit/sec^2 | |
| $130 | 0 | Axis 1 (X) Max travel, unit | Don’t leave at zero. Set to your maximum travel |
| $131 | 0 | Axis 2 (Y) Max travel, unit | Don’t leave at zero. Set to your maximum travel |
| $132 | 0 | Axis 3 (Z) Max travel, unit | Don’t leave at zero. Set to your maximum travel |
| $133 | 0 | Axis 4 (A) Max travel, unit | Don’t leave at zero. Set to your maximum travel |
Step 3 – Software
From the download unzip grblHotwire.zip to a folder. Then run the setup.exe
This will install the software so that we can complete the rest of the bench testing.
You may need to install the .NET Framework if you get any errors. Follow this link and select Runtime. Windows 10 is usually fine, but sometimes Windows 11 will need the Framework installed.
In the software, if your COM port is not selected, press ReScan and click Connect. You should see the image below.

If you get errors, the common one is installing the wrong hex file. The older firmware used XYZU for its axis letters, but the latest firmware uses XYZA.
If you see any numbers other than zero in the DRO, run the following command in the MDI dialogue box $RST=* This will clear any old settings in the EEPROM.
Step 4 – Power Supply
The MKS Gen L V1 and V2 boards can use a 12 or 24-volt power supply. Ensure it is at least 150 Watts. Check that your power supply is set for the correct voltage for your country.

Switch on your power supply and make sure the board still works by connecting to the GRBL Hotwire software.
Step 5 – MicroStepping
The foam cutter built on this website uses 1/8th microstepping. This is set by jumpers in the driver socket location. Set them as the diagram.


The firmware is preconfigured to use this setting with a 1.5mm pitch threaded rod. If you use a different microstepping, you will need to adjust the setting $100-$103 on the settings tab of the software.
If you are using different leadscrews/threaded rods, then this will need to be recalculated. A good resource is https://blog.prusaprinters.org/calculator_3416/, which has Steps per millimetre – leadscrew driven systems, calculator
Step 6 – Driver install
Install the DRV8825 stepper drivers onto the MKS board as shown in the diagram below. You can also use the A4988. The most important thing to check here is that the enable pin on the driver is aligned with the enabled socket pin on the board. If you reverse the driver, it will be destroyed. Double-check before you apply any power

Step 7 – Setting the driver current
The DRV8825 stepper drivers have a tiny trim pot to adjust the VRef(Voltage reference), which sets the current to the stepper motor. This value depends on your stepper motor current per phase. Use the calculator Calibrating the Hot Wire CNC Foam Cutter to get the correct value. Follow this link https://www.youtube.com/watch?v=flOsxI26Jfw&t=2285s showing how to do this.
Step 8 – Stepper Motors
Power off the board and connect the stepper motors to the board with the cables/wires from the parts list.
Power on the board and click Connect on GRBL Hotwire. The stepper motors will be difficult to turn by hand. This indicates they are working correctly. Try using the jog buttons to see if the motors turn.
If the motors don’t turn on or are erratic, the connector wires/cables may be wired incorrectly. This has happened to a few guys. Follow this link on how to check stepper motor wire pairing https://www.youtube.com/watch?v=yzCKXei0pLU&t=445s
This video is quite old now and shows the old stepper driver location, but the method to check the wire pairing is still the same. So follow this to get your motors working if incorrect cables have been supplied
Step 9 – Cooling Fans
The stepper drivers do get warm when sending current to the motors. If you use motors rated at less than 1 amp, you may be OK without a cooling fan. But I would recommend using one anyway. Connect a 12 or 24-volt fan to match the voltage of your power supply. Do not use the FAN socket, which is only for 3d printer firmware. I used two fans on a 3D-printed case


Step 10 – Foam Cutter Build
With the electronics tested and functioning properly, you can now confidently proceed with building the foam cutter.

4 Axis Hot Wire CNC Foam Cutter
The ebook and videos explain the mechanical build in detail. A final test of your build is to make sure you can turn the threaded rods or lead screws easily by hand. If they are hard to turn or bind you will most likely damage the electronics. If all is well, carry on with Step 11
Step 11- Foam Cutter Wiring
You will need to extend the stepper motor wires. Ensure you use a wire with the same or bigger gauge as the stepper motors. If you intend to use Homing, you must use a shielded/screen cable for the switches. You will have problems if you don’t.
If you’re using homing, connect the micro switch between the Normally Closed (NC) and Common terminals on the switch, and between the ground and signal pins on the relevant connector socket. It doesn’t matter which wire goes to ground or signal. External pull-up resistors aren’t necessary since they are built into the MKS Board
Step 12 – Do not enable homing
Make sure $22=0 in the settings tab. Even if you are using homing, it needs to be disabled for testing the correct axis direction.
Step 13 – Test Axis Direction
Ensure the machine is powered off. Manually turn the threaded rods or lead screws to move each axis away from its starting position. Turn them slowly to avoid generating back EMF that could affect the control board. If possible, disconnect the motor before doing this
When you test the axis direction, if it goes the wrong direction towards a hard mechanical stop, you can ruin your flexible couplers. I’ve done this a couple of times.
If you have disconnected them, reconnect your stepper motors and switch on the power.
Set the jog distance to 1mm and move each axis with the plus button, e.g. X+. The axis should move forward or up. If any of them are going in reverse, use the check box on the settings page to Invert Axis Direction. After each change, disconnect and reconnect to make sure the setting has been saved.
Step 14 – Calibration Check
The firmware is pre-configured with a value of 1066 in settings $100-$103 for the steps/mm. If you use different thread rods or lead screws that don’t have a pitch of 1.25mm. You will need to calculate a new value. A good resource is here https://blog.prusaprinters.org/calculator_3416/
You need to ensure that when the g-code sends a command to move a set distance, the foam cutter moves that distance. For example, if the command was G1 X100, then the X carriage moves that distance and not 99 to 101mm
Check my video here https://www.youtube.com/watch?v=CHbdUzbDYh8&t=692s showing how to check and adjust the steps/mm.
If you have used the same thread rods as I have, then I have found the default values need no adjustment. But check each axis is correct.
Step 15 – Homing (Optional)
The foam cutter works fine without using Homing with Limit Switches. You can jog each axis to your chosen position and click the zero buttons to set your start position.
XYZ Switch connections
A Swich connection
You can’t test Homing on the bench; it must be on the machine
The limit switches will prevent the axis from crashing into the end stops or going past the machine limits. You can use software limits to prevent the machine from exceeding its travel.
The majority of questions people contact me about have to do with homing problems. If you follow these guidelines, you shouldn’t have any issues.
- You are using the latest firmware and software
- You have used shielded/screened cables to connect your switches.
- The switches are wired NC(Normally closed)
- Only connect the Ground and Signal wires on the controller pins. Do not connect a 5-volt
- Ground the shield of the limit switch cable at the controller side only
- Before you enable homing with $22=1, check each axis moves in the correct direction when $22=0
I have a separate posting for troubleshooting CNC Homing here https://rckeith.co.uk/troubleshooting-cnc-homing/
You can now allow homing by setting $22=1 and $130-$133 to your maximum travel.
Once homing is enabled, check that the limit switch check boxes are not triggered. If one or more are then ensure $5=1 in the settings.

Trigger each switch by hand and ensure you can see the check box with a tick. If you can’t, then you have a wiring fault or wired the switches NO(Normally Open)
The Homing Cycle button will be red until a homing cycle is run. So click this button and watch each axis. If the axis starts to move in the wrong direction, use the Invert Homing Direction check box to change the direction. Disconnect and reconnect to ensure the settings are taken.
You can stop the homing cycle immediately by pressing the space bar or clicking the reset button.
I only use 4 switches with soft limits for maximum travel ($130-133). You can use 8 switches, but it adds a lot of extra wiring and points of failure. On my first foam cutter running Mach3 software, I had 8 switches and spent more time chasing broken or loose connections. I never exceeded the travel limits because I was ready to stop the machine if something went wrong.
Step 16 – Dry Run
Before you cut any foam, use the sample g-code on the downloads page to ensure the machine runs as expected. If you have followed this guide, then it should. Address any issues before setting the hot wire.
Step 17 – Hot Wire
The hot wire is connected to the D8 plug on the board. I use 0.4mm nichrome wire. My wire is tensioned by a bow which rests on guides. I have used a spring, but the bow puts less strain on the machine if you cut tapered wings.

Set the hot wire slider to around 10% and click the Turn Hotwire ON button. You may just be able to hear a slight buzzing. Keep your fingers away from the wire and try a piece of scrap foam to see if it melts.
To adjust the current to the wire, use the Override Current Setting buttons. Note that the slider will remain fixed while the g-code is running
Getting a good current setting for your wire may take several runs, but I have put together a posting which explains a good method https://rckeith.co.uk/how-to-get-a-good-kerf-setting-for-cnc-foam-cutters/
Step 18 – First Cut
Now you are ready to try the sample g-code to check your machine. Home the machine or set all axes to zero.

Secure your foam block with double-sided tape or a weight. Jog the wire to the start of the foam.
Set your hot wire to a value you found in the previous step and click the run button.
Check the hot wire from above to make sure it is straight and not being pulled out of alignment. If the wire is being dragged, increase the current using the Override Current Setting. On the other hand, if the foam is melting much more than the width of the wire, reduce the current.
Step 19 – G-code generation
If you have reached this step, then congratulations, you can now build some exciting projects.
Now that your machine is working, you will want to generate some g-code for your projects. Please refer to this posting for the options available to you https://rckeith.co.uk/foam-wing-free-cnc-software/
I use DevWing Foam 2 and DevFus Foam 2 for all my projects. Although these are paid software options, I believe they are worth every penny. The free alternatives are sufficient for simple wings, but if you need advanced features like dihedral, washout, and lightning holes, these software packages are the best choice. Since I no longer purchase RC models, I’ve easily recouped the costs many times over

Summary

