Makelangelo Tutorials

How to Build a Drawbot (Makelangelo v1)

These instructions are for the Makelangelo Drawbot v0.1.  For all later versions, please visit our wiki.


 

If any part of these instructions are out of date, confusing, or in any way not clear please contact us and I will fix it quick fast. These instructions are current for v0.8.

The kit should include:

– 2x stepper motors

– 2x motor mounts

– 2x bobbins

– 4x 5mm M3

– 2x 10mm M3

– 1x pen holder ring

– 1x female power plug

– 1x arduino

– 1x motor shield

– 1x 12v2a power supply

(Not pictured: one arduino box.)

You will also need the following:

– a small screwdriver with a phillips head

– some sewing thread or fishing line

– 3x 2″ 1/4-20 bolts. These are available in any hardware store. In this photo I’ve used very long bolts because they’re all I had available.

Count the parts to make sure they are all there.

Screw the 3 1/4-20 bolts into the holes on the pen holder.

When the bolts get close to the center, stick the pen in and tighten one of the bolts until they pinch the pen.

Put it to one side.

Take the steppers out of their boxes.

Attach the motor mounts to the steppers.

Notice how the steppers are mirrors of each other.

Notice how the wires are on the side of the motor mount, never the back.

Put these to one side.

Make sure the bobbins will fit on the stepper shafts.

Make sure the bobbin set screw hole lines up with the flat part of the stepper shaft.

Add the 10mm M3 screw to the bobbin set screw hole.

Slide the bobbin onto the shaft until the middle of the bobbin is lined up with the middle of the five holes on the motor mount.

Gently tighten the set screw onto the flat part of the stepper shaft. Do not overtighten! You’ll know it is enough when turning the bobbin also turns the shaft with no wiggle.

Put your assembled mounts to one side.

Press the motor shield onto the arduino like a sandwich. The electronics are not a sandwich! Please do not eat the electronics.

Arrange the electronics and the arduino.

Attach the wires to the shield. Match the colors and screw until tight.

Attach the female power plug to your shield. Make sure M goes to red and GND goes to black.

Plug in the power.

Mount your motors and electronics to your wall or board. Note that the female power supply should be coming out at the top and all the writing on the motor shield will be upside down. That way the stepper on the left is attached to the left side of the shield and so on. It also keeps the power wire out of the way of the drawing.

You are now ready to attach the strings.

Push the thread through the center hole on the side of the mount and loop it over the set screw. Use the software to wind the bobbin “in” until you have enough thread.

Make a similar loop in the other end and loop it over a 1/4-20 bolt on the pen holder.

Repeat these steps for the other mount, bobbin, and a different bolt on the pen holder.

You should now have two steppers mounted and wired up with bobbins correctly wound and attached to the pen holder. You can now center your pen and start drawing.

In a future update I’ll show you how to add limit switches and auto-centering. For this you need some wire cutting and is considered more advanced.

In a future update I’ll show you how to add a servo for pen up/down. I have not developed a good enough pen holder yet so I am not going to confuse you with instructions that might change later.

Miscellaneous

Drawbot: much better TSP solving

Optimization is the name of the game when attempting to solve the Travelling Salesman Problem (TSP). I’ve figured out most of what Lin/Kernighan is saying and then implemented it to run as fast as I can get it to go. Here’s the progress since the last picture I posted.
Here’s one of the Seattle skyline for the Seattle Maker Fair

It helps if you back up and squint. No really, it’s like pointilism paintings. Ever heard of the Group of Seven? Like that.

Here’s the results of the Drawbot working on the above image done by the TSP solver last night.

It ran for three hours and then failed when the laptop went into sleep mode while I was at the VHS. The mess in the top left is because I tried to draw the picture twice – once it failed when the stepper motor got warm and caused the bobbin to slip off the shaft. In a future version of the drawbot I’d like to try bicycle chain and sprockets instead of bobbins and thread.

Got any suggestions for pictures I should draw? Post ’em below!

In the News

Drawbot presentation slides

In April of 2012 Dan made a presentation at the Vancouver Hack Space about the Makelangelo polargraph drawbot. Dan talked about his history building machines, what he is working on, and what the future holds. Click on each image for a more detailed explanation.

Tutorials

How to convert SVG drawings for Makelangelo

So you want to prepare SVG drawings so they can be drawn on a Makelangelo.  Nice! Scaleable Vector Graphics (SVG) are an great way of storing images as lines because they can be made bigger or smaller without losing detail. Since the Makelangelo “thinks” in lines, they are a natural fit together.

Inkscape: create your art

Inkscape is a free vector drawing program that loads a ton of file formats, including Adobe Illustrator.  You can use it to turn a photo into line art or sketch something totally new. I used this picture of Darth Vader for this example. (Please support them to show your thanks.)

Darth Vector
Darth Vector

Inkscape: Ungroup

Select everything and choose Object > Ungroup. In some vector images you might have groups of groups of groups, so keep going until the Inkscape status bar says “N objects selected of type Path in root.” Fortunately this Darth Vader image is pretty simple and only needs one Ungroup command.

Inkscape: File > Save As > Desktop Cutting Plotter (AutoCAD DXF R14) (*.dxf)

This is another format well respected in the machining communities.  It is used by everything from Automatic quilting machines to CNC lasers to robot arms. Makelangelo software added support for DXF files in ~2014

Makelangelo: Convert > Open File

You should now see your picture on the screen. The picture will automatically fill the paper as much as it can.

Here you may discover a catch: SVG files can be made from many overlapping shapes, with junk hidden under the top-most layers. When you ungroup and save as DXF, the DXF file will have all the lines. The Makelangelo has no idea what lines are supposed to be on top, so you might need to clean up the vector file in Inkscape before you send it to the Makelangelo.

Makelangelo v7.2.9
Makelangelo v7.2.9

Makelangelo: Start

And that’s it! Much easier than pre-2014 when DXF files needed a lot of massaging.

So where do I get a Makelangelo?

Final thought

I’d really appreciate your feedback about this tutorial.  Please comment below with your questions and I’ll do everything I can to help.

Tutorials

Drawbot: Overview

The Makelangelo is a great way to start learning about robotics. It has two motors mounted at the top of a wall. The motors have bobbins wound with string. The strings are connected to a plotter, a tool that holds a pen. To draw lines the computer can control the motors, which pulls the strings and moves the pen.

But how does that actually work?

I’ll start with the motors, then the measurements, and then the math. After that you’ll have all the theory and we can start talking about what the Arduino computer does.

Motors

When you give power to a normal electric motor it spins as fast as it can. A lot of robotics involves stepper motors. They have a special design so that they only move one step each time they are told to, and only in the direction they are told to. I use NEMA17 stepper motors that have 400 steps per turn, or about 0.9 degrees per step. NEMA17 is a particular size. I have seen NEMA sizes from 8 all the way up to 34.

Measurements

Inverse Kinematics

I know how much string is reeled in or out at each step because I know the number of steps per turn and I know the circumference of the bobbin.

STEPS = 200;
DIAMETER = 0.9;  // cm
CIRCUMFERENCE = DIAMETER * PI;
TPS = CIRCUMFERENCE / STEPS;

I can use Pythagorus’ theorem to find the lengths of the strings because I have The distance between the motors (M1M2) and I know the position of the plotter (P) . If all of this was on a grid then I could say

function IK(P) {
  A = Px - M1x;  // same as V-M1 in the picture
  B = Py - M1y;  // same as P-V in the picture
  M1P = square_root(A*A+B*B);
  A = Px - M2x;  // same as V-M2 in the picture
  // B is the same
  M2P = square_root(A*A+B*B);

  return M1P,M2P;
}

In robotics this is known as Inverse Kinematics – when you know where you want to be and you calculate how to move the motors/muscles/etc in order to get there.

Forward Kinematics

There’s also Forward Kinematics, when you know how far the robot moved and you need to find out where the thing has gone to. For that I use the law of cosines.

function FK() {
  A = length( P-M1 );
  B = length( M1-M2 );
  C = length( P-M2 );
  Theta = arccos( ( A*A + B*B - C*C ) / ( 2*A*B ) );
  Px = cos( Theta ) * A*A + M1;
  Py = sin( Theta ) * A*A + M1;
}

So: If you can calculate the length of string at any point then you can find the difference – we can find the moment the string length needs to change while it is moving.

Linear Interpolation

Let’s pretend I’m moving M (me) from point H (here) to point T (there) in one second. At any moment I can describe my position as

M = ( T - H ) * S + H

At the start of the second S=0 and M=T. at the middle S=0.5 and M is halfway between here and there. At S=1 M=T (I have arrived there).

Putting it all together

If we combine this we get something like

function DrawLineTo(T) {
  start = IK( H );
  tstart = millis();
  loop {
    S = ( millis() - tstart ) * 0.001;
    now = IK( ( T - H ) * S + H );

    ChangeStringLengths(now,start);
  } while( S < 1 ); } function ChangeStringLengths( now, &start ) { if( now.MIP > start.MIP + TPS ) {  M1.Unwind();  start.M1P+=TPS;  }
  if( now.MIP < start.MIP - TPS ) { M1.WindUp(); start.M1P-=TPS; } if( now.M2P > start.M2P + TPS ) {  M2.Unwind();  start.M2P+=TPS;  }
  if( now.M2P < start.M2P - TPS ) {  M2.WindUp();  start.M2P-=TPS;  }
}

The rest, as they say, is details. Stepper motors can only turn so fast; the type of plotter used might change things; sometimes the now IK is more than two TPS from the current TPS; and so on.

I use a very similar technique for drawing arcs, or parts of circles. The only difference is that now I’m moving on a curve instead of a straight line.

Arduino code

Download the arduino code here. Almost all of the code has one job: to prevent user error. The rest is comments to explain my specific implementation.

Wait! What about the halftones?

Halftone() uses the line drawing code to fill in a square with a zigzag pattern. I tell halftone how big the square is, how thick the zigzag line is, and how much to fill in. It does the rest!

Can you put all these parts in a kit for me?

I’ve used timing belt and pulleys instead for greater precision, and written software to make it super easy to run.

Thanks for reading!

If you have any comments or questions about the robot, please feel free to post them below and I’ll be happy to answer.