Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: spizzak on July 21, 2009, 12:48:24 PM

Title: Atmega 328 Circuit
Post by: spizzak on July 21, 2009, 12:48:24 PM
Hey everyone, I was wondering if someone could quickly check over my circuit to make sure it looks okay. I have indicated what I plan on connected to each I/O pin as well. Thanks!
Title: Re: Atmega 328 Circuit
Post by: GearMotion on July 21, 2009, 01:05:38 PM
Is the regulator an LDO? If it is a vanilla 7805, the minimum input voltage is 7.5 volts (depends on manuf).

Good practice:

10K - 100K pull up resistor for reset.

.1uF caps on regulator input and output close to body of package.

Title: Re: Atmega 328 Circuit
Post by: spizzak on July 21, 2009, 01:19:09 PM
The VR is the same one as the one used in the 50$ robot so 6V should be enough I think.

How do you connect a pull-up resistor? In series between Pin 1 on IC and pin 5 on programmer header?

How do you connect these caps, and where exactly? Could you give a bit more  detail please?

How much capacitance would I need? Is the 600uF enough? More than enough? Not enough?

Thanks!
Title: Re: Atmega 328 Circuit
Post by: Webbot on July 21, 2009, 01:28:42 PM
How do you connect a pull-up resistor? In series between Pin 1 on IC and pin 5 on programmer header?
Between the reset pin 1 and the +5v supply to the IC

How do you connect these caps, and where exactly? Could you give a bit more  detail please?
One goes between ground and the unregulated voltage into the regulator.
Other goes between ground and the regulated voltage out of the regulator.
Use non-polarised capacitors (eg disc ceramic types) - it doesn't matter which way around you connect them - they have no +ve and -ve.

Title: Re: Atmega 328 Circuit
Post by: GearMotion on July 21, 2009, 01:32:29 PM
> The VR is the same one as the one used in the 50$ robot so 6V should be enough I think.

The KA7805ETU-ND has 2V drop-out, meaning that the input should be 2V above the output. 7v input.

> How do you connect a pull-up resistor? In series between Pin 1 on IC and pin 5 on programmer header?

Between pin 1 (reset) and 5V.

> How do you connect these caps, and where exactly? Could you give a bit more  detail please?

Cap 1: From Vin to ground. Close to regulator.

Cap 2: From Vout to ground. Close to regulator.

> How much capacitance would I need? Is the 600uF enough? More than enough? Not enough?

600uF is probably a good start. It depends on the characteristics of your servos.


(That was a big "ditto" post to webbot. Serves me right for talking on the phone while posting.
Title: Re: Atmega 328 Circuit
Post by: spizzak on July 21, 2009, 01:41:29 PM
Thanks guys, can someone explain what the purpose of the pull up resistor is?

Also I was looking at this tutorial on sparkfun and instead of the 0.1  uF caps they use a 10 and a 100 electrolytic cap. Can someone explain why they would recommend such larger caps than GearMotion. Just curious.


http://www.sparkfun.com/commerce/tutorial_info.php?tutorials_id=57



PS: If I understand correctly, this is how it would look then: ??
Title: Re: Atmega 328 Circuit
Post by: GearMotion on July 21, 2009, 02:03:47 PM
> Thanks guys, can someone explain what the purpose of the pull up resistor is?

To be sure that reset is at 5V when not programming. The AVR has an internal pull-up, but it is common practice to add an external pull-up.

> Also I was looking at this tutorial on sparkfun and instead of the 0.1  uF caps they use a 10 and a 100 electrolytic cap. Can someone explain why they would recommend such larger caps than GearMotion. Just curious.

You are operating on battery. If you were on a power supply (like a wall wart), then the capacitors would be smoothing the noise in the supply. The little caps (.1uF) are OK for battery supply. Their intent is to dampen any quick current draw from the power lines by acting in a sense as teeny momentary energy reserves.


> PS: If I understand correctly, this is how it would look then: ??

Before you solder anything in place, test out the 6v supply to the regulator to see if that works.
Title: Re: Atmega 328 Circuit
Post by: spizzak on July 21, 2009, 02:10:04 PM
Thanks a lot for the info.

I just plugged my battery into Input and ground and was getting ~6.6V across those two and ~5.01V across Output and ground so it looks like it will be okay.

I also just realized that my LCD cannot take more than 5V and TX and RX are getting unregulated 6.5V so could I just plug the ground and signal into PD1 and the supply voltage into a vacant I/O pin thats getting the regulated 5V?  Or should I just connect those to the regulated 5V as well and give the servos 5V?
Title: Re: Atmega 328 Circuit
Post by: SmAsH on July 21, 2009, 04:09:49 PM
nah, don't plug servos into the regulator... thats asking for something to fry...
is there any way that you can give the LCD power from the regulator while still having the servos get unregulated?
this would be much better... is this only because the rx/tx lines are next to the unregulated bus?
you shouldn't really plug anything into I/O to supply power unless its a little led or something...
it could draw too much current and fry the pin (thats bad).
Title: Re: Atmega 328 Circuit
Post by: spizzak on July 21, 2009, 05:41:54 PM
Yeah its because the rx and tx ended up on the unregulated bus lol. I'll just plug the ground and signal for the LCD in on the unregulated bus but have a seperate line for power going to one of the regulated buses.
Title: Re: Atmega 328 Circuit
Post by: spizzak on July 22, 2009, 09:49:33 PM
Could someone please check if the way I connected the crystal is correct. I attached my schematic and a few pics of the final board design for your viewing pleasure... turned out a lot nicer than the $50 one :)
Title: Re: Atmega 328 Circuit
Post by: SmAsH on July 22, 2009, 10:52:56 PM
yep, it looks right, as long as the crystal is in the right place and the caps are going to gnd.
from the top it looks like they are going to +5v? but i think its just looks....
Title: Re: Atmega 328 Circuit
Post by: Razor Concepts on July 22, 2009, 10:59:11 PM
It's going to ground, the black line  ;)
Title: Re: Atmega 328 Circuit
Post by: SmAsH on July 22, 2009, 11:43:50 PM
i wasn't talking about the schematic razor...
i know that was right, it just looked off in the picture.
Title: Re: Atmega 328 Circuit
Post by: spizzak on July 23, 2009, 08:22:33 AM
Yeah it kinda looks like it in the pic but its going to the middle pin on the VR. Is the 47k ohm pull up resistor for reset okay?
Title: Re: Atmega 328 Circuit
Post by: SmAsH on July 23, 2009, 04:37:53 PM
so the two caps are going to ground?
and yes the resistor looks fine.
Title: Re: Atmega 328 Circuit
Post by: Webbot on July 23, 2009, 07:02:08 PM
Now we get to the thorny subject of the Reset pin......


http://www.societyofrobots.com/robotforum/index.php?topic=3903.0 (http://www.societyofrobots.com/robotforum/index.php?topic=3903.0)
Title: Re: Atmega 328 Circuit
Post by: Soeren on July 30, 2009, 06:51:05 AM
Hi,

Also I was looking at this tutorial on sparkfun and instead of the 0.1  uF caps they use a 10 and a 100 electrolytic cap. Can someone explain why they would recommend such larger caps than GearMotion. Just curious.

The cap on the input side should be around 220nF (i.e. 0.2µF) and about 22µF on the output side. The purpose of those caps are not supply smoothing, that's what the large cap in front of them is for. Those two caps are to prevent noise and, even more important, to prevent oscillations.

They can be varied a lot without the circuit going haywire (under ideal circumstances) and that has unfortunately led to various specs from people that seems to base their desicions on either bigger-is-allways-better, or lets-keep-it-physically-small.

If you want to be absolutely perfectionist about it (read: make it as robust as possible,) you'd need lots of calculations based on current draw, impedances and frequencies of the mains as well as the major noise bands - plus lots of imperical measurements, but the 220nF in and 22µF out is a well balanced compromise and I have never seen a circuit misbehave when set up that way, as I have seen with other combinations, with larger and/or smaller caps.

If it's just to operate on your desktop in a controlled environment, you can get away with a lot, but adopting the philosophy to allways design for harsh conditions, won't make it stop working on the desktop and it won't cost you anything, so there's no reason not to go for it.