Saturday, May 23, 2009

$150 Robot - Build the Circuit

Part 7 - Build the circuit

Some people say breadboards, some people say solder your board. I think breadboards are fine unless you want you robot to be permanent, but if you might ever want to recycle parts stick with the breadboard. That's why we chose small cheap boards. Eitherway you will want to make your first draft on the breadboard.

Here's the schematic that's used for the $50 robot (which is really what we're building)

Basically we need:
power - input, voltage regulator with capacitor, led, power switch (optional)
sensor inputs - 3 pin headers that have vcc, gnd, and pin to the microcontroller (pins 27,28)
servo inputs - 3 pin headers that have vcc, gnd, and pin to the microcontroller (pins 2,3)
microcontoller - use the ic socket (especially if you are soldering)
we don't need the program header because we won't be programming the chip on this board

Thursday, May 21, 2009

$150 Robot - Sensors

Part 6 - Make the sensors

Now we make the light sensors, the society of robots has already done the work of writing a tutorial so here we go...
http://www.societyofrobots.com/schematics_photoresistor.shtml

crimping really does make things nicer

Note: I made my cables over a foot long which I'm sure is useful in some applications, I really only needed about 3" meaning I had lots of wire to hide out of the way. In fact it might not hurt to make a set of long wired ones and a set of short wires. Or a set of short wires and an extention cable...

$150 Robot - Servos

Part 5 - Servos
Servos are a type of motor, sure you could probably use a regular motor but servos seem to be very popular with robot people. There is one problem though... servos are manufacture to move 180degrees meaning your robot isn't going to go very far! So we have to modify it a bit...
$50 robot tutorial
A picture tutorial
between these 2 tutorials you should be able to modify your servo. Basically there are 2 things that need to be done. The first is modifing the servo so that it always thinks it at the zero position. The second is clipping off a piece of plastic so that it can go 360degrees

For this little project you will need:
screwdriver
superglue
sharp knife (sharp wire cutters might work)
maybe a file, depending on how well your cutting turned out
your programming board, and a few wires to connect the servo

Saturday, May 16, 2009

$150 Robot - Blinking Light

Part 4 - Blinking Light
Go to http://www.sparkfun.com/commerce/tutorial_info.php?tutorials_id=93
Solder a resistor to an LED so that you can directly plug it in
Put LED between GND and any of the outputs (8 and 9 works)
Download the zip file
Open Programmer's Notepad
Follow directions for running make file
Follow directions for programming
Pray

You should now have a blinking light (this is the "Hello World" of the electronics world).

If its not working:
1. check all your connections
2. make sure all the appropriate power leds are on (if not its a hint of where something is wrong)
3. make sure if you are telling it which programmer you are using (usbtiny)
4. make sure you have told it the correct chip in all the correct places
5. take a break, come back, check 1-4 again (sometimes your eyes and brain need a rest)

Friday, May 15, 2009

$150 Robot - Programming chip

Part 3 - Getting programs on the chip
Download drivers http://www.ladyada.net/make/usbtinyisp/download.html
Unzip drivers
Plug in USBtinyISP
Follow directions here: http://www.ladyada.net/make/usbtinyisp/drivers.html
Download winavr http://www.ladyada.net/make/usbtinyisp/avrdude.html
Install winavr http://www.ladyada.net/make/usbtinyisp/avrdude.html
Got to run and type "cmd"
Run:
avrdude -c usbtiny -p attiny2313 -U flash:w:test_leds.hex
Don't worry, it won't do anything, just making sure avrdude can find the USBtiny

$150 Robot - Build USBtiny

Part 2 - Build USBtiny programmer
Well now you are an expert at soldering (while the board is useful so is the soldering practice).  Now we build our programmer.  The website tells you everything you need to know.  Go ahead and put the jumper on.

Thursday, May 14, 2009

$150 robot - Programming board

Part 1 - Building your programming board

This is the board we are going to program our chip on.  We are going to need a place to put the chip, and interface to our programming cable, we will also need power to our board, and an on/off switch is good too, and an led to let us know things are on)


-Learn about power / LEDs and resistors- sparkfun
-Learn how to solder (try google)

-Figure out what chip you are using, how may pins and the pinout evilmadscientist (programming headers), avrfreaks (chips)
-Things you need - Power, switch, led, dip socket, 6 pin/10 pin programmer, 9v bat/wall plug
-Figure out what other things you might want on the board (led tester, breadboard pwr output, more than 1 chip...)
-Layout your PC board, get your needed parts, wanted parts and start sticking things in holesDon't forget the power buses (connect a bunch of holes -if its not already done- and connect it to your power, connect another set to ground) this way you have easy access to all those wires you will have to connect to vcc and ground..  Mark pin 1 of chip and 6/10 programmer on board (both sides) so you don't get confused.  Once you've figured out how you want things arranged you can start soldering (you might want to take a picture first so you remember where things go).
-Solder everything in place. Use your multimeter to make sure you have good connections

Some things I did/learned:
1. USBtiny provides power to the board, but add a 9v battery adapter to make your board portable.
2. Make sure you have atleast 1 extra row beside your dip socket, once your chip is in these let you access each pin with a wire. If you need more than 1 or 2 holes just attach that wire to a small breadboard and go to town
3. You probably only need either the 6 pin or the 10 pin adapter since the USBtiny has outputs for both, but I had room and this way I can use the extra headers to test since they are connected.
4. Switch, mostly important for the battery
5. LEDs let you know if there's power and where its coming from. My programmer doesn't have a tight fit so the LEDs let me know when my cable is loose (which it usually is) and when I have a good connection
6. I didn't get around to adding a socket for a 8pin chip but I left room for it. 8 pin chips are alot smaller (duh) but have basically the same functionality just less input/outputs. I can see this being useful.
7. LED tester, don't like trying to figure out which end is positive and which is negative. I just hooked up 2 female headers and a resistor and marked which is which, so I can just touch the LED to the tester and if it light up I know it works and which end is which.
8. Get a couple of LEDs and solder a resister to the negative end (it doesn't matter which end, just be consistent) now you have plug and play LEDs , which are good for tons of things, stick them anywhere to see if you have voltage, add lights for fun...
9. Find a couple of standoffs, screw them into the corners of you board so it stands up nicely
10. If you have wires coming off (battery in, pwr out, etc) add a bit of superglue to them at the edge of the board to help prevent them from being ripped off, superglue is much stronger than solder!

$150 robot - Parts

Tools
Breadboard $2.95 elexp.com (B)
PC Board $0.90 elexp.com
Wire $6.95 elexp.com
Wire Cutter/ Strippers/ Pliers $17.95 elexp.com (includes solder stuff)
Helping Hands $3.95 elexp.com
Multimeter $10.95 elexp.com
Programmer $22 (you have to solder it together) adafruit (sparkfun has one pre-build, don't forget a cable $14.95+$1.95)
9V Battery Holder(x4) elexp.com $0.25
$66.65

Components

Resistors $6.75 elexp.com (365 pieces) - you will need atleast 2x1.62kOhms and 1 340 Ohm for each LED (if the values aren't exact that's ok)
Capacitor $13.95 elexp.com (60 pieces) you will need atleast 1 0.1uF and 2x220uF (if the values aren't exact that's ok)
Voltage Regulator 5V-1A $0.35 elexp.com x2
IC Socket-28 pin$0.22 elexp.com x2
AVR Mega 8 (28 pin DIP) $3.66 digikey
Headers $0.75 elexp.com
Switch $0.73 digikey
LEDs $0.12-$0.16 A or B any color, get about 10 elexp.com
$28.18

Total: $94.83
(you might be able to get some parts a bit cheaper at other places, but I tried limiting the number of sites to reduce shipping costs)

Other Parts (some of these should be in the components section but I forgot to put them there)
Motors, servos (I used Hitec HS-311 servo from servocity.com $8.99 each or $10.95 at elexp.com)
chassis material (I used 2 old 3.5" floppy disks)
9V Battery (I got 2 rechargables and a charger for about $8 at allelectonics.com)
Wheels - I used 2 peanut butter lids
Hobby Knife/ Cutter/ Something sharp
photo cells$0.75 elexp.com x2
Female Headers elexp.com
Battery holder (4xAA) elexp.com

Yes I know we are under $150 but once you add in shipping, maybe a few of the optional things, a few extras of the basic items (so you don't have to pay $7 S/H next week for a $0.35 item) maybe a few upgrades, some storage containers, etc you should be at around $150

Optional

Crimping stuff - make nice ends to you input/outputs crimper tool (I used pliers, but they aren't the best), pins, housing (2 pin all the way up to 20s)
Bigger breadboard $8.50 (F) elexp.com (B) for small stuff
Soldering Iron/ Stand/ Solder (this is included in the kit in the tools section, but if you already have tools and just need an iron) $4.95 elexp.com
Better took kit (includes box) $34.75 elexp.com
8 pin IC socket - we are using a chip with 28 pins, but you might in the future want to use the 8 pin chip, you can wire the 8 pin socket to your programming board for future use. $0.10 elexp.com
Bunch of parts (if you want more than the assortment listed this pack has just about everything) $48.95 elexp.com - you would still need 28 pin socket, voltage regulator, headers, pwr in
LED kit $12.95 elexp.com
Bigger or smaller AVR chip
16MHz Crystal (not needed for this project, but needed if you want to use the chip at its fastest speed for other things)

One day soon, I'll add a list of parts you will need to do all the tutorials at sparkfun so you can order them if you want

Lots to talk about

When my $50 robot is up and running at about $200 but I've learned a lot. First things first. Learn what you're doing. Makes sense huh, well I went to a site, bought parts, found I needed different parts, bough different parts, paid too much, bought more parts... and I still didn't have anything to show for it except a bunch of parts. So I'm writing a $150 robot tutorial. I know $150 sounds like a lot, but I'm not assuming you have a soldering iron, wire, wire strippers, multimeter etc. These are the only things I'm assuming you have:

Batteries
Junk
Super Glue
Scissors
Electricity
Light to see with (you might want a brighter light, flashlight, etc)
Computer with a USB port (this can be done with linux, but the tutorial is done with windows)