How to build your first Robot ($ 85) Home Sign Up!

Home Sign Up! Explore Community Submit
All
Art
Craft
Food
Games
Green
Home
Kids
Life
Music
Offbeat
Outdoors
Pets
Ride
Science
Sports
Tech
How to build your first Robot ($ 85)
by fritsl on March 12, 2008
Table of Contents
intro: How to build your first Robot ($ 85) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2
Video . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2
Video . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2
step 1: Buy the materials (Project board, Microcontroller and starter pack) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3
step 2: Buy the materials (The Motor Driver L293D) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4
step 3: Buy the materials (Servo Upgrade Pack) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4
step 4: Buy the materials (A sensor so we can see.. erh - sense) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5
step 5: Buy the materials (Motors and wheels) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5
step 6: You will also need, and you could also buy.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6
step 7: Lets make a robot! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6
step 8: The double adhesive tape - trick . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6
step 9: Build the body out of.. nothing, really! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7
step 10: Design your Robot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7
step 11: Disconnect! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8
step 12: Let's get started with the board. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8
step 13: Insert the chips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8
step 14: Insert the Motor controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9
step 15: The red plastic on the back of the board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
step 16: Connect the motors wires to the board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
step 17: Connect the wires to the motors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
step 18: Hooking up the servo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
step 19: Hooking up the head . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
step 20: Let there be life . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
step 21: Heads up & go! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Advertisements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
http://www.instructables.com/id/How-to-build-your-first-robot/
intro: How to build your first Robot ($ 85)
Note:
A version II with cool code has been done, letsmakerobots.com, no time to post here right now.
********************************************************************************
Update: To some 10.000 people who already read this post, I would like to apologize. When I first entered this post, I was way over estimating the prizes, due to the fact
that I live in Denmark, where everything is very expansive!
The total cost of this robot was originally set to some $ 150. It turns out that the price is actually only some $85 in the rest of the world, almost half prize!!
(sorry, I have entered new prizes for the components)
********************************************************************************
If you have any problems or questions regarding this project, please feel free to contact me at letsmakerobots.com
This is a walk through on how to make an autonomous, self-exploring, "own-mind" (not remote-controlled, not strictly pre-programmed, but reacting to surroundings)
robot in a few hours.
It is really easy, and it does not involve knowledge of electronics to get you started with robot-building.
Focus in here is on the absolute necessary to get the basics covered.
This is meant to be an eye-opener, after building this, you can build anything and control any electronic device!
Sounds crazy? It is true, you just need to try it to understand how much power is in some of the chips you can buy for a few bucks today. Welcome to the world of
microcontrollers :)
The programming example I write in the end is to make this robot what you would call "wall avoiding" (it will sniff around and explore based on which objects it meets,
what is on the left, right and ahead), but it can be programmed into anything - easily. If interest is shown I will provide more programs for it.
Video
Here is another using the exact same basic principles, board, chip etc. it is VERY much alike - Only I have put some more time into this one ;)
Video
http://www.instructables.com/id/How-to-build-your-first-robot/
step 1: Buy the materials (Project board, Microcontroller and starter pack)
Shopping list, start here, by this:
Links are just where I happened to find the items from a world wide web perspective. You can use any (web) shop you'd like, of course.
Prices are approx. As far as possible, try to get it all from the same shop, and from a shop located in your own country etc to get the best deals and faster deliverance etc.
1 PICAXE-28X1 Starter Pack
The 28 pin project board in this package is like a game of Mario Bros; Fun and full of extras and hidden features, making you want to play over and again. This includes
the main brain, the PICAXE-28X1.
Price: 38 USD
This is a little expansive, but it is only the first time I recommend you to get this, it includes a lot of nice basic stuff, you get a CD-ROM with lots of manuals, cables, a
board, the Microprocessor etc. Actually it is EXTREMELY cheap. Similar packages cost up to 10 times this price!
Be sure to get the USB-version, images in the shops may not match, and show a serial-cable when you are ordering a USB. When buying the USB-version, it is not
necessary to get the USB-cable as an extra item, even though it is also sold separately.
Get it here
.
Once you have bought this one time, just buy a new board and accomplishing Microcontroller for future projects, much cheaper, you are a Robot-builder with all the
basics done.
http://www.instructables.com/id/How-to-build-your-first-robot/
step 2: Buy the materials (The Motor Driver L293D)
1 L293D Motor Driver
The name says it all, more about this chip later :)
Price: 3 USD
Get it here
step 3: Buy the materials (Servo Upgrade Pack)
1 PICAXE Servo Upgrade Pack
-An easy way to get a servo topped with some small parts needed for this project.
You can also get any standard servo, the pins shown on the image, and a single 330 Ohm resistor instead of the yellow chip, if you should wish.
Price: 15 USD
Get the full package here
What is a Servo?
A Servo is a cornerstone in most robotic appliances. To put it short it is a little box with wires to it, and an axle that can turn some 200 degrees. on this axle you can
mount a disc or some other peripheral that comes with the servo.
The 3 wires are: 2 for power, and one for signal.
The signal-wire goes to something that controls a servo, in this case that is the microcontroller.
Result is that the microcontroller can decide to where the axle should turn, and this is pretty handy; You can program something to physically move to a certain position.
http://www.instructables.com/id/How-to-build-your-first-robot/
step 4: Buy the materials (A sensor so we can see.. erh - sense)
1 Sharp GP2D120 IR Sensor - 11.5" / Analogue
11.5" or another range will do. Only do not buy the "ÂÂÂœDigital version" of the Sharp sensors for this kind of project, they do not measure distance as the analogue ones
does.
Price: 10 USD
Get it here
Be sure to get the red/black/white wires for it. This is not allways included, and it is a non-standard socket!
This is actually not a favorite of mine, I usually use ultrasonic sensors, such as the SRF05 (find it anywhere via Google - they also sell it at the picaxe-storepicaxe-store
where they call it SRF005 and have a picture of the back of an SRF04 in the shop! But it is the right one, and I did tell them but..). Anyway; The SRF05 is much more
reliable and precise. It is also faster, but costs a little more, is a little more complicated to write code to, and a little more complex to install - so it is not used here, but if
you are fresh, buy one of these instead ;)
If you go for the SRF05, I have made a small walkthrough to connecting the SRF05 here on letsmakerobots.com
step 5: Buy the materials (Motors and wheels)
2 Gear Motors with wheels
The higher the ratio, the stronger robot, the lower, the faster robot. I recommend ratio somewhere between 120:1 to 210:1 for this kind of project.
Price, total: 15 USD
Get some here
http://www.instructables.com/id/How-to-build-your-first-robot/
step 6: You will also need, and you could also buy..
You will also need:
Double sided adhesive tape (for mounting, the foamy sort is best)
Some wire
Ordinary adhesive tape (to isolate a cable perhaps)
Simple soldering equipment (Any cheap kit will do fine)
An ordinary small nipper or scissor to cut things
A screwdriver
You could also get, while you're at it:
Some LED's if you want your robot to be able to signal to the world or make cool flashing-effects
More servos to make your robot move more..erh..arms? Or servos with servos on etc.
A tiny speaker if you would like your robot to produce sound-effects and communicate to you
Some sort of belt-track system. Robots with belt tracks are way cool as well, and the controller and the rest will be the same. Here is an example to what you
could take it to with belt tracks TAMYIA makes cool belt-track-systems, and this one is also a favorite of mine
Any kind of line-sensor-kit, to turn your robot into a Sumo, a Line-follower, stop it from driving off tables, and everything else that needs "a look down".
step 7: Lets make a robot!
OK! You have ordered the stuff, received your package(s), you want to build :) well.. Let´s get started!
First mount the wheels to your geared motors. And add tires (rubber bands in this case).
step 8: The double adhesive tape - trick
An easy way to mount stuff for fast (and amazingly solid and lasting) robots is double adhesive tape.
http://www.instructables.com/id/How-to-build-your-first-robot/
step 9: Build the body out of.. nothing, really!
Insert the batteries, so you have a realistic idea of weight and balance.
When batteries are below the axel of the wheels you can make it balance, but it is no problem if it does not.
Add some double adhesive tape to the button of the server as well, and..
step 10: Design your Robot
Chose your own design, you can also add extra materials if my “design” is too simple.
Main thing is that we have it all glued together: Batteries, Servo and wheels. And wheels and servo can turn freely, and it can stand on it´s wheels somehow, balancing or
not.
http://www.instructables.com/id/How-to-build-your-first-robot/
step 11: Disconnect!
Take out the batteries, to avoid burning something unintended!
(trust me, you want to ;)
step 12: Let's get started with the board.
And now for the main-brain.
You should have a project board similar to the one on the picture.
(and so this may be of interest to you in the future)
Notice that it has a chip in it. Take it out. The chip is a Darlington-driver that is quite handy placed there on the board, but we will not need it for this project, and we need
it´s space, so away with that chip!
It is easiest to get chips out of their socket by inserting a normal flat screwdriver just below it, move it ind, and tip up the chip carfully.
step 13: Insert the chips
A fresh, brand new chip usually do not fit into a socket right away. You will have to press it sideways down on a table, to bend all the legs in an angle so it will fit. (Legs go
down, into the sockets :).
Make sure all the legs are in the sockets.
If you bought the Servo upgrade from Picaxe, you have a yellow chip. Put it in place of the Darlington.
Note that not all holes in the project board are filled out with the yellow chip. We only need the eight to the right in the picture, as this is just simple resistors, we do not
need to feed them extra.
This yellow chip is actually just 8 * 330 Ohm's resistors in a neat package. And so, if you should have a resistor, you can just insert it instead in slot numbered “0” (see
picture for this ugly little hack), as this is the only one we will use, when we only use one servo.
Also insert the large chip, the brains, the microcontroller, the Picaxe 28(version number) into the project board.
http://www.instructables.com/id/How-to-build-your-first-robot/
Important to turn this the right way. Note that there is a little mark in one end, and so on the board. These must go together.
This chip will get power from the board via 2 of it´s legs.
All the remaining 26 legs are connected around on the board, and they will be programmable for you, so you can send current in and out to detect things and control
things with the programs you upload into this microcontroller. (cool!)
step 14: Insert the Motor controller
Now insert the L293D motor-controller in the last socket. Be sure to turn this one the right way just as the Microcontroller.
The L293D motor-controller will take 4 of the outputs from the microcontroller, and turn them into 2. Sounds silly? Well.. Any ordinary output from the microcontroller can
only be “on” or “off”. So just using these would (example) only make your robot able to drive forward or stop. Not reverse! That may come in unhandy when facing a
wall.
The board is made so smart that the 2 (now reversible) outputs get their own space, marked (A) and (B) just next to the motor-controller (Bottom right on the picture).
More about this later.
http://www.instructables.com/id/How-to-build-your-first-robot/
step 15: The red plastic on the back of the board
On the backside of the board you may find some strange plastic.
This has no use, it is just a leftover from manufacturing.
They “dip” the board in warm tin, and parts they do not want so get tinned is sealed with this stuff.
Just peal it off when you need the holes they seal.
step 16: Connect the motors wires to the board
Take 4 pieces of wire, and solder them to the 4 “A & B” - holes.
.. Or if you are that advanced, use some other means of connecting 4 cables to the standard sized holes! (one can buy all sorts of standard sockets and pins that will fit)
If you (like me) just solder onto the board, you can strengthen this part with some tape. or if you have some of that heat-shrinking plastic you can support the wires with
this.
http://www.instructables.com/id/How-to-build-your-first-robot/
step 17: Connect the wires to the motors
The 2 “A” goes to one motor, and the 2 “B” to the other.
It does not matter which is which, as long as “A” is connected to one motor, and “B” to the two poles of the other.
(yes, my soldering iron is really dirty, I know, haha - as long as it works, you know ;)
step 18: Hooking up the servo
Now let´s hook up the servo.
If you should read the Picaxe documentation, you will read that you should use 2 different power-sources if you add servos. To put it short; We don´t mind here, this is a
simple robot, and to my experience this works just fine.
Yo will need to solder an extra pin to output "0", if you want to use the standard servo connection. Such a pin comes with the Picaxe upgrade pack (a whole row,
actually), but you only need one for one servo, and they can be bought in any electronics store.
If your servos cable is (Black, Red, White) or (Black, Red, Yellow), the Black should be to the edge of the board. Mine was (Brown, Red, Orange), and so the brown goes
to the edge.
The hint is usually the Red; It is what is referred to as V, or any of these, used in random: ("V", "V+"•, "œ+"•, "1"•). This is where current comes from.
The black (or brown in my case) is G, or ("œG"•, "œ0"• or "-"•). This is also known as "œGround", and is where current goes to. (the 2 poles, +/- remember your physicslessons?
The last color is then "The signal" (White, Yellow or Orange)
A servo needs both "+ & -" or "V & G", and a signal.
Some other devices may only need "Ground" and "Signal" (G & V), and some may both need V, G, Input and output. Can be confusing in the beginning, and everything is
always named different (like I just did here), but after a while you will get the logic, and it is actually extremely simple - Even I get it now ;)
http://www.instructables.com/id/How-to-build-your-first-robot/
step 19: Hooking up the head
Now let´s hook up â€ÂÂœthe headâۥ, the Sharp IR-sensor. (or SRF05 if you went for that option)
(If you bought an SRF005 or similar instead, you should look here on how to hook this up, it is different from this!)
There are a million ways to hook up a thing like the Sharp IR-sensor, but here are clues:
Red needs to be connected to V1, that is (in this setup) anything marked â€ÂÂœVâۥ, or is connected to this.
Black goes to G, anywhere on the board.
White is to be connected to Analogue input 1.
If you read the documentation that comes with the project-board, you can read how to attach the accompanying ribbon-cable, and use this.
What I have done on the picture, is to cut off a cable from an old burned out servo, soldered in a pin, and connected the whole thing just as a servo. You can use it to see
which colors of the Sharp goes to which row on the board.. or one way to do this.
Weather you use the ribbons or â€ÂÂœmy methodâۥ of connecting the Sharp IR, you
also
should
connect the 3 remaining analogue input to V. (look at the little pins
connected on the picture, next to the plug)
I had some jumpers laying, and you can see that all 3 connections left are short cut. (The last pair, not touched, are just two â€ÂÂœGroundâۥ, no need to short cut
these). If you use the ribbon, you can just connect the inputs to V (or ground for that matter) by connecting the wires in pairs.
The reason it is important to shortcut the unused analogue inputs here is that the are â€ÂÂœleft floatingâۥ. This means that you will get all sorts of weird readings
where you try to read if these are not connected. (to put it short, this is a semi-fast paced walkthrough, we must get to the end ;)
http://www.instructables.com/id/How-to-build-your-first-robot/
Image Notes
1. important to short cut any un-used analouge pins - can be done with jumpers if
you have some like here.
step 20: Let there be life
Now for some fun!
Some how you should get the Red wire from your batteries (+) hooked up to the red wire on the project board (V). And the black (-) to (G).
How you do this depends on the equipment you bought.
If there is a battery-clip on both batteries and board you should still make sure that the "+" from the batteries ends up to the "V" on the board. (Learn more here)
Sometimes (though not often) the clips can be reversed to each other, and just putting two matching clips together is no guarantee that + gets to V and - gets to G! Make
sure, or you will se melting things and smoke! Do not feed the board with more than 6V (no 9V batteries, even though the clip fits)
As a note; We are only working with one power-supply here. Later you will want to use same Ground, but both V1 and V2. That way your chips can get one source, and
the motors etc another (stronger) voltage.
Install the Picaxe Programming Editor on a PC, follow the manuals to get your Jack / USB / Serial hooked up, Insert the batteries in your (still headless) robot, insert the
jack stick in your robot.. enter the programming editor, and write
servo 0, 150
Press F5, wait for the program to transfer, and your servo gives a little yank (or spins, depending on which way it was).
If something goes wrong here, contact mecontact me, or mess with the manuals and ports etc, until no errors are reported, and all seems to work,
To test, try to write
servo 0, 200
and press F5
The servos disc should spin a little and stop. To get back, write:
servo 0, 150
and press F5
Now your robot's “neck” is facing forward.
Stick on the “head” - the Sharp IR
http://www.instructables.com/id/How-to-build-your-first-robot/
step 21: Heads up & go!
You're done building the basics!
You have actually made a robot. Now the fun starts, you can program it to do anything, and attach anything to it, expand in any way. I am sure you are already full of
ideas, and you are likely not to have followed me all this way ;)
The design may wary, you may have used other parts etc.. But if you have connected as described, here are some tips to get started programming your robot:
Enter (copy-paste) this code into your editor, and press F5 while the robot is connected:
Note: The code will look a lot nicer once you get it into your editor, it will recognize commands and give them colors.
+++
main:
readadc 1, b1 ' takes the voltage returned to analogue pin 1, and puts it into variable b1
debug ' this draws out all variables to the editor.
goto main
+++
Now take your hand in front of the robot's head and notice how the variable b1 changes value. You can use the knowledge gained to decide what should happen when
(how close things should get before..)
Now I advise you to put your robot up on a matchbox or similar, as the wheels will start turning.
Enter (copy-paste) this code into your editor, and press F5 while the robot is connected:
+++
high 4
low 5
+++
One of the wheels should turn in one direction. Does your wheels turn forward? If so, this is the instruction for that wheel to turn forward.
If the wheel is turning backwards, you can try this:
+++
low 4
high 5
+++
To turn the other wheel, you need to enter
high 6
low 7
(or the other way around for opposite direction.)
The servo you have already tried.
All the way to one side is:
servo 0, 75
http://www.instructables.com/id/How-to-build-your-first-robot/
the other side is:
servo 1, 225
- and center:
servo 1, 150
Here is a small program that will (should, if all is well, and you insert the right parameters for high/low to suit your wiring to the motors) make the robot drive around, stop
in front of things, look to each side to decide which is the best, turn that way, and drive towards new adventures.
+++
Symbol dangerlevel = 70 ' how far away should thing be, before we react?
Symbol turn = 300 ' this sets how much should be turned
Symbol servo_turn = 700 ' This sets for how long time we should wait for the servo to turn (depending on it's speed) before we measure distance
main: ' the main loop
readadc 1, b1 ' read how much distance ahead
if b1 < dangerlevel then
gosub nodanger ' if nothing ahead, drive forward
else
gosub whichway ' if obstacle ahead then decide which way is better
end if
goto main ' this ends the loop, the rest are only sub-routines
nodanger:' this should be your combination to make the robot drive forward, these you most likely need to adjust to fit the way you have wired your robots motors
high 5 : high 6 : low 4 : low 7
return
whichway:
gosub totalhalt ' first stop!
'Look one way:
gosub lturn ' look to one side
pause servo_turn ' wait for the servo to be finished turning
gosub totalhalt
readadc 1, b1
'Look the other way:
gosub rturn ' look to another side
pause servo_turn ' wait for the servo to be finished turning
gosub totalhalt
readadc 1, b2
' Decide which is the better way:
if b1<b2 then
gosub body_lturn
else
gosub body_rturn
end if
return
body_lturn:
high 6 : low 5 : low 7 : high 4 ' this should be your combination that turns the robot one way
pause turn : gosub totalhalt
return
body_rturn:
high 5 : low 6 : low 4 : high 7 ' this should be your combination that turns the robot the other way
pause turn : gosub totalhalt
return
rturn:
servo 0, 100 ' look to one side
return
lturn:
servo 0, 200 ' look to the other side
return
totalhalt:
low 4 : low 5 : low 6 : low 7 ' low on all 4 halts the robot!
Servo 0,150 ' face forward
wait 1 ' freeze all for one second
return
+++
With some clever programming and tweaking, you can make the robot drive, turn it´s head, make decisions, make small adjustments, turn towards â€ÂÂœinteresting
holesâۥ such as doorways, all working at the same time, while driving. It looks pretty cool if you make the robot spin while the head is turning ;)
Up for some more advanced code? Check this: http://letsmakerobots.com/node/25
Sound:
You can also add a small speaker to example (output) pin 1 & ground, and write
http://www.instructables.com/id/How-to-build-your-first-robot/
Sound 1, (100, 5)
- or within the example program above make it
Sound 1, (b1,5)
- to get funny sounds depending on the distance to objects ahead.
You could also attach a lamp or LED to pin 2 & ground, and write (remember LED's need to turn the right way around)
High 2
to turn on the lamp, and
Low 2
to turn it off ;)
- How about a Laser-pen, mounted on an extra servo? Then you could make the robot turn the laser around, and turn it on and off, pointing out places..
Add a marker on it (perhaps on a second servo, so it can take it on and off the paper?), and teach it to write the number of times you wave your hand in front of it
on a piece of paper.
Turn it into a "cat-get-down-from-the-chair"-guardian-robot, shaking when the cat comes near.
Make it chase another robot (or cat?) You will get into some good chase-routines this way!
Make it seek out the middle of a room
Make it act like a mouse; Freeze if there is movement in sight, and always move close to walls and seek out small gaps to get into.
You could also take an old toy-car apart, take out the electronics in it, save the motors and turning-device in it, and hook up your board, servo and sensor - you will have
given life to your vehicle :)
Also try to read some of the documentation, it will make sense now that you got a head start, You can do anything now!
Welcome to a very funny world of homemade robots, there are thousands of sensors and actuators just waiting for you to hook them up and make robots out of them :)
Now take some pictures of your robot, and send them to me at letsmakerobots.com - C ya ;)
Related Instructables
Setting up to
program a
picaxe via shell
script(linux) by
wee_man
Building Small
Robots: Making
One Cubic Inch
Micro-Sumo
Robots and
Smaller by
mikey77
Build an
autonomous
Wall-E Robot by
djsures
My Autonomous
HomeMade
Wall-E Robot
(slideshow) by
djsures
http://www.instructables.com/id/How-to-build-your-first-robot/
SemiAutonomous
Create a
Submersible
Pushbot! by
robot for
Atomman
underwater
research by
leevonk
K-9 The
Autonomous
Robot Pet
(slideshow) by
djsures
Autonomous,
Self-Assembling
Robots by dan
Advertisements
Comments
50 comments Add Comment
mdgnys says:
view all 166 comments
May 15, 2009. 8:51 AM REPLY
In the video it shows it balancing on a tilting platform. Did you put in a gyro?
AznPanda says:
Apr 11, 2009. 12:57 PM REPLY
Could you get this stuff anywhere else than on the web?
Perhaps
Bestbuy or Fry's? or a place like that?
mdgnys says:
May 15, 2009. 8:19 AM REPLY
Allelectronics.com
hey wont have the PickAxe, But the will have everything els. I live near their store. it is Home to me. I know all the people there.
dowd95 says:
May 1, 2009. 8:44 PM REPLY
i buy most of my electronic parts from Radio Shack but I have not tried to buy this stuff...
fritsl says:
Apr 26, 2009. 6:51 AM REPLY
I would not know. Depending on where on the planet you are etc. I am located in Denmark, and have no clue to where you are :)
AznPanda says:
Apr 25, 2009. 1:56 PM REPLY
>.> can you respond to my question pleasee
Davidl3 says:
May 13, 2009. 6:01 PM REPLY
What does it do?
ARCHGREEN says:
Jun 11, 2008. 12:02 PM REPLY
THE SERVO PACKAGE IS NOT AVAILABLE AT THE HVW TECH SITE YOU PROVIDED FOR CANADA. IS THERE ANY OTHER WEBSITE? I DON'T
WANT TO ORDER OUTSIDE OF CANADA, THEY CHARGED TOO MUCH FOR SHIPPING. I HAVE ORDERED EVERY THING EXCEPT THIS
PACKAGE. TOO EXCITED TO WAIT!WHERE CAN I GET IT IN CANADA?:(. tHANK YOU
CameronKloot says:
Apr 9, 2009. 6:48 PM REPLY
refer to visual reminder:
mman1506 says:
Mar 20, 2009. 3:53 PM REPLY
order from sparkfun only 2.00 shipping im a canadian too
Derin says:
http://www.instructables.com/id/How-to-build-your-first-robot/
Jul 11, 2008. 6:51 AM REPLY
A good name says:
Jul 13, 2008. 9:20 AM REPLY
Lol.
Derin says:
Jul 13, 2008. 9:36 AM REPLY
yo like it?
mman1506 says:
Mar 20, 2009. 3:52 PM REPLY
i can anwser any questions to do with picaxe i love them cheap easy simple no programmer nessceary .there loaded with a bootstrap loader so they need
only a simple circuit to work
Capt. Fat says:
Feb 18, 2009. 5:20 AM REPLY
Dude Im making this definetly!!
How much would it cause to make in Canadian?
mman1506 says:
Mar 20, 2009. 3:48 PM REPLY
about same if you buy from sparkfun im canadian i can answer any question about picaxe i qwork them alot
fritsl says:
Feb 19, 2009. 6:20 AM REPLY
:)
How would I know, I am from Denmark :)
I suggest you log on to letsmakerobots.com, and check the "start here" link at the top. It may also lead to answer of your question..
mman1506 says:
Mar 20, 2009. 3:36 PM REPLY
the picax is great there is a cheaper way im building a altoids bot it uses a picaxe motor driver board 15$ a altoid tin free . a batery holder 1.50 .2 hobby
motor's 2.00 . its a bug bot and cand make sounds and has 2 attenas im posting a ible soon
TXTCLA55 says:
Mar 16, 2009. 4:16 PM REPLY
great job, like the idea, hate the fact i would have to use a controler :(
mrmath says:
Mar 12, 2008. 7:07 PM REPLY
Not a cheap hobby, apparently! I was really interested until I realized this little bugger would run over $150! Man I wish I was rich.
snowpenguin says:
Mar 5, 2009. 2:52 PM REPLY
Actually only $85 now!
rickharris says:
Mar 13, 2008. 3:13 PM REPLY
We build similar in the UK for $14 - parts easily available through post.
mrmath says:
Mar 12, 2008. 7:19 PM REPLY
PS: You say that you don't need to buy the cable. How do you get around that?
mman1506 says:
Mar 20, 2009. 3:41 PM REPLY
you can cut oopen a serial and goes to a headphone jack but its not worth the 3.50
threecheersfornick says:
Mar 12, 2008. 8:57 PM REPLY
I think he means that if you buy it as a kit, the cable comes in the kit -- as opposed to just buying a single micro-controller, which wouldn't come with a
cable.
http://www.instructables.com/id/How-to-build-your-first-robot/
fritsl says:
Mar 13, 2008. 4:22 AM REPLY
Yes, if you buy the kit, it comes with a cable. You can get the kit in both USB and serial. AND you can get the USB-cable as a stand-alone-item.
But if you buy the kit, you can chose to get it with USB, even though the picture only shows serial, and the shop may try to sell you the USB-cable
on top of the kit :)
(Just don't buy a cable if you buy the kit, and chose the right kit for your computer)
mrmath says:
Mar 13, 2008. 3:59 AM REPLY
I see that now. Another site in the US that sells them (don't remember which) was selling the kit without the cable, and it was about the same
price as his site for the kit with the cable. The USB cable at this site was $30.
vince086 says:
Apr 9, 2008. 3:48 PM REPLY
Will the Sharp GP2D120 IR Sensor work just as fast as the one on the small robot you posted in a comment so that the robot can drive and navigate without
stopping ? would a FA-130 type motor with a torque of 3V work ?planing on building the robot with this base http://www3.towerhobbies.com/cgibin/wti0001p?&I=LXGZ87&P=M and the Tamiya Double Gear Box 4-Speed. Might add an LED or 2 that turn on when the lights go out using a photo sensor
or something with a name like that. Sorry for all the questions. Will look at your web site for more advice. Thanks
fritsl says:
Apr 12, 2008. 5:48 AM REPLY
Erh - i understand that you end up looking at & contacting me through letsmakerobots.com ? if not, please ask me one, simple question at a time here,
thanks ;)
vince086 says:
Apr 13, 2008. 3:34 AM REPLY
would a FA-130 type motor with a torque of 3V work ? http://www3.towerhobbies.com/cgi-bin/wti0001p?&I=LXKSH2&P=M
fritsl says:
Apr 13, 2008. 5:09 AM REPLY
Yes.. but gear ratio 114.7:1 will make a very fast robot, and you'd have to have a snappy servo to move the head fast, and optimize the code for
this - the code in part II of this tutorial on LMR will do the trick.
Gearing it 344.2:1 will make an extremely slow robot :) But that would do fine, and it would be easier to follow what it does, and learn.
vince086 says:
Apr 13, 2008. 9:55 AM REPLY
would a Hitec HS-55 Economy Sub Micro Servo be snappy enogh ? if not what do you recommend?
I think i will use the SRF05 if the Sharp GP2D120 IR Sensor isn't fast enogh.
Thank you so much for all the help.
fritsl says:
Apr 13, 2008. 10:49 PM REPLY
I am sorry, but I do not know servos by heart, I cannot tell.
But - all servos are "snappy enough", you always has to code your way and tune with the present hardware, so go for it :)
vince086 says:
Apr 15, 2008. 11:23 AM REPLY
Is there a big difference between the Sharp GP2D120 IR Sensor and the SRF05 ? there is a 8€ difference but if the SRF05 is better
it might be worth it. I
found a great Internet site that sell loads of stuff for your thing http://www.robotitaly.com/product_info.php/manufacturers_id/21/products_id/298
Sorry for all the questions but i sort of whant to know as much as possible.
fritsl says:
Apr 16, 2008. 10:36 AM REPLY
Questions are cool. "Big difference" - I really do not know what to say to that :) Some would say Yes, some No :)
I guess it depends on your wallet - I prefer the SRF.
I strongly recomend you to ask the question in the forum on letsmakerobots.com - there are many there building with these things,
and the latest versions of the walkthroughs are there as well, you get replies fast etc.
snowpenguin says:
Mar 5, 2009. 10:16 AM REPLY
What gear ration did you use? I am looking for relatively quick speed, not too much, but able to run great on carpet.
snowpenguin says:
Oops! I said ration, but I meant ratio!
http://www.instructables.com/id/How-to-build-your-first-robot/
Mar 5, 2009. 10:17 AM REPLY
vince086 says:
Mar 5, 2009. 12:35 PM REPLY
i used 114.7:1 , but that is for the tamya 4 speed geer box.
corsi says:
Apr 9, 2008. 9:50 PM REPLY
whe i try to hook my robot back up to my computer through blue tooth is says tht it need serial port 0 what is that
fritsl says:
Apr 12, 2008. 5:49 AM REPLY
Bluetooth? I am lost, friend, sorry. No clue what you write about.
snowpenguin says:
Mar 5, 2009. 10:20 AM REPLY
Bluetooth is basically wireless 'USB'... It is a wireless interface for computers for mice, keyboards, wii remotes, etc.
craz meanman says:
Nov 23, 2008. 12:07 PM REPLY
hey, i think the bit on the first video at the end where the robot is trying to balance (I THINK) is hilarious. it sounds scared. lol, and im thinking of making
something like this with a arduino...
sk8erman541 says:
Dec 13, 2008. 6:59 PM REPLY
haha yes in deed i lawled haha
it remended me of wall-e
craz meanman says:
Dec 13, 2008. 8:29 PM REPLY
what an awesome movie.
acidblue says:
Sep 4, 2008. 6:22 PM REPLY
What kind of 330 Ohm resistor should i get?
1w, 1/2w or 1/4w?
or does it matter?
Going with a standard servo and the 330 Ohm resistor since it's cheaper.
Sorry if this is a stupid question, just want to make sure I get the right one.
fritsl says:
Sep 5, 2008. 5:04 AM REPLY
Any of the 330 Ohm resistor will do. It does not to be very accurate, and that is the differences; How accurate they are :)
xtank5 says:
Aug 6, 2008. 9:43 PM REPLY
Is there any way you could assemble kits? I would love to buy one.
fritsl says:
Sep 1, 2008. 1:44 AM REPLY
No, I am not going to make business on this - but if anyone is, I'd be glad to help.
H-Bot says:
Aug 31, 2008. 3:20 PM REPLY
Allow me to help you :D The chip isn't going to be called a motor driver when you go to order it it's going to be called (L293D) or (L293D Integrated Circuit)
and if you still can't find it click here. Also if your going to try the 330ohm resistor hack you only need one per motor and you can buy 330ohm resistors here
or at any local electronics/hobby store (ex: Radio Shack). And as for your servo question any servo that can run at 6v will do and that can be bought here.
laconic says:
May 29, 2008. 4:59 PM REPLY
Hello, I'm been looking around I can't seem to find this "package" anywhere in the USA or Canada, could anyone help? If not could I get the names of each
component in the package and I can just buy them separate, thanks in advance
view all 166 comments
http://www.instructables.com/id/How-to-build-your-first-robot/