ATmega328P sleep current

Go To Last Post
33 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


This is a system with an ATmega328P. 

 

Using 'Standby' mode, with a regular watchdog wakeup (for a timing 'tick'):

 

The sleep current consumption is ~ 90µA

 

Detail of the sleep level:

 

 

changing only the sleep mode, to 'Power Down':

 

 

 

detail of the sleep level of just one wake-sleep cycle:

 

 

I'm curious about the slow drop-off of the current when entering sleep - is that expected?

 

Full-size images attached.

 

 

Attachment(s): 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Did you discuss this with your various capacitors & inductors? They make have a lot to say.

 

Also, how much leakage current is there when things are "off", say for 30 minutes

 

This is a system with an ATmega328P. 

hmmm.... 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Mon. Sep 13, 2021 - 08:23 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The power trace differences between Power-Save & Power-Down modes suggests you have an external crystal. is that so; you didn't make that clear ?

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Interesting pictures... did you take care before of going Power Down to clear /as much as possible/ of PRR – Power Reduction Register?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

avrcandies wrote:
Did you discuss this with your various capacitors & inductors? They make have a lot to say.

They are identical, so would be saying the same thing in both cases?

 

avrcandies wrote:
how much leakage current is there when things are "off", say for 30 minutes

Good question.

 

The 'Power Down' case seems to settle to ~ 5uA - which seems in line with datasheet values.

 

Here is 1 cycle of 'Standby':

 

The level remains pretty much steady; in the 'Power Down' case, the "drop-off" is ~ 30uA - which I'd have thought would also be visible in 'Standby' if it were due to "external" reasons?

 

N.Winterbottom wrote:
The power trace differences between Power-Save & Power-Down modes suggests you have an external crystal. 

Yes, that's true (3.5MHz); so the extended startup is expected - as the oscillator starts - is it also the reason for the slow "ramp-down" as it stops?

 

I also omitted to mention that this is at 3.3V.   blush

 

grohote wrote:
did you take care before of going Power Down to clear /as much as possible/ of PRR

Yes.

 

 

 

Attachment(s): 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Mon. Sep 13, 2021 - 09:57 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:
Yes, that's true (3.5MHz); so the extended startup is expected - as the oscillator starts - is it also the reason for the slow "ramp-down" as it stops?

A contrasting test using the internal RC oscillator might be interesting.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Oscilloscopes tend to have strange "recovery" effects after transient overloads. I would not highly trust the observed waveform if the transient is much more than 2x-4x full scale. Your mileage may  vary with manufacturer, transient duration relative to the sampling rate, and the phase of the moon! And, probe compensation becomes even more tricky.

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

Last Edited: Mon. Sep 13, 2021 - 07:10 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What tool is used to measure this waveform?

“Everyone knows that debugging is twice as hard as writing a program in the first place. So if you're as clever as you can be when you write it, how will you ever debug it?” - Brian W. Kernighan

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Heisen wrote:
What tool is used to measure this waveform?

This:

 

https://www.st.com/en/evaluation-tools/x-nucleo-lpm01a.html

 

and the pictures come from its associated PC software: https://www.st.com/content/st_co...

 

ka7ehk wrote:
Oscilloscopes tend to have strange "recovery" effects after transient overloads.

So it's not an oscilloscope, but I'd have thought this effect, if present, would be the same in both cases?

 

But I will also try an oscilloscope ...

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Can you believe it is possible...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That's why I'm asking if it's expected behaviour!

 

EDIT

 

Sorry - which "it" were you referring to?

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

"It"- all, the board, the software, overall functions, everything. A new dimension of "know your power".

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

gchapman wrote:
1 KHz minimum bandwidth

It seems a bit ambiguous about that:

 

But 1kHz really isn't much for this kind of thing.

 

EDIT

 

But still not bad for under $200:

 

https://www.ee-quipment.com/products/real-time-current-monitor-with-usb

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Tue. Sep 14, 2021 - 01:27 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have a similar tool like that, maybe you can post and I can try it out and post graphs, but I don't have 3.5MHz external crystal.

 

Tool - Power Profiler Kit II

“Everyone knows that debugging is twice as hard as writing a program in the first place. So if you're as clever as you can be when you write it, how will you ever debug it?” - Brian W. Kernighan

Last Edited: Tue. Sep 14, 2021 - 01:52 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

been there - the stupid thing can't save data: https://www.avrfreaks.net/commen...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Try setting up a transistor & resistor load ...switch it on/off via AVR & try your meas system on this load...does it accurately show a "square" on/off , going down to zero (a 2N2222A will shut down to handfuls of nanoamps at room temp).

Then you'll know it is/isnot the meas system settling out or having an offset.   That will add (or lessen) confidence in your sleep measurements.

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

avrcandies wrote:
Try setting up a transistor & resistor load

 

I tired this with load resistor value of 100 ohm, VCC from my tool was 5V, switching the 2N2222A from AVR with base resistor 470 ohm. My room temperature is about 27 ºC.

 

I got square wave of current, with lowest being 280nA.

 

 

Looks okay?

“Everyone knows that debugging is twice as hard as writing a program in the first place. So if you're as clever as you can be when you write it, how will you ever debug it?” - Brian W. Kernighan

Last Edited: Tue. Sep 14, 2021 - 05:12 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

May I ask OP to reveal, please:

wakeup source

sleeping time period (cannot read well from the pictures)  

Fuse settings CKSEL

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So your measuring system perhaps is working great...however your top current is WAY too high (50000 uA) to check if you drop to zero.

If you wan to know, did you drop down to, say, 0.1 uA   ...your scope ADC steps ain't gonna show that!!

 

Start with something like 100 uA or 200 uA tops, most scopes read 256 levels (at 50000uA , that is about 195 uA steps @ 256 levels) and some maybe give 1023 levels.

 

...now the OP test system should also be checked.....just to be sure...then any results will be known to really represent reality 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

Last Edited: Tue. Sep 14, 2021 - 05:57 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


Wakeup source is WD interrupt; ~ 36ms period

 

 

@Heisen - what tool (HW and SW) did you use?

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I do not have any new idea, you may question the measuring method... the first step you know, #21: reduce a peak current, drop the maximum current to be a fraction of. 

Ask the manufacturer which is /measuring/ response to a step function /you have/.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

awneil wrote:
@Heisen - what tool (HW and SW) did you use?

I am using Power-Profiler-Kit-2 from nordic semiconductor. I use their provided software named nRF Connect - Power Profiler. It looks something like this and has 100 ksps sampling rate.

 

avrcandies wrote:
Start with something like 100 uA or 200 uA tops, most scopes read 256 levels (at 50000uA , that is about 195 uA steps @ 256 levels) and some maybe give 1023 levels.

Okay, done. Now it looks like this.

Still showing the same current 290 nA. Looks like it's accuracy is good enough. Now that we concluded that my tool is working okay (phew !!), let's go back to the actual thread.

 

I tried the awneil setup (as much as I could understand), a ATmega328p on breadboard with watchdog interrupt, waking the MCU from power down sleep mode every 32ms (and immediately going back to sleep). Only difference is mine is running at 5V and at 16MHz. I tried running at 3.3V at 16MHz the waveforms were 99% same only difference being slightly reduced current consumption. Anyways here is what it's looks like.

 

The current waveforms matches with what  awneil  showed. Let's zoom in on those wakeup pulses.

 

I see some switching happening at the end. Answering the main question.

awneil wrote:
I'm curious about the slow drop-off of the current when entering sleep - is that expected?

No, I don't see the slow drop off of current. Not sure if this is how it's suppose to be. Let's zoom in a bit more on those pulse's where they end.

 

The current consumption literally drops to zero in between those switching and remains zero a little bit after, but then it slowly (but still quick) rises up like that and remains at 6.2uA (average) in deep sleep like shown till the next cycle.

 

“Everyone knows that debugging is twice as hard as writing a program in the first place. So if you're as clever as you can be when you write it, how will you ever debug it?” - Brian W. Kernighan

Last Edited: Wed. Sep 15, 2021 - 06:50 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Very nice!!  Also, it seems like your "meter" has more than 8 bit, 256 level, resolution (nice).

What happens if you let it sleep a LONG time, say 20 seconds?  Does that 6ua ramp up you show level out & stay at 6uA, or does it fall back down during long sleep?

If it stays at 6 uA for a long time, you can poke around & maybe find where it is going.

 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


I wrote:
been there - the stupid thing can't save data: https://www.avrfreaks.net/commen...

 

I dug it out anyhow:

 

 

So that is showing something of a drop-off - but not as pronounced as the ST tool.

But then it does look a lot smoother - so maybe it's just filtered stuff out?

 

Apart from not being able to save the data (as already noted), the Atmel tool is pretty useless for getting any actual measurements - no cursors, no graticule lines, and no summary data for the current view.

 

frown

 

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:
Apart from not being able to save the data (as already noted), the Atmel tool is pretty useless for getting any actual measurements ...
Microchip's Data Visualizer, instead of Atmel's, and the most recent version?

Microchip Gallery | MPLAB-Data-Visualizer-Standalone(Windows)

...

MPLAB® Data Visualizer v1.2.956
May 6th, 2021

...

[mid-page]

WHAT'S NEW

v1.2.956:

- Visualize power consumption on supported platforms

...

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

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

 

gchapman wrote:

Microchip's Data Visualizer, instead of Atmel's, and the most recent version?

...

MPLAB® Data Visualizer v1.2.956
May 6th, 2021

...

Hmmm ... that's within days of when I was looking at it before - I wonder if that's a coincidence ... ?

 

I'll have to check again...

 

EDIT

 

Indeed, the version I have is 1.2.835 - but it reckons it's up-to-date;

 

 

That's the Standalone Visualiser - I guess they haven't updated that?

 

frown

 

I really don't want to have to install the whole MPLAB IDE just for this!

 

EDIT 2

 

No, it definitely says it is the Standalone one:

 

But why would you have to "open it in the IDE" - if it's "Standalone" ?!

 

Is this some strange, new Microchip meaning for the word, "Standalone" of which I was not previously aware?

 

frown

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Mon. Sep 20, 2021 - 07:44 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:
Is this some strange, new Microchip meaning for the word, "Standalone" of which I was not previously aware?

Must be "Cheese"...

The farmer in the dell
The farmer in the dell
Hi-ho, the derry-o
The farmer in the dell

...

The mouse takes the cheese

The mouse takes the cheese
Hi-ho, the derry-o
The mouse takes the cheese

 

The cheese stands alone
The cheese stands alone
Hi-ho, the derry-o
The cheese stands alone

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

in #28, awneil wrote:
But why would you have to "open it in the IDE" - if it's "Standalone" ?!

You don't.

 

It is, in fact, a standalone download and it installs a standalone executable - there is no need for the IDE.

 

awneil wrote:
Apart from not being able to save the data (as already noted), the Atmel tool is pretty useless for getting any actual measurements - no cursors, no graticule lines, and no summary data for the current view.

Does now seem to do all those things.

smiley

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Tue. Sep 21, 2021 - 08:44 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:
But why would you have to "open it in the IDE" - if it's "Standalone" ?!
Likely essential libraries for USB CDC ACM and etc; IIRC, a wee bit of such exists as a copy in Microchip Studio.

Was unaware, until your post, of the dependence of DV EXE on MPLAB X.

 

edit : Oh (#30)

 

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

Last Edited: Mon. Sep 20, 2021 - 08:56 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:
But why would you have to "open it in the IDE" - if it's "Standalone" ?!

You don't, but the IDE has a way to manage packages, i.e. download, unzip etc..   in this case its a standalone package, you can download and unzip manually if you so please.

 

Jim

 

 

Keys to wealth:

Invest for cash flow, not capital gains!

Wealth is attracted, not chased! 

Income is proportional to how many you serve!

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ki0bk wrote:
  in this case its a standalone package, you can download and unzip manually if you so please.

So why does the web page not say that?

 

angry

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...