Archive for the ‘Drawbot’ Category

Get your own Drawbot

Monday, April 23rd, 2012

Want your own Drawbot? It’s this easy.

Kit includes a 3D printed pen holder, 2 stepper motors, a 12v2a power supply, 2 bobbins, an Adafruit Stepper shield, and (optionally) an Arduino UNO. A one-size-fits-all shipping fee will be added at checkout.  The kits will allow you to build a robot up to 45″ wide out of the box, larger with some work.

Drawbot: Added Traveling Salesman Problem and Gcode generation

Saturday, May 12th, 2012

On the whole I’m feeling very good about today.  Here’s a little before and after. Click for a larger version.

The image on the left is the result after 20 minutes of calculating in Java with a “Greedy” TSP solution. Once it finishes generating the lines it saves it all to a gcode file.  I wrote this in about two hours with long breaks to think while I pulled weeds and mowed. It’s brutally stupid code that works. It’s not ready for production yet because it doesn’t meet my standards in two important ways:

  • Lines cross over each other.
  • I need to store information about every single possible pair of points to run my algorithm.  This eats a all the memory Java has access to, and forces me to resize images to ~250 pixels2.

Here is evidence of a solution from MakerBlock that doesn’t have either of these problems.  I haven’t deciphered the python to figure out what they’re doing….yet.  I’d like to be able to convert huge pictures in a few clicks with a nice progress bar.

On a less happy note, my Macbook Pro has finally given up the ghost and I can’t afford to replace it.  My next development machine will probably be a Mac and I’ll be working a lot more in Java.  I’m really falling in love with it’s many (many) time saving features.

Have you got pseudocode for a better TSP solver?  Please share in the comments!

Drawbot: added Floyd/Steinberg dithering

Friday, May 11th, 2012

A big challenge with the drawbot is that it’s still really hard to use. Wouldn’t it be great if you could just load a picture and click start? Well soon you will.

Here’s the plan:
- load a picture (done)
- make it greyscale (done)
- dither it to a set of points (done)
- connect the dots in a single line aka the traveling salesman problem.
- generate gcode
- send gcode to robot

Here’s a sample of what I’ve got so far:

(Poster by Olly Moss.)

Should I give people the power to change the picture size before starting OR should the picture automatically fit the picture to the drawing area (without stretching)?

Drawbot: Automatic Calibration Update

Friday, May 4th, 2012

I had it stuck in my head that I needed to use digital pins to read the value of the switches. On Thursday I downloaded the Adafruit Motor Shield EAGLE schematic and layout files and started reading, only to discover that the empty holes on one corner of the board are intended for analog sensors.  In about an hour I got the switches and the auto-calibration code written & tested.  Victory!

To add the limit switches to your Drawbot, you will need:

  • some female headers
  • a soldering iron
  • two limit switches
  • 2 two-foot lengths of wire in red
  • 2 two-foot lengths of wire in black
  • 2 two-foot lengths of wire in green
  1. The headers I got came in a 20-pack.  I only needed the sets of three so i cut with some pliers and filed them down.
  2. Unplug your Drawbot completely.  Remove the shield from the Arduino.  You may find it easier to remove the stepper wires, too.
  3. In one corner of the motor shield you will see white letters that say “+5/GND/A0-5″.  You want to solder one set of pins into each of the three holes on the right.  I use a set of helping hands to hold the board sideways, then placed the +5 triplet in first.  After soldering it in place I repeated the process with the GND and then the A3/A4/A5 pins.
  4. I soldered one red, one black, and one green wire to a switch. The green is soldered to the C pin that connects to A5. The red is soldered to NC which is connected to +5V. The black is soldered to NO which is connected to GND.  This is now my right limit switch.
  5. I soldered one red, one black, and one green wire to the other switch. The green is soldered to the C pin that connects to A3. The red is soldered to NC which is connected to +5V. The black is soldered to NO which is connected to GND.  This is now my left limit switch.
  6. Grab a copy of the experimental branch from Github.
  7. Reassemble & connect your Drawbot.
  8. Test your limit switch to make sure you solder it in the correct way using the sketch in the download package @ ./arduino/test_switch/test_switch.ino.  The limit switches are wired as “on” by default – when the switch is hit they turn off and the machine thinks it has made contact.  If you have no switch or a bad connection the machine will think you are touching the switch already. You should only see one message from each switch when they are pressed or released. Any more and the switches are “debouncing” which will require a breadboard and some 10k resistors to fix.
  9. Upload the new Drawbot code (./Arduino/arduino.ino) code to your Drawbot.
  10. Either
    • Type “HOME;” in the serial window or
    • Choose “HOME” in the Java app

    Drawbot motors should begin to move the plotter towards the left motor.  When the left limit switch is touched it will reverse direction and move until it touches the right limit switch.  Now the robot knows exactly how much string has been released and it can move the plotter to the (0,0) position automatically.

Drawbot: Pen Holder

Thursday, May 3rd, 2012

Zen Webb asks good questions.  Take this one, for instance.

Can you elaborate a little bit on the gondola design you used? I see multiple versions in the photos, but I’m personally pretty interested in the simple ring design. It looks like it might be 3D-printed, or did you source it from someplace else?

Yes, it’s 3D printed.  So far every version has been.  While I use the ring a lot, it’s far from perfect.  A good pen holder should

…have the two strings meet at a single point, or as close as possible.  The moment they separate the math gets really ugly.

…deals with friction.  Friction causes the pen to drag and lean.  If I tell the robot to draw a square corner and it comes out rounded then I know my pen is dragging because it never reached the corner.  The pen has to stay at a right angle to the drawing surface.  So far I’ve found that having at least three points of contact is enough to eliminate the problem.  That’s why I tape my business card to an eye bolt on the bottom of the ring – the bottom edge of the card forms a large contact area with very little friction.

…deals with gravity.  If the pen is balanced wrong it may point up or down.  If it points up then it might go dry.  If it points down then it might have extra friction when moving downwards, causing the pen to skip and create a dotted line.

…make it easy to switch pens.  Not only should it be easy to replace a pen but every pen should “lock” into the pen holder at the same distance and angle from the drawing surface.  In order to simplify this problem I only use one kind of pen that comes in many colors.

…works on both vertical and slanted surfaces up to a maximum of 10 degrees.

If you have some ideas about how to make a better pen holder, please contact me.  I’d love to print your idea and try it out.

Drawbot: Automatic Calibration

Wednesday, May 2nd, 2012

Zen Webb asks,

Can you briefly describe the process you are thinking of to auto-center the pen carriage? It would be a very useful feature, I’m curious about how you plan to execute it.

I didn’t invent anything.  I started by doing my homework: I looked up every drawbot I could find.  I studied one with auto-center until I understood how they did it.

They put a limit switch next to each motor.  On command left motor winds in and right motor winds out until the left switch touches the pen holder.  Then the process is reversed until the pen holder touches the right switch.  Now the computer knows exactly how much string has been let out of each motor.  Since robot already knows the distance between the two motors, it can use pythagorean theorem to accurately reposition itself to any point on the board.

A machine that has a high degree of repeatable accuracy and that can auto-calibrate is a machine that can restart an interrupted drawing.

I would have this and pen up/down working already but I’m reluctant to modify the motor shield – I want an out-of-the-box solution.  I’d love it if someone could do the eagle design for a new motor shield that gives me what I need.  If you think you have what it takes, contact me and I’ll send you a description of what the shield needs to do.

Drawbot @ Dr. Malabar’s postmortem

Monday, April 30th, 2012

This was drawn on a wall 8′x8′.  There were some technical problems before the drawing began which, combined with my first flu in ages, made pre-game testing a disaster.  The party was already in full swing when I got it started.  The file had WAY more detail than people would be able to see/appreciate at the party (and that also meant it took too long to draw the picture).  Worse, it seems the robot thought the drawing area was 4x bigger than real life – this drawing shows the top right of the image being drawn but it fillls nearly the entire wall area.

So, more lessons learned:

- I need to have the machine installed, calibrated, and ready at least 24h before an event.

- I need to be able to scale drawings on the fly.

- I need to fix a bug in the arduino code that screws up CONFIG calls.

- The rider in the contract should include a cutoff time for client changes.  Wasn’t a problem here but could be in the future.

I don’t know if this kind of post is even interesting to you.  Have you spotted something I’ve missed?  Please share.

Drawbot rentals

Saturday, April 28th, 2012

As I’m setting up the Drawbot for Dr. Malabar’s Circus Spectacular tonight it is obvious that for rentals I’m going to need a few things:

  • This thing needs to be ready to go out of the bag. It’s not enough to bring just the robot parts and a USB stick.
  • A rental contract with a rider and a liability clause.
  • An emergency kit in case something goes wrong: extra cables, a cordless drill, spare parts in case something breaks.
  • My own Gorram laptop that’s been tested to work.
  • A price list!
  • A nice hard case to pack it all in would be sweet.

The people at EATart have been fantastic and incredibly generous for giving me the opportunity.  I really want this to go off without a hitch.  I mean, it’s amazing I can type with my fingers crossed like this.  My hands look like the guy from Enemy Mine.  No, wait!  I mean the Ancients from the original Total Recall.  Eh, whatever.  Close enough.

Oh right, and Dr. Malabar’s is at EATart tonight.  All five of you should go check it out, especially if you live in, like, Costa Mesa or something.

How can you help make robots?

Thursday, April 19th, 2012

I’ve added a new “Join in & Help” page with a donation button as an experiment. Can you spare a few dollars so I can keep making great robot designs? I’m looking for ways to make money from this stuff so I can do it all the time. If you have suggestions, please let me know in the comments below.

Drawbot update: look-ahead optimization

Tuesday, April 17th, 2012

The latest version of the Drawbot code now contains
- the look-ahead code
- a slightly updated Java GUI
- some new gcode scripts for testing

What do you think? Better? Something missing?