Skip to content

Easel driver for Linux, Mac, Windows, ARM, Raspberry Pi, Intel, FTDI, CH340, CH341, CP210x, FTDI clones, local, and remote access to GRBL-based CNC controllers

Notifications You must be signed in to change notification settings

samyk/easel-driver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 

Repository files navigation

easel-driver

UNOFFICIAL Easel driver for Linux (including Raspberry Pi/ARM processors), Mac, Windows + ability to run Easel from a remote computer (providing remote access to CNC mill).

Can be used with X-Carve, Carvey, and other GRBL-based controllers (though it might void your warranty)

Description

I use this to run my CNC mill connected to a Raspberry Pi, and then access it remotely from a non-Linux machine across the network. This is convenient if you don't want to have your CNC mill connected directly to your computer via USB or if you want to run your mill on Linux and still use Inventables' Easel.

The following commands will get the Easel driver running on Linux (tested on Raspberry Pi 3). Additionally, I've added port forwarding instructions if you wish to have your local computer port forward to your Easel machine (Easel's web interface will connect to the port forwarding mechanism on your computer which will forward to the computer your mill is actually connected to).

Note that while Inventables does now offer a Linux driver, it's only for X86 processors and not ARM processors, like the Raspberry Pi.

Commands

# Move previous out of way if exists
if [ -e 'easel-driver' ]; then mv easel-driver easel-driver.bak.`date +%s`; fi &&

# Create dir to work in
mkdir -p easel-driver &&
cd easel-driver &&

# Install wget to grab official Easel Driver
sudo apt-get install -y wget &&

# Download latest Easel Driver for Mac (which we'll extract necessary components from)
wget -O - http://easel.inventables.com/downloads | perl -ne 'print $1 if /href="([^"]+EaselDriver\S+\.pkg[^"]*)/' | xargs wget -O EaselDriver.pkg &&

# Install p7zip to unpack xar archive
sudo apt-get install -y p7zip-full &&

# Unpack Easel Driver
7z x EaselDriver.pkg &&

# Unpack the primary Easel files
cd IrisLib*.pkg &&
zcat Payload | cpio -idv &&

# Grab the necessary files
cp -r lib iris.js package.json ssl avrdude/etc/avrdude.conf ../ &&
cd .. &&

# Move avrdude.conf into lib/etc as that's where the easel driver will look
mkdir lib/etc &&
mv avrdude.conf lib/etc &&
ln -s lib/etc etc &&

# Modify the firmware uploader to support Linux
perl -pi -e 'if (/var PLATFORMS/) { $x = chr(39); print; $_ = "\t${x}Linux${x}: {\n\t\troot: ${x}/usr/bin/avrdude${x},\n\t\texecutable: ${x}/usr/bin/avrdude${x},\n\t\tconfig: path.join(__dirname, ${x}etc/avrdude.conf${x})\n\t},\n"; }' lib/firmware_uploader.js &&

# Install nodejs using nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.0/install.sh | bash - &&

export NVM_DIR="$HOME/.nvm" &&
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" && # This loads nvm bash_completion
. ~/.bashrc &&

# Install nodejs lts
nvm install --lts &&
nvm use 'lts/*' && # LTS 10.x

# Install avrdude for firmware upgrades
sudo apt-get install -y avrdude &&

# Install screen to run in background
sudo apt-get install -y screen &&

# Install the necessary node modules
npm install &&
echo "\n\n\n" &&

# Allow installing on reboot
while true; do
  read -p "Almost done! Do you want Easel driver to run on startup (will install to crontab) [yn]: " yn
  case $yn in
    [Yy]* ) ((crontab -l 2>>/dev/null | egrep -v '^@reboot.*easel node iris\.js') | echo "@reboot source ~/.bashrc ; cd ~/easel-driver && /usr/bin/screen -L -dmS easel node iris.js") | crontab ; echo '\nAdded to crontab (`crontab -l` to view)'; break;;
    [Nn]* ) break;;
    * ) echo "Please answer yes/no";;
  esac
done &&

# Profit (run driver in the background)
screen -L -dmS easel node iris.js &&

# Output the screen log so we can see if it was successful
sleep 3 &&
echo "\n\n\n" &&
tail screenlog.0 &&

# Run `screen -r easel` to access the driver, and Ctrl+A (Cmd+A on macOS) followed by 'd' to detach)
echo '\n\nDone! Easel driver running in background. Run `screen -r` to bring it to foreground.'

Easel is now running on ports 1338 (WebSocket) and 1438 (TLS WebSocket).

You can see the console output by running screen -r easel and detach from the screen process by hitting Ctrl+A followed by d.

Start on boot

The shell script asks you if you want to run on boot, and if so, it will add it to your crontab. If you didn't add it initially and want to now, you can add it like so:

(crontab -l ; echo "@reboot cd ~/easel-driver && /usr/bin/screen -dmS easel node iris.js") | crontab

Ensure that iris.js is actually in ~/easel-driver, and if not, make sure to change the cd directory. You must cd into the directory and not just run iris.js from the directory as iris.js uses relative paths.

Remote Port Forwarding

If you want to run your CNC on a separate computer than the one you run Easel from, you can port forward from the machine you want to run Easel from. Easel uses ports 1338 for websocket and 1438 for TLS websockets, however the interface used to use 1338 exclusively but now seems to use 1438 exclusively.

macOS/Linux

# Port forward local 1438 to remote host raspberrypi.local:1438
sudo ncat --sh-exec "ncat raspberrypi.local 1438" -l 1438 --keep-open &
sudo ncat --sh-exec "ncat raspberrypi.local 1438" -l 1438 --keep-open &

Windows

# you may need to change "raspberrypi.local" to the IP address of the machine running easel-driver
netsh interface portproxy add v4tov4 listenport=1438 listenaddress=0.0.0.0 connectport=1438 connectaddress=raspberrypi.local
netsh interface portproxy add v4tov4 listenport=1338 listenaddress=0.0.0.0 connectport=1338 connectaddress=raspberrypi.local

Firmware Upgrade Support

I've added and tested firmware upgrade support for Linux, so firmware upgrades to your mill will work through Easel, even remotely over your network or Internet. The commands above do this automatically by adding the following code to lib/firmware_uploader.js directly after the var PLATFORMS = { line:

  'Linux': {
    root: '/usr/bin/avrdude',
    executable: '/usr/bin/avrdude',
    config: path.join(__dirname, 'etc/avrdude.conf')
  },

Auto enumeration of the right COM/USB Port

Some users have mentioned they had make the change below, while others have not. I have not had to do this on Carvey as of 2020/05/05, but you may need to.

The Easel auto enumeration of the right com/USB port doesn't work for everyone on Linux. You can simply add your Port under ~/easel-driver/lib/serial_port_controller.js. To find YOUR port inspect the /dev folder on your system for new devices/files after plugging in your Arduino/controller, ls /dev/tty*

Before:

    currentComName = comName;
    var thisPort = new SerialPort(comName, {
      baudrate: config.baud,
      parser: SerialPort.parsers.readline(config.separator),
      errorCallback: function(err){
        logger.log("ERROR: " + err, Debugger.logger.RED);
        return;
      }
    });

After:

    currentComName = comName;
    var thisPort = new SerialPort('/dev/ttyUSB0', {  //    <<<<<<<------ Adjust here!
      baudrate: config.baud,
      parser: SerialPort.parsers.readline(config.separator),
      errorCallback: function(err){
        logger.log("ERROR: " + err, Debugger.logger.RED);
        return;
      }
    });

About

Easel driver for Linux, Mac, Windows, ARM, Raspberry Pi, Intel, FTDI, CH340, CH341, CP210x, FTDI clones, local, and remote access to GRBL-based CNC controllers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages