Use With Lasers - bdring/Grbl_ESP32_MPCNC_Controller GitHub Wiki
About Lasers
Warning
Use of this controller with lasers can potentially be dangerous. There is always a chance the Grbl_ESP32 firmware or this controller will fail in state that turns the laser on. You should have other safety measures in place to make sure the laser cannot fire when you do not want it to, You should always be present when using a laser. You must always be ready to turn it off if something goes wrong. By connecting a laser to this controller you are assuming all safety responsibility.
Overview
The controller can output a power level signal that can be used to control a laser. There are countless varieties of laser power supplies, so there is no guarantee it will work with your laser. It has been only tested with low power (3.5W) laser diode modules.
Grbl_ESP32 Laser Capabilities
Grbl_ESP32 supports the same laser mode as regular Grbl. You can read about it here. Grbl_ESP32 also has a lot of flexibility with the frequency and resolution of the PWM power signal to the laser. It is easily set in the cpu_map.h file. The default PWM frequency is 5kHz, but many laser power supplies prefer around 20kHz.
Laser engraving gcode files are huge. You may be able to stream them over USB/Serial or Telnet, but it is highly recommended to run files from the SD card. That has the highest speed and most reliable connection to the CPU.
Controller
To output a PWM signal you need to disable the spindle relay in the cpu_map.h file by commenting out #USE_SPINDLE_RELAY.
The ESP32 is a 3.3v device. The controller has a level shifter that converts the 3.3v PWM signal to a 5V PWM signal. The device is a TI TXS010. The level is shifted to 5V via a 10k internal resistor. Any pull down resistors that might be on your laser power supply can reduce the 5V.
The PWM is output on a pin near the relay. Next to that are (2) pins labeled interlock. The PWM goes to one of the interlock pins and the other interlock pin is connected to the pin labeled PWM. You need to connect the (2) interlock pins together in order for the PWM signal to reach the pin labeled PWM. Ideally you would do this through a cover switch or e-stop button. This could be used as one part of a safety interlock. A more safe alternative would be to also cut all power to the laser.
Note: If you disable the spindle relay, you can assign the I/O pin used on the relay to another function like mist of flood coolant. This could be used to turn on assist air or fans.