Go Down

Topic: Varying MCU supply voltage (Read 1 time) previous topic - next topic

Jack Christensen

Jan 05, 2013, 02:11 am Last Edit: Jan 05, 2013, 02:15 am by Jack Christensen Reason: 1
I have an idea for a data logger or remote wireless sensor. I want to run it on 2xAA alkaline cells which is no problem for the MCU (ATmega328P), but I may want to use sensors that require 5V. I found a switching regulator (MCP1640C) that has a bypass mode, which can be controlled by an MCU pin. When in bypass mode, the regulator sleeps, lowering power requirements and passes the input battery voltage straight through. When the MCU wakes, it can enable the regulator and boost the supply voltage to 5V. (The MCU will also mostly sleep when the regulator isn't running.)

My question is whether it's reasonable to expect reliable MCU operation with the supply voltage going from a minimum of say 2.7V to 5V, and then back, or is this just a Very Bad Idea? The voltage transition will take a few (2-5) milliseconds. I can always just give it a try, and probably will, but I've been reading the ATmega328 datasheet and googling around and not finding anything, so wondering if anyone can comment.

I have a little breadboard power supply (LM317) that can be switched between 3.3V and 5V, I've been abusing an ATmega328P (at 16MHz) by switching it rapidly back and forth, and it never seems to burp, but I don't consider this to prove much, if anything. (If I build the circuit described above, I'd clock the MCU at 8MHz so it was always in the safe operating area regardless of Vcc.)
MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

dhenry

if the transient is not too bad, it should work.

i would, however, split the rail: using the 2.7v to power the mcu and the dc/dc converter for the 5v device.

retrolefty

Quote
My question is whether it's reasonable to expect reliable MCU operation with the supply voltage going from a minimum of say 2.7V to 5V, and then back, or is this just a Very Bad Idea?


I would think it should work ok. The only caveat I can think of is that the brown out voltage detector reset might have to be disabled or set to a value lower then 2.7?

Lefty

Coding Badly

Quote
My question is whether it's reasonable to expect reliable MCU operation with the supply voltage going from a minimum of say 2.7V to 5V, and then back, or is this just a Very Bad Idea?


I can't think of anything in the datasheet that contradicts what you want to do.  Seems like a good idea to me.  

Quote
I'd clock the MCU at 8MHz so it was always in the safe operating area regardless of Vcc.


If the processor will spend anytime polling 1 MHz (or even 128 KHz) may be a better choice.

Jack Christensen

Most appreciated, gentlemen! I'll give it a try in the coming weeks and will report back! A couple more thoughts below.


if the transient is not too bad, it should work.

i would, however, split the rail: using the 2.7v to power the mcu and the dc/dc converter for the 5v device.


The datasheet for the boost regulator has a scope trace showing the transient, and it seems decently smooth. I thought about splitting the rail, but then I may have to level shift signals between the MCU and sensors, I'd prefer to avoid that if possible.


I would think it should work ok. The only caveat I can think of is that the brown out voltage detector reset might have to be disabled or set to a value lower then 2.7?


I said 2.7V because that's the BOD setting I'd use. The 1.8V setting seems too low to me. An in-between setting might be nice, but such is life! Certainly the battery will have some juice left at 2.7V, so it may be worth trying 1.8V. In that case I'd want to slow the system clock before turning the boost off, but that's straightforward enough.


I can't think of anything in the datasheet that contradicts what you want to do.  Seems like a good idea to me. 


I did find an Atmel application note about using the BOD that talked about variations in supply voltage, and the typical problems if they got below recommended levels, this is why the BOD should be used, etc. So that would seem to imply some variation is tolerable, but it didn't go into detail on that specifically.

Quote

If the processor will spend anytime polling 1 MHz (or even 128 KHz) may be a better choice.


Probably not much if any, but are you thinking more from a power conservation standpoint, or immunity to the Vcc fluctuation?
MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Coding Badly

Certainly the battery will have some juice left at 2.7V, so it may be worth trying 1.8V.


The Rayovac alkaline batteries I've been using have enough life down to 0.8 volts (each times 2 batteries for 1.6V) to keep an ATtiny85 running reliably.  In other words, I believe 1.8V is a good threshold for AA alkaline batteries.

The ATmega328P can accurately measure it's own supply voltage.  You could set the BOD at 1.8V (or possibly disable it) and add a bit of code to "shutdown" (deep sleep) at a voltage of your choosing.

Quote
Quote
If the processor will spend anytime polling 1 MHz (or even 128 KHz) may be a better choice.


Probably not much if any, but are you thinking more from a power conservation standpoint, or immunity to the Vcc fluctuation?


Power conservation.

Jack Christensen


The Rayovac alkaline batteries I've been using have enough life down to 0.8 volts (each times 2 batteries for 1.6V) to keep an ATtiny85 running reliably.  In other words, I believe 1.8V is a good threshold for AA alkaline batteries.


Sounds like 1.8V is definitely worth a try then. BTW, you've converted me to a Rayovac fan. The local Ace Hardware store just had 30-packs of AA cells for $6.99 (after an instant rebate), so there are now two of those in my fridge!
MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Coding Badly


I recently had an Energizer cell leak acid.  I know, given the right circumstances, all alkaline batteries will do that.  However, I have not had that happen with Rayovacs (and I have a drawer full of very nearly dead ones just itching to cause problems [I keep them for testing]).

Quote
so there are now two of those in my fridge


Huh.  For some reason my batteries migrated to the pantry.  I'll have to get them back in the fridge.

dhenry

Quote
but then I may have to level shift signals between the MCU and sensors, I'd prefer to avoid that if possible.


Put a pull-up resistor there.

strykeroz


Quote
but then I may have to level shift signals between the MCU and sensors, I'd prefer to avoid that if possible.


Put a pull-up resistor there.
Can you explain how that would work, or provide a link to a circuit that uses that method?

Thanks
Geoff
"There is no problem so bad you can't make it worse"
- retired astronaut Chris Hadfield

dhenry

One resistor between the mcu's pin to the rail; another resistor from the 5v device's pin to the mcu.

Transmitting '0' is no issue at all: as the signal is referenced to ground.

Sending a '1' from the mcu to the 5v device by turning the mcu into an input: the bus gets pulled to 5v by the first resistor.
Sending a '1' from the 5v device to the mcu is also no problem: the voltage on the mcu's pin will be clamp'd to the mcu's rail, and current limit is done by the 2nd resistor.

What helps tremendously here is that your mcu happens to be 5v compliant.

Which rail?, there are three, 5 V, 3V3 and GND...

Bob
--> WA7EMS <--
"The solution of every problem is another problem." -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

Go Up