Skip to content
Home » Documentation Home » Firmware Update & Settings

Firmware Update & Settings

Note

The following descriptions refer to lasers with Arduino or ATmega microcontrollers. This means the mainboards of S6 and S9. The S10 laser has a new mainboard with an ESP32 chip, which can NOT be flashed with the following methods.

UPDATE
Sculpfun released an official firmware update for the S10 model. You can download the file at the bottom of this page. The update tool and procedure is described there as well.

The firmware is located on the control board. The controller used on most cheap laser engravers is based on an Arduino Uno architecture, since the first boards used genuine Arduino Uno boards with CNC-shields attached. Though, the microcontroller is an ATMega328 that is already shipped with an Arduino bootloader (you don’t need to take care of this technical stuff). Not only the parameters can be changed here, but the whole firmware can be exchanged / changed. Since it is an open project, anyone can make their own changes to the firmware and upload it. I recommend everyone to install the latest version of grbl (1.1h). There are several ways to do this, the easiest is via LaserGRBL (two firmware versions are already included here). But it also works via command line or Arduino IDE.

If you need to make custom modifications to the firmware, you need to compile it using the Arduino IDE. The way how to do it is explained on the grbl wiki (https://github.com/gnea/grbl/wiki/Compiling-Grbl). If you have a standard setup, you can select the already compiled versions provided with LaserGRBL.

Myths about microcontrollers and firmware updates

I constantly read statements about the firmware which, to my knowledge, are wrong. This is why I wanted to clarify a few things:

  • The EEPROM (non-volatile memory of the controller) has limited write cycles
    • Right. BUT: the EEPROM of ATMega microcontrollers has a lifetime of 100,000 write cycles. So if you rewrite your memory daily, you can do it for 270 years until you break it. SO: don’t care about it!
  • The EEPROM does not save settings correctly
    • Entirely wrong. Once written, the settings are stored and can’t get corrupted. 99.99% of users that tell me the controller does not save their settings did not press the SAVE or WRITE button in the control software. Just changing values and clicking OK in the dialog window does not necessarily mean that the settings are written into the memory. Take care of this.
  • Flashing firmware can break your controller
    • Partly correct. Of course, you can break your controller by flashing wrong firmware. BUT as long as you just use standard flash tools and do not alter the fuses settings (if you don’t know what this is, you most likely won’t alter them), you can always re-flash the controller with a new firmware. If you overwrite the bootloader of the controller, you can’t flash directly via USB anymore, but the MKS-DLC boards offer an ISP connector to flash the controller manually. In my whole career, I just broke 1 controller completely (and I flashed thousands). So, the chance you do it is minimal.
  • You can reset the controller by pressing the RESET button on the main board.
    • Wrong. This reset button just does a reboot of the controller. Nothing is reset or set to default values.

Update process

Major steps

1. Save settings first!
2. Do firmware update
3. Check settings and restore if needed

Saving settings

Saving settings is important once you flash the firmware, since some values might be reset to factory settings while flashing. It is even recommended to reset to factory defaults after flashing and then replace changed values by your backup.

Save settings via LaserGRBL

First, you need to connect to the laser by selecting the correct COM port and click on the connection icon.

Select GRBL -> GRBL configuration
Click on Export or note down the values.
The output should look like this. (Values might be different!)

Pre-compiled firmware upload via LaserGRBL

If you just want to upgrade to the latest available grbl firmware, you can use precompiled firmware images (.hex files) that are delivered with LaserGRBL. You even have two options available, either if you have a standard setup without end stops or if you have end stops and can use automatic homing. More information at the LaserGRBL firmware flash page.

LaserGRBL

Step-per-step screenshots:

Click on Tools -> Flash Grbl Firmware
As target you select “Arduino Uno”
Select a firmware (v1.1h either with or w/o homing)
Check the COM port
Click OK
A command window opens showing the flash progress

Firmware for Sculpfun lasers

Since a few default settings of grbl do not correspond to those of the Sculpfun lasers, I compiled my own version of the firmware, which is as close as possible to the firmware that can be installed via LaserGRBL, but all default settings are optimized for the Sculpfun lasers.

List of changes

The following changes have been made compared to the standard firmware:

//Optimize Homing
#define HOMING_CYCLE_0 ((1<<X_AXIS)|(1<<Y_AXIS))  // Homes both X-Y in one cycle. 
#define N_HOMING_LOCATE_CYCLE 2 // improve repeatability
#define HOMING_FORCE_SET_ORIGIN // set the machine origin at the homed location
//Enable second pin for relay control
#define ENABLE_M7 // Enables a second coolant control pin

//Firmware default values
  #define DEFAULT_X_STEPS_PER_MM 80.0
  #define DEFAULT_Y_STEPS_PER_MM 80.0
  #define DEFAULT_Z_STEPS_PER_MM 80.0
  #define DEFAULT_X_MAX_RATE 6000.0 // mm/min
  #define DEFAULT_Y_MAX_RATE 6000.0 // mm/min
  #define DEFAULT_Z_MAX_RATE 6000.0 // mm/min
  #define DEFAULT_X_ACCELERATION (500.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
  #define DEFAULT_Y_ACCELERATION (500.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
  #define DEFAULT_Z_ACCELERATION (500.0*60*60) // 10*60*60 mm/min^2 = 10 mm/sec^2
  #define DEFAULT_X_MAX_TRAVEL 410.0 // mm NOTE: Must be a positive value.
  #define DEFAULT_Y_MAX_TRAVEL 400.0 // mm NOTE: Must be a positive value.
  #define DEFAULT_Z_MAX_TRAVEL 800.0 // mm NOTE: Must be a positive value.
  #define DEFAULT_SPINDLE_RPM_MAX 1000.0 // rpm
  #define DEFAULT_SPINDLE_RPM_MIN 0.0 // rpm
  #define DEFAULT_STEP_PULSE_MICROSECONDS 10
  #define DEFAULT_STEPPING_INVERT_MASK 0
  #define DEFAULT_DIRECTION_INVERT_MASK 0
  #define DEFAULT_STEPPER_IDLE_LOCK_TIME 25 
  #define DEFAULT_STATUS_REPORT_MASK 1 // MPos enabled
  #define DEFAULT_JUNCTION_DEVIATION 0.01 // mm
  #define DEFAULT_ARC_TOLERANCE 0.002 // mm
  #define DEFAULT_REPORT_INCHES 0 // false
  #define DEFAULT_INVERT_ST_ENABLE 0 // false
  #define DEFAULT_INVERT_LIMIT_PINS 0 // false
  #define DEFAULT_SOFT_LIMIT_ENABLE 0 // false
  #define DEFAULT_HARD_LIMIT_ENABLE 0  // false
  #define DEFAULT_INVERT_PROBE_PIN 0 // false
  #define DEFAULT_LASER_MODE 1 // false
  #define DEFAULT_HOMING_ENABLE 0  // false
  #define DEFAULT_HOMING_DIR_MASK 0 // move positive dir
  #define DEFAULT_HOMING_FEED_RATE 75.0 // mm/min
  #define DEFAULT_HOMING_SEEK_RATE 1000.0 // mm/min
  #define DEFAULT_HOMING_DEBOUNCE_DELAY 250 // msec (0-65k)
  #define DEFAULT_HOMING_PULLOFF 1.0 // mm

Download: v1.1h-custom-S6S9.hex

The file can be installed in several ways. I would consider the following two to be the easiest.

Installation via LaserGRBL

To enable LaserGRBL to offer the firmware in its dialog window, it must be moved into the firmware directory within LaserGRBL.

Installation via Xloader

There is a small tool, XLoader, which can be used to upload the hex files without any other tools. I have prepared an archive here that already contains the correct firmware: Download XLoader. With this, you can upload the firmware directly. The firmware file and the COM port must still be selected accordingly.

Flashing via Xloader application

Regardless of which method was selected, the firmware should then report with the version string “grbl 1.1h_S6S9universal”. Now all settings should be reset to the factory defaults, this is done with the command “$RST=*”. Thereafter, the parameters can be adjusted to the personal preferences again or restored from the backup.

If you have now misconfigured your parameters, you can always return to the Sculpfun defaults with the command “$RST=*” and have a running machine again.

Self-compiled firmware using Arduino IDE

Since I am used to compiling my own firmware via Arduino IDE, PlatformIO or just command line, I normally use this process. The process to prepare the firmware and upload it to the controller is described very well at the grbl homepage: Compiling grbl

After the files are installed as Arduino-library, there are three files that are interesting: config.h, defaults.h and cpu_map.h. cpu_map.h is just for information, which Arduino pins are mapped to which functions. Of course, you can adapt those to your needs. Defaults.h contains the default settings that are loaded if you reset the controller to firmware defaults. I use this to define my personal defaults and don’t have to care about saving them each time I change the firmware.

The most interesting file is config.h. Here you can set every setting you might need. This includes adding additional functionality, inverting logic pins, or adjusting parameters. After changing the parameters as you like, you do an upload using the Arduino IDE.

LightBurn recently released a video guide on how to install the self-compiled firmware on a Sculpfun laser:

Rebooting the controller

As stated before, a reboot can be issued by pressing the reset button on the main board (if there is one). Obviously, you can also reboot the controller by power cycling it. BE AWARE: nearly all main boards of diode lasers (and 3D printers as well) have an electrical connection between the USB connection and the microcontroller. If you just turn off the main power switch and leave the USB connection active (PC is turned on and providing power through USB)—the microcontroller IS NOT TURNED OFF! It is still running and using power from USB. So, it does no reboot cycle. [You can check this out by only connecting the USB cable and then use LightBurn or LaserGRBL to connect to your laser. This will work. You can also alter settings and save them. You can check the state of limit switches and all periphery. Only the motors and laser do not work because they need extra power.] So if you really want to reboot your controller, you need to turn off main power and also cut the USB connection. Then you have a clean reboot.

If you want to avoid this, you can also disconnect the supply voltage (VCC, the 5V line, usually red cable) from the USB cable. Then data can still be transferred, but without the main power supply, the microcontroller will also turn off.

[Update April 2022] There appears to be a new version of the motherboard, XY DLC V1.1. Here, it appears to me that this has already been changed, and the microcontroller is switched off completely when the main switch is pressed. Cool!

Firmware update S10

Note

The official firmware image is now available! You can download the file here: Download-Link

The S10 laser does not have an ATmega microcontroller on the mainboard like the other lasers, but an ESP32 chip. This is not relevant for most users, but the ESP represents a different (newer) generation of chip. Among other things, it supports Wi-Fi, but this is not currently enabled. I assume that this functionality will be integrated at some time. The chip is much more powerful than the old generation and can therefore work at higher speeds. But since almost all firmwares for the ESP32 chips currently only use a port of the old grbl code, the improvements are still very limited.

For the update, a separate tool is needed that I have seen so far only for Windows systems. Here is the download link. Those with a Mac will have to resort to virtualization like Parallels or a Windows machine. In the following series of pictures, the upload is explained. Be sure to back up your firmware settings if you changed any values!

Note:

  • It is best to connect ONLY the USB cable, DO NOT connect the power supply or leave the small switch in the OFF position. The controller is powered via the USB cable and may not reset properly if external power is on.
  • After flashing, all settings are reset to factory defaults. Therefore, also in this case, make a backup of the settings before! (E.g., with LaserGRBL, as described above, this also works for the S10).
  • After the successful flashing, unplug the USB cable once and plug it in again so that the controller restarts (therefore do not connect another power cable, then it will not restart).

Now the laser should connect again as usual.

Recommended Firmware Settings

If you want to change a setting, you can do this via the console by entering the parameter, followed by an equal sign and the corresponding value, and then pressing Enter. The controller should answer with OK. You can display all current parameters by typing “$$” and pressing enter.

Example of setting the $131 parameter

LightBurn and LaserGRBL also have graphical dialogs to change these settings (“Machine Settings” in LightBurn and “grbl Configuration” in LaserGRBL).

The following table lists my recommended settings for the S6/S9 lasers. The “standard”-column lists the values that are set standard in the grbl firmware. The “S6/S9”-column shows the recommended / required settings for S6/S9. The third column lists changes that are required if you activate homing functionality. If there is no value in a column, the standard value is used!

#StandardChanges S6/S9Changes HomingExplanationComment
$010Step pulse, microseconds
$125Step idle delay, milliseconds
$20Step port invert, mask
$30Direction port invert, maskHere the motors of the axes can be turned around if necessary (e.g. if you have to turn the whole frame) [Values: 0-3]
$40Step enable invert, boolean
$500/1 Limit pins invert, booleanDepending on switches. Some limit switches have inverted behavior, this can be compensated here.
$60Probe pin invert, boolean
$1010/1Status report, maskDepending on workspace configuration, see article about limit switches.
$110.010Junction deviation, mm
$120.002Arc tolerance, mm
$130Report inches, boolean
$2001Soft limits, boolean
$210Hard limits, boolean
$22101Homing cycle, boolean
$23000-7 Homing dir invert, maskDepending on position of switches; see guide for homing
$2425.00075.000Homing feed, mm/min
$25500.0001000.000Homing seek, mm/min
$26250Homing debounce, milliseconds
$271.0001.000Homing pull-off, mmReturn distance into the workspace after reaching the home position
$301000Max spindle speed, RPM
$310Min spindle speed, RPM
$32011Laser mode, boolean
$100250.00080.00080.000X steps/mmCan be calibrated even more precisely as required
$101250.00080.00080.000Y steps/mmsee above
$102250.000Z steps/mm
$110500.0005000.0005000.000X Max rate, mm/minOften, 6000 is also entered here. I still want to make a measurement to the real maximum achievable value.
$111500.0005000.0005000.000Y Max rate, mm/min
$112500.000Z Max rate, mm/min
$12010.000250.000250.000X Acceleration, mm/sec^21000 is often entered here. In my view, this is clearly too high. However, 500 is usually still possible.
$12110.000250.000250.000Y Acceleration, mm/sec^2see above
$12210.000Z Acceleration, mm/sec^2
$130200.000410.000410.000X Max travel, mmMay vary according to conditions
$131200.000400.000400.00Y Max travel, mmsee above
$132200.000Z Max travel, mm
Values for the grbl settings. In the columns, only the changed values that are relevant are printed.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.