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
Look at this sketch (https://github.com/LowPowerLab/RFM69/blob/master/Examples/DeepSleep_usingLowPowerLibrary/DeepSleep_usingLowPowerLibrary.ino), 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 (http://gammon.com.au/power).
The call below should be enough once you set all the GPIO to LOW.
LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);
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
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
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.
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.
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:
(http://i.imgur.com/cbikwpK.png)
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
Just dont forget to always use the adapter, or you will fry the radio with 5V.
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 ?
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?
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.
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?
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.
(https://farm4.staticflickr.com/3818/10585364014_a1c2871470_z.jpg)
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.
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
QuoteIf you want to minimize power, you need to remove the LDO and feed clean power into the Vin pin.
sorry, but - if I remove LDO from PCB how can I power Moteino via Vin? Vin pin will be completely disconnected after removing LDO module.
or it is just typo and you have meant 3.3v pin?
as for my power source - I need more that 2000 mAh for my project.. in Active mode my device consumes about 150mAh (RX/TX LoRa, 10 termosensors d18b20, photoresistor, laser module, mosfet.. ) and I need my device work for 4-5 month.. So I use LiPo pack with at least 6000mAh..
http://ww1.microchip.com/downloads/en/DeviceDoc/22049e.pdf
You would also need to jumper the pads for pin 2 and pin 3 on the MCP1703 footprint to get power from Vin to the rest of the PCB.
An advantage to jumpering it like ChemE says is that you can then use a 3.3v FTDI connector, as per normal. However, if d00m178 doesn't care about that, then I'm not aware of any problems arising from simply removing the LDO and then powering it through the 3.3v connector if that's how d00m178 prefers to do it. Just be sure you don't exceed 3.6v. If you run with BOD disabled, then it's all on you to guarantee the voltage never drops below 1.8v, including under load.
Quote from: ChemE on April 27, 2017, 03:15:58 PM
http://ww1.microchip.com/downloads/en/DeviceDoc/22049e.pdf
You would also need to jumper the pads for pin 2 and pin 3 on the MCP1703 footprint to get power from Vin to the rest of the PCB.
If I remove LDO and put jumper wire from pin 2 to pin 3 does not this mean the same thing as power Moteino from 3.3v pin?
Please check attached image - seems it is the same contacts - 3.3v and LDO pin 3.
Also please check this link:
http://www.home-automation-community.com/arduino-low-power-how-to-run-atmega328p-for-a-year-on-coin-cell-battery/
There stated:
QuoteThe ATmega328P running at 8 MHz can actually support voltage levels between 2.7 V and 5.5 V
So I supposed that it means that I can power Moteino via 3.3v pin from LiPo battery fully charged to 4.25v
Am I right or it is definitely mistake?
QuoteAn advantage to jumpering it like ChemE says is that you can then use a 3.3v FTDI connector, as per normal.
I can use FTDI adapted without its power line connected - I just poweri Moteino from battery during re-programming. Is it Ok?
So it is still open question about powering MCU via 3.3v from LiPo 4.25v..
Is it ok or not.
Quote from: d00m178 on April 28, 2017, 07:54:39 AM
So it is still open question about powering MCU via 3.3v from LiPo 4.25v..
Is it ok or not.
No! You'll fry the radio.
well, thank you for your answer.
Actually it already works as I described - via 3.3v pin from LiPo - send/receive OK.
But I will change it back - will use LiPo with LDO..
From what I've gathered on the forums (and others might need to correct me) feeding 4.25V into the 3v3 pin is back driving your LDO. This causes it to use vastly more current than if your were feeding that same 4.25V into the Vin. It would seem that back driven, it still brings the voltage down to <3.6V and prevents you from frying your radio which itself is not rated to 4.5V even though the 328p is. If you remove your LDO and feed 4.25V in, you will nuke your radio.
QuoteIf you remove your LDO and feed 4.25V in, you will nuke your radio.
No, I removed LDO and my device works at least couple hours with LiPo on 3.3v pin.
But I noticed strange behavior - in sleep mode device consumes more current (~1,8 mAh) than with LDO and LiPo on Vin (50 uA)..
Quote from: d00m178 on April 28, 2017, 10:08:06 AM
But I noticed strange behavior - in sleep mode device consumes more current (~1,8 mAh) than with LDO and LiPo on Vin (50 uA)..
Moot.