# Run an X-Carve CNC Machine Wirelessly with a Raspberry Pi

## Setting Up the Proxy

![](https://cdn-learn.adafruit.com/assets/assets/000/027/176/medium800thumb/hacks_raspberry_pi_carvegif.jpg?1448319361)

I recently picked up an [X-Carve CNC router](https://www.inventables.com/technologies/x-carve). Its a great tool,&nbsp;but Inventables' web based digital CNC software, [Easel](http://easel.inventables.com), currently requires a constant connection from a Mac or Windows based computer&nbsp;in order to send commands to the [X-Carve](https://www.inventables.com/technologies/x-carve)&nbsp;over USB.&nbsp;This tutorial will show you how you can free up your main computer while the X-Carve&nbsp;is running&nbsp;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.

Danger: 

## Hardware Requirements

If you aren't using our [Raspberry Pi 2 starter pack](https://www.adafruit.com/product/2380), you&nbsp;will need the following pieces of hardware to complete this project:

- [Raspberry Pi 2](https://www.adafruit.com/product/2358)
- [microSD card](https://www.adafruit.com/products/1121)&nbsp;formatted with the latest version of [Raspbian](https://www.raspberrypi.org/downloads/raspbian/).
- [WiFi dongle](https://www.adafruit.com/products/1012)
- [Power Supply](https://www.adafruit.com/products/1995)
- [Raspberry Pi 2 case](https://www.adafruit.com/categories/289)

In addition to the hardware included in the starter pack, you will also need the following items:

- [Ethernet Cable](https://www.adafruit.com/products/730)&nbsp;(for the setup process)
- 2x&nbsp;[Female to Male](https://www.adafruit.com/products/1952)&nbsp;jumper wires (12 inches or longer)
- [Powerswitch Tail](https://www.adafruit.com/products/268)&nbsp;(for automatic control&nbsp;of the X-Carve's power supply)
- [USB Type A to B Cable](https://www.adafruit.com/product/62)

## Raspberry Pi Setup

Install your&nbsp;Raspberry Pi into the case, and insert the microSD card into the Pi's microSD card slot.&nbsp; If you have not formatted your microSD card with Raspbian, please[&nbsp;follow our guide](../../../../adafruit-raspberry-pi-lesson-1-preparing-and-sd-card-for-your-raspberry-pi/overview)&nbsp;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.

![](https://cdn-learn.adafruit.com/assets/assets/000/027/156/medium800/raspberry_pi_connect.jpg?1439836018)

Next, download a copy of the&nbsp;[Adafruit Raspberry Pi Finder](../../../../the-adafruit-raspberry-pi-finder)&nbsp;on your Windows, Mac, or Linux&nbsp;computer, install it, and launch the application. Follow the [Pi Finder's guide](../../../../the-adafruit-raspberry-pi-finder)&nbsp;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.

![](https://cdn-learn.adafruit.com/assets/assets/000/027/158/medium800/raspberry_pi_Screen_Shot_2015-08-17_at_2.32.14_PM.png?1439836415)

Once the Raspberry Pi has been located, you will see a screen like the one shown below.

![](https://cdn-learn.adafruit.com/assets/assets/000/027/159/medium800/raspberry_pi_Screen_Shot_2015-08-17_at_2.35.28_PM.png?1439836541)

Enter&nbsp;_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.

![](https://cdn-learn.adafruit.com/assets/assets/000/027/160/medium800/raspberry_pi_Screen_Shot_2015-08-17_at_2.33.09_PM_copy.png?1439837006)

You will then see a window appear that will show you the progress of the bootstrapping process. It will&nbsp;take a few minutes to complete, and may take several minutes&nbsp;depending on the speed of your internet&nbsp;connection.

![](https://cdn-learn.adafruit.com/assets/assets/000/027/161/medium800/raspberry_pi_Screen_Shot_2015-04-08_at_9.18.29_AM.png?1439837093)

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](../../../../what-is-the-command-line).

![](https://cdn-learn.adafruit.com/assets/assets/000/027/165/medium800/raspberry_pi_Screen_Shot_2015-08-17_at_2.33.09_PM_copy.png?1439839477)

## Installing the X-Carve Service on the Raspberry Pi

First, check to make sure Node.js was properly installed by the bootstrap process by typing the following command at the prompt.

```
node -v
```

You should have **v4.6.2** &nbsp;or higher installed.

![](https://cdn-learn.adafruit.com/assets/assets/000/037/222/medium800/hacks_Screen_Shot_2016-11-10_at_2.11.51_PM.png?1478805127)

Make sure that npm has the proper permissions to install packages by running the following command.

```
sudo chown -R pi /usr/local
```

Next, install the **xcarve-server&nbsp;** package using _npm_.

```
npm install -g xcarve-server
```

It will take a few minutes to build and install&nbsp;the server&nbsp;software.

![](https://cdn-learn.adafruit.com/assets/assets/000/027/164/medium800/raspberry_pi_Screen_Shot_2015-08-17_at_3.21.23_PM.png?1439839306)

Once the packages have been installed, start the X-Carve service by running the following command.

```
xcarve-server start
```

You should then see&nbsp;the service start in the SSH window.

![](https://cdn-learn.adafruit.com/assets/assets/000/027/166/medium800thumb/hacks_raspberry_pi_start_xcarve.jpg?1448319355)

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.

![](https://cdn-learn.adafruit.com/assets/assets/000/027/169/medium800/raspberry_pi_shut.png?1439839835)

## Connecting the X-Carve to the Raspberry Pi

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.

![](https://cdn-learn.adafruit.com/assets/assets/000/027/170/medium800/raspberry_pi_pi.png?1439840948)

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** &nbsp;on the Pi. Check out [this pin diagram](http://pi4j.com/images/j8header-2b-large.png)&nbsp;if you need help locating the appropriate pins on the Raspberry Pi.

![](https://cdn-learn.adafruit.com/assets/assets/000/027/171/medium800/raspberry_pi_wirepi.png?1439841843)

Plug in the male side of the **GPIO 17** jumper wire to the **1: +in** connector on the Powerswitch Tail. Then, plug&nbsp;in the male side of the **GND** &nbsp;jumper wire to the **2: -in** connector on the Powerswitch Tail.

![](https://cdn-learn.adafruit.com/assets/assets/000/027/172/medium800/raspberry_pi_power.png?1439842549)

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.

![](https://cdn-learn.adafruit.com/assets/assets/000/027/174/medium800/raspberry_pi_P1040607.jpg?1439842996)

## Disabling the Local Easel Install

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&nbsp; **OS X** , you will need to disable&nbsp;the local copy of Easel by running&nbsp;the following command in the terminal.

```
sudo launchctl unload -w /Library/LaunchDaemons/com.Iris.Iris.plist
```

If you are running **Windows** , you will need to disable&nbsp;the local copy of Easel by uninstalling EaselLocal from the Control Pannel.

![](https://cdn-learn.adafruit.com/assets/assets/000/027/180/medium800/raspberry_pi_uninstall.png?1439849296)

## Installing the Proxy

Next, you will need to install a simple proxy on your computer that will relay traffic between easel.inventables.com&nbsp;and your&nbsp;Raspberry Pi. First, install the latest version of Node.js for your operating system.

[Node.js Download](https://nodejs.org/download/)
After installation, confirm that you have the latest version by opening the terminal on OS X &&nbsp;Linux, or the command prompt in Windows. Run the following command to confirm that you are running Node.js v4.6.2 or higher.

```
node -v
```

![](https://cdn-learn.adafruit.com/assets/assets/000/037/223/medium800/hacks_Screen_Shot_2016-11-10_at_2.13.02_PM.png?1478805194)

Next, install the&nbsp; **xcarve-proxy** &nbsp;package using npm.

```
npm install -g xcarve-proxy
```

Finally, start the proxy.

```
xcarve-proxy start
```

![](https://cdn-learn.adafruit.com/assets/assets/000/027/179/medium800thumb/hacks_raspberry_pi_Aug_17__2015_17_32.jpg?1448319367)

## Testing Communication

Now that you have the server and proxy started, you can visit [easel.inventables.com/setup](http://easel.inventables.com/setup)&nbsp;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.

![](https://cdn-learn.adafruit.com/assets/assets/000/027/178/medium800/raspberry_pi_Screen_Shot_2015-08-17_at_5.18.53_PM.png?1439846462)

You will then see the normal X-Carve setup screen once Easel connects to the Raspberry Pi.&nbsp;Click **Confirm settings** once you have set the approprate settings for your machine.

![](https://cdn-learn.adafruit.com/assets/assets/000/027/218/medium800/raspberry_pi_setup1.png?1439900620)

 **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.

![](https://cdn-learn.adafruit.com/assets/assets/000/027/219/medium800/raspberry_pi_setup2.png?1439900812)

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.

![](https://cdn-learn.adafruit.com/assets/assets/000/027/220/medium800/raspberry_pi_screen3.png?1439900954)

Finish the rest of the install process, and try a test carve to make sure everything is working.

![](https://cdn-learn.adafruit.com/assets/assets/000/027/221/medium800/raspberry_pi_screen5.png?1439908235)

## Final Thoughts
![](https://cdn-learn.adafruit.com/assets/assets/000/027/177/medium800/raspberry_pi_P1040609.jpg?1439845885)

You will need to start the local&nbsp; **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&nbsp; **xcarve-server stop** or&nbsp; **xcarve-proxy stop** to kill&nbsp;the processes.

You can find the source to both of the modules using the links below.

[xcarve-proxy on GitHub](https://github.com/adafruit/xcarve-proxy)
[xcarve-server on GitHub](https://github.com/adafruit/xcarve-server)

## Featured Products

### Raspberry Pi 2 Model B Starter Pack - Includes a Raspberry Pi 2

[Raspberry Pi 2 Model B Starter Pack - Includes a Raspberry Pi 2](https://www.adafruit.com/product/2380)
Why not trick out your fresh new board with some&nbsp;accessories? The Pi 2 is a big deal - a big, big deal. &nbsp;It has an upgraded ARMv7 multicore procssor and a full Gigabyte of RAM - meaning you're going to see ~2x the performance on processor-upgrade only and 4x on average for...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/2380)
[Related Guides to the Product](https://learn.adafruit.com/products/2380/guides)
### Premium Female/Male 'Extension' Jumper Wires - 20 x 12"

[Premium Female/Male 'Extension' Jumper Wires - 20 x 12"](https://www.adafruit.com/product/1952)
These Female/Male 'Extension' Jumper Wires are handy for making wire harnesses or jumpering between headers on PCB's. These premium jumper wires are 12" (300mm) long and come in a 'strip' of 20 (2 pieces of each of ten rainbow colors). They have 0.1" male header...

In Stock
[Buy Now](https://www.adafruit.com/product/1952)
[Related Guides to the Product](https://learn.adafruit.com/products/1952/guides)
### Powerswitch tail 2

[Powerswitch tail 2](https://www.adafruit.com/product/268)
[**The PST has been discontinued. Please check out the IoT Power Relay for an equivalent alternative. The IoT Power Relay has more outlets but otherwise is functionally the same, and at a similar price!**](https://www.adafruit.com/product/2935)

The Power Switch...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/268)
[Related Guides to the Product](https://learn.adafruit.com/products/268/guides)
### Ethernet Cable - 5 ft long

[Ethernet Cable - 5 ft long](https://www.adafruit.com/product/994)
We have so many Internet-connected goodies in the shop, we figured it's time to carry a cable so you can easily connect them up! This cable is 5 feet long, comes in Adafruit black and has all 8 wires installed. Perfect for use with the <a...></a...>

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/994)
[Related Guides to the Product](https://learn.adafruit.com/products/994/guides)
### USB Cable - Standard A-B

[USB Cable - Standard A-B](https://www.adafruit.com/product/62)
This here is your standard A-B USB cable, for USB 1.1 or 2.0. Perfect for connecting a PC to your Arduino, USBtinyISP (among other things).  
  
3 feet / 1 meter long  
  
Color may vary!

In Stock
[Buy Now](https://www.adafruit.com/product/62)
[Related Guides to the Product](https://learn.adafruit.com/products/62/guides)

## Related Guides

- [Bluefruit Ouija Board](https://learn.adafruit.com/bluefruit-ouija-board.md)
- [Walkmellotron: Cassette Player Mods](https://learn.adafruit.com/walkmellotron.md)
- [Matrix 2 Mod](https://learn.adafruit.com/matrix-2-mod.md)
- [Spruce Up a Costume with MONSTER M4SK Eyes and Voice](https://learn.adafruit.com/spruce-up-a-costume-with-monster-m4sk-eyes-and-voice.md)
- [Robotic AI Bear using ChatGPT](https://learn.adafruit.com/robotic-ai-bear-using-chatgpt.md)
- [Guitar Hero MIDI Controller](https://learn.adafruit.com/guitar-hero-midi-controller.md)
- [Cardboard Fundamentals](https://learn.adafruit.com/cardboard-fundamentals.md)
- [Kali Linux on the Raspberry Pi with the PiTFT](https://learn.adafruit.com/kali-linux-on-the-raspberry-pi-with-the-pitft.md)
- [Improve the Low Speed of Brushed DC Motors](https://learn.adafruit.com/improve-low-speed-performance-of-brushed-dc-motors.md)
- [ Adafruit DRV8833 DC/Stepper Motor Driver Breakout Board](https://learn.adafruit.com/adafruit-drv8833-dc-stepper-motor-driver-breakout-board.md)
- [Diet Raspberry Pi](https://learn.adafruit.com/diet-raspberry-pi.md)
- [Stand-alone programming AVRs using CircuitPython](https://learn.adafruit.com/stand-alone-programming-avrs-using-circuitpython.md)
- [Adafruit 8-Channel PWM or Servo FeatherWing](https://learn.adafruit.com/adafruit-8-channel-pwm-or-servo-featherwing.md)
- [Face Tracking Robot with MEMENTO](https://learn.adafruit.com/face-tracking-robot-with-memento.md)
- [What's in the Box86? More gaming possibilities on Pi!](https://learn.adafruit.com/box86-gaming-on-arm-raspberry-pi.md)
