Author Topic: My Moteino are using ~90uA during powerdown (SOLVED)  (Read 8441 times)

ove

  • NewMember
  • *
  • Posts: 8
  • Country: se
My Moteino are using ~90uA during powerdown (SOLVED)
« on: July 22, 2016, 01:52:26 PM »
Hi,

I am trying to power consumption down to ~5uA during powerDown on my Moteino R4 with flash and RFM69W_433MHz and it should be possible because I have seen posts where they are close to 1 uA.
The Moteino is powered by two AA batteries (3.14V at the moment).

I have changed the fuses to lfuse: E2 hfuse: DC efuse: FF so it is using internal 8MHz RC oscillator and brown out detection is disabled (BOD could most likely be left on but I disabled it anyway).

The mcp1703 voltage regulator is not removed yet... but I have removed the D9 led, flash chip and the radio on one of my Moteinos but it did not help.

I am using Arduino IDE 1.6.9 and the latest version of the libraries... what did I miss?
Do I have to remove the external crystal and/or voltage regulator (there is not much else to remove)?

This is the test sketch I am using:
Code: [Select]
#include "LowPower.h"
#include <RFM69_ATC.h>
#include <SPI.h>
#include <SPIFlash.h>

#define NODEID        100
#define NETWORKID     100
#define GATEWAYID     1
#define FREQUENCY   RF69_433MHZ
#define ENCRYPTKEY    "sampleEncryptKey"
#define FLASH_SS      8
SPIFlash flash(FLASH_SS, 0xEF30);
RFM69_ATC radio;

void setup() {
  pinMode (9, OUTPUT);
  radio.initialize(FREQUENCY,NODEID,NETWORKID);
  radio.encrypt(ENCRYPTKEY);
  radio.enableAutoPower(-70);
  radio.sleep();
  flash.initialize();
  flash.sleep();
}

void loop() {
    LowPower.powerDown(SLEEP_2S, ADC_OFF, BOD_OFF);
    digitalWrite (9, HIGH);
    LowPower.powerDown(SLEEP_2S, ADC_OFF, BOD_OFF);
    digitalWrite (9, LOW);   
}

« Last Edit: July 23, 2016, 04:04:41 AM by ove »

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6867
  • Country: us
    • LowPowerLab
Re: My Moteino are using ~90uA during powerdown
« Reply #1 on: July 22, 2016, 03:01:06 PM »
YOu need >3.5v on VIN. Unless you remove the regulator and power 3.3v pin directly. Anything else won't work as long as the regulator in on there.
Use the deepsleep sketch in the examples, should give you 7uA on stock Moteinos (loaded).

ove

  • NewMember
  • *
  • Posts: 8
  • Country: se
Re: My Moteino are using ~90uA during powerdown
« Reply #2 on: July 22, 2016, 04:03:16 PM »
Thanks... I removed the regulator and now it is only using 4.3 uA during powerDown :)
The regulator is a bit small so I did not want to remove it unless I had to. It will not be as pretty if I try to solder it back again ;)

I tried both VIN and the 3.3v pin and both worked and the current was almost the same ~90uA... removing the regulator made a huge difference.

Best Regards
Ove

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6867
  • Country: us
    • LowPowerLab
Re: My Moteino are using ~90uA during powerdown (SOLVED)
« Reply #3 on: July 25, 2016, 08:18:00 AM »
The regulator is a very small quiescent current and allows you to power the board with up to 16v. With stock fuses/settings/regulator, you get around 7uA in deep sleep.
You get some savings from removing the regulator (all other things equal). The tradeoff is that you cannot feed more than ~3.5v into the 3.3V pin to power the board.

ove

  • NewMember
  • *
  • Posts: 8
  • Country: se
Re: My Moteino are using ~90uA during powerdown (SOLVED)
« Reply #4 on: July 25, 2016, 01:49:09 PM »
Are you sure it is possible to get down to ~7uA in deep seep with Moteino R4 without removing the voltage regulator?

The only thing I did to get from 90 to 4.3uA was to remove the voltage regulator... and I found this blog post so I am not alone with this problem:
https://harizanov.com/2013/03/funky-v2s-ldo-to-blame-for-high-sleep-current-now-fixed/

Did earlier Moteinos have another voltage regulator or has it always been mcp1703?

Best Regards
Ove

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6867
  • Country: us
    • LowPowerLab
Re: My Moteino are using ~90uA during powerdown (SOLVED)
« Reply #5 on: July 25, 2016, 01:56:43 PM »
Are you sure it is possible to get down to ~7uA in deep seep with Moteino R4 without removing the voltage regulator?

Did earlier Moteinos have another voltage regulator or has it always been mcp1703?

Yes, try this sketch.
Yes, for a very long time.

TomWS

  • Hero Member
  • *****
  • Posts: 1930
Re: My Moteino are using ~90uA during powerdown (SOLVED)
« Reply #6 on: July 25, 2016, 03:17:05 PM »
Also, verify that you have the very latest version of LowPower library.  IDE from 1.6.5 on, I believe, had compiler optimization that killed the BOD disable sequence.

Tom

emjay

  • Full Member
  • ***
  • Posts: 119
  • Country: nl
Re: My Moteino are using ~90uA during powerdown (SOLVED)
« Reply #7 on: July 25, 2016, 05:40:29 PM »
@ove,

Quote
The Moteino is powered by two AA batteries (3.14V at the moment).

The LDO target output voltage is 3.3v - how do you expect it to achieve that?
Try 3x AA when feeding through the LDO, some of your symptoms will go away.
« Last Edit: July 26, 2016, 05:44:29 AM by emjay »

TomWS

  • Hero Member
  • *****
  • Posts: 1930
Re: My Moteino are using ~90uA during powerdown (SOLVED)
« Reply #8 on: July 25, 2016, 08:37:49 PM »
@ove,

Quote
The Moteino is powered by two AA batteries (3.14V at the moment).

The LDO target output voltage is 3.3v - how do you expect it to achieve that?
Try 3x AA, your symptoms will go away.
OP said he reprogrammed the fuses to operate with internal 8MHz clock.  3.14V is more than enough for that (he's also pulled the VR).  3xAA will blow out his radio module without the VR.

Tom

ove

  • NewMember
  • *
  • Posts: 8
  • Country: se
Re: My Moteino are using ~90uA during powerdown (SOLVED)
« Reply #9 on: July 26, 2016, 05:34:51 AM »
I tried the DeepSleep sketch from Felix on a new Moteino R4 with Arduino IDE 1.6.9 and 8V on the VIN pin... and I got  ~220uA
Then I switched to ArduinoIDE 1.5.8 and it went down to ~100uA... so there is a problem with BOD disable sequence in newer versions of Arduino IDE.
Still a long way to 7uA

Best Regards
Ove

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6867
  • Country: us
    • LowPowerLab
Re: My Moteino are using ~90uA during powerdown (SOLVED)
« Reply #10 on: July 26, 2016, 08:19:10 AM »
I tried the DeepSleep sketch from Felix on a new Moteino R4 with Arduino IDE 1.6.9 and 8V on the VIN pin... and I got  ~220uA
Then I switched to ArduinoIDE 1.5.8 and it went down to ~100uA... so there is a problem with BOD disable sequence in newer versions of Arduino IDE.
Still a long way to 7uA
Try IDE 1.0.6 see what you get with that.

ove

  • NewMember
  • *
  • Posts: 8
  • Country: se
Re: My Moteino are using ~90uA during powerdown (SOLVED)
« Reply #11 on: July 26, 2016, 10:08:25 AM »
Try IDE 1.0.6 see what you get with that.
I get the same result with IDE 1.0.6... ~100uA

If I place my finger on pin 7-8-9 then it goes down to ~70uA... do I have to connect any pull down or pull up resistor?!

emjay

  • Full Member
  • ***
  • Posts: 119
  • Country: nl
Re: My Moteino are using ~90uA during powerdown (SOLVED)
« Reply #12 on: July 26, 2016, 10:13:29 AM »
@ove,

Open DIO pins left as inputs are bad. You can enable the internal pullup to get out of the "floating" zone or just define them as output - with nothing connected, that does not consume load current.

ove

  • NewMember
  • *
  • Posts: 8
  • Country: se
Re: My Moteino are using ~90uA during powerdown (SOLVED)
« Reply #13 on: July 31, 2016, 08:26:12 AM »
Open DIO pins configured as inputs is probably not a good idea but I was using the sketch provided by Felix and I wanted to replicate his ~7uA deep sleep on an unmodified Moteino R4.

I will switch LowPower library from the LowPowerLab fork (https://github.com/LowPowerLab/LowPower) to the original library from Rocket Scream (https://github.com/rocketscream/Low-Power) because it contains a patch so Brown Out Detector can be disabled even if you use newer Arduino IDE.
I will also replace the external crystal with a 32.768MHz one so I can keep track of time even when I am in low power mode.

It will take a week or two before I get the new crystal so I can continue my testing but I still think there is something wrong with the power regulator on the Moteino... I have to remove it to get below 90uA.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6867
  • Country: us
    • LowPowerLab
Re: My Moteino are using ~90uA during powerdown (SOLVED)
« Reply #14 on: August 01, 2016, 08:13:20 AM »
I will look into patching the LowPower lib if there are any updates.
But there is nothing wrong with the regulator(unless it's damaged somehow or the compiler will do something to prevent the deep sleep). You should be able to get the 7uA, that is why I posted that sketch.

perky

  • Hero Member
  • *****
  • Posts: 873
  • Country: gb
Re: My Moteino are using ~90uA during powerdown (SOLVED)
« Reply #15 on: August 01, 2016, 09:52:22 AM »
Felix, did we ever come to a conclusion whether the MCP1703 would actually work below 3.3V but with an output resistance of a few ohms instead? This is how normal LDOs generally work, however there are indications this regulator might not be as 'normal' as others, taking excessive current when powerd by its output for example. You'd expect the pass transistor diode to power up the input, and then it would turn on hard (if below 3.3V) so you should just get the quiescent current but they appear to take significantly more. It also has other circuitry like current limiting and a soft turn on characteristic.

Mark.
« Last Edit: August 01, 2016, 10:00:23 AM by perky »

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6867
  • Country: us
    • LowPowerLab
Re: My Moteino are using ~90uA during powerdown (SOLVED)
« Reply #16 on: August 01, 2016, 12:08:25 PM »
Mark,
Not sure I follow, you mean if there was a series resistor on the VOUT of the LDO? Was this suggested somewhere that I missed?
I have not tried this. What folks have been doing is lift the LDO so they could power from less than 3.3V if that's what they really needed.
The 'normal' way of powering through the VIN (stock, as designed) is to provide at least 3.55v to be above the LDO drop voltage. That allows for the 7uA I am able to get.

perky

  • Hero Member
  • *****
  • Posts: 873
  • Country: gb
Re: My Moteino are using ~90uA during powerdown (SOLVED)
« Reply #17 on: August 01, 2016, 01:47:26 PM »
No, what I mean is an LDO usually works by modulating the P-FET pass transistor resistance so that the output voltage stays at a fixed value. That P-FET has a small resistance even when fully on, and this minimum resistance is what actually determines the dropout voltage which itself is therefore linearly dependent on current. If the input voltage is above this dropout voltage then the output is fully regulated because the P-FET's minimum resistance is less than that needed to achieve the desired value. However if you provide the regulator with an input voltage below that dropout voltage then the P-FET is either partially or totally hard on, which is usually a few ohms.

If you look at the regulator spec there's a minimum voltage specified which is 2.7V, this is actually the voltage at which the internal logic is fully functional and the P-FET can be driven properly internally.

In other words, the regulator should allow the voltage through but with a small resistance in series if the input is below the dropout. The output voltage might then be modulated itself by the current it's taking, but that might only be a few hundred millivolts or so, so if the minimum voltage you need to keep things working can cope with those dips then it's entirely possible to use voltages below 3.3V. In theory if the output was taking very little current this would work with an input voltage right the way down to 2.7V.

Mark.

Edit: Here's an example of an LDO doing this, see Figure 6. It's curious why the MCP1703 is not specified like this and has no equivalent graph, but this is generally how LDOs work. That's why I thought it might possibly be a bit quirky, but I'm willing to lay odds on it actually doing this:
http://www.st.com/resource/en/datasheet/stlq015.pdf

Also this explains why the dropout voltage changes with input voltage. The higher the input voltage the harder on the P-FET is driven (larger Vgs), this reduces the minimum on resistance which reduces the dropout voltage. It all fits ;-)

BTW if this is correct then it's OK to run a Moteino from 2 lithium AA cells into Vin, or 3 alkaline AA cells into Vin with a termination voltage of 1V per cell at full TX power.
« Last Edit: August 01, 2016, 03:07:28 PM by perky »

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6867
  • Country: us
    • LowPowerLab
Re: My Moteino are using ~90uA during powerdown (SOLVED)
« Reply #18 on: August 01, 2016, 04:15:15 PM »
I see what you mean now.
For the MCP1703 the DS doesn't show much graphing for 3.3vout and always assumes the VIN > Vreg, so the part we're interested in is not shown.
So it's left to experimentation and measurement to see how this works. I'll try to play around with this when I get some time.

perky

  • Hero Member
  • *****
  • Posts: 873
  • Country: gb
Re: My Moteino are using ~90uA during powerdown (SOLVED)
« Reply #19 on: August 01, 2016, 04:53:31 PM »
It'll be interesting see what results you get. I can fully understand a reluctance to use a device 'off label' though for production, generally we'd like to prove correct operation by specification but my hunch is this is a safe bet if it behaves this way.

Mark.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6867
  • Country: us
    • LowPowerLab
Re: My Moteino are using ~90uA during powerdown (SOLVED)
« Reply #20 on: August 02, 2016, 03:23:19 PM »
Ok here's what I did - I loaded the DeepSleep sketch on a stock Moteino. This yields a ~6.5uA power consumption using LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF); from a 5V FTDI-Adapter source.

Then I fed a 2xAA pack (~3.15v) into VIN. This jumps the Moteino to a 88uA consumption. So maybe this REG doesn't fit the theory?

Anyway, Hey that's not too bad compared to an Adafruit Feather which is declared "ultra-low-power" at 300uA  :-X

ove

  • NewMember
  • *
  • Posts: 8
  • Country: se
Re: My Moteino are using ~90uA during powerdown (SOLVED)
« Reply #21 on: August 02, 2016, 03:28:24 PM »
I modified my test sketch a bit so it can use a 32.768kHz crystal...

If CLOCK_XTAL is not defined and a unmodified Moteino R4 with RFM69W and flash is connected to two AA batteries on VIN the current is ~85uA.
If a 8V powersupply is connected to VIN the current will drop to ~6.5uA... so Felix was right :)
If I remove the regulator and use two AA batteries it will drop to ~4.2uA.  :D
If I define CLOCK_XTAL and use internal 8MHz clock and connect a 32.768kHz crystal to the clock pins then the current drops to 1.3uA  ;D

So you have to remove the voltage regulator if you want to use two AA batteries for power... it is not enough to connect it to the 3.3V pin.

Code: [Select]
#include "LowPower.h"
#include <RFM69_ATC.h>
#include <SPI.h>
#include <SPIFlash.h>

#define NODEID        100
#define NETWORKID     100
#define GATEWAYID     1
#define FREQUENCY     RF69_433MHZ
#define ENCRYPTKEY    "SampleEncryptKey"
#define FLASH_SS      8
//#define CLOCK_XTAL

SPIFlash flash(FLASH_SS, 0xEF30);
RFM69_ATC radio;

// Timer2 overflow interrupt handler
SIGNAL(TIMER2_OVF_vect){
}

void setup() {
  radio.initialize(FREQUENCY,NODEID,NETWORKID);
  radio.encrypt(ENCRYPTKEY);
  radio.enableAutoPower(-70);
  radio.sleep();
 
  if(flash.initialize()) {
    flash.sleep();
  }
  #ifdef CLOCK_XTAL
    // Setup TIMER2 for 32.768 kHz crystal
    TIMSK2 = 0;                                                      // Stop timer2 interrupts while we set up
    ASSR = _BV(AS2);                                                 // Timer/Counter2 clocked from external crystal
    TCCR2A = 0;                                                      // Override arduino settings, ensure WGM mode 0 (normal mode)
    TCCR2B = _BV(CS22) | _BV(CS21) | _BV(CS20);                      // Prescaler clk/1024 -- TCNT2 will overflow once every 8 seconds
    TCNT2 = 0;                                                       // Start the timer at zero
    while (ASSR & (_BV(TCN2UB) | _BV(TCR2AUB) | _BV(TCR2BUB))) {}    // Wait for the registers to be updated
    TIFR2 = _BV(OCF2B) | _BV(OCF2A) | _BV(TOV2);                     // Clear the interrupt flags
    TIMSK2 = _BV(TOIE2);                                             // Enable interrupt on overflow
  #endif
}

void loop() {
  radio.sendWithRetry(GATEWAYID, "Ping", 4);
  radio.sleep();
  #ifdef CLOCK_XTAL
    LowPower.powerSave(SLEEP_FOREVER, ADC_OFF, BOD_OFF, TIMER2_ON);
  #else
    LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
  #endif
}

perky

  • Hero Member
  • *****
  • Posts: 873
  • Country: gb
Re: My Moteino are using ~90uA during powerdown (SOLVED)
« Reply #22 on: August 02, 2016, 06:49:41 PM »
OK, this LDO is a bit quirky! Good to know, thanks to both you and Felix for trying this out. I wonder what the mechanism is that makes this regulator take that current. These results fit in with others who have powered the board from the 3.3V line without removing the regulator, they were getting similar results - that would have seen Vin either the same or up to a diode drop below Vout. These results could explain why this regulator isn't specified for this condition.

Mark.