step 11: Upload the Code onto the Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 step 12: Create the robot casing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 Advertisements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
http://www.instructables.com/id/Wallbots-Autonomous-Magnetic-Robots-that-Traverse/
License: Attribution Non-commercial Share Alike (by-nc-sa) Intro: Wallbots: Autonomous Magnetic Robots that Traverse Vertical Surfaces
This Instructable will teach you how to create magnetic robots that traverse vertical surfaces. These robots can move on any metallic walls, including elevators, whiteboards, refrigerators or metal doors.
The robots are outfitted with several light sensors, allowing them to respond to simple user interactions. My implementation supports 3 robot 'personalities', which can be changed by covering the topmost light sensor: Red robots move fast, going towards objects (such as human hands or other robots) Green robots move slower, turning away from objects Yellow robots move the slowest, and stop completely when motion or objects are detected This instructable details my first prototype. In the future I plan to build in more complex, autonomous behaviors. I will use these robots to engage people in public spaces such as elevators or hallways. In doing so, I hope to facilitate creative interaction between people and technology in mundane, everyday settings. Stacey Kuznetsov stace@cmu.edu Human Computer Interaction Institute Carnegie Mellon University for Making Things Interactive, Spring '09 *** UPDATE *** I recently made another version of this project using continuous servo's from sparkfun and a custom-cut PCB. The new robot is much much sturdier: http://www.youtube.com/watch?v=DtwVwc91XYs
http://www.instructables.com/id/Wallbots-Autonomous-Magnetic-Robots-that-Traverse/
Electric Tape Wire Shrink Tubing Cardboard or paper Hot glue or epoxy You will also need access to: Soldering Iron Hot glue gun (or epoxy) Scissors Wire Cutters Exacto Knife
Image Notes 1. light sensors 2. servo motor 3. 10K resistor 4. 100ohm resistor 5. 2.2K resistor 6. hard wire 7. magnetic disks 8. arduino mini 9. rgb led 10. shrink tubing
step 2: Hack the Servo Motors to Allow for Continuous Rotation (Part 1)
Off-the shelf servos allow for fixed motion. We want continuous rotation in order to control robot movement. You will need to make 2 simple modifications to each servo: remove the physical rotation barriers, and hack the potentiometer into always receiving a constant signal. The black part of the motor is designed to stop movement after 180 degrees. This is done physically- there are two plastic knobs that prevent continuous movement. 1. Pry open the servo case 2. Take apart the gears 3. Cut the wires off from the black casing (the next step explains what to do with them) 4. Clip off the small plastic bearings that hinder continuos rotation
http://www.instructables.com/id/Wallbots-Autonomous-Magnetic-Robots-that-Traverse/
Image Notes 1. the piece of the case that prevents motion has been clipped
http://www.instructables.com/id/Wallbots-Autonomous-Magnetic-Robots-that-Traverse/
step 3: Hack the Servo Motors to Allow for Continuous Rotation (Part 2)
Now 'trick' the potentiometer into always getting continuous signal 1. Cut the red, green and yellow wires from the black casing (you should have done this in the previous step) 2. Solder a 2.2K resistor between the green wire and yellow wire. 3. Solder a 2.2K resistor between the red wire and the yellow wire.
http://www.instructables.com/id/Wallbots-Autonomous-Magnetic-Robots-that-Traverse/
*actually, I've found that once the magnets are glued on, working with the servos becomes really annoying- the stick to everything. You may want to hold off and do this at the very end.
http://www.instructables.com/id/Wallbots-Autonomous-Magnetic-Robots-that-Traverse/
http://www.instructables.com/id/Wallbots-Autonomous-Magnetic-Robots-that-Traverse/
Image Notes 1. 100 ohm resistor 2. 10K resistor 3. Power (VCC) 4. Analog In on the arduino (pins A0-A3) 5. Ground
http://www.instructables.com/id/Wallbots-Autonomous-Magnetic-Robots-that-Traverse/
http://www.instructables.com/id/Wallbots-Autonomous-Magnetic-Robots-that-Traverse/
http://www.instructables.com/id/Wallbots-Autonomous-Magnetic-Robots-that-Traverse/
rightThreshhold = (val /5) - 100; val = 0; for (int i = 0; i<5; i++) { val += analogRead(leftSensor); } leftThreshhold = (val /5) - 100; // Print threshold values for debug Serial.print("top: "); Serial.println(topThreshhold); Serial.print("right: "); Serial.println(rightThreshhold); Serial.print("left: "); Serial.println(leftThreshhold); Serial.print("front: "); Serial.println(frontThreshhold); } void setup() { // turn on pin 13 for debug pinMode(13, OUTPUT); digitalWrite(13, HIGH); // setup sensor pins for (int i = 0; i<4; i++) { pinMode(i, INPUT); } Serial.begin(9600); calibrate(); // generate a random state STATE = random(0, 3); setColor(STATE); } // MOTOR FUNCTIONS void turnLeft() { Serial.println("LEFT"); start(); delay(20); for (int i = 0; i<20; i++) { servo2.write(179); servo1.write(1); delay(20); } stop(); delay(20); } void turnRight() { Serial.println("RIGHT"); start(); delay(20); for (int i = 0; i<20; i++) { servo2.write(1); servo1.write(179); delay(20); } stop(); delay(20); } void goForward(int del = 20) { Serial.println("FORWARD"); start(); delay(20); for (int i = 0; i<20; i++) { servo1.write(179); servo2.write(179); delay(del); } stop(); delay(20); } void stop() { servo1.detach(); servo2.detach(); delay(10); }
http://www.instructables.com/id/Wallbots-Autonomous-Magnetic-Robots-that-Traverse/
void start() { servo1.attach(10); servo2.attach(9); } // Set the color of the top tri-color LED based on the current state void setColor(int color) { if (color == RED) { digitalWrite(greenPin, 0); analogWrite(redPin, 180); } else if (color == GREEN) { digitalWrite(redPin, 0); analogWrite(greenPin, 180); } else if (color == ORANGE) { analogWrite(redPin, 100); analogWrite(greenPin, 100); } } // Blink the yellow color (when robot is confused) void blinkOrange() { for (int i = 0; i<5; i++) { analogWrite(redPin, 100); analogWrite(greenPin, 100); delay(300); digitalWrite(redPin, 0); digitalWrite(greenPin, 0); delay(300); } analogWrite(redPin, 100); analogWrite(greenPin, 100); } void loop() { top = analogRead(topSensor); long int time = millis(); while (analogRead(topSensor) < topThreshhold) { delay(10); // while there is an arm wave from the user don't do anything } if ((millis() - time) > 3000) { // if the sensor was covered for more than 3 seconds, re-calibrate calibrate(); } // if the top sensor was covered, we change state if (top < topThreshhold) { STATE = (STATE+1) %3; setColor(STATE); Serial.print("CHANGED STATE: "); Serial.println(STATE); } // Read the other sensors right = analogRead(rightSensor); left = analogRead(leftSensor); front = analogRead(frontSensor); if (STATE == RED) { // go towards objects if (front < frontThreshhold) { goForward(); } else if (right < rightThreshhold) { turnRight(); } else if (left<leftThreshhold) { turnLeft(); } else { goForward(); } } if (STATE == GREEN) { // go away from objects if (front < frontThreshhold) { int dir = random(0,2); if (dir == 0 && right > rightThreshhold) { turnRight(); } else if (dir == 1 && left > leftThreshhold) { turnLeft(); }
http://www.instructables.com/id/Wallbots-Autonomous-Magnetic-Robots-that-Traverse/
} else if (right < rightThreshhold) { if (left > leftThreshhold) { turnLeft(); } else { goForward(); } } else if (left<leftThreshhold) { if (right > rightThreshhold) { turnRight(); } else { goForward(); } } else { goForward(); } delay(200); } if (STATE == ORANGE) { // only move if there are no hand motions- otherwise blink int dir = random(0, 3); if (left<leftThreshhold || right<rightThreshhold || front<leftThreshhold) { blinkOrange(); } else { if (dir == 0) { goForward(); } else if (dir == 1) { turnRight(); } else if (dir == 2) { turnLeft(); } delay(1000); } delay(10); } }
Image Notes 1. left servo 2. right servo 3. top sensor 4. front sensor 5. left sensor 6. right sensor 7. rgb LED 8. arduino 9. Ground (-) wire for the battery 10. VCC (+) wire for the battery)
Image Notes 1. hole for the photo resistor 2. space for the servo gears
http://www.instructables.com/id/Wallbots-Autonomous-Magnetic-Robots-that-Traverse/
Related Instructables
Build a Very Small Robot: Make The World's Smallest Wheeled Robot With A Gripper. by mikey77
Building Small Robots: Making One Cubic Inch Micro-Sumo Robots and Smaller by mikey77
Electro-Graf by Q-Branch
Advertisements
Comments
36 comments Add Comment
Cynar says:
Aug 6, 2010. 12:18 PM REPLY If you added a larger flat magnet in the middle of the robot it would give you a bit more weight to play with(just need to be careful of slippage). Good show though :-)
louisr90 says:
Jun 15, 2009. 11:04 PM REPLY how exactly would u upload the code the the control circuit and is there anyway for u to make a "kit" that other people could buy
staceyk says:
Yea i have a pcb, and bunch of extra boards i printed back in the day. it's pretty easy to put together
PS118 says:
May 11, 2009. 10:50 AM REPLY These things are so cute! I think it's a travesty that this one wasn't "featured". BTW, How much does one cost? Also, since they travel on whiteboards, it could be fun to give them a marker "tail" so they make designs in their travels.
pocketspy says:
Aug 6, 2010. 9:52 AM REPLY I like the marker idea. If you could use a smart board like Mimeo, that my ex, an art teacher uses, you could have them create art and 'save' it to your computer.
http://www.instructables.com/id/Wallbots-Autonomous-Magnetic-Robots-that-Traverse/
rak says:
Aug 5, 2010. 9:23 AM REPLY I love the marker tail idea! That would be so cute. Cost wise: the servos he uses are $10 each. An arduino like his is in the range of $20. Add headers (the connectors), the leds and photocells, and shipping, and I would say that each one cost him around $70. I could make it quite a bit cheaper though, just by using a different microcontroller and buying cheaper servos in bulk.
peanutgnome says:
Aug 5, 2010. 3:57 PM REPLY the opposite would be fun too - add an eraser and these would be like the Roomba robotic vacuums, but for the whiteboard. Turn them on when you leave at night and come in to a clean board in the morning!
rak says:
Aug 5, 2010. 4:11 PM REPLY lol. Wow this is a fun thread to be participating in! Given the processing power of arduino, I would get some proximity sensors and maybe a compass sensor, so that this thing can go up until it senses the edge, turn to the right and go for a bit, then go down and do the next row, and so on. Only thing is that you would need to install a ledge at the top much like the one on the bottom that holds the markers.
staceyk says:
I recently made another version of this using continuous servo's from sparkfun ( http://www.sparkfun.com/commerce/product_info.php?products_id=9347 - $13) Some pictures here And a demo video I used a custom-cut PCP, which cost me $89 for about 20ish boards? So I think the price per one is $26 for servos $5 magnets $20 arduino $5 for the custom cut board $2-3 for wires, LED's, resistors, etc
So about $60 just for the robot itself. Then, the price goes up depending on what sensors/lights/etc you put on it. Photocells are less than a dollar, so is a hall effect sensor- which you can use to detect when the robot is about to climb off a magnetic surface.
rak says:
Aug 5, 2010. 9:43 PM REPLY perfect timing, posting that video. I must say, using the hall effect sensor as you have just described is pretty genius. I had not thought of that. I am definitely going to be making something like this bot in the future, as soon as I can clear some time to do so. I would make the pcbs by hand, and I use the raw atemega chip + oscillator right on the pcb to save money. Not much to say for the servos. Also helps that I have a fully stocked workshop for everything else.
Cynar says:
http://www.dealextreme.com/details.dx/sku.35764 Good little miniture servo that might be helpful
staceyk says:
how do you print your own pcb?
rlmagidson says:
Nov 24, 2009. 9:52 AM REPLY I've read in many projects about the "how" of hacking servos, but I don't really get the "why." Why is it better to hack a servo than just buy a (cheaper) motor that already allows for full rotation? Thanks for taking the time to educate me. - Russ
rak says:
Aug 5, 2010. 9:20 AM REPLY Servos are an easier alternative to using dc motors such as hobby or gear motors. They feature a built in gearbox and drive circuitry. Say a servo costs 10 bucks. If you get a hobby motor for $1 , you still need gears and drive circuitry. The common L293D dual motor drive chip (aka dual half bridge) costs about 5 bucks. Not to mention this requires more pins of your microcontroller (like arduino) vs. a servo only requiring one. A gear motor (with a built in gear box) will typically cost more than a servo itself. So... servos are quick, cheap(er), and are generally more convenient. In a project like this, there's no space to build 2 gearboxes with about a 120:1 gear ratio each. It also leaves a lot less room for error. I can't tell you how many robots I've built where the fatal error was an ever so tiny flaw in the gear train.
nak says:
yep
fluffy111 says:
Becouse it has got already build in drive transfer and you only mount wheels when you hack servo.
http://www.instructables.com/id/Wallbots-Autonomous-Magnetic-Robots-that-Traverse/
Munchys says:
They look like moving led stop/street lights
AndyGadget says:
May 8, 2009. 3:26 PM REPLY It would be fascinating to have a LED at the back of each robot and give them an occasional light homing behaviour. You could than have a 'crocodile' of magnetic minibots.
rak says:
Aug 5, 2010. 9:24 AM REPLY So now we can move this project into swarm robotics with infrared leds and recievers as the primary form of communication.
marc.cryan says:
Well done!
kinomix says:
I think its awesome
killerdark says:
Well done!
crossfire says:
I love it! Can you make a kit for it?
noik says:
skills
kcls says:
Cool!
shawntherobot says:
you should enter this into the arduino contest
afw11 says:
Which LED did you use? Is the light sensor threshold different for each one? If so, how do you find it?
afw11 says:
Also, in the last picture, where is the battery?
robot797 says:
do you sell them i wanna buy 2 of them
magicpocket says:
Beauty
Bongmaster says:
May 9, 2009. 2:15 AM REPLY what changes would need to be made if u were to use LEDs for the light sensors? (due to me only having one LDR). i understand the LED wouldnt be a very good light sensor but it can be one aparenty :)
munchman says:
You can't use an LED in place of an LDR, an LED only emits light, it cannot detect it.
http://www.instructables.com/id/Wallbots-Autonomous-Magnetic-Robots-that-Traverse/
Bongmaster says:
May 10, 2009. 3:29 AM REPLY actually it can. even tho its not made to do so. its prolly not that good at it tho, but they have been used in applications like LED tables that react to movement, the LEDs that are used as the sensors are used in between the ones that give light. check the arduino site, there are examples.
DemonDomen says:
You should use a board to mount the electronics. You will use less wire, it will be more robust and possibly take up less space.
jeff-o says:
It's fine for a prototype, but yeah, a custom PCB would be most excellent.
Bongmaster says:
kool looks like the kind of code i need for my R2 :3
http://www.instructables.com/id/Wallbots-Autonomous-Magnetic-Robots-that-Traverse/