Skip to content

nornagon/saxi

Repository files navigation

saxi

make plot good

saxi is a tool for interacting with the AxiDraw drawing machine by Evil Mad Scientist. It comes with an easy-to-use interface, and is exactingly precise.

  • automatically scales & centers your drawing to fit on the paper
  • minimizes pen-up travel time by reordering & reversing paths
  • uses a custom motion planning algorithm (inspired by axi) that's smooth & fast
  • automatically splits apart layers based on SVG stroke colors or group IDs
  • has a web-based UI, so there's no need to muck around with installing X11 and Inkscape
  • can run on a Raspberry Pi or similar, so you don't need to be tethered to your plotter while it plots

a screenshot of the saxi user interface

Usage

$ npm i -g saxi
$ saxi
Server listening on http://0.0.0.0:9080
Connecting to EBB on /dev/tty.usbmodem1461

If you encounter an EACCES error when installing the package globally, see Resolving EACCES permissions errors when installing packages globally.

Raspberry Pi

To install saxi on a Raspberry Pi, first install node.js if you haven't already:

$ curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
$ sudo apt-get install -y nodejs

and then proceed as above :) If you connect to the raspberry pi over ssh, you might want to run the saxi server inside a tmux or screen session to have it stay running even if your ssh session disconnects.

If you want saxi to run at boot on the Pi you can use a systemd unit file and enable the service:

sudo tee /lib/systemd/system/saxi.service <<EOF
[Unit]
Description=Saxi
After=network.target

[Service]
ExecStart=saxi
Restart=always
User=pi

[Install]
WantedBy=multi-user.target
EOF
sudo systemctl enable saxi.service

To watch the logs while it is running, use:

journalctl -f -u saxi

Raspberry Pi Zero OTG

Pi Zero on an AxiDraw with a Y-shaped USB cable

For the Pi Zero you can make a USB "OTG" cable out of two Micro-B cables and two 0.1" headers to tap into the AxiDraw's 5V servo supply to power the Pi. This makes for a more compact installation without the need for an additional wall-wart.

           +------ Center pin on servo rail
           | +---- Ground pin on servo rail
           | |
           | |
Red   -----+-|---- Red
Black -------+---- Black
White ------------ White
Green ------------ Green (sometimes Blue)

The Pi will also need to have the dr_mode=host parameter set in config.txt to force host mode, since normal USB Micro cables do not include the ID pin that would be used to signal that it is an OTG connection.

echo dtoverly=dwc2,dr_mode=host | sudo tee -a /boot/config.txt

CORS

If you want to connect to saxi from a web page that isn't served by saxi itself, you'll need to enable CORS, otherwise GET/POST requests will be denied by the browser. CORS is disabled by default as a security precaution, but if you need it it's available. Just launch saxi with the --enable-cors flag.

Info

saxi makes use of the low-level LM command introduced in EBB firmware version 2.5.3 to carry out highly accurate constant-acceleration motion plans. If your AxiDraw is running an older version of the firmware, saxi will fall back to the less-accurate (but still pretty accurate) XM command.

To check what version of the EBB firmware your AxiDraw is running, run saxi --firmware-version:

$ saxi --firmware-version
EBBv13_and_above EB Firmware Version 2.5.3

To upgrade your AxiDraw's firmware, see here.

Developing

To work on saxi, you can clone this repo and then run npm start:

$ git clone https://github.com/nornagon/saxi
$ cd saxi
$ npm run dev

This will watch local files for changes. If you change the server code, you'll need to restart manually.

Credits

saxi's motion planning algorithm is heavily inspired by Michael Fogleman's axi project.

saxi's UI would be an ugly mess if it weren't for @kylestetz's discerning eye.

Thanks to Evil Mad Scientist for designing and building such a lovely machine!


Made with saxi

These images were plotted by folks using saxi. If you'd like to add something you've made here, shoot me an email!

Plotted image by @targz

by Julien Terraz (@targz)

Plotted image by @abey79

by Antoine Beyeler (@abey79)

Plotted image by @MAKIO135

by Lionel Radisson (@MAKIO135)

Plotted image by @daniel_feles

by Daniel Feles (@daniel_feles)