Update S10
At the bottom of the page you will find an Update how to connect the relay at the S10 laser.
Adding relay to control extra devices
Most control boards offer the ability to attach a relay that can be triggered by firmware commands. You can use this, e.g., for controlling the air assist compressor. If the firmware is compiled with standard parameters (or taken from LaserGRBL), there is one control command available. This command is “M8”. This is a G-code command as explained in the Basic Principles chapter. There is another command, “M7”, that is available only if you compiled your firmware and activated this function. Both commands tell the firmware to trigger a pin on the control board which can be used to control other devices like lights, fans, or air assist systems. To turn off the pins, issue the “M9” command in the command line. Both pins are turned off, you can’t turn off them individually. The following picture shows where you find the pins that are controlled by those commands.

Since those pins are incapable of driving high loads, you need to connect a relay to them. The picture shows how to do it. There is a pin header in the top right of the board next to the end stop connectors. Here you find some analog microcontroller pins made available. The ones we are looking for are A3 and A4 (this one only if you use your individual firmware as mentioned above). Most relays need three pins to be controlled: VCC and GND (voltage) and the control signal (sometimes named IN, or S). Connect them as depicted, and you are ready to go. Now you can test it by typing “M8” in the command line and pressing the enter key. You should hear a clicking sound at the relay (or a small LED showing status). If you used a solid-state relay, there is no clicking sound. For solid-state relays, I recommend one that has separate inputs for voltage and trigger, like this one: AliExpress.



If you use a conventional relay, I recommend buying one that can select between high-level-active and low-level-active, like this: Amazon-Link. This way, you can invert the logic at the relay. Some users had the relay active all the time and only turned off if they command M8. In this case, you need to invert the relay logic from high-level to low-level or vice versa. The standard trigger is defined in the firmware like this: low-level: disabled/high-level: enabled (the relay should state high-level-active in this case). You can also compile your own firmware to invert this setting, in case you have a low-level-active relay that can’t swap input logic. Another remark: make sure, the relay is rated for 5V (not 12V or something different). The power line needs to connected to the COM and NO (normally open) contacts on the high voltage side.
Warning
Using a relay, you can connect/control any load to it. Even 110/220V devices like the air assist compressor. Only do that by yourself, if you know what you are doing! Electricity is nothing to play with, it can be deadly! Better ask an electrician to help you out.
The control board itself is harmless to work with, it only contains 5V and 12V power lines which can safely be touched while active (though it might break if you cause a short circuit). Hence, you better disconnect it from power (power supply AND USB cable) while connecting cables.

Configuring LightBurn to automatically turn on / off air assist
LightBurn can be configured to automatically use those commands to start / stop the air assist compressor while working.


From now on, the compressor is turned on while the laser is working and turned off afterwards.

Sculpfun S10
With the S10, there is a small change to the S6/S9 (at least with the current version of the firmware). The ports are named differently, and as far as I found out, there is only one pin that can be toggled. The pin is IO04 and is toggled by the M7 command.


To control the relay, you have to use the command M7, not as usual M8 (I think with further firmware versions this will also be improved / changed). It is also important that it is a high-level trigger relay, as you can not invert the pin here. For example: AliExpress link

MKS DLC32
If you use a MKS DLC32 mainboard, you can connect a relay as well, as shown in the diagram below (thanks to Lionel Koehl):

The control of the relay is also done using the M7 command.