brachio.me

This web site is all about the BrachioGraph which is the cheapest, simplest possible pen plotter you can build for your Raspberry Pi, invented by Danielle Procida.

Everything you need to know about the BrachioGraph can be found on Danielle's web site:

https://www.brachiograph.art/

This is intended to be a quick start guide to get you up and drawing. Please refer to Danielle's web site if in doubt.

Make it!

Start by building your BrachioGraph. Here's a video I made showing you how to build one with some fairly "standard" dimensions:

By making a plotter with these standard dimensions, you can avoid the need to do any calibration, and Danielle's example code should just work unmodified.


Next you need to install some software on your Pi to drive the BrachioGraph. Using the terminal, type all this stuff in:

python3 -m venv env
source env/bin/activate
sudo apt-get install python3-pip pigpiod libatlas3-base libgfortran5 git
pip install pigpio numpy tqdm readchar
git clone https://github.com/evildmp/BrachioGraph.git

Drive it!

When you run the git clone command, git creates a directory called BrachioGraph with all the code in it. Go in there, and look at the file bg.py

That file defines a BrachioGraph in software, with numbers that work if you built one like in the video.

Try copying the file and changing it like this (note, only the last line is new!) to drive your BrachioGraph by hand:

from brachiograph import BrachioGraph

# Uncomment the definition you want to use.

# This is an example BrachioGraph definition. If you build a plotter as
# described in the "Get started" section of the documentation, this definition
# is likely to work well. However, you should work out your own servo
# angle/pulse-width values as described in "Improve the plotter calibration".


# angles in degrees and corresponding pulse-widths for the two arm servos

servo_1_angle_pws1 = [
    [-162, 2470],
    [-144, 2250],
    [-126, 2050],
    [-108, 1860],
    [ -90, 1690],
    [ -72, 1530],
    [ -54, 1350],
    [ -36, 1190],
    [ -18, 1010],
    [   0,  840],
    [  18,  640],
]

servo_2_angle_pws2 = [
    [  0,  660],
    [ 18,  840],
    [ 36, 1030],
    [ 54, 1180],
    [ 72, 1340],
    [ 90, 1490],
    [108, 1640],
    [126, 1830],
    [144, 2000],
    [162, 2200],
    [180, 2410],
]

bg = BrachioGraph(
    # the lengths of the arms
    inner_arm=8,
    outer_arm=8,
    # the drawing area
    bounds=(-8, 4, 8, 13),
    # angles in degrees and corresponding pulse-widths for the two arm servos
    servo_1_angle_pws=servo_1_angle_pws1,
    servo_2_angle_pws=servo_2_angle_pws2,
    # pulse-widths for pen up/down
    pw_down=1200,
    pw_up=1850,
)

bg.drive_xy()

Save that file as testdrive.py and then on the command line run it by saying:

source env/bin/activate
cd BrachioGraph
python3 testdrive.py

(Note, you always have to souce the env/bin/activate file before you start running Python code, and you have to change to the BrachioGraph directory to run files in there). Now you can drive your plotter around with the keyboard. The controls are:

  • 0: exit
  • a: increase x position 1cm
  • s: decrease x position 1cm
  • A: increase x position .1cm
  • S: decrease x position .1cm
  • k: increase y position 1cm
  • l: decrease y position 1cm
  • K: increase y position .1cm
  • L: decrease y position .1cm

Draw something!

Once you are happy that you have your BrachioGraph working, you can start drawing pictures. Again, we'll do this by copying bg.py and making changes.

Go ahead and use the main page to turn a drawing into json, or try one of the examples. Save the json file to the BrachioGraph/images directory.

Make a copy of bg.py called draw.py and have it say something like this (note again, only the last line has changed):

from brachiograph import BrachioGraph

# Uncomment the definition you want to use.

# This is an example BrachioGraph definition. If you build a plotter as
# described in the "Get started" section of the documentation, this definition
# is likely to work well. However, you should work out your own servo
# angle/pulse-width values as described in "Improve the plotter calibration".


# angles in degrees and corresponding pulse-widths for the two arm servos

servo_1_angle_pws1 = [
    [-162, 2470],
    [-144, 2250],
    [-126, 2050],
    [-108, 1860],
    [ -90, 1690],
    [ -72, 1530],
    [ -54, 1350],
    [ -36, 1190],
    [ -18, 1010],
    [   0,  840],
    [  18,  640],
]

servo_2_angle_pws2 = [
    [  0,  660],
    [ 18,  840],
    [ 36, 1030],
    [ 54, 1180],
    [ 72, 1340],
    [ 90, 1490],
    [108, 1640],
    [126, 1830],
    [144, 2000],
    [162, 2200],
    [180, 2410],
]

bg = BrachioGraph(
    # the lengths of the arms
    inner_arm=8,
    outer_arm=8,
    # the drawing area
    bounds=(-8, 4, 8, 13),
    # angles in degrees and corresponding pulse-widths for the two arm servos
    servo_1_angle_pws=servo_1_angle_pws1,
    servo_2_angle_pws=servo_2_angle_pws2,
    # pulse-widths for pen up/down
    pw_down=1200,
    pw_up=1850,
)

bg.plot_file("brachio.json")

Now from the command line, say:

python3 draw.py

Hopefully your BrachioGraph started drawing whatever you saved as brachio.json!


If you have a fast Raspberry Pi, or another computer, you can use that to create the json files instead of using this web site. In fact, all this web site is doing is running linedraw.py with very few modifications. You'll need to install a bit more software:

sudo apt install libwebp6 libtiff5 libjbig0 liblcms2-2 libwebpmux3
sudo apt install libopenjp2-7 libzstd1 libwebpdemux2 libjpeg-dev
pip install pillow	

Then follow along here: https://www.brachiograph.art/how-to/use-linedraw.html

Have a lot of fun with your BrachioGraph!