Polargraph Server for Adafruit Motorshield v2

There’s been a bit of ongoing investigation about getting the polargraph firmware running with the new Adafruit Motorshield (v2). I have just got one of these shields recently, so have only just had a chance to work on it tonight.

https://github.com/euphy/polargraph_server_a1

The new Adafruit library is slightly bigger than the old one, and the polargraph_server_a1 firmware was super tight on space already, so I’ve split up the code into a set of features that can be easily enabled or disabled at compile time to save space:

  • PIXEL_DRAWING – This is pixel shading.
  • PENLIFT – Controlling a servo to lift the pen.
  • VECTOR_LINES – Drawing straight lines, aka vector plotting.

So to get this to fit on, you need to disable either PIXEL_DRAWING or VECTOR_LINES – can’t have both anymore, not with Motorshield v2.

For convenience, I’ve pre-compiled two binaries, one for Motorshield v1 (using AFMotor), and the other for Motorshield v2 (using¬†Adafruit_MotorShield). The firmware for Motorshield v2 has pixel drawing disabled.

This is a bit of a pain, but I don’t see an acceptable alternative.

I haven’t tried this for actual drawing yet, because I haven’t got a machine made up that uses this system, but at least the motors move! Please let me know if there is any success – or otherwise.

Happy scribbling!

See also http://www.polargraph.co.uk/forum/polargraphs-group2/troubleshooting-forum5/motors-not-working-when-i-compile-but-hex-works-thread324/

This knowledge transferred to: https://github.com/euphy/polargraph/wiki/Polargraph-Server-for-Adafruit-Motorshield-v2

Polargraph at the Edinburgh Science Festival

So I’ve finally been able to step away from the new installation that I’ve been building to be presented as part of the Edinburgh Science Festival, in the Grand Gallery in the National Museum of Scotland. It’s pretty swish.

Polargraph at Edinburgh Science Festival

A little PC inside uses a webcam to detect faces in the crowd, and the faces that stay still are snapped, cropped, converted to line art and then drawn out on one of the two drawing machines either side.

The machines themselves are a new prototype breed of Polargraph, with Teensy 3s at their hearts, and Easy Drivers doing the moving. The guts of them are laid out as on an dissection table.

Polargraph at Edinburgh Science Festival

The drive chain consists of a stepper motor and an optical encoder, coupled by the beaded cord. The encoder keeps track of the true position of the cord, and so these machines are wonderfully robust. They can hop and skip, get pulled around and abused and they do not lose position.

PolargraphPro transmission

Small magnets sewn onto the cord, and reed switches above the encoder wheel make self-homing trivial.

PolargraphPro homing mechanism

The pen lift is half a lolly stick, hot-glued onto a servo motor, blu-tacked onto the gondola.

Polargraph at Edinburgh Science Festival

The controller is a Python Flask web app, publishing its interface as a web page. It is very simple at the moment, but is pretty extensible. Part of the app is a core class that encapsulates the communications, queueing and commands. Writing this in Python rather than Processing / Java has been a resoundingly positive experience (less so actually installing Python and it’s libraries on Windows – but you win some, you lose some).

IMG_20140405_160452105_HDR_c

The firmware is a stripped-back version of the standard Polargraph firmware, using a couple of nice Teensy features – namely the IntervalTimer library to deal with serial concurrent serial comms.

The Making It exhibition runs from the 5th to the 20th of April, in the Grand Gallery of the National Museum of Scotland. It is presented by the Edinburgh International Science Festival. You should go and see it!

IMG_20140409_084402602_c