Step 1: Modifying an iRobot Create to Paint
This is a robotics project that could probably be completed by someone who has no experience with robots at all. I say this because, before I started, I had no experience with robots. Or writing programs. In fact, I knew how to paint and that was pretty much it.
I had originally intended to write programs so that the robot could do specific paintings. I quickly realized that doing that is tedious, boring, and really doesn't take advantage of many of the robot's great features. So instead of that, this instructable will teach you how to:
- modify the robot so that it can paint with brushes, rollers, and a variety of other apparatuses
- take advantage of the basic pre-set programs to do some painting
- use Active TCL to design a painting using LOGO
- modify the sample programs that came with the module to do some paintings using the sensors on the robot.
This project assumes that you can follow the directions that came with your Create to set up the Module, connect it to a computer, etc. I'm pretty sure most people will be able to handle that without (much) difficulty, so I haven't duplicated those directions here.
Conceptual Basis (or, why I did what I did from the perspective of an artist)
After playing with the robot for a bit I realized that I needed to decide if the robot was an artist or a glorified paintbrush. The logo programing treats it more like a paintbrush, whereas the sensor based programming treats it more as it's own artist. I like it as an artist best. In reality, we quickly became art team-mates. It painted faster and more decisively than I would, but without me to choose paint colors, fill it and push go it was a basically really heavy frisbee. No artist can possibly work without an awareness of the world around them (having senses at all affects your art) so to use the robot without using the sensors seemed ridiculous. I provided it with the things it needed to be aware of, and it's response to these things created the paintings.
I also quickly realized that it's important to forget about how a human completes a task and consider how a robot would complete it most easily. With the exception of spray painting, the majority of painting is most effectively done on a horizontal surface, in spite of the cliche of the artist at their easel. The easel is there for the ease of view for the artist - horizontal art has a foreshortened effect. That's why your printer prints horizontally - that's the best way to apply ink without risk of running or bleeding. That's why I decided to work with the naturally horizontal nature of the robot, instead of trying to build on something that could paint on walls as is so common among 'painting robots.'
I put a lot of thought to the difference between painting an printing. When I paint I don't worry about working left to right, or top to bottom. I put paint where it should be, working in curves, straight lines or whatever else is appropriate. As I'm not trying to just build a printer, I thought that the robot should paint in lines the way I would, rather than work across the painting like a roving printer.
This presented certain challenges, especially with the obvious risk that the robot would roll over wet paint. As it turned out, paint doesn't really seem to accumulate on the wheels much, but they do add a nice mark to the painting. A little builds up between the treads of the tires, but that can easily be peeled off when it's dry. In a way, it's no different than an artist using their fingers to smudge pastels - the robot uses it's 'appendages' to affect the way paint is applied to the surface.
Step 2: Materials List
This is what you need to complete all steps in this project, but if you're picking and choosing you might not need all of it.
- iRobot Create (obviously)
- Command and Control Module (attach it now, and set it up. Double check that it's ON when you're setting up the USB connection, that held me up for a few minutes because I didn't realized that the robot and the command each have an on/off switch.)
- Battery charger
- Serial Cable (included)
The create comes with holes all over it to accept 6-32 screws. Don't buy anything that's not threaded 6-32, because it's inconvenient to have keep track of more than one thing. Also, if you can, either get all flat (like mine) or phillips screws. One screwdriver rules because you'll want to keep around to tighten and adjust things as necessary.
- 4 - 12 inch pieces of threaded rod
- 2 - 2 inch screws
- 10 (or more) nuts
- 2 - 1/2 inch screws
- 9/64 drill bit (this seems to be a good size because it's just a tiny bit snug. The vibration and movement of the robot will tend to loosen connections, so being a little snug is a good thing.)
- 2 - 1 to 1 1/2 inch hinges (these are commonly used for wooden boxes and dollhouse type applications)
- 2 or more - 2 inch clips (green is nice if you can get it - it coordinates with the module, and they come in handy for securing things)
- 1 sheet of white plastic at least 9x9 inches (mine is a board that is sold with cake decorating supplies - it's used to support a cake after it's been decorated. It's corrugated and about 1/8 inch thick, and I was able to cut it with heavy duty scissors.)
- 2 feet of 1x2 lumber
- funnels (to hold the paint)
- 3/8 inch outside diameter clear plastic tubing
- 1/2 inch electrical shrink tube
- small paintbrushes, rollers, painting pads, makers, pens, or anything else that you can think of that will make a mark
- masking tape (to hold down paper and hold things temporarily)
- plastic sheeting (because robots are unpredictable and fast, and you probably don't want everything painted)
- a diner ketchup style bottle with cap for ever color you plan to use
- white paint (for style)
- something to cut wood and something to drill holes
- a screwdriver
- other basic household tools
- lots of paint that cleans up with water (I use mis-tints from paint and home improvement stores. You can get a lot of it for $1 to $5, or, if you're super nice/lucky they'll give it to you for free, like the super nice people at Pittsburg Paint, who supplied almost all of mine.)
- something to paint on (paper and fabric work well. Butcher paper comes on rolls and is a cheap choice, especially for starting out.)
Step 3: Modify it to Apply Paint
The robot needs to be able to hold a variety of different paint appliers, as well as pencils, markers, or whatever else you would want to make art with. This presented a variety of challenges, but I think my system resolves most of them quite well. Two wooden arms are attached to the top of the robot, and hinges hold a clip at the end of each. This way the arms can be as far apart or close together as they need to be (they swivel at the point of attachment to the robot, and, once set, that screw can be tightened to keep them more solid, or left a bit looser so the brush can swing at bit as the robot turns.) The hinges allow the clips to always point right at each other or at any other angle necessary to hold the brush, which wouldn't be possible if the clips were screwed directly to the arms. The paint needs to be supplied steadily to the brush, so I added an upper deck to hold a funnel, and paint runs down a tube to drip out right in front the brush. The brush spreads it as the robot moves. You can choose a different size of tubing to supply a different amount of paint, or adjust the speed the robot moves if you don't like the line you're getting. The shrink tubing holds the vinyl tube and funnel together, makes it easy to clean, and allows it to just drop into the top platform. It's a fairly simple assembly, and has held up well through a lot of paintings.
Cut the lumber into 2 7" long pieces.
Drill a hole (the long way) one inch from the end of each piece.
On the other end, drill pilot holes to attach the hinges.
Paint these pieces white (if that's what you're into.)
Once dry, screw the hinges onto the ends.
Then, on the other side of the hinge, attach a clip with a screw and nut. Most clips like those shown come with a hole (even if it's covered with plastic) but you might have to enlarge it a bit. This will work, I promise.
Use a 2 inch screw through the hole on the other end into the furthest back pair of holes on the top surface of the robot.
Cut the plastic sheet based on the pattern in the images. I used heavy duty (these will cut a penny!) style scissors, but I'm sure most plastics can be cut with a utility knife or, if you feel like splurging, have it laser cut from acrylic.
Screw a nut 3/4 inch from one end of each threaded rod. Screw a nut onto the other end about three inches from the end.
Screw the short end of the threaded rods into the holes in the cargo bay, up to the nut.
Slide the plastic sheet down 3 inches to the top of the other nuts. You may need to add a second nut on top of the plastic if it's not holding firmly on it's own.
Set your funnel into the opening on the platform.
Measure how much vinyl tube it will take to reach from the bottom of the funnel to just touch the surface below.
Use about an inch of the shrink tubing to attach this tube to the funnel. A heat gun will do this well, but my sister's hairdryer was handy and got the job done. You can use masking tape to do this instead if you'd rather, of if you want to test it before committing.
Whatever you use to paint with (the brush/roller/etc.) will be held in place with the two clips. The tube should sit between the paint applicator and the robot. You may want to tape the tube to the brush if it doesn't stay in place on it's own.
Fill the ketchup bottles with the paint you plan to use. A funnel and ladle (that won't be used with food) come in handy for this. You'll be happy to have such fast paint refill abilities later, and the ketchup action helps fill the tube quickly instead of waiting for paint to run down on it's own.
Step 4: First Painting: Using the Demos
Lay out your plastic sheeting. Tape your paper/fabric down with masking tape, on all sides. An area of around 3 by 4 feet seems like a nice amount of surface for it to paint on. Larger works, too, but much smaller than 2 by 3 and you'll paint more on your plastic than your paper. If it can come up around the edges the robot will catch it, pull it around, crumple it up and do whatever other mischievous robot things to it that it can think of, so tape it down well.
Turn on your robot. Select a program that sounds appealing - 5 is my favorite, but any that you have the equipment for are good. If you choose a cover type program be sure to put something around the perimeter of the area (like 2x4 lumber or something) because otherwise it will cover and paint your room. You can also have a lot of fun with a pong/4 square kind of deal if you have 3 friends around - have on person on each side and make them responsible for bouncing the robot on their side. You could do this on a table top and count on the cliff sensors, too.
Fill some paint into the funnel. Start small the first time, but you can put quite a bit in once you're confident. As soon as the paint it down to the bottom of the tube push the 'start button' and watch it go. Be ready to be fast if it goes off course of something. Also be sure to watch how the brush/roller/etc does, as you may need to do some adjusting there. You'll probably get the hang of it pretty quickly. If you want to take a break or want some extra time a small c-clamp screwed down onto the tubing will stop the paint. The clips used on the arms aren't strong enough to stop the paint in the tube, though.
You can pull the funnel and clean it between colors, but I usually just add one color on top of another in the funnel. It's smart to know your color wheel and choose another color to add that doesn't combine red, blue and yellow (because this will make a brown/grey awkward color) but you can get great results with different shades of blues, then adding some purple or red, etc.
Step 5: Use Active TCL and LOGO to Paint
There is a super clever guy that posted some awesome stuff on the create forums. The forums are a great resource, especially if you don't really know what you're doing.
His documentation is available here:
He used TCL to set up the robot to run using LOGO commands. You'll need to go to the post and follow his directions for downloading and installing Active TCL, then downloading his program. I didn't feel right posting his code here (for obvious reasons), but it is available at the forum post included above.
Once you get it all installed and downloaded you're ready to start using your new iTurtle Create (which is a bad LOGO pun). It's an extremely simple interface where you literally tell it (in millimeters and angle degrees) what to do, connect the serial cable, and do it. This will work much better if you have a laptop, as the serial cable isn't that long and it will have to be connected while it's working. The robot is (apparently) able to carry around 30 pounds, so if you did something to accomodate it I could imagine you could set your laptop right on it and let it go. You can spend hours and hours plotting out paintings, somewhat etch-a-sketch style with this system, and other than installing programs you don't need much computer knowledge at all.
Special Note: Pull the Command Module off your robot if you try this. It seems to interfere somehow, and this probably won't work if you have it attached (even if it's turned off.)
It's a good idea to set up your painting and either run it without any paint or with a marker before committing to it with paint (at least at first). This is especially useful for choosing your starting point as that will dictate where the imagery appears on the paper.
It is important to note that this method seems to disable all of the safety sensors on the robot, so if you set it to go forward 50,000 instead of 500 it will really do that, and you'll be chasing it down to stop it. If it's using real paint you'll have a lot of cleanup to do after you catch it.
This method is really effective for creating and rapidly changing what you want to paint, and is much more efficient than writing programs and installing them on the Command Module. The biggest downside is the serial cable.
Step 6: Using Sensors to Paint
As I stated in my introduction, after working on this for a while I realized that treating it as a printer really overlooked a lot of features the robot has to offer. So here are a few things you can do with the Create, Command Module, and sample programs to make paintings. Once you get a feel for how the code works and what you can change the options will be endless.
The very easiest way to paint with sensors is to the run the sample 'cover' program with objects around the perimeter of the painting area, and even some heavy objects (that are either paint resistant or wrapped in waxed paper) within the painting area. But you probably want a little more control than that, and I added the Command Module to the materials list for a reason.
If you would like to keep some of the randomness in what the robot is painting, but still have it work within parameters you set, here are some ways to do it:
Open the sample program called 'drive' in programmers notebook (an explanation of this is available in the manual you can download from the iRobot website.)
On line 156 you will find:
// Set the turn parameters and reset the angle
This is what the robot does when a sensor is triggered. This includes bumping into things or almost falling off of things. This section has some fun things to play with.
distance = 0;
You can change this to any number. The number you choose is how many millimeters the robot will back up after it hits or finds the edge of something. So, for example, changing the "0" to "200", it will back up 200 millimeters. This will give you 200 millimeter long lines at various angles coming from the edges and whatever other objects are on and around the painting surface.
angle = 0;
This means it backs up straight after it hits something. You man not want this. If you'd like it to back up at different angle set a number here. Changing "0" to "45" will cause it to back up at an arc of 45 degrees. This one takes some tweaking to get just how you want it, but it can cause some cool effects.
turn_angle = randomAngle();
This means that the amount the robot turns after hitting something will be somewhere between 53 and 180 degrees. If you'd like to change the range of "random" then head down to line 460 and change that code. If you'd like to set it to a specific angle change "randomAngle()" to "15" or whatever other angle you like. The numbers "1" and "-1" are reserved for right angles, but it seems that any other number, positive or negative is fair game. I just realized that I haven't tried anything over 360, but now I can't wait to try.
On lines 143 and 149 you find "turning" followed by a 0. Changing those to anything else makes the robot spin forever. This isn't a very effective or fun change to make, so I wouldn't bother.
This means move forward at a rate of 300 heading straight. You can change the speed of the robot by changing "300" to another number. Lower is slower, higher is faster (no tricks here). Changing "RadStraight" to a number will result in the robot driving in an arc. This will definitely increase the 'painterly' nature of what the robot does. I really like changing this setting.
Changing the speed the robot moves can change the lines it paints. Slower speeds will usually result in a smoother, heavier application of paint. Faster speeds will give you a brushier effect, or it will sometimes even make your brush skip.
Once you get involved in the code you'll be able to tweak all kinds of things. If you are having trouble understanding something check the oi file, sometimes there are clues in there. A lot of the time I've had better luck using an angle number instead of "RadCW" or similar commands. I'm assuming this is a fluke, but it's something to check if you have trouble.
I'm not an experienced programmer at all. In fact, this is the first I've ever done anything with code, with the exception of making websites. I think it's pretty hard to hurt the robot, and there's always a clean copy of the sample programs on the CD if you irreparably damage the one you're modifying. The code is well noted, and you can pretty much figure out what everything does if you take some time with it. It's worth diving in and changing things to see what you get. I've written quite a few new things to add to the 'drive' program, but they aren't ready to show to the world quite yet.
Step 7: Conclusion
It was important to me that I turn the Create into something I would really, honestly use on a regular basis. A robot that can get a can of soda from the fridge is awesome, but I drink one can a day at most, and I usually grab it on my way to do something else. Even if I had made a robot that would do that I really wouldn't use it.
I've been a full time artist/designer for years, and anyone who's done that knows how difficult and lonely it can be. That's why artists hang out at galleries, movie theaters and bars. You need to get out of your own head and think about different things. That's part of what has been so fun about working with the robot - it is fairly unpredictable (and the amount of unpredictability can be changed in it's code) and it generates imagery that I never would have. It does some of the heavy lifting for me, but I still get to make decisions. I've gotten into the habit of working with it, and I really use it a lot.
Here are my plans for future experiments with the robot and some ideas I'd love to see other people work on:
- LOGO and fractals are practically best friends. There's a lot of potential in fractal paintings if you get more involved with LOGO. Fractals can be similar in structure to trees, coral, and other organic forms, leaving the door open to making a field of unique but related trees, and possibly even adding to the painting yourself to create a landscape.
- Collaborating on paintings with the robot in general could be a lot of fun. Let the robot paint, then paint yourself, then let the robot paint again. I did a lot of this with real humans in art school, but it would probably be more fun with a robot. They aren't concerned with preserving your work, and will paint with reckless abandon.
- Writing a program that runs on the Command Module that causes the robot to run on a certain path would have some benefits. It could be used to try the same idea in different colors and mediums. It could be used as the basis for a whole series of paintings that would each be handled differently after that. It could even be used for graffiti.
- Graffiti in general would be an option with the robot. It could paint on streets or sidewalks. Use this at your own discretion and be responsible. Or just have it hold chalk instead of paint and go to town with it. It could draw arrows directing people to something. It could write messages. In theory, it could even be used to paint the edges of parking spaces. That would be especially useful for temporary markings.
- Attaching a servo motor to the brush holder would give you the option to stop and start painting wherever you choose. This was outside my experience level to figure out in the time I had, but I'd really like to try it in the future.
- The platform was built with the option of adding more colors of paint/brushes at the same time in mind. It would be possible to add a second deck to it, which would support more funnels.
Basically, after 2 months or so of working on this I feel like I'm still just starting, and I'm spending as much time with it as possible.
This robot and I will be at Maker Faire in Austin if you want to get up close and personal with it! Hopefully by then I'll have made even more progress with it!