Robot Recipe(Hardware)

This is where I will share my robot experiments from the ground up. If you follow along, you will achieve the same results I do, good or bad.

OK, To start we need some hardware.

1. I use a dell note book. Why dell, because it was free. You don't need a supercomputer to do this. If you have a dual core and 512mb of memory, I think you'll do fine. Here is a picture of mine:
programming workstation



2. You will also need to acquire few items. I will show you mine and provide a link so that you may order yours:

A tiny USB programmer:

my usb programmer


This page will allow you to order it and help you to assemble it. You cannot do this project without one.
http://www.ladyada.net/make/usbtinyisp/

3. I am using Atmel 2313 micro-controllers. They are cheap, have all the functionality you need and easy to program. You can order them from here:

http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=ATTINY2313-20PU-ND

buy two, their small. You should always have spares of everything!

4. While your at it you should also get a couple of NTE 3221 Opto Isoloators. You actually should get five or six if you can afford it. They are starting to become more harder to find:

http://www.mouser.com/ProductDetail/NTE/NTE3221/?qs=sGAEpiMZZMvxO7XFMojgsPTIid4zh4w%252b

5. Next you need a target board for you ATMEL Tiny2313. I got mine from http://www.adafruit.com/index.php?main_page=product_info&cPath=16&products_id=174, or you can get the blank card from the Evil Mad Scientist (no kidding, there really is one) http://evilmadscience.com/tinykitlist/112-tiny2313
You can buy the kit or the assembled board from adafruit. I prefer the kit, otherwise, what fun is it?
Here's a picture of mine:
Tiny2313 target board



6. You will also need a usb cable like this:

Usb cable with small end

You need this to connect your notebook to your USBTiny programmer.

7. Then you need a protoboard to start with. I purchased a Radio Shack Digital Electronics http://www.radioshack.com/product/index.jsp?productId=3814337 .

It was a bit pricey, but had everything on it I needed. Here is mine:
Radio Shack Electronics Lab



8. Finally you need to get some tools. A nice set of small pliers set, a soldering Iron, solder, and stuff. Don't worry, I'll tell you what you need before you need it. Here is a snap shot of some of the stuff I've been using. Oh ya, don't over look the VOM. You will need something to measure the current, voltage, and continuity, not to mention the resistance.


Well, that should be enough for now. By the time I get back, you should have most of this stuff. Till next time!




Now that you have all the parts, I want to share with you the schematics so far to help you understand where we are going.   If you have trouble reading this, let me know and I will create a professional software schematic and post it instead. I kind of like doing it the old way, so here is version 1:

The AT2313 is the micro controller that I will show you how to program for this part of the process. The PS 2501-4 is the opto Isolator to keep the higher voltages from coming over and messing up my 5v data. I used the NTE 3221 but I put the 2501 in my schematic because the 2501 is basically the same chip, just the 3221 is from mouser and the 2501 is from Jameco. Either one will do, what ever your preference. The motor is a Neocene 35-Slim stepper motor. I think you may have to dig to find one like it. I had it left over from junking out an ink-jet printer. I will follow through with this motor, however, I may break down and buy one from Jameco, just so these instructions can be completely duplicatable. However if you absolutly need this motor, here is the link to the factory, and maybe they can tell you where to find one:
http://www.neocene.com.tw/eng/eindex.htm
  So if you have all the stuff, you can put it on your bread board and wire it up pin for pin as on the schematic and you will have the hardware stuff out of the way.
Software stuff will be next to get the motor actually running. Till next time!
________________________

Now we are at the hardware portion of phase 1 of our project. The object is to have some lights blink on a bread board. The blinking light program, which you should have loaded in your kontroller lab (if not, go to the software tab and do so), now we have to load the program into our microcontroller.

If you have your 2313 on the target board, and your programmer, as mentioned above, connected to the usb port of your computer then click the rocket button in the tool bar in the kontroller lab. This will send the program into the microcontroller and then we will move our project to the breadboard and test things out. I'll show you schematics and pictures when we are ready for that step. For now, just get the program into the 2313 using Kontroller lab. If I am missing steps or you are not sure where we are or how to do this, post a comment and I will help you out. Remember the comments are helpful to me for filling in the gaps that I miss.
Stay tuned!

_______________________________________________________________________

Regarding robotic movements we have three class of motors that are routinely used. These are:
1. Stepper Motor
2. Servo Motor
3. DC Motor

We have already addressed the stepper motor in as much as designing a stepper motor controller and writing code to get it working. Again, I encourage you that if you have questions on the stepper motor, please post it and even if I may not have the answer, someone else watching will.
Now lets delve into the Servo Motor. This is new ground for me, so we may be learning this together.  At the risk of glazing the eyes of the nontechnical, I will post the math needed to be operate the servo motor properly. It is necessary to do some math for the programming. If you are not interested in the derivation of the program, I will be listing the completed code on this blog for downloading.
The servo is a deceivingly easy motor. At first glance, it only rotates 180 degrees. There are only three wires connected to it, Power, Ground, and Signal.  How easy is that ???
It is very easy until you have to figure out the signal to make it work.
The signal is called, "PWM" signal, Pulse Width Modulation. That is a cool way that says, instead of using frequency, like the stepper motor, we us the width of the pulse to move it.
The frequency is steady, 20us or 50khz. 1hz is 1cycle per second, so we have 50,000 cycles per second. This frequency will not change.
Now for the Pulse Width: Pulse width is the time it takes for the signal from one state to another. That is the time it takes the signal to to from a high(5v) to a low(0v).
To center the servo, we need a pulse width of 1.5ms. To rotate the servo 90 degrees we need a pulse width of 2ms. (ms=milliseconds or .001 of a second). To go back to 0 you need 1ms pulse width.
So here is the picture of  the servo motor:
The red wire is +5v, the black wire is ground, and the yellow wire is the signal wire that you input your pulse signals with.
Here is a picture of a square wave. This one is has a pulse width of about .5ms.

We will need a longer width to move the servo motor and we will address that on my next post.
Stay tuned.

_____________________________________________________________________________