emontx - voltage and sleep

Am I correct in thinking that I can't use the sleep function to increase battery life on my emontx if I'm measuring voltage?

Thanks

Lloyd

glyn.hudson's picture

Re: emontx - voltage and sleep

I can't think of any reason why sleep could not be used. We use delay in the example since we assume if someone is monitoring voltage with an AC-AC adapter they will also power the emonTx with a USB power supply. When using a USB power supply using delay instead of sleep give a more constant current draw which puts less stress on the SMPS. 

Lloyd's picture

Re: emontx - voltage and sleep

Ok - It's just that it is commented out in the example sketch:

void emontx_sleep(int seconds) {
  // if (emontx.battery > 3300) {
    for (int i=0; i<seconds; i++) {
      delay(1000);
      if (UNO) wdt_reset();
    }
  // } else Sleepy::loseSomeTime(seconds*1000);
}
 
Does the watchdog timer also need to go in the else clause (ie outside of the conditional code) ?
 
Lloyd
glyn.hudson's picture

Re: emontx - voltage and sleep

No I don't think it does. It works ok in the current only example: https://github.com/openenergymonitor/emonTxFirmware/blob/master/emonTx_CT123/emontx_lib.ino

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.