I'm wondering what's the simplest and possibly cheapest portable power arrangement to keep an ATMega328P-PU or ATMega328-PU alive.

There are plenty of approaches involving a power regulator (and a power source > 5v) or a boost regulator (and a power source < 5v). However, I'm wondering if it's possible to simply power a 328 directly off some kind of battery technology which produces a voltage within the right sort of range, to maximise simplicity and minimise cost of tutorials and demonstrations.

So far I've been speculating about...

3 AA NIMh batteries, coming in at about 3.6V 4.2V when fully charged

1 Lipo battery, about 3.7V when fully charged

...but there may be other arrangements I should consider or concerns I should have.

I can't find a pre-existing discussion about this as I think most projects assume they are using a full-fledged Arduino including a regulator, or that 5V is important for some reason. Anyone have experience of running off batteries without any regulator?

In our case we're relying on Arduino-compatibility, but we're building simple ATMEGA328-based projects direct on stripboard, like this...http://cefn.com/shrimping/Shrimpduino_bb.png...so the minimum component count and most consistency between running off USB and running portable the better. I don't think the exact voltage matters for us, so long as the microcontroller is running stable.

When any battery technology starts to go flat, I guess we'll need a 328P with picopower to handle a graceful brownout, though. Don't know what the consequences would be of using the simpler 328 without picopower on a battery-driven project. Perhaps it could corrupt the bootloader when it starts to run random instructions?

Update: I finally found this thread http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1295580639 but seems to be inconclusive, with Jeenode offered as an example of running at 16MHz with low voltage and some saying chips will happily run down to 2.5 volts, whilst others saying it won't work.

Given their low cost I'd really REALLY consider using an LDO regulator when running from batteries. I wouldn't feel comfortable feeding any microcontroller-based project from an unregulated supply, even from batteries. It doesn't really add much complexity to the circuit

Given Jeenodes are running at 3.3v and regular Arduinos at 5V I had the impression that the voltage could be anywhere in the range from 3.3v to 5v and from the thread I linked to, perhaps even a wider range than this. Perhaps you're alluding to something bad which happens when the supply voltage changes while a sketch is running. Perhaps you're trying to underline my ignorance. I'm a bit confused by your question.

I don't think the exact voltage matters for us, so long as the microcontroller is running stable.

There is a big difference between exact voltage and consistent voltage. Batteries will give you neither.

It may not be clear from my wording, but these are unknowns for me - my main reason to raise it on the forum. If you know a reason why regulating the power supply to 5V IS important, please share. Equally if you have notions of 'exact' and 'consistent' for voltage which corresponds with the well-functioning of ATMEGA328 projects when powered by batteries, then I'm all ears. The insights promised by your post could mean I have no choice but to include a regulator. However, I don't think I can guess what those insights are, yet.

Given their low cost I'd really REALLY consider using an LDO regulator when running from batteries. I wouldn't feel comfortable feeding any microcontroller-based project from an unregulated supply, even from batteries. It doesn't really add much complexity to the circuit

One of the aspects of the way we're workshopping with the ATMEGA chips is to try and maintain continuity as much as possible from one stage to the next. Ideally the exact same solderless breadboard circuit powered off the CP2102 attached to a laptop is transferred to stripboard wholesale, without having to rethink or rewire it. One way to go is to include the LDO regulator in the circuit even when it's not strictly needed (e.g. when attached to the regulated USB supply). That way we can switch seamlessly from the USB-connected lab-prototyping mode into a battery-operated in-the-field mode without any sleight of hand.

Do you think this would work? I gather there's a loss of voltage when going through a regulator, but given the spec of the component you described this may not be significant.

LiPo are more like 4.2V when fully charged and 3.7V when discharged.If you running at 16MHz, then full performance is guaranteed down to ~3.8V.If you run at 8 MHz, it's less. So you coul run from a LiPo directly and not use a regulator at all.I have an RF remote control that does just that - 8 MHz, 1000mAH LiPo, MAX1811 to control recharging the battery from a 5V source.

I am testing a '2560 design right now using 3 AA batteries. I have a 24V to 5V DC/DC module on the board, but don't have the right female cables yet to power it up.Running from battery with no regulator is fine as long as the battery voltage is in the correct range.

I use the LM2940 regulator on pretty much everything, but then all my stuff is 5V, 16MHz, so it makes sense for me to do that. If you had a 3.3V 8MHz setup then a single lipo/no reg solution would probably be ok just like Crossroads said.

I like using them because it also gives me inbuilt reverse battery cockup and short-circuit protection, and given I have been known, on occasion, to do some monumentally stupid things it's nice to have a bit of a safety-net

Given Jeenodes are running at 3.3v and regular Arduinos at 5V I had the impression that the voltage could be anywhere in the range from 3.3v to 5v and from the thread I linked to, perhaps even a wider range than this.

With suitable changes to fuse settings, the Arduino can run at either 3.3V or 5V, not any random value in between.

Quote

Perhaps you're alluding to something bad which happens when the supply voltage changes while a sketch is running.

Yes, bad things happen when the voltage is not constant. Serial data transmission, among other things relies on clock speed, which is a function of voltage.

Quote

Perhaps you're trying to underline my ignorance.

Not really. Just questioning why you think that the 5V is not important.

If the LiPo solution doesn't appeal, then four NiMH or NiCd cells produce a nominal 4.8V and it seems quite common to run an Arduino off that. An unregulated source like that probably wouldn't be suitable, though, if you were also supplying external loads from the same batteries which were high enough to impact the battery voltage, since this would then tweak the Arduino supply voltage each time you switched the load on or off.

I only provide help via the forum - please do not contact me for private consultancy.

Update: given the comments by WizenedEE below, I'm now of the feeling I shouldn't have accepted all of PaulS suggestions entirely as the gospel truth, although it sounds intuitively to make sense that many things change with a change in voltage, it seems that there are mechanisms specified to prevent this, such as crystals, and that there's no need to change fuses necessarily for a change in voltage. There still seems to some debate anyway. Now go on to read my original response >>>>>>>>>

With suitable changes to fuse settings, the Arduino can run at either 3.3V or 5V, not any random value in between.

Aha, makes perfect sense. I had no idea that fuses had to be changed to support a 3.3V set up, although I knew 8MHz operation needed a change in fuses I didn't figure for the voltage itself having to be accounted for. I guess the Jeenodes I had just came with the correct fuse settings out of the box. I'll follow up with JCW at Jeenodes and see if I can find out more about this compromise.

...bad things happen when the voltage is not constant. Serial data transmission, among other things relies on clock speed, which is a function of voltage.

Right, that makes a huge amount of sense too. Fortunately when we're connected to the USB (and wanting to attempt Serial comms) it will be powered off the 5V regulated. The rest of the time perhaps we'll get away with a slow clock (and incorrect timings). Once people have got the idea of programming simple behaviours and the arduino-compatible bug has bitten, we can expose them to more complex design issues, so when they start to design their own projects which demand a near-real-time clock or an actual real-time clock, then we can talk them through using a power regulator or a supporting chip. I think we're already stuck with a 'now we add 4 capacitors and a diode for protection' phase in the workshop, and this might be a moment to introduce the power regulator too.

Quote

Perhaps you're trying to underline my ignorance.

Not really. Just questioning why you think that the 5V is not important.[/quote]

I simply didn't know why 5V was important. What you describe makes a lot of sense, thankyou.

LiPo are more like 4.2V when fully charged and 3.7V when discharged.If you running at 16MHz, then full performance is guaranteed down to ~3.8V.If you run at 8 MHz, it's less. So you coul run from a LiPo directly and not use a regulator at all.I have an RF remote control that does just that - 8 MHz, 1000mAH LiPo, MAX1811 to control recharging the battery from a 5V source.

I am testing a '2560 design right now using 3 AA batteries. I have a 24V to 5V DC/DC module on the board, but don't have the right female cables yet to power it up.Running from battery with no regulator is fine as long as the battery voltage is in the correct range.

Setting fuses is a really hard ask for new Arduino-compatible experimenters in a workshop. Do you know, is attaching an 8MHz crystal like http://www.taydaelectronics.com/8-000-mhz-8-mhz-crystal-hc-49s-low-profile.html in the place of the 16MHz crystal more-or-less equivalent to asking it to use it's internal clock, or is the change of fuses also needed to get other aspects of 328 behaviour to line up correctly with the 8MHz clock speed?

It would be great if I could just plug in an 8MHz crystal to the circuit, then use a 'board' setting in the Arduino IDE which would assume an 8MHz clock in its defines for Serial interrupts etc. Then I could use that setting when programming a simple 8MHz ATMEGA328 circuit which could be programmed directly off 5V but run down to a <3.8V supply on a battery without changing anything (assuming the project doesn't mind timings all going astray as per PaulS' comments).

Given Jeenodes are running at 3.3v and regular Arduinos at 5V I had the impression that the voltage could be anywhere in the range from 3.3v to 5v and from the thread I linked to, perhaps even a wider range than this.

With suitable changes to fuse settings, the Arduino can run at either 3.3V or 5V, not any random value in between.

Do you have any source for this? Page 316 of the datasheet here shows a curve between maximum clock speed and voltage. Notice that it is a curve, and shows the maximum clock range for every voltage between 1.8V and 5.5V -- not just 3.3V and 5V as you seem to suggest. Furthermore, except for the BOD fuse -- which could be disabled completely for non-critical applications -- no fuses need to be changed for a change in voltage. I'm not completely sure about this part, but you showed no source either.

Quote

clock speed, which is a function of voltage.

Clock speed is a function of the crystal one puts on the chip. True, the _maximum_ clock speed changes, but as long as the speed is under the maximum for the minimum voltage one will have (or if one doesn't mind overclocking) the voltage does not affect clock speed. Notice that standard crystals you can buy don't have specific voltage written on them.