LowPowerLab Forum

Hardware support => Low Power Techniques => Topic started by: KanyonKris on January 20, 2014, 02:24:39 AM

Title: Power Saving Techniques and Libraries
Post by: KanyonKris on January 20, 2014, 02:24:39 AM
I thought it might be useful to have a thread on power saving techniques and libraries.

This article about making low power sketches seems like a good starting point - http://jeelabs.org/2011/12/13/developing-a-low-power-sketch/

Basically you save power by transmitting as little as possible and putting the radio and processor to sleep as often as you can.

There are JeeNodes running on a single lithium coin cell for months so it is possible to run a Moteino for a long time on battery power.

These two lines save a lot of power:

Code: [Select]
radio.Sleep();
LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);

The first line puts the radio module to sleep and is part of the Moteino RFM12B and RFM69 libraries. When the radio module is in Receive mode it draws 12 - 16 mA, in Sleep mode it draws 0.1 - 0.3 uA - huge difference.

For the 2nd line you will need the lowpower library - http://www.rocketscream.com/blog/2011/07/04/lightweight-low-power-arduino-library/
This line puts the ATmega processor in Power Down mode for 8 seconds, turns off the Analog to Digital Converter (ADC) and Brown Out Detector (BOD). Basically this shuts down most parts of the processor except the low power watchdog timer which wakes the process up after the given time interval. The maximum the watchdog timer can be set to is 8 seconds. If you need to sleep longer just put this function call in a loop.

For an example, see the Sump Pump Alert sketch - https://github.com/LowPowerLab/SumpPumpAlert/blob/master/SumpPumpAlert.ino

I've been using the above 2 lines for a while but only recently began avoiding the use of the delay command to save power. If the program needs to wait, it makes sense to power down instead of idling. For example, to blink the Moteino LED (turn the LED on for 60 miliseconds then turn it off):

Code: [Select]
pinMode(LEDPIN, OUTPUT);
digitalWrite(LEDPIN,HIGH);
LowPower.powerDown(SLEEP_60MS, ADC_CONTROL_OFF, BOD_OFF);
digitalWrite(LEDPIN,LOW);

There are other low power arduino libraries you may want to use. Narcoleptic has some nice features, including sleeping for much longer times and correction for millis() - https://code.google.com/p/narcoleptic/source/browse/user+guide.txt

Jee Lab has a function similar to Narcoleptic called Sleepy that is in the ports library - https://github.com/jcw/jeelib/blob/master/Ports.h#L331-L362
The low power sketch pages shows how it's used - http://jeelabs.org/2011/12/13/developing-a-low-power-sketch/

Hopefully this is a good start.
Title: Re: Power Saving Techniques and Libraries
Post by: ltj on January 20, 2014, 02:59:42 AM
Great idea, KanyonKris.
I'm using the Jeelib Sleepy functions with great results myself. I have JeeNodes running for months on end using just a 110mAh lipo.

Recently I found a great resource (a 'Low Power Cookbook') on the the Princeton QED wiki: http://qed.princeton.edu/main/CEE474/LowPower
It's quite detailed on reducing power consumption on AVR uC's using native register settings, but it's well written and contains some good links as well.
Title: Re: Power Saving Techniques and Libraries
Post by: KanyonKris on January 20, 2014, 12:23:45 PM
I'm using the Jeelib Sleepy functions with great results myself. I have JeeNodes running for months on end using just a 110mAh lipo.

To use Sleepy do you include the whole ports library or did you pull the Sleepy function out into its own library?

I have some questions about LiPo batteries. Does your LiPo go through the regulator or bypass it and connect directly to Vcc?

I'm a fan of LiPo, they pack a lot of charge into a small package. But what about self-discharge? I've read they range from 2-8% per month. What has been your experience?

Thanks for the link to the low power cookbook, it's an excellent reference.
Title: Re: Power Saving Techniques and Libraries
Post by: ltj on January 20, 2014, 03:19:46 PM
To use Sleepy do you include the whole ports library or did you pull the Sleepy function out into its own library?

I have some questions about LiPo batteries. Does your LiPo go through the regulator or bypass it and connect directly to Vcc?

I'm a fan of LiPo, they pack a lot of charge into a small package. But what about self-discharge? I've read they range from 2-8% per month. What has been your experience?
I haven't bothered to extract the Sleepy functions, since most of my sensor nodes are JeeNodes anyway. But this might change now :) Could be a nice little project to add some of the Sleepy convenience to LowPower.

Regarding lipo connections, I pondered too for a long time whether or not the regulator should be bypassed. In the end I chose to run it through the regulator. Reasons being that 1. It's simpler and the node/mote/whatever can still be used with a >5V source with the regulator left on (it should be removed or disconnected somehow for direct power, since reverse feeding it, might make it consume a substantial amount of power) 2. When fully charged the lipo is at 4.2V - too much for RFMXXB's and perhaps other devices. Besides, regulated 3.3V is nice and 3. The discharge profile of a lipo means that when the voltage drops below 3.3 + the Vdo of the regulator we are very close to the end of it anyway.

I don't have any exact figures on self-discharge but they are surely way better than standard NiMHs :) The jeelabs forum/blog has quite a few discussions on this topic.

Cheers
Title: Re: Power Saving Techniques and Libraries
Post by: ssmall on January 21, 2014, 07:21:09 PM
Would it be possible to sleep longer than 8 seconds?
Title: Re: Power Saving Techniques and Libraries
Post by: Felix on January 21, 2014, 09:28:13 PM
I believe 8 seconds is the longest uninterrupted sleep period. Could be wrong but either way you'd have to wakeup, figure out that you want to sleep longer and go back to sleep until you have accumulated the amount of time you want to sleep. The narcoleptic library does that for you with a simple function call (just tell it how much time and it will divide it out for you).
Title: Re: Power Saving Techniques and Libraries
Post by: ssmall on January 21, 2014, 11:30:21 PM
Thanks for the tip I will take a look at the library.  I am building a weather station and I thought it might pay to conserve power.  Sending out measurements every 8 seconds or so seems too much.
Title: Re: Power Saving Techniques and Libraries
Post by: KanyonKris on January 22, 2014, 12:46:47 AM
As Felix noted, and I mentioned in the first post, you can sleep longer than 8 seconds by using LowPower in a loop or use a different library (i.e narcoleptic) that does this looping for you so you can just give it the total time you want to sleep. Here's some example code using a loop that will sleep for 80 seconds:

Code: [Select]
radio.Sleep();
var = 0;
while(var < 10){
  // do something 10 times
  var++;
  // put the processor to sleep for 8 seconds
  LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
}

If you want to know the details, the watchdog timer (WDT) is one of the few things running when you put the processor to sleep. You give the WDT a value and it counts down from there, when it gets to zero it wakes up the processor and it starts executing code again below the sleep command. The LowPower library supports the following times for the WDT, from 15 miliseconds to 8 seconds:

SLEEP_15MS, SLEEP_30MS, SLEEP_60MS, SLEEP_120MS, SLEEP_250MS, SLEEP_500MS, SLEEP_1S, SLEEP_2S, SLEEP_4S, SLEEP_8S, SLEEP_FOREVER

If you use SLEEP_FOREVER you need to setup an interrupt to wake up the processor otherwise it will never wake up.
Title: Re: Power Saving Techniques and Libraries
Post by: hexibot43 on January 22, 2014, 01:34:13 AM
Not sure why I didn't have luck with the Narcoleptic Library, but I'm having good luck with

https://github.com/n0m1/Sleep_n0m1 (https://github.com/n0m1/Sleep_n0m1)

It has a very simple delay function that works like the Narcoleptic....

Code: [Select]
        radio.sleep();  // Put radio to sleep 
sleep.pwrDownMode();
sleep.sleepDelay(SleepTime);

I was thinking of moving to a lipo battery and some solar cells.   But with a battery lasting a year I just don't see the point anymore.  I wonder how long that lipo battery would last?  That one lipo battery costs more than 4 - 9 volt batteries.  Do you think a lipo battery would last longer than 4 years?   

I'm currently waking up once 1 minute to relay data, and then back to sleep.
Title: Re: Power Saving Techniques and Libraries
Post by: Felix on January 22, 2014, 08:26:20 AM
Do you think you won't change anything in 4 years?
I respect the desire of so many people the really prolong battery life, however in reality I think the technology changes much faster than that, and at some point you will innevitably change something. Even with a Lipo it will discharge by itself at a slow rate under little or no load.
I haven't done extensive testing with Lipos but they should last a good amount. Maybe others can pinch in if they have more experience with Lipos.
Title: Re: Power Saving Techniques and Libraries
Post by: hexibot43 on January 22, 2014, 11:25:55 AM
1.     I would love to be able to deploy and forget some of the nodes I'm making.  I don't see any reason to mess with my backyard sensors for ground temperature, air temperature, and humidity.  I just want that thing to pump out this information for as long as possible without any work on my part.  And no further investment.

2.    I would agree though that things change so fast.  So a year of service without having to worry about a node is more than good enough.

3.   But I still have a desire for No. 1.

4.   I would love to see a day when a solar panel with some capacitors or something in between a battery and a capacitor would eliminate the need for batteries.  The batteries are the weak link.  I've got solar calculators I've had for years that just work, period.  The closer we get to not needing batteries the better.
Title: Re: Power Saving Techniques and Libraries
Post by: Felix on January 22, 2014, 12:41:38 PM
You bet, I have the same desire, deploy and forget.
Solar would be great. I have yet to explore more about solar and how effective it is to power a low power node.
Title: Re: Power Saving Techniques and Libraries
Post by: KanyonKris on January 22, 2014, 03:11:35 PM
hexibot43, thanks for bringing up the Sleep_n0m1 library. It looks like it has some nice features.

Jee Lab did some testing with a few solar panels. He had some encouraging results but there were caveats, seems he didn't come up with a system he really liked. http://jeelabs.org/tag/solar/

Regarding LiPos, they can hold a big charge but when looking at run-times of years I think self-discharge will be the problem. I went looking for self-discharge data for LiPos and found claimed rates of 2-8% per month. If it's 8% then half the LiPo charge is gone in 6 months. 2% looks a lot better at 25 months (2 years). If 2% LiPos exist they would work very well for powering a Moteino. The other cool thing about LiPos is: because they can hold so much charge, you might as well use that charge to run the processor longer and use the radio more rather than let the charge be lost in self-discharge.

Eneloops (or similar low self-discharge NiMH batteries) are a very attractive choice for powering a Moteino for a long time. The 3rd generation Eneloops (October 2011 or later) claim capacity of up to 90% after one year, 80% after 3 years and 70% after five years (http://en.wikipedia.org/wiki/Eneloop). Comparison of low self-discharge batteries - http://www.stefanv.com/electronics/low_self_discharge.html
Title: Re: Power Saving Techniques and Libraries
Post by: hexibot43 on January 22, 2014, 03:41:25 PM
Kanyon Kris,
     I checked out that JeeLabs page on using Solar.  I'm actually very encouraged.  He was talking indoor usage with small cells.  I think with good power conservation, and a similar setup using two cells this could be very viable for outdoor usage.  With the weather we're having here in the San Francisco Bay Area no problem.  Haven't seen a "real" rainy day in over a year.  Omitting the battery all together.   
     I'm going to have to check out some of those SuperCaps. 

Quote
One conclusion is that only the lightest load of 0.15..0.20 ľA allows the supercap to retain a decent amount of charge through each night. On the other end of the range: with two solar cells in parallel, a 15..20 ľA load might be able to stay alive for a few hours each day.
Title: Re: Power Saving Techniques and Libraries
Post by: MikesTechBlog on April 19, 2014, 10:23:04 PM
Also just to add a little heads up when using the Rocketscream LowPower.powerDown function and sending data out the serial port, such as in debugging. I kept getting garbled data on my Serial.print functions.

I don't recall where I saw the solution (Reference anyone??) but I saw in another forum somewhere that the Arduino / Motenio can go to sleep before all of the serial data is completely sent. Then the next time it wakes up, and sends another stream of serial data, there is still residual from the previous time, which gets garbled.

The solution this other forum suggests is to perform a Serial.flush(); just prior to the  LowPower.p(SLEEP_8S, ADC_OFF, BOD_OFF); call.

This has cleared up the garbled data issue for me.
Title: Re: Power Saving Techniques and Libraries
Post by: Clemens on June 14, 2014, 03:56:41 PM
Has someone tried out LowPower vs. Narcoleptic lib? I will use a node who's logging time and some sensor values and transmit it once a day to a gateway with GPRS access. Narcoleptic has a nice time / date adjusting feature this is not available in LowPower.

But the biggest downside of Narcoleptic seems to be that ADC is not shut down and power consumption is so 0.4 mA vs. 0.4 uA, see http://forum.arduino.cc/index.php?topic=121096.msg924613#msg924613 Update: Seems there is an option to disable ADC via

https://code.google.com/p/narcoleptic/source/browse/examples/MerlinTheCat/MerlinTheCat.pde
Quote
  Narcoleptic.disableADC();

Has someone tried out LowPower vs. Narcoleptic with the Moteino and measured power consumption?
Title: Re: Power Saving Techniques and Libraries
Post by: Felix on June 14, 2014, 08:28:38 PM
I think I did at one point and with all the same options off I did not see a worthy difference between the two. They are basically doing the same thing...
Title: Re: Power Saving Techniques and Libraries
Post by: Alia on July 24, 2014, 07:42:56 AM
Hi,

I'm using the LowPower library with my moteino R4 with RFM69H and i'm not getting the results expected in terms of power consumption.
It's drawing 0.99 mAmps from the battery when using

Code: [Select]
radio.Sleep();
LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);

which is driving me nuts since according to the rocketscream webpage and according to the first post on this thread, the consumption should be way lower than that.

I even tried disabling the wdt but that wasn't useful.
Any hints?
Title: Re: Power Saving Techniques and Libraries
Post by: Felix on July 24, 2014, 07:57:55 AM
You need to sleep not just the arduino but the radio, flash, and any other peripherals/sensors that you have attached.
Title: Re: Power Saving Techniques and Libraries
Post by: Charly86 on August 05, 2014, 02:28:32 PM
I've been able to have 4uA consumption using a moteino like but with RFM12B module powered by a mosfet, removing power from RFM12B, then setup correctly your IO port so they are not sinking or drawing any current when in sleep mode.

Using watchdog you can't go below 4uA because this is the power the Watchdog need.

But I'm working hard on ultra low power version I'm close to 500nA in sleeping mode, that makes a huge difference but I think I found a way to close down to 150nA yes (0.150 uA )but I need external component for this. I will post a article soon about this.
Title: Re: Power Saving Techniques and Libraries
Post by: Felix on August 05, 2014, 04:27:59 PM
I've been able to have 4uA consumption using a moteino like but with RFM12B module powered by a mosfet, removing power from RFM12B, then setup correctly your IO port so they are not sinking or drawing any current when in sleep mode.

Using watchdog you can't go below 4uA because this is the power the Watchdog need.

But I'm working hard on ultra low power version I'm close to 500nA in sleeping mode, that makes a huge difference but I think I found a way to close down to 150nA yes (0.150 uA )but I need external component for this. I will post a article soon about this.
Sounds good, but there are some caveats. When you run on battery (lipo?) you might get close to 3.3V or even less and the mosfet eats some of that voltage since it has internal resistance. Since batteries don't discharge linearly you're spending most of the time in the lower voltage part of lifetime of the battery, so something to keep in mind. Also you will need to re-initialize the radio every time you wake up, which is just a tradeoff you need to live with. The radios have a low power sleep mode but that will need more than 1uA.
Title: Re: Power Saving Techniques and Libraries
Post by: ColinR on August 22, 2014, 05:36:06 PM
The solution this other forum suggests is to perform a Serial.flush(); just prior to the  LowPower.p(SLEEP_8S, ADC_OFF, BOD_OFF); call.

Thanks for this.

C
Title: Re: Power Saving Techniques and Libraries
Post by: Charly86 on August 27, 2014, 03:51:00 AM
Hi guys,

Correct, you need Serial.flush() before every entering into sleep mode, made me mad until I found it.

Concerning coin cell, I've made several node using them, then send data to emoncms with my dual gateway board (RFM12B + RFM69) and I'm facing the Coin Internal resistor problem.
I was hoping sending data until battery come to 2.2V (min voltage for RFM12) or 1.8V (for RFM69) but on the real life, all my nodes start loosing send packet from about 2.7V of the battery. I spend much time to figure out until I read this excellent document from TI http://www.ti.com/lit/wp/swra349/swra349.pdf (http://www.ti.com/lit/wp/swra349/swra349.pdf)
Very good reading, this mean at 2.7V peak current can be up to 12mA for RFM12B and so decrease voltage for about 0.5V, and we're at the limit of RFM12B, and it's same thing with RFM69 (more current about 30mA) even it it works until 1.8V the voltage drop is about 1V.
Of course I tried adding 100uF cap in // of the battery to see (suggested in the doc above)
I will try with RF module in sleep mode instead powering it off with mosfet, may be startup will need less peak current like this and will work longer.
Anyway this is not the ideal solution, so I need to go backward to my 1st idea, add Boost Converter and enable it only when I need juice, this is working fine also but I need to do another design.
Title: Re: Power Saving Techniques and Libraries
Post by: Tomega3 on December 12, 2014, 07:39:19 PM
I am just about to order a few Moteinos. I have been reading the excellent RFM69 library files, the hoperf rfm69 manual (www.hoperf.com/upload/rf/RFM69W-V1.3.pdf) and the LowPower library (see https://github.com/rocketscream/Low-Power ) files and have a question about sleeping the moteino and radio. I see that the current LowPower library will work with the Moteino )avr 328p) but not with the Moteino Mega. (avr 1284p)

If I understand correctly a radio.sleep() call will put the radio in low power mode but it can still fire an interrupt indicating packet received or packet sent.

Looking at the LowPower powerDownWakeExternalInterrupt.ino example I am not sure what will happen in the watchdog timer routine if it attaches an interrupt to the same pin as the rfm69 interrupt pin. Is this even possible to share an interrupt or am I going about waking up from an incoming packet while the Moteino is sleeping all wrong.

It appears that the LowPower(powerDown() calls lowPowerBodOn or lowPowerBodOff both of which call cli and sei (disable interrupts and enable interrupts). I think I can use LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF); without calling attachinterrupt before it and detachInterrupt after it but this will probably prevent waking up the Moteino upon the radio receiving data when the radio and Moteino are both sleeping because interrupts are disabled during sleep..

My goal is to put the Moteino and radio in low power mode using a watchdog timer to 'sleep' for so long unless the radio indicates it has data available. Any and all help in doing this is appreciated.



Title: Re: Power Saving Techniques and Libraries
Post by: TomWS on December 12, 2014, 09:09:10 PM
I would suggest looking into the Sleep_n0m1 library.  I find that it's more comprehensive than the Lowpower library.

I've incorporated this into my own Moteino infrastructure so I just 'sleep' for as long as I want for the specific application and everything is managed and recovers nicely on 'wakeup'...

Tom
Title: Re: Power Saving Techniques and Libraries
Post by: Tomega3 on December 13, 2014, 10:58:56 PM
Thanks for the info on the Sleep_nom1 library
I will take a look at it.

I think I can Sleep in Low Power mode a mote that only transmits.
I think I want to know if I can sleep a mote in Low Power mode that is a receiver.
The low power sleep code I have looked at all disable all interrupts except the watchdog interrupts during sleep.
If this is the case, wont I miss an incoming packet from the radio since int2 is disabled?

Tom
Title: Re: Power Saving Techniques and Libraries
Post by: TomWS on December 14, 2014, 07:44:08 AM
Thanks for the info on the Sleep_nom1 library
I will take a look at it.

I think I can Sleep in Low Power mode a mote that only transmits.
I think I want to know if I can sleep a mote in Low Power mode that is a receiver.
The low power sleep code I have looked at all disable all interrupts except the watchdog interrupts during sleep.
If this is the case, wont I miss an incoming packet from the radio since int2 is disabled?

Tom
I'll have to let Felix answer about an receive capability while in radio.sleep() mode.  Somehow I doubt that it can receive in this mode given the overall power of a Moteino with an RFM69HW in sleep mode consumes about 6uA.

I would try to structure your receive/tx end points so that you can 'sniff' at fixed intervals but with as low a duty cycle as possible.  If the TX side has enough power to tx with multiple retries and the total time for all the retries is longer than your rx interval, you should be able to catch the TX signal during one of the shots.

I'm curious about a low power receive only mote.  What is it used for?  I do have at least one of these kinds of devices (a battery operated sprinkler valve) but I set it up to 'ping' my gateway at reasonable intervals and the gateway, if it has anything to send to the device, will ACK with a flag saying, "Stay online, I've got something for you."

Tom
Title: Re: Power Saving Techniques and Libraries
Post by: KanyonKris on December 14, 2014, 11:58:23 PM
As TomWS mentioned, in order to receive you're going to need to keep the radio on and that costs 16 mA + the power to run the ATMega enough to not miss any data that the radio may receive.

If your project permits, a technique I've used is to transmit then keep the radio on and listening for say 100ms then if no data was received go to sleep.
Title: Re: Power Saving Techniques and Libraries
Post by: Tomega3 on December 15, 2014, 08:14:26 PM
Hi KanyonKris
I am interested in learning how you keep the radio on and listening for say 100ms then if no data was received go to sleep.
I appreciate the help along with the info that I must keep the radio on so not to miss any packets, I think a sleep wake up duty cycle could be found to save power and not miss too many packets.

Thanks again
Title: Re: Power Saving Techniques and Libraries
Post by: Tomega3 on December 15, 2014, 09:30:52 PM
I think I may have found an answer to the question: can a sleeping radio receive data?

I found a reference to this on this forum but did not copy the topic link.  :-[

The answer, from Felix, goes like this:
A packet will only be received if the radio is listening.
If it's sleeping it will not "hear" anything. (receiverDone returns false).

My text here:   
I am assuming it cant send anything too. send and sendwithretry will fail.

So... during radio.sleep() packets received will be missed.
So... some sort of wake / sleep duty cycle should be implemented to try not to miss to many incoming packets while sleeping to save power.

So... its OK to sleep the radio and the moteino and  use a watchdog timer to 'wake' up the moteino and the radio every so often to check for received data and maybe send a "hello I am awake to the Gateway.

   
Did I get this correct?

Thanks
Title: Re: Power Saving Techniques and Libraries
Post by: KanyonKris on December 15, 2014, 11:35:27 PM
Tomega3, this sticky thread is for low power libraries and it seems were off on an application problem. I recommend you start a new thread (topic) to continue this discussion.
Title: Re: Power Saving Techniques and Libraries
Post by: hexium on February 09, 2015, 07:36:09 AM
Hi,

I'm using the LowPower library with my moteino R4 with RFM69H and i'm not getting the results expected in terms of power consumption.
It's drawing 0.99 mAmps from the battery when using

Code: [Select]
radio.Sleep();
LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);

which is driving me nuts since according to the rocketscream webpage and according to the first post on this thread, the consumption should be way lower than that.

I even tried disabling the wdt but that wasn't useful.
Any hints?

Hi, I had exactly the same problem. I think it was caused by the flash memory.

If you have flash on your Moteino you can try the following

#include <RFM69.h>
#include <SPI.h>
#include <SPIFlash.h>
#include <LowPower.h>

#define NODEID        1    //unique for each node on same network
#define NETWORKID     100  //the same on all nodes that talk to each other
#define FREQUENCY     RF69_868MHZ

#define FLASH_SS      8 // and FLASH SS on D8

RFM69 radio;
SPIFlash flash(FLASH_SS, 0xEF30); //EF30 for 4mbit  Windbond chip (W25X40CL)

void setup()
{
   radio.initialize(FREQUENCY, NODEID, NETWORKID);
   radio.sleep();
   flash.sleep();          // put flash (if it exists) into low power mode
}

void loop()
{
   LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
}
Title: Re: Power Saving Techniques and Libraries
Post by: dhnz on March 07, 2015, 01:43:32 AM
Hello,

I am using the example Struct_Send with an RFM69HW.

I have tried using ...

Code: [Select]
radio.Sleep();
LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);

It works, but the Acknowledge reply from the Receiver  no longer works. 

I have tried it in multiple places within the code.  I guess it is putting the system to sleep before it hears the acknowledge?

Can someone please point me where in the Struct_Send this should go?

Thank You  ;D
Title: Re: Power Saving Techniques and Libraries
Post by: Stark on March 11, 2015, 05:20:19 PM

I have tried using ...

Code: [Select]
radio.Sleep();
LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);

It works, but the Acknowledge reply from the Receiver  no longer works. 

A bit off topic here probably, but I have the same problem.

I apply the radio.sleep and the powerdown in a loop to give me 10 minute intervals for sensor data transmission from the node. Gateway pings node but always nothing.

I think I'm lacking the understanding of the ACK process....or an idiots guide!
If anyone can give some pointers this would be much appreciated.
Title: Re: Power Saving Techniques and Libraries
Post by: WhiteHare on August 24, 2015, 09:24:26 PM
Does everything that was put to sleep by the sleep library automatically wake up when the arduino does, or does the arduino have to explicitly wake some things up?  I never investigated, so I'm still wondering.

As a test bed I was able to get an 8Mhz Pro Mini down to 3.5uA (while sleeping) using Gammon's "Sketch I" and down to 125nA using Gammon's "Sketch J", though it would require an external interrupt to ever wake up from "Sketch J" because the WDT is turned off.  I couldn't get below 17uA using the LowPower library.  Not sure what the difference was.   I did my current measurements with a uCurrent Gold in conjunction with a Fluke 87V.

I'm not sure how to measure currents separately on the Moteino, because the chips are soldered on.
Title: Re: Power Saving Techniques and Libraries
Post by: Felix on August 24, 2015, 10:31:44 PM
The libraries only put to sleep the MCU, anything else is your responsibility. For low power you have to power off all sensors and peripherals that might drain your battery.
Title: Re: Power Saving Techniques and Libraries
Post by: javiercuellar on May 23, 2016, 08:15:47 PM
Hi Felix

The libraries only put to sleep the MCU, anything else is your responsibility. For low power you have to power off all sensors and peripherals that might drain your battery.


Using a basic example, I have connected a DHT11 to +VCC, GND and Pin 7 directly of the moteino, how can I power it off?

Regards

Javier


Title: Re: Power Saving Techniques and Libraries
Post by: Felix on May 24, 2016, 10:34:46 AM
Switch power to any sensor or load via a transistor/mosfet/relay. If the load is low enough power (up to 15ma or so) then you can simply power it from a digital pin directly. I think for the DHT11 you might be able to do that.
Title: Re: Power Saving Techniques and Libraries
Post by: XFVB56 on October 07, 2016, 10:09:02 PM
Way back in the thread someone asked about li-poly discharge rates. I just did some li-poly testing of hobby grade batteries and found self discharge to be 1%-2% per month at room temperature.  The discharge rate is temperature sensitive and if you're looking to minimize it, keep the batteries at room temperature or cooler. 

The bigger issue is that li-poly batteries degrade rapidly when stored at full charge so most manufacturers suggest storing them at 50% charge. I don't have any test data on that, but anecdotally I have experienced life spans in two year range when storing batteries fully charged.  If you are looking for maximum lifespan from the batteries, it is much better to configure the charger so that only charges to about 80% and use a larger battery if necessary for capacity.  For a standard voltage li-poly "3.7 volt" cell, this is a terminal voltage of about 3.98-4.00 v/cell  as opposed to the standard 4.20 v/cell.
Title: Re: Power Saving Techniques and Libraries
Post by: EdM on May 22, 2017, 11:18:37 AM
Following up on Felix's comment about switching loads, I finally got around to de-powering my the SD cards on my data loggers.

https://edwardmallon.wordpress.com/2017/05/21/switching-off-sd-cards-for-low-power-data-logging/ (https://edwardmallon.wordpress.com/2017/05/21/switching-off-sd-cards-for-low-power-data-logging/)

I saved SD power control to the end of my quest for low power logging, because of all the potential weirdness that could arise with the Arduino SD libraries. But after a fairly thorough round of testing it seems to be working OK with a BJT switch on  the ground line.