CNC, Easel & Linux

We've toyed with the idea of getting a small CNC machine for a while and recently decided to take the plunge. After looking around we decided to get a Genmitsu 3018 ProVER (apparently the numbers reflect the size of bed the machine has, i.e. 30cm x 18cm).

Once the kit arrived assembly took a while (certainly not the 15 minutes they advertised) but all tools needed were provided together with some excellent instructions.

Software

The machine operates using grbl, an open source project that seems to be very widely adopted. Not being familiar with CNC this didn't help much and a lot of the software I initially found was seriously expensive :-( However, while researching the machine via YouTube we saw Easel being used. This turned out to be  a great recommendation as it is very straightforward to use.

As Easel is a webapp it also has the advantage of being able to run on any operating system. To interface with the CNC machine driver packages are provided for Linux, Windows and Mac.

Ready to Carve?

Rather than start with the usual Easel test piece, we jumped straight into creating a sign. This was a great way to find a lot of the limitations of Easel and rapidly increase our knowledge of CNC. It also threw up the first roadblock.

We took advantage of the web based nature of Easel to create the project in the warmth of our office before moving into the colder, draughtier workshop where the CNC machine was located. The primary computer in the workshop is an old Thinkpad laptop. It runs Ubuntu nicely enough for what's needed of it and so this was an ideal candidate for connecting to the CNC machine.

Once the USB was connected, FireFox was pointed at Easel and the project loaded we started the process to install the drivers and start setting up the machine.

Except it didn't work.

Privileges

The downloads available are listed on the Easel website which provides a .deb package for Linux. Unfortunately when the webapp kindly offers to download and install it on Linux the process fails as it needs higher privileges. The solution was to save the file and then install it directly using the command line

$ sudo dpkg -i ~/Downloads/EaselDriver-0.3.20-x64.deb

This worked as expected and moved things along with Easel. After picking the machine type, selecting the correct settings I hit the Confirm button.

Nothing happened.

A Few Days Later

Having been stymied by the connection and setup on Linux we resorted to using a MacBook Air for the first few carves. This had no problem connecting but was only ever a temporary fix.

Having used the machine a few times we decided we needed a larger working area so ordered the extension kits to convert it into a 3040 machine. This video was very helpful for the upgrade although the kit we received was subtly different. While doing the upgrade we also changed the physical location to make it easier to use. The new location meant it was now more permanently attached to an old PC running Ubuntu.

Of course this exhibited the same issue whereby the driver was installed but no connection was possible. :-(

Drivers?

After some looking at what had been installed, it became apparent that the easel-driver package was simply a nodejs package that handled communication between the webapp and the CNC machine. There wasn't a huge amount to it, so the failure to work was a bit puzzling. Some web searches later I came across an unofficial driver that provided a working driver. Specifically it mentioned the CH340 interface the CNC uses.

~$ lsusb
...
Bus 001 Device 005: ID 1a86:7523 QinHeng Electronics CH340 serial converter

Sadly I was unable to get the install script for the unofficial driver to work fully with various nvm errors constantly reported. As the Ubuntu 21.04 nodejs package was sufficiently modern I installed that and was then able to run it directly.

$ sudo apt install nodejs
$ cd easel-driver
~/easel-driver$ node ./iris.js

Running it this way allowed me to observe the logging output, revealing a few issues.

Permissions

The CNC machine is detected and installed as /dev/ttyUSB0.

crw-rw----+ 1 root  dialout 188,  0 May 27 22:08 /dev/ttyUSB0

Of course the user I was logged in as was just my regular user which lacked permissions for the dialout group. Fixing this was simple.

$ sudo usermod -a -G dialout david

After logging out and back in things looked better, but the connection still wasn't working.

Switch Off, Switch On

To double check what was going on I used minicom to connect to the CNC machine and see if everything looked OK.

ALARM:1
[MSG:Reset to continue]

Seeing this I checked the machine and powered it off and on again. This time Easel connected :-) Stopping the patched easel-driver and trying again with the Inventables.com version resulted in no connection, so the patches installed via the unofficial driver are needed for the CNC controller.

Patching

After looking at the patched files I added the patch from  the unofficial lib/serial_port_controller.js file to the Inventables version. This has worked without issue and allows me to use the installed systemd service to control the easel-driver.

It would be really helpful if Easel could add the small patch to their driver as a lot of smaller CNC machines use a CH340 or CH341 serial interface. However, at least the solution was easy enough and despite taking some time to figure out I have learned a lot about Easel, grbl and CNC along the way :-)