Polargraph Drawing Machine

531,584

1,316

609

Introduction: Polargraph Drawing Machine

About: Like everyone, I like making things. I'm currently a computer programmer by trade, which I adore, but I like building physical things when I can. I like pottery and lino cutting and photography, and I love t…

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 website
Polargraph wiki and code
Flickr stuff

Step 2: Parts

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 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)

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!

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

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

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

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

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

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. Seriously. Actually do this. Nothing will work until you do this. Do it.

Look at this fine guide courtesy of Adafruit for help. Or anywhere on Instructables, or one of the hundreds of Arduino tutorials on the web.

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. Download the file called Polargraph.___.zip.

Unzip the bundle. Inside it is a folder called arduino-source which contains (you guessed it), the source code for the arduino part of the project.

Inside arduino-source there is a folder called libraries. It contains the libraries you need (

Adafruit's AFMotor and Mike McCauley's Accelstepper)

It also contains a folder called polargraph_server_a1. This is the polargraph firmware source code.

Copy the contents of arduino-source/libraries into your Arduino/libraries/ folder.

Copy arduino-source/polargraph_server_a1 into your Arduino/ folder.

You should have created three new folders on your disk:

  • Arduino/polargraph_server_a1/
  • Arduino/libraries/Accelstepper/
  • Arduino/libraries/AFMotor/

Start Arduino IDE.

Go to File->Sketchbook->polargraph_server_a1

Fourteen files will open up and be displayed as tabs in the IDE. This is the source code of the firmware.

Press the "verify" button in the toolbar to try and compile it.

If it compiles, press the "upload" button in the toolbar to upload it.


Of course the source code is also available in the code repository - https://github.com/euphy/polargraph_server_a1 - should you want the very most recent version, but you'll have to figure that one out yourself.

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 last 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. Lots of people are still selling clones of the v1 design on ebay, just search for "L293D arduino motor shield".

(The firmware can be compiled to use the Adafruit Motorshield v2, but it's not as good. There are instructions in the source code that show you what you need to change.)

The motorshield has two stepper motor ports, one on either side. It takes it's power from the host arduino, but has a 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.

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. Download the file called Polargraph.*.zip (rather than the "source code" files).

(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 3 yet. So in the meantime, it will only compile in Processing 2.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.

  1. Install Processing 2.2.1 (From https://processing.org/download/?processing)
  2. Run Processing, find where your sketchbook folder is: (File->Preferences, sketchbook location).
  3. Install libaries: Unzip the code bundle, and copy the contents of the processing-source/Processing libraries into sketchbook/libraries.
  4. Install project: In the code bundle, copy the whole processing-source/polargraphcontroller folder into your sketchbook folder.
  5. Restart Processing, and open the controller with File->Sketchbook->polargraphcontroller.
  6. 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 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.

  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 render pixel) 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

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

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, or you can grab the source from the github repo), 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 tube (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 put a bead of glue around the hole in the stabiliser, and then another couple of dots around the hole in the final spacer ring.

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

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

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

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. Yours are probably 200, so you should enter 400.
  • 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 off 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. 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

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

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

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

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

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).

4th Epilog Challenge

Participated in the
4th Epilog Challenge

43 People Made This Project!

Recommendations

  • Toys & Games Contest

    Toys & Games Contest
  • Big vs Small Challenge

    Big vs Small Challenge
  • Fix It Challenge

    Fix It Challenge

609 Comments

0
moji123
moji123

Tip 7 weeks ago

Hello
Thank you for your good project
I did all the steps and made the parts
Unfortunately, the program does not run
I am using Windows 10 x 64

0
ErwinM5
ErwinM5

Question 2 months ago

Everything works now, only my motors are not running, I do hear a sound when I move the pen on the screen
I am using 28BJ48 motors and ULN2003 drivers
Arduino Nano ver. 1.8.5 program: polargraph server a1
Processing 2.2.1 program polargraph 2017-11-01
I can run my servo with the polargraph controller program, and you can feel the motors getting voltage, because it is difficult to turn them by hand, motors are powered separately with 4x new AA batteries
Have also set the max speed to 5000 but no result
Motors Are connected to the Arduino Nano on MotorA 2,3,4,5, and MotorB 6,7,8,9 the servo on 13 (I had to change this in the program)
Can someone help me with this please please I have now come this far and I succeeded in the past but I don't remember what I did (I am 67 years old sorry for that, I have patience with me)

Scherm 1.pngScherm 2.pngScherm 3.png
0
ErwinM5
ErwinM5

Answer 2 months ago

Everything looks good
Problem with the Motors was that I forgot to remove line 76 in the arduino prog the // (in my case) and put a // on lines 58 and 59 (Adafruit motorshield and AFmotor.h
Now I have another problem, the motors run too far, for example if I place move point in the middle, the pen moves a lot further
If anyone wants to help please thanks

0
Euphy
Euphy

Reply 2 months ago

Differences between controller moves and then physical moves are almost always a measurement problem.

“Upload machine spec” to synchronise the two. Look at the serial port during startup to make sure the new spec has been transferred successfully.

Double check your measurements - machine width, home point position, steps per rev, mm per rev.

0
ErwinM5
ErwinM5

Question 2 months ago



And sometimes an error cannot find a class or type named "Println"
public Println console = null;
Can anyone help me what am I doing wrong
I am using Processing 2.2.1
Polargraphcontroller 2017-11-01_20-30

0
Euphy
Euphy

Answer 2 months ago

Hi Erwin, that doesn't look like any Processing IDE that I've seen before. Processing 2.2.1 is a desktop java-based application.

0
kevin_mic
kevin_mic

2 months ago

Thank you for the writeup. Between you and others I finally got my plotter working. Getting the software running was fairly difficult (Its possible that I got the software running earlier and thought something was messed up so I kept searching.)

https://www.youtube.com/watch?v=4L0eSA47Qoc

Now that it is running and drawing things I am running into an issue. After drawing for a period of time correctly it will then drive way too far in the wrong direction and then every command after that will get the error "incoming: MSG,E,Line is not on the page. Skipping it.".

Finding the exact set of lines in the logs

Dispatching command: C17,161323,96164,2,END
Last command:C17,161323,96164,2,END
regenerating preview queue.
incoming: SYNC,161322,96164,END
incoming: READY
Dispatching command: C17,161099,96150,2,END
Last command:C17,161099,96150,2,END
regenerating preview queue.
incoming: SYNC,161098,96150,END
incoming: READY
Dispatching command: C14,END
Last command:C14,END
regenerating preview queue.
incoming: READY
Dispatching command: C17,89071,153101,2,END // Last successful move
Last command:C17,89071,153101,2,END
regenerating preview queue.
incoming: SYNC,239793,92173,END // Strange end point returned
incoming: READY
Dispatching command: C13,END
Last command:C13,END
regenerating preview queue.
incoming: READY
Dispatching command: C17,88625,153259,2,END // Now all moves are skipped?
Last command:C17,88625,153259,2,END
incoming: MSG,E,Line is not on the page. Skipping it.
incoming: READY
regenerating preview queue.
Dispatching command: C17,88406,153332,2,END
Last command:C17,88406,153332,2,END
incoming: MSG,E,Line is not on the page. Skipping it.
incoming: READY
regenerating preview queue.
Dispatching command: C17,87978,153465,2,END
Last command:C17,87978,153465,2,END
incoming: MSG,E,Line is not on the page. Skipping it.

Notice on the last successful move "Dispatching command: C17,89071,153101,2,END" the response was a point that I was not sent -- "incoming: SYNC,239793,92173,END". Then after that I just get "Line is not on the page" errors.

Any ideas why this might be happening?

(Note I would have posted on the polargraph forum but it doesn't accept new members).

0
Euphy
Euphy

Reply 2 months ago

Hi Kevin, love your video, the soundtrack is epic!

This is a puzzle. That message about skipping lines because they aren't on the page happens in two cases 1) the current position is in an impossible position, so it doesn't know how to get from there to the point you want to move to, or 2) the target point is in an impossible position (same problem).

Both of these things happen when there's a mismatch between the machine spec that is in the arduino, and the machine spec that is in the Polargraph controller as it generates its commands. It's not unlikely for the difference to be small, and so half the commands will work (landing inside the page boundary) and half fail.

But what should never happen is the machine gets into a state where it has successfully drawn TO a point that it can't then draw OUT OF. What I mean is if the target point is outside of the page, the machine won't go to it. And therefore if the machine has just completed a move, then by definition, the target of that move must have been on the page. You've discovered a paradox!

I'm honestly a bit stumped on it. The line you indicate is telling me something but I don't know what.

There is a discrepancy between the targeted coordinates and the eventual SYNC and I'm not sure why that would be

Last command:C17,161323,96164,2,END
incoming: SYNC,161322,96164,END

You said to go directly to 161323 but it went to 161322. Next command is the same

I don't know, but I _think_ that's harmless... Maybe it's always been like that, rounding floats to ints does that kind of thing. This _feels_ like an overflowing problem - because of the geared motors, the grid is very very fine and the numbers are very large. Polargraph has drawn much bigger than this before though, with no problem, we use long ints internally. Besides there's other large numbers in your drawing that it does fine.

Ok, instead of speculating:

1) If you export the queue and run the exact same series twice does the error happen in the same place each time?
2) What does the machine say when it restarts (starting with "POLARGRAPH ON!")?
3) Have you definitely uploaded the machine spec to the arduino, and not changed the controller size since? Have to ask :)
4) Can you tell, if during the "working" part of this drawing, that it's square and true and seems calibrated?

Oh yeah re the polargraph forum ... it decided to break one day and I can't figure out Wordpress enough to fix it.

sn


0
kevin_mic
kevin_mic

Reply 2 months ago

Thanks for the quick reply.

I was working today on setting it up so that a raspberry pi zero can send the commands rather than have a computer setup all night. As I was working on this I noticed I kept getting weird behavior on the first few commands. To verify I hooked up polargraph directly and got the same strange behavior.

Then I read your reply and it made me wonder if perhaps I was running an old version of the controller. As I said before I was trying all sorts of different tutorials on getting this up and running and fighting polargraph java code at the same time.

So I went and found the latest source mentioned in this instructable and loaded that. The weird behavior I was seeing went away. So I am going to try writing a valentines note to my wife tonight and see how it goes.

Thanks again. I really appreciate the help.

(Now if I could figure out how to prevent chalk pens from drying out while drawing. I would like to draw more than just an SVG lines but I don't think my pen would last long enough for the other type of drawing).

0
Georgw6
Georgw6

Question 3 months ago

Could I use a USB to connect to a computer for drawing instead of an SD card? How to do it?

0
Euphy
Euphy

Answer 2 months ago

Georgw6 this instructable describes using USB to connect to a computer for drawing.

0
mereko
mereko

Question 3 months ago

Hello,

Thank you again for this lovely project and for making all the resources available! I wanted to do this project, over the winter break to print my final piece for my creative coding class but I ran into some problems.

The pen lift works, the motors as well, except that they never stop once I call to move to point, They also don't move when drawing a vector image but the pen lift accepts all the commends.

My guess is that the step multiplier is not being updated properly.

New window size: 1232 x 729
incoming: POLARGRAPH ON!
incoming: Hardware: 2
incoming: MC_MEGA
incoming: Loaded width:1200
incoming: Loaded height:790
incoming: Loaded mmPerRev:nan
incoming: Loaded steps per rev:400
incoming: Loaded step multiplier:255
incoming: Loaded down pos:187
incoming: Loaded up pos:70
incoming: Recalc mmPerStep (nan), stepsPerMM (nan)
incoming: Recalc pageWidth in steps (-2147483648)
incoming: Recalc pageHeight in steps (-2147483648)
incoming: READY_100

I have tried to update the default file as well as the processing and Arduino code without success.

It would be greatly appreciated to have your assistance in this situation.

Thank you so much for your time and help

parts:
motor:
https://www.amazon.co.uk/gp/product/B074Z52M26/ref...
Shield:
https://www.banggood.com/Motor-Driver-Shield-L293D...
Cord/pulley:
https://www.banggood.com/GT2-Pulley-16-Teeth-5mm-B...
Board:
Arduino elegoo mega 2560
Computeur:
MacOS Catalina



Screenshot 2021-01-04 at 09.38.10.pngIMG_4818.jpgIMG_4819.jpg
1
Euphy
Euphy

Answer 3 months ago

Hi! Looks like you're almost there. I think you're right, the spec isn't getting uploaded to the arduino correctly - mmPerRev is nan which means "not a number"... Which means it's never been successfully set.

Nothing else is likely to work predictably as long as these bits of configuration are missing or not accurate. It doesn't look like any of your settings have been uploaded to the arduino successfully - even the machine size doesn't match your software.

This "should" be fixed with an "upload machine spec". You've already done that I bet, since it's the first thing the instructable tells you to do. To find out what's going wrong, you should look in the console when you do an "upload machine spec". You will see a lot of back-and-forth messages that say things like "setting mmPerRev to xx" and then a followup that says "mmPerRev loaded: yy". If you copy and paste that block of comms into the chat here, that's the best thing to look at.

If the upload machine spec doesn't work for whatever reason, it's possible to craft and send the individual setting messages one by one using the serial port.

Sometimes, unfortunately, the EEPROM on the Arduino is faulty (or worn out) and you actually _can't_ save settings to it. If that's the case, you can try a different memory location and I can show you how to modify the code to do that if we need to.

I'm assuming you're compiling the firmware from source code.

sn

0
mereko
mereko

Reply 3 months ago

OMG Euphy!

First of all, thank you so much for your fast and detailed reply! Secondly, I feel like a real potato for missing on uploading machine spec... Like I have been playing with this, looking everywhere multiple times, the past weeks, and I cannot believe I have missed this. Good lord....

Now have been moving the gondola for the past H, with pure joy of seeing some progress. The motors are turning and stopping at the selected point all the time!!

Tho it seems the servo is now not responding even after uploading the lift range. Also, it used to tic whenever I plug the machine in but now it's silent :(. Would you happen to have an idea of what I might have overlooked this time?

Also, how did you code all this? I mean I just got started in Arduino and processing and seeing something like this is just impressive.

Thank you again for your help and support during the holiday.

M

0
Euphy
Euphy

Reply 3 months ago

Don't worry, upload machine spec catches us all :) The servo issue is another story though - the spec doesn't really affect that. The up and down position is sent as part of the "upload machine spec" process, but you can also send it with "upload lift range".

Unless you get really good ones, servo motors are twitchy. Sometimes the control horn gets stuck at one extreme end of it's travel, and needs a little push to get it back on track. That's about all I can suggest, except checking your connections.

Good luck!
sn

0
Leon a von m
Leon a von m

Question 9 months ago

Hi everyone
The polargrapher moves extremely slowly and I tried to increase the motor speed but that only increases the maximum motor speed and not the speed at which it is drawing, how could I increase the move speed?

Also in the arduino source code there are some variables called in Param1,2,3,4 they are char arrays, they are used quite a lot with reference to position but also to speed sometimes, what are they though?

I have just one more question, I have specified all the correct parameters of machine width as well as width of the paper, however when I set the pen to position on the edge of the page the gondola always moves past the point into the motor and causes a block in the motor so it doesn't work very well after that. I used 3*4 A4 pages so the height and width is almost similar.

Thanks for any help

fixit.png
0
Euphy
Euphy

Answer 9 months ago

Hi Leon, how fast the machine can draw depends on a few things
1) Motor max speed
2) Acceleration speed and
3) Line length

Long lines allow the pen to accelerate up to it's maximum speed. Increasing the acceleration speed does the same thing!

Very short lines are also slow though, because there's usually a very large number of them, and the communications protocol is very slow. It ends up spending more time sending commands to the machine than it does actually moving!

There is no harm in setting the speed and acceleration very high (5000+). You will end up with skipping pen tips and jerky movement, but you might not mind that.

Regards param1-6: When the polargraph machine receives a command like the one shown in your eg C01, 2342, 11294, END, the parts of it get split up by commas, and put into those param variables. So C01, 2342, 11294, END becomes

inParam1="2342"
inParam2="11294"

There's a branching part of the code in https://github.com/euphy/polargraph_server_a1/blo... that looks at the whole command and decides what to do based on it.
It sees that the command here starts with C01, and knows to call exec_changeLength() which in turn knows to find the two parameters in inParam1 and inParam2. It also knows that they are integers, so can convert them from the char array.

Last question: This is hard to diagnose without more information. So I'll suggest a test.

1. "upload machine spec"
2. Physically move the pen to the home position.
3. "set home"
4. "move pen to point" - click just below your home point - a centimetre or two.
- does the pen move there?
5. "move direct" - click a bit lower down again - another centimetre or two
- does the pen move there?

6. "move pen to point" - click just to the left of the current point
- does the pen move there?



sn

0
Leon a von m
Leon a von m

Reply 9 months ago

Thank you so much Euphy.
For the first two questions I appreciate the answers, and with respect to the third question, I have done those steps but as soon as I try to move pen to point then when I say move any amount downward then it looks like the polargrapher moves double that amount, in the image below there is a photo of where the image was placed on the computer screen vs where it was placed on the page, while trying to draw circles they come out as ovals almost every time and hexagons are flattened in some way.
We spoke about the error from uploading machine spec and you said not to worry about it but that is the only place that I can see being problematic, but you are the expert so I will appreciate any help. It also says that the pen size is 0.8 and it says that there probably won't be too much detail, because the pen tip size is 0.8 but I set my pen tip size to 0.4.

Thank you very much
All the best

drawer.jpgscreen.png
0
Euphy
Euphy

Reply 9 months ago

That kind of scaling issue is usually where you've got a mismatch between the machine size as specified in the controller, and the size in the machine OR the actual physical spec of course!

What might be interesting to see is a screenshot of your "setup" tab or a copy of your default.properties.txt file. And also a copy-paste of the text that comes up when you restart the arduino. So in processing, when you restart, there's a load of text that the machine puts into the serial port, you should be able to see it scroll past in the console, or use the serial monitor in the Arduino IDE to grab it. It starts with "POLARGRAPH ON!" and quickly states the current machine spec.

My guess, from looking at your machine is
mmPerRev = 30mm (ish)
stepsPerRev = 200
stepMultiplier = 8

I always set my machines to use 8x microstepping. That's usually done with a jumper setting on the board - yours might be different but that's worth double-checking.

There isn't a right or wrong, they physical setting just needs to match whatever you've set the stepMultiplier to. Higher rate of microstepping makes things move more slowly (for the same given speed. Lower rates of microstepping start to lead to some jerky movement.

0
Leon a von m
Leon a von m

Reply 9 months ago

Thank you very much
I think it works much better now I had to change my mm per revolution to 64, I don't know why it works but it does...

I still have to try the microstepping increment, but I will let the comments know how it goes, might that be the reason that the pornographer's movement is so jerky(the picture is a drawing where the lines are dotted because the machine's movement is not smooth)?

I promise that is my last question lol
All the best, can't thank you enough!!

20200720_132056.jpg