2
\$\begingroup\$

im wondering if it is Ok to power an ATMEGA328P directly from an USB-Poweroutlet i.e. an Apple-USB-Charger.

And I mean directy:
VCC to Pin 7+20
GND to Pin 8+22
Peripherals should be powered from this source too.

Or is the output from an usb-charger not stable enough to power an ATMEGA328P?

\$\endgroup\$
1
  • \$\begingroup\$ You want us to answer this for all USB supplies past and future, forever? Because the answer to that is "maybe". Different USB supplies have different characteristics, and some of them may not work properly with specific applications. \$\endgroup\$ Feb 22 '15 at 16:38
6
\$\begingroup\$

TLDR; Yes, but it is always a good idea to put a smoothing capacitor across the Vcc/Ground pins of the IC, and try to put that capacitor as close to the pins as possible.

Longer answer:

The USB standard specifies that a "charging port" should be able to supply up to 500mA at 5 volts...

http://en.wikipedia.org/wiki/USB#Charging_ports

The voltage required by the chip depends on what speed you are running at, but even at the maximum speed of 20MHz it only needs 4.5 volts...

enter image description here

...so you are good on voltage.

The chip is also spec'ed to pull an absolute max of 200mA of current...

enter image description here

...(and that would mostly be from driving output pins), so you are good on current.

So, at least in terms of voltage and current everything looks good, but there is also the issue of noise. This noise can come from either the power supply or can be generated by the chip itself as it makes very fast changes to the amount of current that it requires (for example, at the instant you switch a bunch of output pins from 0 to 1).

As far as the noise coming from the charger, all USB chargers are not built equally. I tested a few crappy USB chargers to see how noisy the output was...

http://wp.josh.com/2014/12/09/a-tale-of-four-usb-power-supplies/

Here is one of the worst...

enter image description here

So the real concern here is that some of that noise (the jigglyness of the voltage) could cause the cause the chip to glitch.

A filtering capacitor across the power leads can help smooth this out. It is typically recommended to put a couple of uF of capacitance across the power leads where they enter your circuit to filter this kind of noise.

It is also generally recommended to put a smaller decoupling cap across the power supply pins, and to put this cap as close to the chip as possible to smooth out the very quickly changing power supply demands of the chip.

Much has been written about how to pick the correct decoupling capacitor size and type, including...

http://www.intersil.com/data/an/an1325.pdf http://www.atmel.com%2FImages%2FAtmel-2521-AVR-Hardware-Design-Considerations_ApplicationNote_AVR042.pdf Atmel AVR042: AVR Hardware Design Considerations: Providing robust supply voltage, digital and analog. Choosing and Using Bypass Capacitors: Application Note

...but a good guess for decoupling cap for a chip like this might be about 0.1uF.

All that said, in practice I've found AVRs to be remarkably tolerant when it comes to power supply, and I've also found name brand USB chargers to be high quality and smooth. You can often just use what you've got and putting, say, a 1uF across the power supply pins will usually eliminate any problems- especially if you are just bread boarding and not designing a commercial product. It is also a good idea to use the on-chip watchdog to reset the chip just in case you ever do have problems due to power supply issues (it also saves you from other problems too).

\$\endgroup\$
4
  • \$\begingroup\$ I can't wish for a better answer! Thanks, you were very helpful! Regarding the cap: Arduino uses two 47uF 25V caps. Aren't they oversized? Woulnd be a (i.e.) 6,3V/10uF caps sufficient when im working with 5v and 380mA maximum (according to the Datasheets)? \$\endgroup\$
    – bam
    Feb 23 '15 at 16:25
  • \$\begingroup\$ The Arduino (Uno in this case) has several caps for filtering the power supply. Cap C7 is the small decoupling cap that is physically right near the Vcc and GND pins of the ATMEGA. PC1 is a large cap that filters the power coming in off the jack. PC2 and C2 filter the regulated 5V is distributed to the board (sometimes it takes 2 different sized caps to get all the filtering you want). I will probably get downvoted for this, but if you are just building for yourself and don't care about passing FCC tests, a single 1uF (+/-1000%) across the power leads (physically close to them) will work fine. \$\endgroup\$
    – bigjosh
    Feb 23 '15 at 16:41
  • \$\begingroup\$ It's just personal use. None FCC testing intendet ;) I'm very thankful for your reply. I wish i could upvote you even more :) \$\endgroup\$
    – bam
    Feb 24 '15 at 11:51
  • \$\begingroup\$ "...but a good guess for decoupling cap for a chip like this might be about 0.1uF." Ceramic type? \$\endgroup\$ Jul 31 '17 at 17:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.