Arduino mini pro 3.3v 8Mhz wake up / go to sleep times.

Hi,
I would like to ask about a guidance to resources or measurements describing timings for arduino/Atmega328p when going to sleep / waking up.
In datasheet for Atmega328p we can find description of 5 sleep modes. But I cannot find any detailed information about how long it takes to go from 'active' state to 'power-down' or 'idle'. And other way around. How long it takes to go for example from 'idle' to 'active' state.

Would be great if you can point me to some existing chart/grid with some timing summary or maybe help understand and calculate values on my own.

Background:
I have a battery-driven sensor, based on mini pro 8Mhz 3.3v, that needs to report data several times per second. So, wake up, get data, send data, sleep. In loop. The operation of getting and sending data is around 2.5ms. Sleep time is 120ms.
Some time is spent on waking up device and then putting it into sleep.
I read somewhere that full process of waking up arduino from power-down takes 2ms. I assume that putting it into sleep will take same amount of time. So in summary I have 4ms when I am just waiting for internal arduino operations and 2.5ms of my own operations. So total of 6.5ms when adruino is working with current of 3.88mA (measured active state of my pro mini) and then sleeps 120ms with current arount 66uA. I am not considering here my sensor for simplicity. Also I am not able to find how much current is used during the process of wake-up, go-to-sleep so I assume worst case scanario - same amount as in active state.

Some simple math: (6.5ms x 3.88mA + 120ms x 0.066mA) / 126.5ms = 0.262mA

With 1000mAh battery it gives me around 159 days.

So I started to wonder if using other sleep modes will give me chance to reduce 'active' state time with a cost of slightly increased sleep current. Which in general will still reduce average current and increase battery life. 4ms of internal operations comparing to 2.5ms of actual job seems too much. And with so frequent wake-ups maybe other sleep mode will be more suitable for me.
Unfortunately I have no laboratory equipment to measure those times or currents myself so I can base only on theoretical calculations which seems not available.

Thank you!

See post #16

Wake-up time depends on the sleep mode, and also whether you run off the internal oscillator or an external crystal. The datasheet has a complete table detailing the different options. Waking up from power down sleep with external crystal can take over 64 ms.

Thats exactly where my confusion comes from. I have seen this 65ms value somewhere already. And in that discussion people mentioned that 65ms is not wake up time from power down but from reset. And there as well 2ms were mentioned but without any reference to documentation.
Thats why I am asking about reference to measurments or documents here.

The measurement that srnet did is quite awesome and impressive. 1ms instead of 2ms is huge baterry life improvement. But how is that in relation to 65ms that wvmarle mentioned.

wvmarle, could you please point me to right documentation chapter, where I can find this table?
Thank you.

forest100:
The measurement that srnet did is quite awesome and impressive. 1ms instead of 2ms is huge baterry life improvement. But how is that in relation to 65ms that wvmarle mentioned.

Also bear in mind what I said about the node I have had running for just over a year on a 155mAhr battery, which is now still only about 55% disharged. So average current consumption is a mere 10uA. Thus with the watchdog taking around 6uA, the average current of the rest of the circuit, regulator, BME280 and LoRa module including the wakeup every 15 minutes to read a sensor and transmit a LoRa packet is an average of only 4uA.

How likley is it that there is a 65mS wakeup period every 8 seconds, with an 'average' current consumption of somewhat less than 4uA ?

When waking up from power-down mode, there is a delay from the wake-up condition occurs until the wake-up becomes
effective. This allows the clock to restart and become stable after having been stopped. The wake-up period is defined by the
same CKSEL fuses that define the reset time-out period

The wake-up period depends on the type of oscillator used and the setting "burnt" into the CKSEL fuse

The 65ms applies only after starting from RESET. For 8Mhz and 16K clock cycles, that would be about 2 ms to wake-up from Power-down

forest100:
1ms instead of 2ms is huge baterry life improvement.

Not a significant difference, do the sums.

If the running current of the processor is 5mA, then an extra 1mS every 8 seconds, is only an average of;

5mA/8000 = 0.625uA.

forest100:
wvmarle, could you please point me to right documentation chapter, where I can find this table?

ATmega328P data sheet ch9.3 (p.29) through ch9.8 (p.35).

wvmarle:
ATmega328P data sheet ch9.3 (p.29) through ch9.8 (p.35).

wvmarle, thank you.

srnet:
Not a significant difference, do the sums.

If the running current of the processor is 5mA, then an extra 1mS every 8 seconds, is only an average of;

5mA/8000 = 0.625uA.

srnet, thing is that I am running my code every 120~200ms. Giving that I started to wonder if putting arduino into power down and sacrifice 4ms for internal arduino operations needed to wake up and put to sleep is too much. 4ms is almost twice as much time that I need for my operations.
Thats why I asked also for other types of sleep modes available.
I have small hope that maybe wake up times for other sleep types will be shorter and not too much current will be added during sleep. But I dont have any numbers so far, so its still guessing and hoping.
Btw, srnet what kind of magic tricks did you do to have wake up time equal around 1ms?

forest100:
Btw, srnet what kind of magic tricks did you do to have wake up time equal around 1ms?

Nothing magic, although I am using the MiniCore for my 8Mhz Atmega.

There might be some measurement error, but in my case the difference between 1mS and 2mS is not significant.

As long as the sleep period does not need to be precise, an ATmega328P can do very well as a very battery efficient sensor, no extra components needed. My sensors 155mA battery looks like its going to have a battery life of around 2 years, so a set of AAs would last around 36 years.

forest100, perhaps you could write a sketch that would allow someone with a scope to measure how long going to sleep and waking up take. And with a shunt resistor in the power line, they could also measure the sleep current.

I'm curious about your 66uA sleep current. Is that power-down with the watchdog timer running? It seems high for just the 328P. Does that also include a voltage regulator? A USB-to-UART adapter? A bare 328P with everything turned off will do power_down sleep at some fraction of a microamp. My understanding is the WDT oscillator would add about 6uA to that.

There is really not much to share in terms of sketch because I am focusing here only on arduino itself. Like I wrote in subject I am using Arduino Mini Pro. 3.3v 8Mhz. Its actually a clone called The Simple. I have removed power led but regulator is still in place. Its there for a reason because whole module is gonna be powered by 5v source. I am aware that its not efficient from power point of view but its how it is and I have to adjust. I was thinking about removing regulator and using some external LDO to give 3.3v to my arduino directly on Vcc but before doing so and trying to find LDO that will not waist too much energy by itself I wanted to check if there is any other way - for example playing with timing and different types of sleep modes.
This way helped me once when playing with nrf24l01. There was really small sleep current like below 1 micro amp. But wake up time was something about 1.5ms. And I found that there is standby mode as well where it was using around 26uA and it had much faster wake up time like 150us. And all in all when using standby mode, average current was smaller than when using deep sleep and wait doing nothing until its up again.
Thats why this whole topic was created.

And yes I am using watchdog to wake up every 120ms.

forest100:
Like I wrote in subject I am using Arduino Mini Pro. 3.3v 8Mhz. Its actually a clone called The Simple. I have removed power led but regulator is still in place.

So replace the regulator with one designed for the job, I use an MCP1700 in the examples quoted above. Its rated Iq is 1.6uA.

srnet:
So replace the regulator with one designed for the job, I use an MCP1700 in the examples quoted above. Its rated Iq is 1.6uA.

Yes, that is definetely step that I should do. I am aware of that. Thank you for pointing our proper LDO. Appreciate that.

But still, I would like to focus on timigs and sleep modes. In datasheet of atmega328p, I found Table '8-11 Start-up Times for the Internal calibrated RC Oscillator Clock Selection'. And there is stated that when using internal oscillator and having enabled BOD during power down, power up process will take 6 clock cycles. For 8Mhz that would be 750ns if I didnt mess up with zeros. Thats quite better than 2ms even considering additional 25uA for sleep period. Does this make sense? Anyone used internal oscillator? Any drawbacks?
Thanks.

All my custom PCB design uses the internal oscillators and it's fine. I don't deal with high speed UART so the accuracy on the internal oscillators are fine. If you do run some sort of RTC without an actual RTC module (such as DS3231), expect to lose or gain up to 10 minutes every 24 hours. I2C and SPI peripherals will work fine even with up to 10% variance in the oscillator clocks.

I was thinking you could have a sketch that brings a digital output high immediately before going into sleep mode, and takes it back low again immediately after wakeup. You would set the WDT to do the wakeup at a very short interval. Then someone with a scope and a 3.3V 8MHz Pro Mini could measure the time during which the output is high. And you could do the same test on the different sleep modes. The absolute numbers might not be all that accurate, but the differences probably would be. This would measure the total time required to go to sleep and to wake up among the different sleep modes.

A more accurate measure of the actual time of reduced current, and the actual sleep current on each sleep mode, might be obtained by scoping the voltage drop across a shunt resistor inserted into the power line. And that would also tell you if there are any strange current spikes during the wakeup process.

My Pro Minis are an earlier design than your "The Simple" versions, but I think they are pretty much the same electronically. I tested the power_down sleep current on one with the LED removed, and got 49uA with WDT turned off, and 63uA with WDT enabled. Another one with the regulator also removed sleeps at less than 1uA with WDT disabled. So it looks like about 53uA of your 66uA is the regulator. Of course you could remove the regulator and run the Pro Mini on 5V with no problem, but it would use more current in all modes at 5V than at 3.3V. So the optimum solution is probably replacing the regulator with one that's better behaved. By the way, powering the Pro Mini directly at the Vcc pin, but with the regulator still in place, doesn't make much difference in current draw.

It's too bad nobody makes a Pro Mini clone with a quality regulator. And a genuine Atmel processor too.

ShermanP:
It's too bad nobody makes a Pro Mini clone with a quality regulator. And a genuine Atmel processor too.

I don't see a place for regulators in battery powered operations. Just connect that battery to the Vin pin. 2 or 3 Alkaline or a 3V lithium is what you would typically use, no regulator needed.
I'm not aware of Atmel processor clones. I'd be really impressed if someone would indeed be able to pull off a completely functional clone of a microcontroller (and get it to market at a significantly lower price than the original!).

ShermanP:
It's too bad nobody makes a Pro Mini clone with a quality regulator. And a genuine Atmel processor too.

I make my own.

wvmarle:
I don't see a place for regulators in battery powered operations.

I do.

For one, it makes it heaps easier with a far wider choice of batteries, to use sensors\GPS\radios and similar that are 3.3V supply devices, and would be destroyed if you use them without regulators.

When discussing low power topics, everywhere where I look sooner or later discussion goes down to having lowest possible current during sleep. I didn't see, to be honest any talks about the actual runing time. And thats fine as long as sleep time is significantly longer than active time. Right? Days, months of sleep will have greater impact than 1 or 2ms of additional active time.
But I have to be active several times within 1sec.
Let me go back to equation I did before.
2ms wake up time, 2ms go to sleep time. 2.5ms performing operations and 120ms of sleep. When active use 3.88mA, when sleep use 0.066mA. Units are mA and ms.

((2+2+2.5)3.88+1200.066)/(2+2+2.5+120) = 0.262mA

Now approach with removing regulator. As ShermanP suggested 53uA less for sleep and I guess for active as well.

((2+2+2.5)(3.88-0.053)+120(0.066-0.053))/126.5 = 209mA

And now lets keep inefficient regulator in place but reduce wakeup time by using internal oscillator. It is then 750ns to wake up. Lets use 1us. BOD needs to be active all the time so sleep current is larger by 25uA

((0.001+0.001+2.5)3.88+120(0.066+0.025))/122.502= 0.169mA

Again for simplicity I am not considering additional sensor as it would add costant value to all three calculations.

I am not saying that removing or replacing regulator is not important. It is. And it is mandatory. But I hope you see now how much impact can have properly configured active period.