Deep Sleep / Low Power mode question

Started by Robert, March 25, 2017, 05:11:41 AM

Robert

Hi,

It is unclear for me the best way to put the AVR in deep sleep mode.
Looking at the LowPower library I read that:
LowPower.powerDown(period_t period, adc_t adc, bod_t bod) is the lowest current consumption state, however this function doesn't put timers, spi,  uart and twi off,  such  as the LowPower.idle(..) function. However this function doesn't turn the BOD off

Should I to ensure the lowest power consumption mode to specify:
LowPower.idle(SLEEP_FOREVER, ADC_OFF, TIMER2_OFF, TIMER1_OFF, TIMER0_OFF, SPI_OFF, USART0_OFF, TWI_OFF );
and
LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);

or something like:
  sleep_bod_disable();
  LowPower.idle(SLEEP_FOREVER, ADC_OFF, TIMER2_OFF,TIMER1_OFF, TIMER0_OFF,SPI_OFF, USART0_OFF,TWI_OFF );

Thanks in advance
Robert

Felix

Look at this sketch, it sleeps for 8sec instead of FOREVER, meaning it uses the WDT to wakeup. That feature uses around 4uA. Otherwise it will be lowest power. Also see Nick Gammon's excellent guide.

The call below should be enough once you set all the GPIO to LOW.

LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);

ChemE

Quote from: Robert on March 25, 2017, 05:11:41 AM
Hi,

It is unclear for me the best way to put the AVR in deep sleep mode.
Looking at the LowPower library I read that:
LowPower.powerDown(period_t period, adc_t adc, bod_t bod) is the lowest current consumption state, however this function doesn't put timers, spi,  uart and twi off,  such  as the LowPower.idle(..) function. However this function doesn't turn the BOD off

Should I to ensure the lowest power consumption mode to specify:
LowPower.idle(SLEEP_FOREVER, ADC_OFF, TIMER2_OFF, TIMER1_OFF, TIMER0_OFF, SPI_OFF, USART0_OFF, TWI_OFF );
and
LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);

or something like:
  sleep_bod_disable();
  LowPower.idle(SLEEP_FOREVER, ADC_OFF, TIMER2_OFF,TIMER1_OFF, TIMER0_OFF,SPI_OFF, USART0_OFF,TWI_OFF );

Thanks in advance
Robert

The way the sleep states of the 328p work, when you place the AVR in power down mode, those peripherals that you listed are off automatically which is why the function doesn't bother with them.  There are no active clock domains when the AVR is in power down mode.

Check out table 10-1 here for more details: http://www.atmel.com/images/Atmel-8271-8-bit-AVR-Microcontroller-ATmega48A-48PA-88A-88PA-168A-168PA-328-328P_datasheet_Complete.pdf

Robert

Thanks,

Indeed looking at the ATMEL specs I see that using power.down is sufficient, so I will simplify my code.

Now a subsidiary question.
My 3v6 battery is directly connected to the 3v3 input of the Moteino, bypassing the LDO, and an think the output of they LDO is uselessly consuming power of my battery.
Should I remove my LDO (drawback is that I can't use the a 5V FDI interface to program it)?
Robert

Felix

Robert,
In general there should not be an INPUT at the LDO output. So yes I would remove the LDO. You can easily build an adapter that feeds 3.3v into the FTDI connector rather than the 5v. In fact you could use the removed regulator with a 0.1uF cap to do just that on a small strip of proto board.

perky

#5
Quote from: Felix on March 28, 2017, 08:14:05 AM
In general there should not be an INPUT at the LDO output. So yes I would remove the LDO. You can easily build an adapter that feeds 3.3v into the FTDI connector rather than the 5v. In fact you could use the removed regulator with a 0.1uF cap to do just that on a small strip of proto board.

I agree. There are some LDOs though that do allow backdriving, this tends to forward bias the diode in the pass FET and powers the regulator with a diode drop. The MCP1703 unfortunately starts sinking too much quiescent current under those conditions so not recommended. The MCP1703 though is a bit of a hybrid LDO, it is unusual in having such a wide input voltage range. That choice of course was a good one to allow higher voltage operatiion.

Quote from: Felix on March 28, 2017, 08:14:05 AM
You can easily build an adapter that feeds 3.3v into the FTDI connector rather than the 5v. In fact you could use the removed regulator with a 0.1uF cap to do just that on a small strip of proto board

Unnecessary if you use a FTDI cable that already has a 3.3V regulator on board, such as this (however I think this one can only supply 75mA):
https://www.amazon.com/GearMo-Header-TTL-232R-3V3-Windows-Support/dp/B004LBXO2A

Mark.

Felix

Mark,
The FTDI-Adapter I make is also capable of that but will saturate around 50mA or so. It can power Moteinos that won't use more than that.
I made myself some adapters for 3.3v operation:


Robert

Thanks for your advices,
So I will remove and bypass the LDO from my Moteino and build a 3v3 FTDI adapter as recommended (to be able to program my LowPower Moteino).
Expecting to have my Moteino running on battery more than few days (expecting few months :))
Robert


Felix

Just dont forget to always use the adapter, or you will fry the radio with 5V.

d00m178

QuoteMy 3v6 battery is directly connected to the 3v3 input of the Moteino

would you please clarify this in some more details: is it usual LiPo battery?
As far I know fully charged LiPo has about 4.25v - is it possible to connect it to Vcc pin directly ?

d00m178

Hello all.

Would you please answer on my previous question?
I really need to know - if I remove LDO from Moteino - can I power it from LiPo battery (4.25v) to Vcc directly?

TomWS

Quote from: d00m178 on April 02, 2017, 04:01:39 PM
would you please clarify this in some more details: is it usual LiPo battery?
As far I know fully charged LiPo has about 4.25v - is it possible to connect it to Vcc pin directly ?
There is no VCC pin on a Moteino.  There are Vin and 3.3V pins, which one do you mean?  YES, you can connect a fully charged LiPo to Vin.  NO, you can not connect a fully charged LiPo to 3.3V pin.

d00m178

Thank you!

Yes, I mean 3.3v pin - which is usually called Vcc on different arduino mini pro.

QuoteNO, you can not connect a fully charged LiPo to 3.3V pin.

Just don't understand - if there is advice to remove LDO and power MCU via 3.3v pin to lower power consumption - what is the battery need to use as power source?
Only 2 AA battery (2x1.5v) ?

And if in my project I definitely need to use LiPo battery (I need a lot of mAh and rechargable ability)- I should never remove LDO because I always need power MCU via Vin?

ChemE

#13
The 3V3 pin is meant to be an output to power peripherals that require 3.3V.  If you look closely at the pinout, 3V3 is called an output.



The only input is Vin which gets routed through the LDO and goes on to supply 3.3V as well as the radio and microprocessor.  If you want to minimize power, you need to remove the LDO and feed clean power into the Vin pin.

TomWS

Quote from: d00m178 on April 27, 2017, 01:46:23 AM
Thank you!

Yes, I mean 3.3v pin - which is usually called Vcc on different arduino mini pro.

Just don't understand - if there is advice to remove VR and power MCU via 3.3v pin to lower power consumption - what is the battery need to use as power source?
Only 2 AA battery (2x1.5v) ?

And if in my project I definitely need to use LiPo battery (I need a lot of mAh and rechargable ability)- I should never remove LDO because I always need power MCU via Vin?
If you remove the LDO, then your voltage restriction is governed by:
Flash Chip if you have one on the Moteino board,
Radio chip (RFM69xxx or RFM95)

A quick look at those datasheets will tell you what the maximum limits are.

You can power directly from 2XAA and have 3000mAH of capacity which will give you a long duration if you're careful in your power management.  I routinely get more than 2 years with this combination (using Lithium AAs and run the AtMega328P at 8MHz internal oscillator, etc, etc).  You can also power from 2XAAA or 1 CR123 or...  lots of choices...

If you need rechargeable then keeping the VR and wiring to Vin is your easiest solution, however, there are many more approaches if you look around this forum.

Tom