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.
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.
1. Save settings first!
2. Do firmware update
3. Check settings and restore if needed
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.
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.
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
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.
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
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!
- 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.
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!
|#||Standard||Changes S6/S9||Changes Homing||Explanation||Comment|
|$0||10||Step pulse, microseconds|
|$1||25||Step idle delay, milliseconds|
|$2||0||Step port invert, mask|
|$3||0||Direction port invert, mask||Here the motors of the axes can be turned around if necessary (e.g. if you have to turn the whole frame) [Values: 0-3]|
|$4||0||Step enable invert, boolean|
|$5||0||0/1||Limit pins invert, boolean||Depending on switches. Some limit switches have inverted behavior, this can be compensated here.|
|$6||0||Probe pin invert, boolean|
|$10||1||0/1||Status report, mask||Depending on workspace configuration, see article about limit switches.|
|$11||0.010||Junction deviation, mm|
|$12||0.002||Arc tolerance, mm|
|$13||0||Report inches, boolean|
|$20||0||1||Soft limits, boolean|
|$21||0||Hard limits, boolean|
|$22||1||0||1||Homing cycle, boolean|
|$23||0||0||0-7||Homing dir invert, mask||Depending on position of switches; see guide for homing|
|$24||25.000||75.000||Homing feed, mm/min|
|$25||500.000||1000.000||Homing seek, mm/min|
|$26||250||Homing debounce, milliseconds|
|$27||1.000||1.000||Homing pull-off, mm||Return distance into the workspace after reaching the home position|
|$30||1000||Max spindle speed, RPM|
|$31||0||Min spindle speed, RPM|
|$32||0||1||1||Laser mode, boolean|
|$100||250.000||80.000||80.000||X steps/mm||Can be calibrated even more precisely as required|
|$101||250.000||80.000||80.000||Y steps/mm||see above|
|$110||500.000||5000.000||5000.000||X Max rate, mm/min||Often, 6000 is also entered here. I still want to make a measurement to the real maximum achievable value.|
|$111||500.000||5000.000||5000.000||Y Max rate, mm/min|
|$112||500.000||Z Max rate, mm/min|
|$120||10.000||250.000||250.000||X Acceleration, mm/sec^2||1000 is often entered here. In my view, this is clearly too high. However, 500 is usually still possible.|
|$121||10.000||250.000||250.000||Y Acceleration, mm/sec^2||see above|
|$122||10.000||Z Acceleration, mm/sec^2|
|$130||200.000||410.000||410.000||X Max travel, mm||May vary according to conditions|
|$131||200.000||400.000||400.00||Y Max travel, mm||see above|
|$132||200.000||Z Max travel, mm|