How to wirelessly plot with the AxiDraw

Using a Raspberry Pi and Saxi

June 16, 2021 5 min. plotterraspberry piwireless

I’ve recently joined #plottertwitter by acquiring an AxiDraw V3/A3. It’s a marvelous machine: robust, precise, and computer-controlled. You attach the thing via USB to a computer and into a power socket and off you go. I’m used to work only digitally and don’t have much experience with hardware like this, but it’s very nice to have your algorithms… physically manifest themselves.

The standard way to plot via the AxiDraw is by way of an Inkscape plugin. That means loading the SVG in Inkscape, making sure the dimensions of the artwork are correct in relation to its paper size, and controlling the plotter via spartan plugin buttons.

It works fine. But there are a couple of things that are suboptimal.

Noise. You hear every pen stroke, every motor movement and each time your pen goes up or down, the little motors squeak like a mouse.

Inkscape. Having to control the plotter via a plugin inside a full vector editor feels a bit like overkill. It works, sure, but in order to have a quick workflow without positioning and scaling your artwork (Inkscapes struggles with lots of vector lines), you have to make sure your SVG markup is correct.

Cables. The AxiDraw takes up quite some space, and it generously sprawls its USB and power cables around.

So I thought: there must be someone that made something to wirelessly control this thing. And surely in some tucked away corner on the internet I found a picture connecting a Raspberry Pi to the AxiDraw.

No installation instructions whatsoever, so I had to figure out some things and connect some dots.

I’m new to Raspberry Pi as well, but now that I was into hardware anyway, I ordered a 4B / 4G with power supply, a case, some tiny heatsinks and an SD card.

Preparing the Raspberry Pi

It’s a tiny computer. In a cheap plastic case. But it does nothing out of itself. So, we first have to install an OS on this thing.

I don’t have an extra monitor / keyboard laying around so I opted for a headless setup. I’m using a MacBook to control and log into the Raspberry Pi.

These are the steps to prepare the Pi:

Installing the OS

You install the OS on an SD card on your main computer via Raspberry Pi Imager.

Fire it up, and choose an OS. I chose Raspberry Pi OS Lite (32-bit), as I don’t have any use for a desktop environment without having a monitor anyway.

Then choose the storage location of the SD card and let it install there.

Configuring the SD card

Now you have an SD card with the base OS on it, but you have to prepare it a bit more for it to wirelessly control it.

First tell it to join your WiFi network. Create a file called wpa_supplicant.conf in the root of your volume and add this content:

country=NL # your country code
ctrl_interface=/var/run/wpa_supplicant
network={
    ssid="your-network-name"
    psk="your-password"
    key_mgmt=WPA-PSK
}

We also have to tell it to accept SSH connections. Create a file called ssh in the root of your volume and then be done with it.

Next time you boot up, these contents are read by the OS and will be incorporated in its system. The files will be deleted after this happens, that’s normal.

Booting up the Pi

Now you can place the SD card into your Pi and boot it up. If all goes well, you can now ssh into your pi from your local machine. Fire up a terminal and log in with the default machine name and password (which is raspberrypi):

Update it to all the latest things:

sudo apt update
sudo apt full-upgrade

Installing Node via NVM

Let’s go install Node via NVM first. You do this by (dangerously, but hey) curling a script into bash. This is for version 0.38, you’ll find the most up-to-date command on the nvm repository.

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash

Now that NVM is installed, you have to log out from your terminal and ssh back in for the terminal to pick up the new environment variables.

After that, install the latest Node with long term support:

nvm install --lts

Installing Saxi

Saxi is a NPM package by Jeremy Rose. It can be used instead of Inkscape to control the AxiDraw. It comes with a nice UI and path optimization algorithms.

npm i -g saxi

Wirelessly control the AxiDraw

Make sure your AxiDraw is connected via USB to the Raspberry Pi and both machines are powered.

From the Raspberry Pi terminal, fire up Saxi:

saxi

From your main computer, go to a browser and type in the address http://raspberrypi.local:9080

You’re now wirelessly connected to the Saxi UI, which lets you control the AxiDraw. It comes with a couple of nice benefits

A dedicated UI. Saxi directly controls the plotter, so this will be your new UI instead of a plugin inside Inkscape. It works by dropping your SVG file directly into the browser UI and hit “plot”.

Automatic scaling. Saxi makes it easy to center and scale your SVG to your paper dimensions. You can also adjust the margins.

Drawing optimization. Saxi can automatically optimize the drawing order of your SVG paths so it efficiently controls the pen for your plots. It even shows the time it takes to plot your drawing.

That’s it!

You can now store your AxiDraw somewhere else and let it happily hum along to plot your artwork while you enjoy the silence and your clean workspace.