Polargraph Drawing Machine
This machine, a variation on the hanging-pen plotter is a conspicuous and wilfully naive attempt to break out of the pristine, pixel perfect, colour-corrected space that exists inside our computers. It’s a drawing machine, that takes a pen (a human tool) and uses it to draw in a singularly robotic way, with some grand results.
It doesn’t draw at all like we would (though it could), and we would struggle to draw exactly as it does (though we could).
It can draw on things bigger than itself – the question is really “how long is a piece of string?” when it comes to working out it’s maximum area.
It’s easier to look at what it does, than to explain it, so just have a look.
Step 1: History
Well there have been lots of new drawing machines doing the rounds lately, there’s a real thirst to see devices that leap out of the virtual into the
physical. For me, it’s all too easy to produce digital things which are interesting – programming or mash-ups or virtual experiments are devalued because they are intangible, you can run a hundred, a thousand, a million variations in a day – it’s the proverbial roomful of monkeys with typewriters. The output becomes disposable, it get’s hard to see the value, the craft.
So 3D printers and other desktop manufacturing tools and technologies (laser cutters etc) have got more and more popular, it’s hard to overestimate how much hunger there is for a tangible, physical, touchable, smellable product of all this clever-clever digital work.
So this isn’t wholly original, check out this prior art for more inspiration:
Hektor – the daddy of all hanging drawing machines
Der Kritzler – the smartest one yet
AS220 Drawbot – the basis for mine
SADBot – Instructable for an automatic drawing machine on the same pattern by Dustyn Roberts
But this is the original Polargraph! The term is a portmanteau word invented for this instructable, and it has caught on. People who don’t know their drawbot history often use the word to describe any hanging-v plotter, but it is actually means something very specific: A machine that runs the Polargraph software.
Mostly based on the success of this instructable, I started a little workshop making Polargraph parts, and the next-generation Polargraph gear (PolargraphSD). Couple of links below:
Polargraph wiki and code
Step 2: Parts
- Microcontroller – Arduino Uno or compatible. I’ve used a Seeeduino here. (from coolcomponents). Be aware that some “arduino compatible” boards that use FTDI chips are only really Arduino Duemilanove compatible – they have very slightly less memory, so the Polargraph code no longer fits on it.
- Motor drivers – Adafruit’s Motoshield v1. A modern classic. It can drive two stepper motors each drawing up to 600mA and has pinouts for a servo too, so is perfect for this project. This is now discontinued by Adafruit, but boards like them are widely available on ebay (search for “L293D motor shield arduino”). Adafruit _do_ make a new motorshield that is even better, but I haven’t got one to test one.
- Motors – Look for motors with a current rating of around 600mA (0.6A). Mine were 400 steps per revolution (0.9 degree per step), NEMA 16 stepper motors, with a 5mm diameter shaft off ebay, but something like this NEMA-17 with a 0.4A current rating would do nicely, as would this one from Adafruit.
- Power supply. 1 amp (1000mA) Variable voltage AC/DC power supply. Set the voltage as high as you dare. If things start getting hot, just turn it down a bit. 9v will be fine, 12 may be pushing it, but it depends on your motors really. At peak, the machine might be drawing 1.2 amps (2x 600mA), so you might benefit from a beefier-than-average power supply. That said, it ran for months on a 600mA supply before I did something silly and it stopped. (expro.)
Gondola. This is the pen holder. I am from the “heavy and stable” school of thought. I think it makes for a more definitive impression, and a cleaner line.
- 3x 6003Z deep groove bearings. (simplybearings.co.uk)
- 50mm length of K&S stock #144 brass tubing (21/32″, 16.66mm dia). (hobbies)
- Laser cut acrylic parts. The original is made of corrugated cardboard and a blank CD, just glued on, so this is by no means necessary. (Ponoko)
- Beaded cord. This is used in roller blinds. (ebay – a shade better). You could use metal ball chain if it matches the pitch.
- Sprockets. Don’t seem to exist off-the-shelf, so I made these 3D printed ones (shapeways).
- Counterweights. I used a bolt with a stack of washers hung on it.
- Surface – big flat surface to base your machine on. Discussed in the next step.
- Brackets – laser cut plywood to allow the motors to be fastened to a flat wall. If you are mounting on a board, you might be able to just simply stick the motors directly on the top edge of the board. (Ponoko)
Step 3: Sprocket up!
Step 4: Prepare your motors
Step 5: The drawing surface
Using a board means you can tilt it slightly too just by leaning it against the wall, and that’s a good thing because the weight of the gondola presses the pen to the page. When the surface is perfectly vertical, it’s hard to get any pressure against the page – the lines tend to come out a pretty woolly.
I went down the local DIY shed and scavenged in the offcuts bin for the biggest bit of chipboard I could fit in my little car, but I’ve also had good success with building a machine based on the biggest IKEA Ribba picture frame. This has the added feature that you can use it as a picture frame afterwards, amazingly. A whiteboard is a good alternative too, because you can test quickly, but any kind of flat surface will do. My first one was only big enough for A3, and worked fine, so don’t feel it has to be massive.
Step 6: Mount your motors – edge style
If you have access to a 3d printer, there is a neat stepper motor mount available at http://softsolder.com/2011/08/23/nema-17-stepper-motor-mount/.
Step 7: Mount your motors – front style
The plans for Der Kritzler include window-mountable servo holders that use suction cups. That bracket is probably stronger than mine too, but it needs more parts to build it.
Fasten the big plates onto your surface in the top corners. They should be exactly level. I use double sided sticky foam tape for more or less everything, but make sure you use plenty because they are fairly heavy, and there is some vibration.
Step 8: Electronics – Arduino
You need an Arduino UNO board, I used a Seeeduino v2.21 here – it did the job very nicely back in the day, but a couple of new features have been added to the code and so it doesn’t fit on anymore. Genuine UNOs have very slightly more space for programs.
Upload the source code to the arduino. Look at this fine guide courtesy of Adafruit for help.
Because it changes regularly, I have not attached a copy of the code itself to this step, but the very most recent version can be downloaded in a bundle from the polargraph code repository.
You should save the code file into a new folder inside your arduino sketch folder. Give the new folder the same name as the source code file. So if the file is called polargraph_server_a1.ino, you should create a new folder called polargraph_server_a1 and save the file into it.
It also uses Adafruit’s AFMotor library and Mike McCauley’s Accelstepper libraries. Please use the copy of Accelstepper that is in the zip file – the newest versions of it have a few fixes in them that the polargraph code isn’t yet updated for.
The AFMotor library files should be put into a folder called AFMotor inside your Arduino/libraries/ folder.
The Accelstepper library files should be put into a folder called AccelStepper inside your Arduino/libraries/ folder.
Once they are moved, your arduino installation directory should look something like the second image on this page.
Of course the source code is also available in the code repository – https://github.com/euphy – should you want the very most recent version.
Once you do that, you should confirm that it is working properly – use the serial monitor on the board, set to 57600 baud to make sure that it is issuing “READY” every couple of seconds (see the third image).
Step 9: Electronics – Motorshield
The motorshield is usually supplied as a kit, it’s easy to solder up, follow the instructions on the Adafruit site. It’s brilliant. I am an Adafruit fanboy, so sue me. Not much more to say about it. Adafruit discontinued the v1 motorshield in 2013, and I haven’t updated the polargraph to use the new v2 shield. Lots of people are still selling clones of the v1 design on ebay, just search for “L293D arduino motor shield”.
The motorshield has two stepper motor ports, one on either side. It takes it’s power from the host arduino, but has an separate connector that you can use to connect an external power supply. If you have a power supply that has bare leads, you can screw them in here (make sure you get the polarity right) use this and remove the power jumper from beside it. I’m going to stress that the power connector is wires up properly – +V on the left hand wire, GND on the right. There is no reverse polarity protection on this board, so if you do it wrong it’s likely you’ll damage the board, and maybe your arduino too.
If you don’t use it, you should plug your external power supply directly into your arduino, and leave the power jumper ON. I am wiring directly, because it’s better practice to have entirely separate supplies for motor and logic, and also because the Seeeduinos have a funky JST power connector on them that doesn’t fit anything standard.
I also added little heat sinks to the driver chips (L293Ds) on the motorshield. They get hot, and you can use a fan to cool them if you have one spare, and really, I don’t know if they every really get dangerous, but with heatsinks on I feel a more comfortable letting them run for hours and hours.
Step 10: Electronics – Wiring
Each motor has two circuits, or coils in it, and a bipolar stepper has four wires coming out of it, two for each circuit. Most steppers will have a datasheet that will let you know which colour wires lead to which coil. Find out, either using your datasheet, or a multimeter (a bit more about steppers, and how to figure them out on adafruit and this article helped me figure it all out.).
Mine have the red and the blue wire attached to one coil, and the white and the yellow wire on the other coil.
The two motors should be wired up with their coloured wires matching left and right. So on the left hand side, you should have wire pair 1 (red/blue) in the top two terminals, and wire pair 2 (yellow/white) in the bottom two terminals. And on the right, it’ll be exactly the same: pair 1 in the top, pair 2 in the bottom.
I stuck my arduino to a bit of foamcore board stuck on the back of my drawing surface. Just makes it a bit easier to deal with.
Push the motorshield into the arduino, and fire it up!
Step 11: Controller software – install
The setup is ready to test! The software you use to control it is a little application written in Processing. You can run this from the source code, but it’s probably easier to use one of the pre-compiled binaries that I’ve made. The most recent code bundle has the latest versions for Mac, Windows or linux.
(That bundle also includes all the source for the controller, and the firmware, and all the Processing and Arduino libraries you need to run from source.)
Download it, unzip it, and run the executable in the controller folder. It’ll open up very small, but maximise the window to see more. It will automatically create a default configuration file in the same folder as it runs in, and you should then click “save properties” in the top-left corner to save the new window size as the default.
Compile from source
If you’re curious about Processing, you’re right to be: It’s ace. There are useful tutorials on processing.org, and of course here on Instructables too. It’s basically java, but optimised to run little stand alone programs with graphics. If you’re interested in keeping on the leading edge of the controller development, you might like to check out the code directly from the repository and compile it yourself. Another reason: The precompiled binaries that I distribute are a little idiosyncratic, and sometimes refuse to work on some people’s machines. If you compile from source, then it’ll work at least.
Couple of notes – The controller is getting a bit long-in-the-tooth now, and I haven’t updated it to use Processing 2. So in the meantime, it will only compile in Processing 1.x. Additionally, the libraries have also since moved on since it was written, and it’ll only work with the versions in the zip file (referred to above). I’m working on an update, but it’s not ready yet.
- Install Processing 1.5 (download:http://processing.googlecode.com/files/processing-1.5.1-windows.zip)
- Run Processing, find where your sketchbook folder is: (File->Preferences, sketchbook location).
- Install libaries: Unzip the code bundle, and copy the contents of the processing-source/Processing libraries into <sketchbook location>/libraries.
- Install project: In the code bundle, copy the whole processing-source/polargraphcontroller folder into <sketchbook location>.
- Restart Processing, and open the controller with File->Sketchbook->polargraphcontroller.
- Run: When some files have opened up and you can see some code, hit the play button in the toolbar (or use Ctrl-R) and you should see the controller spring into live.
It’ll only be a small window, so go ahead and maximise it, or stretch it so you can see everything. If it worked, then well done. NEXT!
Step 12: Controller software – Primer
Ok, in the controller window there are three main elements.
- The control panel with all the buttons down the far-left,
- The grey rectangle in the middle that represents the machine itself,
- The command queue down the right-hand side of the machine.
Some of the controls are just to do with the controller (like load image), but some (like set home or shade square wave) send commands to the machine itself. Some of the controls are number spinners, click and drag up and down on them to change their value.
Move the mouse over the machine and you’ll see some lines overlaid that represent the hanging cords. You can zoom in and out from the machine using the mouse scroll wheel, and “grab” it and move it around using the middle mouse button drag.
If a command is issued to the machine, it’s held in a queue until the machine signals to say it’s ready to do something. The command queue is shown on the far right of the app window. When you first start it up, it’s in paused mode, and is pre-loaded with a couple of default settings. You can start it and stop it by clicking on the queue header (where it says COMMAND QUEUE: Paused – click to start). The queue can be emptied with the reset queue button. While the queue is paused, individual commands can be removed from it by clicking on them.
- Input. Used for loading images, moving, resizing, selecting an area to draw, as well as issuing the drawing commands. Click on load image and browse to an image, (png or jpg), then move image and resize image to place it on the page.
- Setup. Used for defining the machine hardware. Change the machine size, the page size and position and the home point position. Also change the motor speeds and pen size. Once you’ve changed the machine on-screen to reflect the real size of your own machine, press upload machine spec to send it to the machine.
- Queue. Used for exporting and importing the queue to and from a text file. They are in plain text, so it’s easy enough to hack them.
Next let’s connect it up.
Step 13: Controller software – introduce it to your hardware
To get the controller to talk to the machine, change to the setup tab and then click on the serial button. This will pop up a little window with a list of the available serial ports in it. If you know which one to try, click it. If not, just go through them, waiting for a couple of seconds between each one until you see the top line of the main window turn green and show Polargraph READY!
The hardware broadcasts that it’s ready every couple of seconds, which is why you might need to wait. If you don’t want to connect it (because you haven’t got a machine yet) just choose no serial connection.
Job done! Close the serial port window and then click save properties in the control panel, so the controller remembers it for next time.
Step 14: Controller software – make it move!
Confirm you have set the right serial port, and that it’s communicating with the arduino by looking for a Polargraph READY! at the top of the window. This line will be red if it’s not connected. If you connect the machine after starting the controller, then you’ll probably need to close and restart the controller too.
If you’re running from Processing, then you should also be seeing incoming: READY in the Processing console every couple of seconds, in the background.
That’s great! Unpause the command queue, and you’ll see the first couple of commands get gobbled up by the machine, one after another. Click Set home. You’ll see a command appear in the the command queue, and then it’ll get sent to the machine right away. You will see the big purple dot that signals the location of the pen will move to the be in the middle of the top edge of the machine on-screen. The motors themselves will also give a little wriggle, and you’ll find they’re locked – they’re now under power!
Ok, now click the Move pen to point button, which is as close to a manual move command as you have, and click somewhere right down at the bottom of the machine. With luck, you will hear and see the motors whirr into life, accelerate and then decelerate back down again.
For more detail: Polargraph Drawing Machine
This Post / Project can also be found using search terms:
- polargraph machine
- how i make arduino drawing machine
- pdf in details polargraph
- polargraph arduino