I recently picked up an X-Carve CNC router. Its a great tool, but Inventables' web based digital CNC software, Easel, currently requires a constant connection from a Mac or Windows based computer in order to send commands to the X-Carve over USB. This tutorial will show you how you can free up your main computer while the X-Carve is running by using a Raspberry Pi as a bridge to wirelessly send commands to the X-Carve's Arduino Uno. We will also use a Powerswitch Tail to automatically control the main power to the X-Carve when Easel launches in your web browser.
If you aren't using our Raspberry Pi 2 starter pack, you will need the following pieces of hardware to complete this project:
- Raspberry Pi 2
- microSD card formatted with the latest version of Raspbian.
- WiFi dongle
- Power Supply
- Raspberry Pi 2 case
In addition to the hardware included in the starter pack, you will also need the following items:
Install your Raspberry Pi into the case, and insert the microSD card into the Pi's microSD card slot. If you have not formatted your microSD card with Raspbian, please follow our guide on the formatting process. If you have the Raspberry Pi starter pack, your SD card should come with Raspbian pre-installed.
Once you have the SD card setup, attach the WiFi dongle, power supply, and ethernet cable to the appropriate ports on the Pi. You will need to move your Pi close to your network router during the setup process, but you will be able to move it anywhere within WiFi range once the setup process is complete. Plug in the other end of the ethernet cable into a free port on your wireless router, and power on the Raspberry Pi by plugging in the power supply to a wall outlet.
Next, download a copy of the Adafruit Raspberry Pi Finder on your Windows, Mac, or Linux computer, install it, and launch the application. Follow the Pi Finder's guide if you need more info about the installation process.
After the Pi Finder launches, click the Find My Pi! button to search for your Pi.
Once the Raspberry Pi has been located, you will see a screen like the one shown below.
Enter xcarve into the hostname field, and fill in the appropriate WiFi SSID and WiFi Password for your network. Then click the green Bootstrap! button to set up your Pi.
You will then see a window appear that will show you the progress of the bootstrapping process. It will take a few minutes to complete, and may take several minutes depending on the speed of your internet connection.
You will then be returned to the Pi Finder window once the bootstrapping process has completed. Click on the blue Terminal button to open a SSH session to the Raspberry Pi. If you need help getting started with the command line, check out our great command line introduction guide.
First, check to make sure Node.js was properly installed by the bootstrap process by typing the following command at the prompt.
You should have v4.6.2 or higher installed.
Make sure that npm has the proper permissions to install packages by running the following command.
Next, install the xcarve-server package using npm.
It will take a few minutes to build and install the server software.
Once the packages have been installed, start the X-Carve service by running the following command.
You should then see the service start in the SSH window.
Once the service has been started, quit the SSH session by typing exit at the prompt and pressing return. You can then power down the Raspberry Pi by pressing the red Shutdown button in the main Pi Finder window.
Next, remove the ethernet cable from the Pi, and unplug the Pi from the wall. Move the Pi near your X-Carve power supply, and attach the X-Carve's Arduino Uno to the Pi using a short USB Type A to B cable. Don't power on the Raspberry Pi yet.
Next, we will connect the Powerswitch Tail to the Raspberry Pi using the Female to Male jumper cables. Attach the female end of one jumper cable to a GND pin on the Pi, and the female end of a second jumper cable to GPIO 17 on the Pi. Check out this pin diagram if you need help locating the appropriate pins on the Raspberry Pi.
Plug in the male side of the GPIO 17 jumper wire to the 1: +in connector on the Powerswitch Tail. Then, plug in the male side of the GND jumper wire to the 2: -in connector on the Powerswitch Tail.
Plug the power cord from the X-Carve power supply into the Powerswitch Tail, and then plug in the Powerswitch Tail into an outlet. Flip the X-Carve power supply into the on position, and plug in your Raspberry Pi to a power outlet. From now on the Raspberry Pi will be controlling the power to your X-Carve.
You will need to disable the local install of Easel on your computer in order to use the proxy. Follow the instructions for OS X or Windows to remove the software from your computer.
If you are running OS X, you will need to disable the local copy of Easel by running the following command in the terminal.
If you are running Windows, you will need to disable the local copy of Easel by uninstalling EaselLocal from the Control Pannel.
Next, you will need to install a simple proxy on your computer that will relay traffic between easel.inventables.com and your Raspberry Pi. First, install the latest version of Node.js for your operating system.
After installation, confirm that you have the latest version by opening the terminal on OS X & Linux, or the command prompt in Windows. Run the following command to confirm that you are running Node.js v4.6.2 or higher.
Next, install the xcarve-proxy package using npm.
Finally, start the proxy.
Now that you have the server and proxy started, you can visit easel.inventables.com/setup to test communication. It might take a few seconds for the connection to be established. You will see a download screen like the one shown below until Easel establishes communication with the X-Carve.
You will then see the normal X-Carve setup screen once Easel connects to the Raspberry Pi. Click Confirm settings once you have set the approprate settings for your machine.
Windows only: You will need to enter a fake COM port when Easel prompts you to enter one. Any number will do here since the Arduino is connected to the Raspberry Pi.
You should then see a screen that will allow you to test communication between Easel and the X-Carve. Use the arrows on the screen to test the stepper motors.
Finish the rest of the install process, and try a test carve to make sure everything is working.
You will need to start the local xcarve-proxy daemon on your computer and the xcarve-server on the Pi after any restarts. If you need to stop either the proxy or server, just run xcarve-server stop or xcarve-proxy stop to kill the processes.
You can find the source to both of the modules using the links below.