Skip to content
Home » Documentation Home » Laser Upgrades » Relay Control

Relay Control

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.

Overview of control board and where to connect relay. You can choose any VCC (5V) line on the board, e.g., the V-Pin from the Extra- or Probe-ports will work as well. (mainboard picture stolen from plottmania)

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.

I do not recommend to use two-pole SSRs because the control pin of the mainboard is misused as a power supply. In the worst case, this can lead to the pin being overloaded and damaged. Therefore, always use a relay that has a separate power supply and uses the pin only for triggering.

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.

This is a very rough schematic drawing 🙂 If I find time, I will update it.

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.

In the Device settings dialog, you can select whether you’d like to use M7 or M8 as a control command.
In your layer settings, you can enable the Air Assist button for each desired layer

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

If you are not familiar with soldering, you can use such a Dupont wire (male+female) to connect the relay if it has screw terminals like the one in the picture above.

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

In the machine settings in LightBurn, M7 must be selected as the control signal for Air Assist.

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):

Relay connection MKS DLC32

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