Installing LaserGRBL on Debian
Running LaserGRBL on Debian under Wine
I recently got a GRBL based laser cutter, and it seems that unlike with 3D printer software, there isn't anything graphical that's FOSS that runs on Linux for laser cutting. However, there IS LaserGRBL, which is for Windows, but is GPL3 licensed. This is how I got it working on my Debian system.
There are instructions on the LaserGRBL website, but they seem very outdated, and I couldn't get it working using them my system, so I had to work out my own way. I definitely used them as guidance, though, and some parts work without modification. After a fair bit of experimentation, I did get up it and running, and have successfully used LaserGRBL to control my Sculpfun S30 laser cutter!
First off, these instructions are only guaranteed to work on Debian 12 (Bookworm) with the software releases I'm stating right here... things change, so these instructions might need further tinkering if the current versions are newer than what I'm talking about here. Hopefully this will help you get going anyway...
Software releases
- LaserGRBL v6.1.1 or v6.2.0 (newer may well work, but YMMV)
- Debian 12 (Bookworm) 64-bit x86_64
- MATE Desktop
- Wine 8.0
Hardware requirements
- An Intel or AMD based PC (I don't expect this to run on Raspberry Pi or anything ARM based)
- USB-connected GRBL-based CNC laser cutter
Installing
First, add yourself to the dialout group so you can access the USB ports.
sudo usermod -aG dialout andy
Obviously, replace "andy" with your username. Now log out of your Linux
session, and back in again. If you get an "Access Denied" message later when
trying to connect to your laser cutter, you need to check this bit. A reboot
might help if you have definitely done it and it still doesn't work. Go figure.
You can check your group memberships with the command groups
to confirm that
"dialout" is listed.
Continue installing...
sudo dpkg --add-architecture i386 sudo apt update sudo apt install libmpg123-0:i386 sudo apt install wine wine64 wine32 wget wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks chmod +x winetricks ./winetricks gdiplus msxml3 mkdir ~/.fonts ln -s /usr/share/wine/fonts/tahoma.ttf .fonts/
When you plug your laser into your PC, a new entry for it will appear in /dev,
named either "ttyUSBn" or "ttyACMn" (n may vary, but is usually 0 if you
don't usually have any other USB serial communications devices plugged in, like
Arduino's, 3D printers or similar devices. The command ls /dev/tty*
will list
your "tty" devices - run the command before you plug in, then again after, and
compare the output.
Now we need to set up some virtual USB ports in wine: run the command
wine regedit
The regedit application should load. Perform the following steps, substituting the name of the ttyUSB or ttyACM devices you identified in the previous step.
- Navigate to HKEY_LOCAL_MACHINE/Software/Wine/Ports
- Create a String key named "com10" and set its value to "/dev/ttyUSB0" OR "/dev/ttyACM0"
- Exit regedit
Now create a soft link to the your ttyUSB or ttyACM device. Run the appropriate one of the following, substituting your actual device name as appropriate:
ln -s /dev/ttyUSB0 ~/.wine/dosdevices/com10
ln -s /dev/ttyACM0 ~/.wine/dosdevices/com10
Ok, now the prep is mostly done - wine should be up and running, and your ports should be accessible. LaserGRBL needs the mono library (a Free Software Microsoft .NET-compatible framework), so we need to download and install it:
wget http://dl.winehq.org/wine/wine-mono/4.9.4/wine-mono-4.9.4.msi wine msiexec /i wine-mono-4.9.4.msi
Now we get to the money shot: download and install LaserGRBL:
wget https://github.com/arkypita/LaserGRBL/releases/latest/download/install.exe
This should run the LaserGRBL installer - just take the defaults - and then start LaserGRBL itself at the end. If it doesn't start up, you need to find out what it's failing on, and the easiest way to do that is to run it from the Linux command-line:
wine "C:Program Files (x86)/LaserGRBL/LaserGRBL.exe"
If something is still wrong, it will probably vomit out a "stack trace" and you can hone your google-fu to find out what's wrong! For example, you might get a message about being unable to load a font, check you did the tahoma.ttf copying step properly.
First steps using LaserGRBL
There are excellent instructions on the LaserGRBL website, but some things took me a while to figure out - maybe I'm just slow - but you might find this useful:
- You connect LaserGRBL to your Laser CNC device by selecting the correct COM port in the top left of the window, then the baud rate (115200 works for me), and then clicking the "Plug and lightning" icon to the right of these. You should hear a confirmation beep when successful.
- Before you can start cutting, you probably need to click the "Home Cycle" button on the icon dock at the bottom of the window. This will make your device seek to its limit switches - if it has them. If this doesn't exist, you might need to switch this on.
- To switch on "Home Cycle" you may need to go to "GRBL/Grbl Configuration", and adjust "$22 | Homing cycle enable" to "1" and then click the "Write" button. If you can't find this, it might mean your device doesn't support this function.
- You can click the "Home" button in the middle of the cluster of "jog" arrows to seek the head to 0,0.
- You can load various vector and bitmap resources for engraving or cutting using either "File/Open File" or the "Filename" field just under the COM and Baud fields - click the little "folder" icon to the right of the field.
- I'm mainly using ".svg" (scalable vector graphics) made with Inkscape, another brilliant FOSS program.
- If you want to engrave and cut in the same job, split your source file into separate parts for each pass, and load the first asset as normal, set the engrave parameters accordingly; THEN load the next part with "File/Append File", and set the parameters for cutting - this adds the new asset "onto the end" of the currently loaded one. It seems important that the assets are the same dimensions so they line up.
- The "jog" buttons can be used to move the laser head around your workpiece to position for cutting, but you have to click on the "Globe" icon to make the next job start from this point, otherwise it will just start from 0,0 agin.
- Before you start burning, you can use the "Frame" button to move the laser head around the perimiter of your loaded asset in order to check it's lined up right.
- If your device has an air pump, you can switch it on automatically at the start and end of your jobs by adding a little G-Code to the "Header" and "Footer" settings. Go to "Grbl/Settings", and change to the "GCode" tab; then add "M08" to the Header code, and "M09" to the Footer code (both on a new line).
- You can create "Custom buttons" to run arbitrary G-Code when you click their icon - right-click on the blank space next to the icons in the bottom icon dock, and select "Add Custom Button".
- There is a G-Code reference for GRBL at https://www.sainsmart.com/blogs/news/grbl-v1-1-quick-reference
Good luck out there!