## "Preferred" DC Power Schematic/Voltage?

20 posts / 0 new
Author
Message

So I know The Atmega328 can handle voltages around 1.8-5.5v I believe (with the Clock speed changing at each one). So I had a couple of questions:

1. Is this clock speed change automatic? or do you need to set something in the chip.

2. Is there a voltage that the Atmega will just in general run better at (Maybe thats a silly question ha).

3. I've seen TONS of schematics for 5v power supplies (With various cap sizes/etc...) i'd plan on using a LM7805 and some batteries just for a "test" power supply circuit. (Im still an Electronics noob so Im still researching what battery setup is really "best" for long term use)...but is there a certain schematic thats SUPER safe and just "best"? or is just sticking with a couple of 10uf and 100uf caps the best way to go? (I've seen some that have even 3 or more Capacitors, is that really necessary?) Or should some sort of protection circuits be thrown in?

Last Edited: Sat. Dec 31, 2016 - 01:48 AM

No, the clock speed does not "change". Well, that is not exactly correct, because it does change a little. What you have likely seen is a table or chart of the LIMITS for clock speed at various supply voltages. It is up to you to make sure that the clock speed is within the specified limits.

There is not really a "best" supply voltage. 5V will give you the widest possible range of valid clock frequencies. HOWEVER, the power consumption will be higher and some peripherals cannot run from a micro that is powered at 5V.

LM7805 is one of your very worst choices when you are using batteries. You waste a lot of the battery power in the regulator. For example, if you run it from 12V, you waste at least (12-5)/12 = 7/12 of the battery power in the regulator.  If your MCU is 3.3V, then you waste (12-3.3)/12 = 8.7/12 of the power. 7805 is even worse than that. Sorry, but thats the way the physics of it all "crumbles".

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

What would you suggest then for running 5v? Running maybe 3 1.5v batteries? that'd be around 4.5 which is probably close enough to the clock speed limit I would probably use?

Take a look at these:

http://www.ebay.com/itm/5PCS-LM2...

I bought 20 of them recently and they are great to have around.  They are adjustable so all you need is a DC power source and you adjust the output to the voltage you need.  OYu can even run them on a battery.

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

"The critical shortage here is not stuff, but time." - Johan Ekdahl

"Step N is required before you can do step N+1!" - ka7ehk

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

All good advice above, but the world is not all doom and gloom when one mentions the 7805.

I might suggest powering the 7805 with a "wall wart" power supply, 9V would be perfect, 12V would be reasonable.

Know that the higher the input voltage to the 7805, for a given load,(your micro and some LED's, for example), the more energy the linear regulator has to dissipate.

So, you will want to use a 7805 in a TO-220 case, the ones with the small heat sink tab with a hole it in, and NOT the 7805's that look like little transistors.

Additionally, you will want to mount a heat sink on the 7805, to help keep it cool.

The 7805 is a very old linear regulator, and it is manufactured by several companies.

Pick one from a name brand company, and download the data sheet for the specific 7805 you have.

You want at least the minimum capacitance the data sheet recommends, and yes, it often involves several different caps on the input and the output.

Know that if you go with an Arduino type board, many of them include a power supply circuit right on the board, and the board is then powered by a wall wart, or by a USB connection, etc.

As you build up your supply of gadgets and gizmos, you will likely find that some at 5V devices, some run on 3V, some can run on either, etc.

One of the things to keep in mind is that, as a general rule, you would like to have a circuit run entirely on one voltage, either 5V or 3V.

It can be a real hassle to level shift between the two.

There are times when one has no choice but to have a multi-voltage design, but as a relative beginner you should avoid that scenario.

You can purchase LCD displays, for example, that run on either 3V or 5V, so you need to give it some thought.

As mentioned, some of the AVR's run faster at 5V, but for many projects 20 MHz just isn't necessary, so running on 3.3 V and a slower clock might be just fine.

For LED's and push button switches and piezo beepers, etc., it won't matter which voltage you elect to use.

JC

I have a few 7805's with the holes in them, it's just all I know. Im still a noobie with electronics but I read up on buck converters and the principle does make sense. I guess the Linear voltage regulator just seems "simple" so for now i'll use that at 5v so I can understand my circuits better.

If I ever do any permanent projects it seems that a buck converter is the way to go.

Just to be blatantly clear, a virgin atmega328 arrives from the manufacturer configured with its internal RC oscillator set to run at 1MHz. It will do so over the full supply voltage range. If you want it to run at another frequency, perhaps to achieve the accuracy required for UART operations, you can provide an external crystal and matching load capacitors and ensure that the supply voltage is greater than the cutoff for that frequency.

Hope that helps.

HNY.

Ross McKenzie ValuSoft Melbourne Australia

Right now I have a 16mhz crystal connected when I programmed it. Honestly however since AVR dude is not using the fuse bits (Im still unsure of the best way to set them in Atmel Studio) im not really sure it's even USING 16mhz.

Is there any way to tell without a debugger at what MhZ the chip is running at?

Program your device to continuously blink an LED for 0.5 seconds on and 0.5 seconds off. Then measure this actual timing with your watch. Should be once per second.

Ross McKenzie ValuSoft Melbourne Australia

Mercfh wrote:
If I ever do any permanent projects it seems that a buck converter is the way to go.
That's what the ones at FTDI did for their Arduino UNO follow-on NerO.

An Arduino UNO has a 1117-type low dropout (LDO) linear; these are common and may be somewhat defect tolerant.

Linear Technology LT3088 is a rugged 1117 replacement.

http://www.ftdichip.com/Products/Modules/NerO.htm

http://www.onsemi.com/PowerSolutions/product.do?id=NCP1117

http://www.linear.com/product/LT3088

"Dare to be naïve." - Buckminster Fuller

valusoft wrote:

Program your device to continuously blink an LED for 0.5 seconds on and 0.5 seconds off. Then measure this actual timing with your watch. Should be once per second.

Seems about right, Im using "-c usbtiny -p m328p -v -v -v -U flash:w:\$(TargetDir)\$(TargetName).hex:i" in atmel studio now (with the Sparkfun AVR programmer). How would I go about adjusting fuses?  (I know http://www.engbedded.com/fusecalc/ is a good place, but does anyone know how i'd adjust that line of code) I can't seem to find any examples where people are manually adjusting the fuses

Mercfh wrote:

Right now I have a 16mhz crystal connected when I programmed it. Honestly however since AVR dude is not using the fuse bits (Im still unsure of the best way to set them in Atmel Studio) im not really sure it's even USING 16mhz.

Is there any way to tell without a debugger at what MhZ the chip is running at?

```Checking & setting fuse bits with AVRdude:

avrdude (your particular command line switches) ---> enter

In avrdude:

Reading the AVR fuses to see how they are set

d efuse ---> enter
response:
avrdude efuse 0xhh

d hfuse ---> enter
response:
avrdude hfuse 0xhh

d lfuse ---> enter
resonse:
avrdude lfuse 0xhh

Writing the AVR fuses to your new values...

w efuse 0 0xhh ---> enter
response:
avrdude efuse 0xhh

w hfuse 0 0xhh ---> enter
response:
avrdude hfuse 0xhh

w lfuse 0 0xhh ---> enter
response:
avrdude lfuse 0xhh

Where:
0xhh is the fuse bit value in Hexadecimal```

Oddly, I set up a new clone Arduino ATMega2560, just today.  This was my first time ever setting AVR fuses with AVRdude, since I abandoned Windows and AVRStudio.  It was actually more difficult tracking down the correct fuse settings in the data-sheet than it was figuring out how to set them with AVRdude.  But once I worked my way thru the data-sheet, figuring out how to tell AVRdude to change the fuses was quite painless.  Really, it's all about reading and understanding the data-sheet and... reading and understanding the AVRdude users manual.

EDIT:

Fixed some typo's...

You can avoid reality, for a while.  But you can't avoid the consequences of reality! - C.W. Livingston

Last Edited: Sun. Jan 1, 2017 - 04:34 AM

Looks like your able to just add -U (fuse bits as calculated from the website) then -U and the flash command. So it atmel studio 7 this worked:

`-c usbtiny -p m328p -v -v -v -U lfuse:w:0xff:m -U hfuse:w:0xd9:m -U efuse:w:0xff:m -U flash:w:\$(TargetDir)\$(TargetName).hex:i`

Your idea of using 3 x 1.5v batteries will work fine, no mess no fuss!

There are lots of 5v wall wort power supplies available, check your local thrift store and buy one for a cell phone for a \$1, cut off the connector and your set.

The LM7805 is also easy to use, down load the datasheet for the one you have and stay close to the required caps it recommends for input and output.

Come back here if you have questions, Welcome to a larger world!

Jim

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get \$5 free gold/silver https://www.onegold.com/join/713...

Yes, 7805 is easy to use. However, the OP wrote about "batteries" and, in that context, 7805 is not so great. Requires lots of headroom (minimum input is around 7.5V) and the quiescent current is almost as high as the MCU current. Both of these points lead to very disappointing battery life. For ordinary "lets try this out...", one of the line-power supplies will do what is needed, very nicely.

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

Might as well add one more comment.

Chips generally don't like having their power connected up backwards, (V+ to the Ground rail, Ground to the V+ rail).

This will kill many chips, instantly.

So, when you are hooking up batteries, or small battery packs, etc., one has to be very careful!

When using a wall wart be sure to verify which lead is + and which is (-) (Ground).

When using a linear regulator and a wall wart it is often reasonable to include a "reverse polarity protection diode" in the input to the circuitry, as shown in the image below.

If the tip/barrel of the particular wall wart is backwards from the expected, it doesn't matter.

The diode protects the remainder of the circuitry from the reversed power supply.

Know that, as mentioned, the 7805 requires some "head room", Vin must be > 7.5 V or so.

The RPP diode will take another 0.6 to 0.7 V or so across it, do now Vin, from the wall wart, must be > 8.2 or so, and one still wants a little extra headroom.

So, a 9V wall wart is perfect for this setup.

A 12V wall wart can be used as well, but then the 7805 must dissipate more energy as heat, and a bigger/better heat sink will be required.

JC

Good point! But I'd use a schottky diode since it has less voltage drop, so it won't heat up that much and give a little more headroom for the regulator.

This however means that the regulator will have to dissipate more heat, so a normal diode can under some circumstances allow for better heat distribution. But once this is an issue, it's time to switch regulators (pun intended).

"Some people die at 25 and aren't buried until 75." -Benjamin Franklin

What is life's greatest illusion?"  "Innocence, my brother." -Skyrim

I recommend using a 18650 battery.  They are Lithium-Ion +3.8V and last a long time between charges.  But they are expensive.  And you need the battery, the holder,  a TP4056 recharge board, and a 1 amp/+5V source to recharge them.   Use a simple silicon signal diode 1N914 to bring the voltage to 3.3V.

The holder: http://www.ebay.com/itm/5pcs-Bla...

The recharge supervisor board: http://www.ebay.com/itm/5pcs-Bla...

and the battery:http://www.ebay.com/itm/2x-GENUI...

Last Edited: Tue. Jan 3, 2017 - 12:18 AM

The recharge link is incorrect in post #19

Found this:

http://www.ebay.com/itm/like/222...

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

"The critical shortage here is not stuff, but time." - Johan Ekdahl

"Step N is required before you can do step N+1!" - ka7ehk

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown