Polargraph Drawing Machine

 by Euphy
Featured
P1030510_p.jpg
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

P1020768_c_p.jpg
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

Or have a look at what I've been doing with mine
Polargraph website
Polargraph project code and wiki
Flickr stuff

Step 2: Parts

P1030231_c_p.jpg
There's a hundred different ways of making a machine like this, but I'm going to show you how I make mine, as a jumping off point. I hope you'll see some places it can be improved.

Electronics.
  • Microcontroller - Arduino (ATMEGA328) compatible. I've used a Seeeduino here. (from coolcomponents).
  • Motor drivers - Adafruit's Motoshield. 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. (oomlout.co.uk)
  • Motors - 400 steps per revolution (0.9 degree per step), 4.6v NEMA 16 stepper motors. These have a 5mm diameter shaft. (ebay - astroyn excess).
  • Power supply. 1 amp (1000mA) Variable voltage AC/DC power supply. I set mine at 6v. 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)

Running gear.
  • 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.

Hardware.
  • 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!

P1030602_c_r.jpg
P1030603_c_r.jpg
I couldn't find a source for these beaded cord sprockets.  Roller blind mechanisms have them in, but not in an easily usable form.  I made my own and had them printed through Shapeways.  John Abella has made a parametric sprocket suitable for other bead spacings that can be 3d printed at home if you have access to something like a makerbot or a reprap.

Push-fit a sprocket onto the 5mm shaft of the motor.

Step 4: Prepare your motors

P1030604_p_r.jpg
Strip the ends of the motor wires and tin them. Unless you have very long wires already on them, you'll be extending them, and use whatever is to hand to do it - in my case, I used plain screw terminals.  Make sure you label your extension cable too.


Step 5: The drawing surface

P1030387_r_p.jpg
Find a big board or something to use as your surface.  Your board should be at least 150mm bigger on each side than the largest sheet of paper you want to draw on.

You can use a wall if you have some motor mounting brackets, but I was always terrified about it going wrong and scrawling marker pen over my wall.  My landlady would be unimpressed, I feel.

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

P1020438_c_p.jpg
P1010716_xc.jpg
Your motors should be mounted so that the sprockets are as close as possible to the drawing surface.  If you have a thick surface, you can get away with just sticking your motors to the top edge of the board with double-sided foam tape.  This is actually a nice way of doing it because it cushions the vibration too.  The motors do tend to twist a bit, because their little foam rafts have some stretch in them, but on mine it wasn't really a problem unless I left the gondola hanging for days.

This arrangement is much neater when it comes to cabling and things too.  It all hangs down the back.

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

P1030421_c_p_r.jpg
P1030434_r_p.jpg
P1030606_c_r_p.jpg
P1030609_c_p_r.jpg
P1030612_c_p_r.jpg
This is way I've come to mount the motors, and it looks a bit untidy, but it is less dependant on the type of your drawing surface - it can be stuck onto anything basically, including walls and other enormous surfaces.

I have attached plans for a motor mount to be lasercut from 3mm thick plywood, but there's nothing clever about it except that it only slots together, so the motory bits can be removed easily, leaving the main mount plates in place.  I have got it on a Ponoko P1 sized piece of board, and you will need two of these cut.

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

P1030417_c_p_r.jpg
path-afmotor-library.jpg
serial-port-monitor-ready.jpg
You need an ATMEGA328-based arduino compatible board, I used a Seeeduino v2.21 here - it does the job very nicely.

Upload the source code to the arduino.  Look at this fine guide courtesy of Adafruit for help.

The code now requires version 1.0 of the Arduino software. If you already use another version of Arduino, go get the new one but install it alongside your existing installation in a separate folder.  They are happy to live together.  But Arduino 1.0 breaks all your old libraries, so if you want things still to work, keep your old Arduino too.

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 - the sketch is made up of multiple files, so you need to download them all.  (There is also a pre-compiled binary in there too if you want it.)

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.

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.

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

P1030624_c_r_p.jpg
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.

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

P1030650_c_p_r.jpg
P1030646_r_p.jpg
P1030649_c_p_r.jpg
P1030654_c_p_r.jpg
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

interface with labels.jpg
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 google code project site has the latest versions for mac or windows, in a zip called polargraphcontroller<version number><platform>.zip.  

Download it, unzip it, and run the executable.  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.

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.

So open Processing up, and go to File->Sketchbook and you should see "polargraphcontroller" listed there.  Click on it, and the application should open up.  It'll only be very small, so go ahead and maximise the window, or stretch it so you can see everything.  If it worked, then well done. NEXT!

Step 12: Controller software - Primer

startup app.jpg
Ok, in the controller window there are three main elements.  
  1. The control panel with all the buttons down the far-left,
  2. The grey rectangle in the middle that represents the machine itself,
  3. 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.

The interface is separated into three tabs, switch between them using the labels at the very top.  Each tab has a different set of buttons in it's panel.
  1. 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.
  2. 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.
  3. 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

change serial port.jpg
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.



The purple spot will move too.  This is where the machine thinks the pen is.

Try this again, and make sure the sprockets are moving in the right direction.  When the machine is moving the pen down the page, the left-hand motor will be spinning clockwise, and the right-hand motor will be spinning anti-clockwise.  When the machine is moving up the page, it'll be the other way around.

If one, or both of your motors are going in the wrong direction, you might have got your datasheet wrong, or made an error when labelling them up or something.  You just need to swap your two pairs of wires around.  To be honest, trial and error is as good a way of working out the correct circuits as anything else, but it's hard to do until you're absolutely sure all the rest of it is working right.

Good work! I recommend a cup of tea!  There's no part of a project quite so rewarding as that first moment when it moves, or makes a noise, or electrocutes you, I think you'll agree.

Step 15: Assemble the gondola

P1030394_c_p_r.jpg
P1030392_r_p.jpg
5801383646_00a15ec557_z.jpg
The gondola is the pen holder.  There's a few alternative designs out there for them, including this 3D printable one that seems to do the business nicely.  My design is much heavier, and has a hollow centre so that the pen can always be in the exact point where the cords converge.  In practice, I'm unclear about how much difference this makes, but it makes me feel good.

I made the first one from corrugated cardboard, and a blank CD, stuck to some ball bearings (see the last picture on this step). Later I graduated onto some fancy-dan laser cut parts (available through ponoko), but the principle is the same.  I've attached the design in an EPS on a ponoko P1 sized board.

The parts just slide together, and then onto a length of brass pipe (see parts list).  The laser cut parts have nodes in them that will need a little filing to get them on. Just be careful because the acrylic is pretty brittle.  It should all push-fit together, but if it gets too loose, a few dabs of glue will keep it together.  I usually make these as a stack, and put a bead of glue around the tube before pushing on the very top-most acrylic ring.  This glued ring lets me handle it a bit more confidently when it's hanging.  It makes just as much sense to glue the big stabiliser instead.

The sequence is, from bottom to top:
  1. Big stabiliser
  2. Empty bearing
  3. Spacer ring
  4. Bearing with straight cord hanger arm
  5. Spacer ring
  6. Bearing with offset cord hanger arm
  7. Spacer ring (this is the one I glue)
  8. And a plywood ring as a decorative touch

Step 16: Add cord and counterweights

P1030413_c_r_p.jpg
P1030409_sq.jpg
The length of the cord will obviously dictate the size of your drawing.  Make your cords long enough to stretch at least from your sprocket to the opposite corner of your biggest drawing paper sheet, when it's mounted.  Don't forget to leave a couple of inches to tie/clip your counterweights on with.  Just push one end into the clips on the gondola.

I use some bolts with washers on them as counterweights, but you can use anything - bags of change are a good alternative.  The exact weight isn't critical at all - this is not a finely balanced machine.  The object is to have the gondola hang naturally in the upper-middle of the machine's drawing area.  My weights are around 150 grams each.

After this, you may even wear your gondola with beaded cord as if it is a steampunk arc reactor medallion.  I often do, and feel very powerful at it. POW! TAKE THAT, BAD GUYS!

Ahem... Or you can just put it on the machine, draping the cords over the sprockets.  You'll need to figure out a neat way of avoiding the cables if you have front-mounted motors like me.

Step 17: Back to the drawing board

marking diagram.jpg
Ok, the last bits of configuration then:
  1. Measure your machine size
  2. Find your home point
Use the diagram attached to this step, and draw lines on your drawing surface in the places marked.

It's important that the lines are all square and parallel, and your measurements are accurate.  You can't hope to get good results if you don't have it marked out properly.  As they say: Proper Preparation Prevents Poor Polargraphs.  Don't they?

Ok, so measure your machine width, in mm.  This is the distance between the closest points of your sprockets.  Measure from the teeth rather than from the rim.  It should really be from the point where the cord hangs, but that changes all the time, so this'll do.

Now draw a line for the top edge of your machine.  It should run exactly in between your sprockets, between the two motor shafts.

Draw another horizontal line, exactly 120mm lower than your top edge you just drew.  This is where you'll put the top edge of your page.  You can't expect to draw much higher than this.

Draw a vertical line down the exact centre of your machine.  Where this vertical line crosses your top edge of page line is your home point.  The machine knows where it is, you know where it is.  You both agree, and it's where everything starts from.

Step 18: Finish configuring your controller

setup tab.jpg
Start the controller again, and change to the setup tab.

Set:
machine width
machine height


entering the values you just measured, in millimetres.  Height isn't actually that important since it doesn't affect the geometry, but it does affect how big it appears on your screen, so make it accurate if you can.  You will be able to see the machine changing size on screen as you adjust these values.

You can also change the page width here, and the page position.  Unless you have a much wider machine than this, leave page pos y as 120 though.  

Other than that, page size and position is a purely visual aid to let you size your drawing properly.  You can centre the page horizontally with the centre page button.

The home point has a default position that is where you marked it on your board in the last step, that is, halfway across the top edge of your machine.  Click centre homepoint to reset if it goes astray, and you can set it to anywhere you like if you don't want it there (for whatever reason).

Now save properties again so you don't have to enter this again!

Advanced editing
If you are using different motors, or different sprockets, change:
  • stepsPerRev: This is how many steps your motors have per revolution.  Well, it's actually _double_ that, because I'm using an interleaved step style in the software - it creates kind of intermediate steps.  My stepper motors have 400 steps per rev, so I enter 800.  
  • mmPerRev: This is how much cord is extended per revolution.  It is essentially the circumference of the sprockets, though with these beaded cords, it's actually the length of 8 bead sections.
  • step multiplier: (not shown on the pic...) This is how many microsteps the machine can make between your big steps.  For this machine, set to 1.
If you are changing these settings, you are best of restarting the app afterwards.  There's a lot of other calculations based on these figures, so a fresh start is safer.


Step 19: Upload your measurements to the machine

So now you should see the size has changed on-screen so the controller knows what the real size of your machine is.  But the machine itself doesn't!

You need to upload it by going on the setup tab, you might already be there, and clickking Upload machine spec. This saves the new size into EEPROM on the arduino, so it'll stay there even when the power is lost.  Unless you change the sizes, this is the only time you have to do that.  Page size isn't relevant here, only machine size.

If you're curious (and why wouldn't you be?) Download machine spec does the opposite - it set's the machine size in the controller to be whatever the hardware has saved.  This might be useful if you delete your configuration file sizes and don't want to measure it all again.

But remember that the configuration file doesn't ever get updated until you click save properties.  So remember that if you make changes you want to keep.

Step 20: Now really make it move!


You need to calibrate the machine before each drawing session.  This involves telling it where the pen is.  You do this by clicking Set home on the Input tab and then physically moving the gondola so that it directly over the home point that you worked out earlier.

Clicking Set home locks the motors, it applies power, so they will hold the gondola there for as long as you want.

AND THAT'S IT!

Use Move pen to point to move the gondola around the drawing surface.  The noise should be smooth, and the motion also.  If you find your motors slip - most likely near the extremes of the the surface, or when you're moving fast - you'll need to recalibrate.  As soon as the actual position of the gondola gets out of sync with where the machine thinks it is, then your geometry is all off and your drawings will be distorted.

The standard maximum speed is 600 steps per second, and the acceleration is 700 steps per second (per second).  Change these values by using the number spinners on the setup tab, and then clicking send speed. You can also increment and decrement the top speed with + and -, and the acceleration with / and *, in blocks of 25.  These speed change commands also skip right to the front of the queue too - they're priority, you can see them in cyan in the queue.

Step 21: Work with images

move image.jpg
select image area.jpg
selected density preview.jpg
resize image during preview.jpg
change grid size during preview.jpg
change sample size during preview.jpg
So that's the hard bit done - now load a drawing, select an area to draw, and choose a drawing style.
  • On Input tab, click load image and browse to an image to try.  Some work better than others, but it's all to taste, so just experiment.
  • If your image doesn't show up right away, it might be off the screen somewhere, or too small.  Click move image and you should see a ghost version of your image hovering under your mouse.  Click in the centre of your machine to place it there, and click move image again to move out of that mode.
  • Drag resize image to control how big the image is.
  • Click Select Area and drag a box around the area you want to draw.
  • Once you've selected an area, the view will automatically switch to hiding the image, and showing the density preview. Use the smaller view buttons in the bottom of the control panel to show the image or hide the density preview.
  • The density preview is designed to show what detail is being captured.  The circles are not representative of the shapes that will be drawn, but are representative of their intended position, size and brightness.
  • Drag the number spinner for grid size to change the size of the "pixels", bearing in mind that smaller ones take longer to draw (actually they are faster individually, but there are more of them).
  • Drag the number spinner for sample area to change the contrast of your image.  This is the size of the area that is sampled when choosing the density (pixel sample area).  I find I get the best results with a sample area just bigger than my grid size.
Remember, that once you've found a setting you like, you can save it to the properties configuration file by clicking save properties. If you don't, it'll all disappear when you restart and you will burst into tears.


Step 22: Choose a pixel style

P1030497_p.jpg
P1020505_sq_p.jpg
P1020532_c_r.JPG
P1030006_c_p.jpg
P1020969_r_p.jpg
Currently there are four pixel styles.
  • Shade Square wave - the standard. Pixel density is translated into a square wave pattern.  Darker pixel = more waves = more ink.
  • Shade Scaled square wave - the half-tone effect.  Instead of changing the number of waves, this one changes the size of the square that gets drawn.  Darker pixel = big pixel = more ink.
  • Shade Solid - used for multi-layer chroma keying effects.  This shades every pixel at maximum density, no variation.
  • Shade scribble - noisy effect.  This is like a randomised pixel - a number of lines are drawn, but their direction and length are random (within the boundary of the pixel).  Darker pixel = more lines = more ink.

Step 23: Load it up and get scribbling!

Load a pen in the gondola just by sticking it in with a bit of blu-tack, so the tip peeps out just a bit.

Stick a piece of paper onto the surface.

Home your gondola.

Click the "render" button for the kind of pixel you want.  Watch in amazement!

I've had best success with non-bleeding pens and paper.  I like using a very smooth paper like bristol board, along with hard-tipped fineliner pens.  Here in the UK I can buy these ZIG Millennium pens quite easily, and they're really good. Pigma MICRON seems to be a popular US pen in the same kind of vein.

For coarser drawings, a thicker tip is good, I've used regular sharpies regularly, and though they bleed badly, they are vibrant and solid.

Step 24: Pen lift servo

6286936263_f2f2f34372_z.jpg
6287459182_d5b432ee37_z.jpg
If you fasten a little servo motor to the gondola, you can use it to lift the pen off the page.  There are two servo connectors on the motorshield, if you connect up SER1, then this will respond to commands sent to the machine.  I just use the control horn to poke through the gondola and lever against the surface.

The commands can be issued manually by using # or ~ to raise or lower the pen.  This is not very subtle, but it works well enough to prevent the pen from leaving a big bleedy mark at the end of the drawing. These commands are automatically added to the beginning and the end of the queue when you do a drawings.

Step 25: Pen thickness

6233798806_c1f6353119.jpg
The size of the pen tip controls how many waves the machine can fit into one pixel.  If you have a pixel that is 20mm square, and you have a 1mm pen tip, then you can only fit a maximum of 20 lines in before it's at it's maximum density.  Adding more ink then won't make it any darker.

If you then swap out the pen and put in one with a 0.5mm tip, 20 lines will no longer completely fill in the pixel, now it will require 40 lines to fill it.  The machine works out the maximum possible density based on what sized pen you tell it you've installed.

You can change the pen width on the setup tab, by changing the value of pen tip size and clicking send pen tip size.  The tip size is not saved in the machine, it needs to be resent every time the machine is restarted, which is why the value is pre-loaded in the queue when you restart the controller.

Test pen widths
Rather than rely on manufacturers descriptions of pen tip width, there is a kind of calibration function to test pen widths too, this draws a sequence of pixels at maximum density, but it increments the pen width setting between each one, so you can try to narrow down what pen tip thickness gives you the deepest density you want.

There are three settings on that setup tab that control the size of the test swatch:

Pen test start tip - this is the tip size for the very first square and should be low.
Pen test end tip - this is the biggest tip size the machine will try.
Pen test inc size - this is the size of the increments that the machine will make to get from the start tip size to the end tip size.

If it was set to start:0.6, end: 2.0 and increment: 0.1, the machine will draw the first pixel as if it has a 0.6mm sized pen, then draw more, each time incrementing by 0.1mm, until it is 2mm.

Once you've decided which square you want to be your darkest, set the pen tip width to the setting required and save properties.

Step 26: Vector graphics drawing

load vector graphics.jpg
With the new software (controller v1+ and server_a1), came vector drawing capabilities that make this machine even more useful.

Using Inkscape
All the paths need to be separate in the SVG file.  Text needs to be converted into paths.  You can do this by selecting everything and going to Path->Object To Path (this will convert any shapes like letters into outlines), and then select them all again and do Path->Break Apart (this breaks up any letters that have more than one outline in them).  You might find it useful after that to change the fill colour to empty (click on the empty swatch at the bottom), and set the outline to be black (shift-click on the black swatch at the bottom).  Save it.

Click load vector from the input control panel, and choose your SVG file.  If you can't see your vector, click "move vector" and you should see it floating under your mouse as you move it.  Click again to place the SVG.  You can resize by dragging the "resize vector" number spinner.  Here 100 represents full size, that is 1px in inkscape equals 1mm on the machine.

Only lines that are entirely within the page area will be processed by the controller.

Now click render vector to convert the line art into polargraph commands and load them all into the command queue.  For vector work, the move direct command is used to tell the machine where to move, and it will always draw in a straight line on the board. The down side is that it's a lot slower because it basically chops the line into dozens of smaller lines, and has to do a lot more calculations continuously.

If you hide the vector lines (show vector) you can see the actual lines that are stored up in the command queue previewed (show queue preview).
1-40 of 146Next »
smacneil says: Apr 29, 2013. 1:26 PM
Hi Sandy, love your project! I've managed to build a drawing machine of my own thanks to your help, but I wondered if you had any tips or information on how I might run a Processing sketch through it instead of using the Polargraph Controller?
Thanks in advance :)
Euphy (author) in reply to smacneilApr 29, 2013. 2:18 PM
Thanks! Well the polargraph controller is a processing sketch, so you you can just do it the same way as it does? I'm not really sure what you mean!

sn
unknowntothem says: Apr 28, 2013. 12:17 AM
Seriously awesome project!!
Euphy (author) in reply to unknowntothemApr 28, 2013. 1:09 AM
Thank you!
Mizchief100 says: Feb 13, 2013. 5:40 PM
Thank you! I built mine about a month ago and have had fantastic results. Such a cool program/project/instructable I'm amazed it isn't one of the top ones of all time. The idea for my first instructable was inspired by this.
Euphy (author) in reply to Mizchief100Feb 14, 2013. 3:52 AM
Brilliant work Mizchief, great achievement and I haven't seen anything like it before! You've got my vote :)
FamilyGuy2006 says: Feb 10, 2013. 11:28 PM
This is a great write up. I now plan to make my own with the confidence through knowledge that you have bestowed upon me. Thanks for being awesome like that.
chubchublolly says: Feb 6, 2013. 7:41 AM
Ok so one like this but lower current
http://www.circuitspecialists.com/nema_16_step_motor_39byg407.html
chubchublolly says: Feb 5, 2013. 10:00 AM
Thanks for quick reply so one like that but lower voltage
Euphy (author) in reply to chubchublollyFeb 5, 2013. 1:58 PM
Voltage isn't that important: Current is more significant. What I meant was that I would use a low-ish voltage power supply. I always use variable-voltage power supplies so I can turn it down when it's getting hot, or up if I need a bit more "bite". Running somewhere between 5 and 8v.
chubchublolly says: Feb 5, 2013. 8:31 AM
Sorry last motor for you to look at
http://www.circuitspecialists.com/nema_16_step_motor_39byg407.html
Euphy (author) in reply to chubchublollyFeb 5, 2013. 9:16 AM
0.65A is over current as far as the spec is concerned - that means it might draw more current than the motorshield is comfortable supplying. It's worth noting though that the L293D chips on the motorshield are rated to supply 0.6A continuously, but can handle peaks of twice that. Personally I would use those motors happily, but stick a couple of heatsinks onto the motorshield, maybe a fan if it came to it. And run it at as low a voltage as I could get away with.
chubchublolly says: Feb 4, 2013. 11:27 PM
So this one would work
http://www.circuitspecialists.com/nema_16_step_motor_39byg302.html
Euphy (author) in reply to chubchublollyFeb 5, 2013. 1:00 AM
Probably yes, the torque is a little low, but only in comparison to the other motor.
chubchublolly says: Feb 4, 2013. 1:45 PM
Thanks
So it doesn't anything under 0.6A will work doesn't mater what type of nema it is eg(34,21,17,16)
Euphy (author) in reply to chubchublollyFeb 4, 2013. 2:46 PM
Pretty much yes, it'll work in the sense that it won't burn your motorshield out! Very low current will usually require high voltage, and that's not really a problem up to 12v or so. But you might also find that very low current doesn't provide much torque or holding strength. The NEMA value just describes the physical size of the casing of the motor and the position of the mounting holes, 16/17 are pretty much the same.
chubchublolly says: Feb 4, 2013. 9:58 AM
For the motor wold these work or any other on this website I am a beginner and am not sure what to look for
http://www.circuitspecialists.com/nema_17_stepper_motor_42byg228.html
Euphy (author) in reply to chubchublollyFeb 4, 2013. 10:29 AM
Yes I don't see why not - current rating is the most important thing, should be under 0.6A, and these are 0.4 so will be ok. Six wires though, just cut the white and black wires, or tie them up somehow. Good luck!
b.sss says: Jan 29, 2013. 10:02 AM
Hi Sandy,
I liked your polargraph project and i had decided to create a replica of the same for one of our technical events at our college. Thanks to your help and all the steps you have given here I am succesfully able to complete the polargraph machine and it is drawing well... But I am still not able to understand how it works basically.. I mean how the commands are generated according to the image we load, how it drives the motors in sync with it.. I tried understanding the arduino code but it seems complicated..So can you please just elaborate about it a little in brief?
Euphy (author) in reply to b.sssJan 29, 2013. 1:46 PM
Hi there, thanks for your note, glad you got it running!

Right, there is a lot of stuff in the code, so I can't go through much of it without writing more than the code.but only a small bit of it does the interesting stuff about converting images.

First part - taking in an image, re-rasterising it using the native coordinates system.

Second part - driving the motors in sync to make straight lines.

First part is mostly in the Machine class in the controller. The Machine class is a model of the actual machine, the size of it, the size of the sprockets and the number of steps per revolution, along with the image that's loaded and the grid size.

There is a sub-class of Machine that is used to model the machine that is displayed on screen - DisplayMachine. This has all the properties of Machine, but also has zoom and colour and position settings.

The image gets loaded into Machine (imageBitmap) is given a position (imageFrame). And because I know the grid size that's being used (gridSize), I can cycle through all the intersections of the grid lines and then look at the coloured pixel that's at that coordinate.

There is a pair of algorithms at the heart of all the polargraph stuff:

public PVector asNativeCoords(float cartX, float cartY)
{
float distA = dist(0,0,cartX, cartY);
float distB = dist(getWidth(),0,cartX, cartY);
PVector pgCoords = new PVector(distA, distB);
return pgCoords;
}

public PVector asCartesianCoords(PVector pgCoords)
{
float calcX = int((pow(getWidth(), 2) - pow(pgCoords.y, 2) + pow(pgCoords.x, 2)) / (getWidth()*2));
float calcY = int(sqrt(pow(pgCoords.x,2)-pow(calcX,2)));
PVector vect = new PVector(calcX, calcY);
return vect;
}

These two routines convert a cartesian coordinate (x and y) into a native polargraph coordinate (usually a and b), and vice versa. Above is the version from the controller. PVector is a Processing object that has three properties, x, y and z.

The same calculation is done in the arduino code for doing stuff like vector graphics where the machine has to figure out where the gondola is in cartesian terms. This is the arduino version (it doesn't have the same PVectors so they're a bit more long-winded):

float getMachineA(float cX, float cY)
{
float a = sqrt(sq(cX)+sq(cY));
return a;
}
float getMachineB(float cX, float cY)
{
float b = sqrt(sq((pageWidth)-cX)+sq(cY));
return b;
}

float getCartesianXFP(float aPos, float bPos)
{
float calcX = (sq(pageWidth) - sq(bPos) + sq(aPos)) / (pageWidth*2);
return calcX;
}
float getCartesianYFP(float cX, float aPos)
{
float calcY = sqrt(sq(aPos)-sq(cX));
return calcY;
}

In the arduino, driving the motors is simple enough, I use changeLength:

void changeLength(float tA, float tB)
{
// Serial.println("changeLenth-float");
lastOperationTime = millis();

transform(tA,tB);
motorA.moveTo(tA);
motorB.moveTo(tB);


while (motorA.distanceToGo() != 0 || motorB.distanceToGo() != 0)
{
impl_runBackgroundProcesses();
if (currentlyRunning)
{
if (usingAcceleration)
{
motorA.run();
motorB.run();
}
else
{
motorA.runSpeedToPosition();
motorB.runSpeedToPosition();
}
}
}

reportPosition();
}

This uses the accelstepper library. First I set the position to mode to (motorA.moveTo(...)) and then go into a loop where I run both motors until they're there (motorA.run()).

Drawing straight lines is a bit awkward, uses:

void exec_drawBetweenPoints(float p1a, float p1b, float p2a, float p2b, int maxSegmentLength) { ... }

This basically chops the line into lots of segments (maxSegmentLength), and uses the regular changeLength() method (above) to draw a tiny short line. Then I calculate the pens position in cartesian space, and then begins to plot a new line from that position to the end. Then another short line, and a new positional check and so on. So eventually we end up with a straight-ish line. It's not possible to make a truly straight line - for a polargraph machine, it's cardinal directions are all curves, so it's really hard to get it to do something that looks straight in cartesian.

That might not shed any light on it at all, but maybe it will. If you have a more specific question, I am happy to help - email is a better medium (sandy.noble@gmail.com), or better still leave a note on the polargraph forum!

sandy noble

Euphy (author) says: Jan 29, 2013. 11:28 AM
Well you're right, it _is_ off centre - but weirdly the centreline looks entirely straight and the outline of the image is square and regular. I mean, it's not straight down the centre of the board. Normally distortions that go to one side or another are because of mis-homing, that is the home point is too far to one side, but in those cases the centreline is actually curved - it sort of swerves off and the distortion gets worse as the drawing goes on.

This _looks_ like one motor was lower than the other, or the paper was wonky - but I'm assuming that isn't the case, and everything looks square and level to me.

Does this happen with every drawing?
sweta_rocks says: Jan 29, 2013. 10:24 AM
Hey sandy,
at last i succeeded in designin the polargraph and everything seems to be going fine... I am facin a small problem though... its drawing the image a bit tilted, even though the setup and everything is perfect as far as i know and i havent got any idea y is it happening so...have u any idea about wat cud be going wrong??
i have attached a pic of the same for ur refernce..
Photo-0040.jpg
chubchublolly says: Jan 25, 2013. 9:17 AM
Can you use a belt instead of beaded cord
Euphy (author) in reply to chubchublollyJan 25, 2013. 11:15 AM
No reason why not, lots of machines do - including Hektor, der kritzler and Harvey Moon's machine.
sweta_rocks says: Sep 12, 2012. 7:12 PM
are yu sure that libraries folder should be copied into the arduino sketchbook folder ? cos yu mentioned in step 8 that it shud be saved in arduino libraries folder !

Also i am finding a gr8 difficulty in finding the components yu hav listed !
can you tell me wat NEMA 16 signifies about the motor ?
n what shud be the torque required to be handled by the motor if i am supposing to make this project on a A3 size paper ?
the reason for asking dis is that in the markets here i am gettin 1.8 degree stepper motors but their torque values are different for different models n i dunno wich one to go for ?
Euphy (author) in reply to sweta_rocksDec 29, 2012. 5:19 AM
Arduino sketchbook folder has a libraries folder in it (usually), and the main arduino application folder also has one - it doesn't actually matter which one you use. Originally I used the application one, but now I tend to just use the one in the sketchbook folder. It only might get to be a problem if you had different versions of the same library in two different places - I'm not sure which version it would use first.

NEMA 16 just describes the physical size of the casing of the motor. NEMA 16 seems pretty rare actually, I've only really seen them from that one supplier I've got them from. NEMA 17 is slightly larger, but a lot more common. The current and voltage is more important. Torque required isn't related to size - that is, you don't need more torque for a bigger machine. I also don't really know the torque that's required. If I've lacked torque I've always been able to fix it by turning up the voltage on the power supply, or by adding more weight to the counterweight. So it's not that critical, but if you have a choice, go for higher (bulkier) rather than lower (slimline or compact).

sn
sweta_rocks says: Dec 28, 2012. 8:21 AM
hey sandy i am a bit confused with the files yu hav added in yur recent polargraph code repository -polargraph1.2.4 !
i hav unzipped it and hav 4 folders out of wich application.windows32/application.macosx contains the polargraph controller. Polargraph Arduino code contains d code to be frst saved in the arduino sketch folder as yu hav said above n libraries to be saved in arduino library.
am i correct with this ?
also i aint able to understand the use of Processing libraries ?
what is to b done with this folder ?
Euphy (author) in reply to sweta_rocksDec 28, 2012. 11:19 AM
Forgot to mention - the new download is http://code.google.com/p/polargraph/downloads/detail?name=Polargraph1.2.5.zip
Euphy (author) in reply to sweta_rocksDec 28, 2012. 11:14 AM
Hi Sweta, I've actually just uploaded a new zip file that includes a couple of fixes.

The folders called "application. ..." are the ones that have the precompiled controller app inside them - different version for different operating systems. Use the version that matches the kind of computer you have. You don't need to install any libraries if you are just going to use the precompiled applications.

Inside the arduino-source folder is all the source code that you'd open up in the Arduino IDE and upload to your arduino board. There is a libraries folder inside that that should be copied into your arduino sketchbook folder.

Inside the polargraph-source folder is all the source code for the controller app. If you want to run this you will need to add the two libraries that are in the libraries folder there too. Just put them in your libraries folder in your processing sketchbook folder.

Good luck!
sweta_rocks says: Dec 24, 2012. 5:04 AM
m sry if my question looked silly to yu ! :P
but can d same mechanism work wen yu place the board horizontal ?
n also can yu tell me mre about yur polargraph SD prototype ?
Euphy (author) in reply to sweta_rocksDec 24, 2012. 6:03 AM
If you mean having a board landscape (short and wide) rather than portrait (tall and thin), yes there's no reason why the same mechanism won't work. It's just like only using the top half of my own machine. The only problem might be with the counterweighting system then the weights will eventually hit the ground because it is wider than it is tall.

The solution to that is to use plain bobbins instead of sprockets and gather up the thread instead of hanging it over and using a counterweight. Unless you have a really heavy gondola, there's no real problem with that except homing (calibration) is a bit more of a pain.

The PolargraphSD prototype - not much more to say about it other than what you see in the pics on [url=http://www.polargraph.co.uk/2012/04/polargraph-sd-prototypes/]http://www.polargraph.co.uk/2012/04/polargraph-sd-prototypes/[/url]. It uses an arduino mega loaded with the firmware at [url=http://code.google.com/p/polargraph/source/browse/#svn%2Fembedded%2Fbranch%2Fpolargraph_server_mega]Polargraph_server_mega[/url] and allows you to read a load of commands off an SD card rather than having to have the PC connected. It doesn't really change the speed of the drawing much.

sweta_rocks says: Dec 22, 2012. 11:43 PM
hey sandy,

i am an engineering student studying in India and i am truly inspired by yur work !
i decided to make your work as a project fr an exhibition to b held in my college but d problem with it is that it is too big n also it requires a long time to complete the picture. No i am not criticizing your work but den it'l be difficult fr me to demo its working at the exhibition !

i saw the prototype link yu posted in the comments but dunno how to go bout it cos yu haven't provided any guidelines on that page.

so as a request i was wondering if yu can help me build a smaller version of your main project providing me wid the guidelines as you've mentioned above fr yur main work ! also if only yu can provide me a solution to demo the working of this machine in a short time period !

thanking in advance,
Sweta
Euphy (author) in reply to sweta_rocksDec 24, 2012. 3:32 AM
Hi thanks Sweta, not quite clear what it is you're looking for - a smaller version is just the same as the one you see here, but .. er, smaller. Just mount the motors on a smaller board?
MrStein says: Dec 3, 2012. 11:35 AM
That not work with the AFmotor exemples,that make a step at right and a step at left but no rotation..
Euphy (author) in reply to MrSteinDec 3, 2012. 12:16 PM
Ok, if the examples aren't working either then there might be a fault in your wiring / assembly - check that your ICs (chips) are in the right way around, and that your resistor network is in the right way around too. I've put them in wrong before. You should probably direct any questions to the adafruit forum though - they're the experts on diagnosing motorshield issues!
MrStein says: Dec 2, 2012. 12:24 PM
I don't know why that don't work, my adafruit driver become hot (the ship in the center not the l293D) and my motors shaking as if they were powerless (it's 7.5v 0.2a motors and i use a variable power supply 1a )
Euphy (author) in reply to MrSteinDec 3, 2012. 4:31 AM
Does the shield work ok otherwise? With the other AFMotor examples in Arduino?
hilukasz says: Dec 2, 2012. 3:18 PM
ok so been at it for a few hours, new to stepper motors. would something like this work: http://store.kysanelectronics.com/servlet/-strse-71072/20BYGH33/Detail voltage rating is a bit lower, but correct amps.
Euphy (author) in reply to hilukaszDec 3, 2012. 4:30 AM
Hi they look good, voltage doesn't matter so much, but amperage is the most important. They are fairly dinky by the looks of thing though, so you might find they aren't very strong - I don't really know how to read and compare the torque specs. Probably ok though - the machine doesn't need an awful lot of power.
MrStein says: Dec 2, 2012. 8:16 AM
Hello, great project :D
I would like make it with a arduino duemilanove, can it work? And i have two bipolars motors (1.8degres, 0.2a) I think it's good?

Thank you!
1-40 of 146Next »
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!