So my next project in mind is to create a simple microcontroller thingy with a ATmega644. I'm basing it off Admin's $50 robot, and some other tutorials I've seen online. If all goes well, I'll have something that will let me control servos and I/O from sensors relatively cheaply.

hey! so im programming at ATmega644 now actually! we should collaborate somehow . . . the $50 robot is actually based off of what I learned with the 644 but i plan to have some really advanced/expensive features on it so its not the kind of thing beginners should ever attempt . . .

Hmm, what kind of stuff are you doing with the 644? I'm currently drawing a schematic that'll let me use it as a simple microcontroller with a separate power for servos. My idea is to come up with something like an Arduino, but with special PWM ports for servos (which will have the 3 socket thing for the servos and handle the separate power source), and other I/O ports for sensors..

So far (when I said I'm currently drawing the schematic, I meant it literally ), I've gotten to this stage:(Edit: removed old schematic)

I'll be adding in the rest of it later tonight probably.. I'm not an ECE major though, and I didn't take any ECE courses but I'll be asking my ECE friend to look through it once it's done and all. He's been very helpful so far with reading through the datasheets and explaining stuff to me

Oh wow! That's a lot I'm just intending to do some servo controlling and sonar + zigbee probably.

yea ive been working on it for like 6 months now . . . im using the easyradio . . . i chose it because lower the frequency means better underwater range . . . but i think our projects are really close . . .

Hmm.. sounds like it.. I'd really like to have a look at the circuit diagram you have

I'm trying to figure out which pins support PWM.. I can't figure it out from the datasheet All I know is that there are 6 channels that do PWM, but not which 6

I'm also working on a serial port to communicate with a PC. A couple of questions about it:1. Is it just a matter of connecting the RX and TX to an 7404N inverter, then to a serial connector?2. Do I need to worry about the voltage levels coming from the PC?3. How will the software to read/write to the serial port be like?

1. Is it just a matter of connecting the RX and TX to an 7404N inverter, then to a serial connector?2. Do I need to worry about the voltage levels coming from the PC?

use a MAX232 to solve both of these. it's a buffer chip designed for interfacing TTL UART voltages to RS232 voltages.(there are a few other chips around that do the same thing but the MAX232 is the most common.)

Quote

3. How will the software to read/write to the serial port be like?

start off using hyperterminal at the PC end. (windows terminal software.)

Hmm.. I don't really understand that part, but I'll ask my ece friend to parse through it and explain it to me

Quote

Put the .33uF cap on the out pin of the 5V regulator, otherwise it will just burn out the regulator faster when the cap is drained.

Hmm, do you mean switch the 0.33uF and 0.1uF caps, or add an additional .33uF to the out pin of the regulator?

Quote

And Im guessing thats a 6V regulator on the 7.2V battery to power servos? BAD! It will overheat and stop working. Use a switching regulator, or a 6V battery. Expect each servo to drain ~.5A.

Oh, the reason why I wanted to do this was because Whisk had issues with voltage dropping after running for a while. Will attaching a heat sink be sufficient? I was intending to put a heat sink on each of the voltage regulators.

Quote

I am assuming that '20 Mhz' has a crystal and capacitors?

Hmm, so the datasheet said the crystal was "series" and didn't have a capacitor listed, so I'm assuming it doesn't need one? Some other crystals by the same manufacturer had capacitances listed, but this one and a couple others didn't.. Here's the datasheet: http://www.ctscorp.com/components/Datasheets/008-0309-0_C.pdf

Quote

Lastely, on/off switches near your batteries is a must, and maybe a fuse too if you expect to drain high currents.

Yeap I was intending to have switches for the batteries. What amperage should I put a fuse at? Slightly higher than the max rating of the regulator, or double?

Hmm, do you mean switch the 0.33uF and 0.1uF caps, or add an additional .33uF to the out pin of the regulator?

the .33uF cap should be connected to the regulator output, not input pin.

Quote

Oh, the reason why I wanted to do this was because Whisk had issues with voltage dropping after running for a while. Will attaching a heat sink be sufficient? I was intending to put a heat sink on each of the voltage regulators.

a regulator will make it worse . . . regulators are very inefficient and will just waste energy. servo power doesnt need to be regulated anyway as long as you keep it below 6V. it sounds like the problem you were having is just your battery going low. what mAh was it rated at? try getting 2500mAh NiMH, that will last you a long while.

Quote

Hmm, so the datasheet said the crystal was "series" and didn't have a capacitor listed, so I'm assuming it doesn't need one? Some other crystals by the same manufacturer had capacitances listed, but this one and a couple others didn't.. Here's the datasheet: http://www.ctscorp.com/components/Datasheets/008-0309-0_C.pdf

unless you plan on doing heavily computational algorithms (such as vision or trig), i wouldnt bother with the crystal . . . ive never used or needed one. crystals will need capacitors, unless they come built in to the package.

Quote

Yeap I was intending to have switches for the batteries. What amperage should I put a fuse at? Slightly higher than the max rating of the regulator, or double?

I removed the regulator for the 7.2V battery and changed it to a 6V battery. I suppose I can add in a regulator if/when the need arises.

I added a switch and fuse for each of the battery sources. The fuse ratings are just semi-random numbers for now, I haven't actually figured out what to put for each yet.

I added a 0.1 uF capacitor from AVcc to ground, and Aref to ground.

And I switched the 0.1 uF and 0.33 uF capacitors for the 5V regulator. I'm a little unclear about this part though. In the datasheet (http://www.st.com/stonline/products/literature/ds/2143/l7805c.pdf page 4 Figure 3), it shows the application circuit with 0.1 uF connected to the output pin, and 0.33 uF connected to the input pin.

Regarding the crystal:

For now, I left the 20 MHz crystal connected. If I don't use a crystal, do I just leave the pins unconnected, or do I short them? Regarding the capacitors for the crystal, it seems that a series crystal doesn't need external capacitors (http://www.foxonline.com/techdata.htm search for "Figure 3.0"), is that right?

So I was wondering, why not just add a crystal to make the IC go faster? The internal clock goes at 8 MHz but a crystal can push it to 20 MHz, and extra speed for the cost of a crystal is worth it right? Power consumption goes up, but it shouldn't make too much of a difference right?

Regarding the regulator for servos power:

The trouble I had with Whisk was that a fully charged battery would give >6V (I think), which caused the speed to be slightly higher than when it settled to 6V or so after 1-2 runs. Since I used an open-loop timer, the changes in speed weren't a good thing In this case, I probably won't be doing that so having a regulated voltage might not be important.

Also, I was looking at the switching regulators, and it seems that 5V is the closest I can get. 6V switching regulators don't seem to exist somehow.. Any ideas why?

For now, I left the 20 MHz crystal connected. If I don't use a crystal, do I just leave the pins unconnected, or do I short them? Regarding the capacitors for the crystal, it seems that a series crystal doesn't need external capacitors (http://www.foxonline.com/techdata.htm search for "Figure 3.0"), is that right?

it's possible you don't need the timing capacitors but i think it's unlikely.i generally build to the microcontroller's datasheet specifications whenever possible and it tells you they are required.

it's still possible to use the internal regulator with a crystal attached. just enable/disable the relevant fuse bits.

Quote

So I was wondering, why not just add a crystal to make the IC go faster? Grin The internal clock goes at 8 MHz but a crystal can push it to 20 MHz, and extra speed for the cost of a crystal is worth it right? Power consumption goes up, but it shouldn't make too much of a difference right?

yea. there will be very little change in power draw.

Quote

Also, I was looking at the switching regulators, and it seems that 5V is the closest I can get. 6V switching regulators don't seem to exist somehow.. Any ideas why?

so 5V is a common regulator because so many ttl voltage components use 5V.you can get variable voltage regulators that you set the voltage with a capacitor or resistor. one of these is probably your best bet.

Put a capacitor across your 6V battery, .33uF rated for 12V+ would work, but higher capacitance the better.

You probably wont need a fuse for the 9V battery. But if you do, 1A is way too high. A 9V couldnt (correct me if Im wrong) supply that much . . .

Quote

I added a switch and fuse for each of the battery sources. The fuse ratings are just semi-random numbers for now, I haven't actually figured out what to put for each yet.

You will find that finding small fuses is actually pretty hard . . . let me know what you find cause I might use it for a future project . . .

Quote

And I switched the 0.1 uF and 0.33 uF capacitors for the 5V regulator. I'm a little unclear about this part though. In the datasheet (http://www.st.com/stonline/products/literature/ds/2143/l7805c.pdf page 4 Figure 3), it shows the application circuit with 0.1 uF connected to the output pin, and 0.33 uF connected to the input pin.

hmmmm Im not sure why they did it that way . . . I personally would put both caps only on the output pin, but Im definitely not an expert . . . the reason is because if the cap is on the input and suddenly drained, all that power would go through the regulator all at once. If the cap is on the output pin, that sudden power surge will not go through the regulator . . .