Trying to get below 10uA in sleep


(Bborncr) #1

I have been reading all the low power posts and techniques for days but am stuck at 45uA in sleep for my ATMEGA328p + RFM95 (915MHz) node.

I have removed all resistors and other components on the board. All I have is a MCP1703 – ATMEGA328P – RFM95

The uC is connected like this:

  • Pin 10 - NSS
  • Pins 11-13 to the equivalent SPI pins on the RFM95
  • Pin 2 – DIO 0
  • Pin 8 – DIO 1
  • Pin 7 – DIO 2
  • Pin 9 – to LED through a 1kohm resistor
  • Pin 3 – to RESET through 10kohm resistor

I have tried three different methods and libraries for the ATMEGA sleep but they all give the same result (45uA):

  • LowPower (RocketScream)
  • SleepyDog (Adafruit)
  • Direct AVR/sleep.h using examples from Nick Gammon’s tutorials

Different firmware tests:

  1. LMIC: After LMIC joins and sleeps the current drops to 45uA.
  2. No code – Empty setup and loop – just induce sleep (current drops to 45uA).
  3. No code – All pinModes to OUTPUT (current drops to 45uA).
  4. No code – All pinModes to OUTPUT and digitalWrite HIGH or LOW (FAIL – many mA)

I have two boards with this setup and they both show the same results. I have a third board that just has the MCP1703 + ATMEGA328p (No RFM95). This boards sleeps at 1.5uA!!

Any tips? I am running out of ideas.


#2

Its hard to say, but I’ll try to give it a shot:

  • are you using Arduino Pro mini?
  • what firmware loaded onto atmega328p / what fuse settings?

Normally, you should start with just a bare atmega328p board and sleep (lowpower from rocketscream is good). Then you add peripherals and more software (rfm95w + LMIC etc) and check current. MCP1703 would have a current consumption of around 2uA.

Do you have schematic of your project?


(Bborncr) #3

The board is called an Anarduino, but it looks identical to a Moteino that I have. The bootloader is Duemilanove. I’ve removed everything from the board except for the MCP1703, the reset button and led. I’ll find a schematic.

I was thinking about the fuses. Is there anything I should be looking for in the fuses related to low power?

Here are the fuses:
BODLEVEL = 2V7
RSTDISBL = [ ]
DWEN = [ ]
SPIEN = [X]
WDTON = [ ]
EESAVE = [ ]
BOOTSZ = 256W_3F00
BOOTRST = [X]
CKDIV8 = [ ]
CKOUT = [ ]
SUT_CKSEL = EXTXOSC_8MHZ_XX_16KCK_14CK_65MS

EXTENDED = 0xFD (valid)
HIGH = 0xDE (valid)
LOW = 0xFF (valid)


#4

I know this board, but I have not had any experience with it. With Molteino you get 5uA straight out of the box.
These are my fuse setting for my atmega328p tqfp (8Mhz internal oscillator, disabled BOD) board
atmega328_384_8.bootloader.low_fuses=0xE2
atmega328_384_8.bootloader.high_fuses=0xDE
atmega328_384_8.bootloader.extended_fuses=0xFF

These settings are used to run it on a battery power.

Re bootloader, I can highly recommend Optiboot, but I do not think it would solve your issue re consumption.

All three boards are 100% identical?
I think the only other option left is to de-solder rfm95w module (VCC pin) and see if it makes a difference.


#5

Another suggestion, please upload this sketch (change the pins)

#include <LowPower.h>
#include <lmic.h>
#include <hal/hal.h>

//==================THIS HAS TO BE CHANGED============
#define LMIC_NSS    10
#define LMIC_RXTX   LMIC_UNUSED_PIN
#define LMIC_RST    A0
#define LMIC_DIO0   2
#define LMIC_DIO1   7
#define LMIC_DIO2   8
//=====================================================

const lmic_pinmap lmic_pins = {
    .nss = LMIC_NSS,
    .rxtx = LMIC_RXTX,   
    .rst = LMIC_RST,
    .dio = {LMIC_DIO0, LMIC_DIO1, LMIC_DIO2},  
}; 
void setup()
{
Serial.begin(115200);
os_init();
LMIC_reset();
}

void loop() 
{
Serial.print("Sleeping now");
delay(50);
digitalWrite(lmic_pins.nss, LOW); // NSS
LMIC_shutdown();
LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF); 
}

Let’s see if it helps.


#6

(LoRaTracker) #7

Are you actually setting up the RFM95 to go into sleep mode itself ?

My own preferance for working on issues like this is to start with the bare board, no added components, and ensure sleep is in the 1uA region.

Then add say the RFM95, minimum connections, SCK, MOSI, MISO, NSS and write to the registers directly to put the LoRa device into sleep. Then start connecting the extra pins, RESET, DIO0, DIO1, DIO2.

Then when your happy with the sleep current, which should be circa 2uA, perhaps try the LMIC library sleep stuff.


#8

That’s the best way to do this :wink:

For reference, to put quickly RFM95 into sleep mode

    //Set NSS pin Low to start communication
    digitalWrite(LORA_CS,LOW);

    //Send Addres with MSB 1 to make it a write command
    SPI.transfer(0x01 | 0x80);
    //Send Data
    SPI.transfer(0x00);

    //Set NSS pin High to end communication
    digitalWrite(LORA_CS,HIGH);

(Bborncr) #9

Thanks for all the help!

@alexsh1 Your code gives me 45uA.
@alexsh1 I am going to change the bootloader, I don’t know why it has Duemilanove.
@LoRaTracker You are right, next thing to try is to isolate the RFM95 completely.

@Charles This code gives 5mA…maybe there is something missing? Being able to manually shutdown the RFM95 without LMIC would be great for troubleshooting.

#include <SPI.h>
#include "LowPower.h"
#define LORA_CS 10

void setup()
{
  pinMode(LORA_CS, OUTPUT);
  //Set NSS pin Low to start communication
  digitalWrite(LORA_CS, LOW);

  //Send Addres with MSB 1 to make it a write command
  SPI.transfer(0x01 | 0x80);
  //Send Data
  SPI.transfer(0x00);

  //Set NSS pin High to end communication
  digitalWrite(LORA_CS, HIGH);
  LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);
}

void loop()
{
}

#10

Sorry, I don’t see any SPI.begin() initialization, may be your problem ?


(Bborncr) #11

Of course, I should have seen that!


(Bborncr) #12

SOLVED! It WAS the regulator after all. Thanks for all the help! I learned a lot about low power because of this, so there’s that :slight_smile:


(LoRaTracker) #13

The regulator ?

You said it was a MCP1703, this has a standby current of 2uA, so it was faulty ?


(Bborncr) #14

It’s either faulty or it’s not really a MCP1703. There is no writing on the ic itself.