Atmega328p LoRa Low power use!

By pbecchi at 2018-03-15 • 0 collector • 1226 pageviews

Hi I received few of these boards one week ago . Boards are good but documentation and examples are a little pour!

I am testing now the board in LowPower mode using LowPower.h and I am getting an 1mA minimum average consumption during sleep without the power led(2.5 mA with power led). I was expecting much less ( from 1 to 10 uA for the Atmega32 + about 250uA for the Sx1728) ! Is this due to any particular board component? There is any way to reduce that (other then taking the led away)? Can you send me password to access board schematic? Thanks

16 Replies | Last update 2019-09-09
2018-03-21   #1

Hi, Sorry never try the low power for this before, so no idea now, will test this and reply you later. 

The wiki login info is sent together with your order tracking info email, please check there.

2018-03-23   #2

Thanks, let me know, the board is ok for my project! I want to make a bulk order if I can reduce the power.... I can I get a quotation for 100 or 200 ?

2018-03-27   #3

Hi, we will need time to check the low power, not really good at this. We have a replacement IC instead of Atmega328, which should work fully same. but 1.2 usd cheaper. Totally each board could be 1.5-2 usd cheaper for bulk I think. 


2018-03-28   #4

Just a couple of suggestions for reducing power drain:

Power led drain about 1 mA ,it will be nice to have a way to disconnect it. Battery voltage is measured with a voltage divider with 2 10k resistors. This generate a continuous drain of about 0.2 mA . I suggest to use two resistor of 100k.

The new MCU will have same low power performances as the atmega328 ?

Thanks

2018-04-19   #5

we have just done some test today, result is here. 


http://www.electrodragon.com/w/Low_Power


On transmitter mode, should be 9.5mA regular standby, remove all extras, can reduce about 4 mA maxium.


if use a blank board without lora module, is about 6.1mA, could be lower down to 2mA if remove extras. 


The lora module should cased about 3mA when standby.


So regular 9.5mA -> remove all extras -4 to 5mA -> remove lora module -3 -> 2mA. More or less like this.

2018-04-19   #6

Ah, just posted a "me too" to access the schematic, when I spotted this thread.


(btw, my search for Loraduino only came up with one other thread which was not relevant)


Like the original poster (and many others), I have got good low power results with pro minis, with the "remove the led hack", but mostly by the use of the LowPower.h library, which is pretty awesome and taught me a lot about accessing directly the registers on the mega328p.


I mean the table they posted on the wiki is fine, but without including the use of the LowPower libary then I think it is a bit of a wasted exercise.


I actually started this reply because it dawned on me that, given that I too could (eventually) be ordering 100's of these things, it might be in Electrodragons interest to produce something which was low power to start with, the twinkly leds could be something that users get to add themselves. 


Its just a thought, but users like us mangling your carefully thought out boards on arrival just to remove components would seem on the face of it like an opportunity to reduce costs.


caveat : I'm not an electrical engineer, and realise any EE with a well stocked mind could probably shoot me down.

2018-04-20   #7

We will keep doing this test, with lowpower library too.  

Any suggesttions. or test need please let us know we will do. Any updates will update this thread and also on wiki.


2018-04-22   #8

If I compare correct, pro mini use regualtor MIC2505, which quiescent current is 5uA, but only 150mA delivery, the upgrade version MIC2519 is better 8uA/500mA. Our current use is AP2112 but 55uA quiescent and output up to 500mA. Which also add this to test later.

2018-09-16   #9

Reply to #8 @chao :

Hi Chao After long time I came back on this thread!

Your results (the ones of your table) are very interesting. It will be better to list the power reduction per each element removed. Like this:

Remove power led. About 3mA Remove analog input resistors. About 300uA Remove external flash. About 600uA

Since my measurement show about 1 mA drain with Lora receiving in CAD mode , I can reduce that to few( ≤100uA)!

This is a very good result : the board will run for 1 year on a 2000mAh Lipo.

The remaining question is how to modify the hardware to get to that!

Are you going to modify the board in future productions? It will be good to have soldered bridges that can be easily cut to reduce drain. Regarding resistors it will be sufficient to increase the values by a factor 20 to 50.You could also replace the LDO with a AP 7354 with a quiscent current of less than 1 uA.

Other question : with LGT 8f328 can we expect same drain of the atmega328?

Thanks

2018-09-28   #10

Hi,


What is CAD mode? What we can do on hardware to help on this? Please let mek now, thanks.


  1. power LED no problem, this is a demo board, we can just do not place the led during production. but can also add bridge, will add this.

  2. the VBAT monitoring resisitor is changed to 100K, which is always available on our tray of the pick and place machine.

  3. Currently use MIC5219, Iq current is 3uA according to datasheet.

  4. No hope on low power LGT8F328, it is a cheap clone, not that good on everything except price. 

2019-01-18   #11

Hello all,


The flash also need to be iniateed well, otherwise if only power but not operate, will cost up to 700uA

2019-01-30   #12

Conclusions:

  • Power LED about 2ma

  • LDO ~ 60uA

  • Battery monitoring resistor ladder - 20-30uA

  • If flash not well iniated will usee 700uA

Remove Power LED only:

    • down to 80uA, power used by 50uA LDO, 20-30uA battery monitor, 5-15uA MCU +flash + RF

    • Test video - https://twitter.com/electro_phoenix/status/1090468852410925057

Test down to 5-15 uA:

  • Remove or bypass LDO, direct 3.3V VIN

  • Remove battery monitor

  • With MCU, RF and flash

  • Must well initiated and all in sleep mode


If you need demo code please email info@electrodraogn.com

2019-02-26   #13

Greetings. I bought fees from you, I'm testing.

Can I have an example on the mail GYura2014@gmail.com


I need to minimize power consumption in the mode of continuous data reception.

I understand this makes the "Preamble".

Maybe there are code examples for putting the board into sleep mode with detection on the preamble ?!

aeProduct.getSubject()

2019-02-26   #14

Hi,


Yes, demo code in our bitbucket, will email you the credential.

2019-02-28   #15

I need to use a LoRa module (SX1278) in RX Single mode (on battery) when the Mega328p chip is sleeping.

In addition, when the LoRa module (SX1278) reads the preamble of a new packet, it wakes up, awakens Mega328p (interrupting the DIO branch), processes the data, and then everything goes into deep sleep.

I tried the LoraLib library (https://github.com/jgromes/LoRaLib/tree/master/examples/ReceiveInterrupt) I also had a MCU sleep and an interrupt on PIN 2, the LoRaDuino v1.2 board consumes 15mA when LoRa (SX1278) in this mode, and the MCU is full of sleep which is very much for battery power. But when a new package arrives, the board wakes up and processes it well.

Please tell me which library will you use for the LoRa module (SX1278) for working in CAD mode? If you can help me, send examples to my email address GYura2014@gmail.com or give a link.

I don’t understand why SPI FLASH (WINBOND W25Q16JVSSIQ) is used on LoRaDuino boards? Judging by the incomplete scheme, is it installed in parallel with the MCU and LoRa Module SX1278 contacts?

/*
   LoRaLib Receive with Inerrupts Example

   This example listens for LoRa transmissions and tries to
   receive them. Once a packet is received, an interrupt is
   triggered. To successfully receive data, the following
   settings have to be the same on both transmitter 
   and receiver:
    - carrier frequency
    - bandwidth
    - spreading factor
    - coding rate
    - sync word
    - preamble length

   For more detailed information, see the LoRaLib Wiki
   https://github.com/jgromes/LoRaLib/wiki

   For full API reference, see the GitHub Pages
   https://jgromes.github.io/LoRaLib/
*/

// include the library
#include <LoRaLib.h>
#include <LowPower.h>
#include <SPIFlash.h>    //get it here: https://github.com/LowPowerLab/SPIFlash
#include <SPI.h>

// create instance of LoRa class using SX1278 module
// this pinout corresponds to RadioShield
// https://github.com/jgromes/RadioShield
// NSS pin:   10 (4 on ESP32/ESP8266 boards)
// DIO0 pin:  2
// DIO1 pin:  3
// IMPORTANT: because this example uses external interrupts,
//            DIO0 MUST be connected to Arduino pin 2 or 3.
//            DIO1 MAY be connected to any free pin 
//            or left floating.
SX1278 lora = new LoRa;
// Use pin 2 as wake up pin
const int wakeUpPin = 2;
#define LED           7 // Moteinos have LEDs on D9

// flag to indicate that a packet was received
volatile bool receivedFlag = false;

// disable interrupt when it's not needed
volatile bool enableInterrupt = true;

// this function is called when a complete packet
// is received by the module
// IMPORTANT: this function MUST be 'void' type
//            and MUST NOT have any arguments!
void setFlag(void) {
  // check if the interrupt is enabled
  if(!enableInterrupt) {
    return;
  }

  // we got a packet, set the flag
  receivedFlag = true;
}

void wakeUp()
{
    // Just a handler for the pin interrupt.

}


void setup() {
  
  Serial.begin(9600);

  // initialize SX1278 with default settings
  Serial.print(F("Initializing ... "));
  // carrier frequency:           434.0 MHz
  // bandwidth:                   125.0 kHz
  // spreading factor:            9
  // coding rate:                 7
  // sync word:                   0x12
  // output power:                17 dBm
  // current limit:               100 mA
  // preamble length:             8 symbols
  // amplifier gain:              0 (automatic gain control)
  int state = lora.begin();
  if (state == ERR_NONE) {
    Serial.println(F("success!"));
  } else {
    Serial.print(F("failed, code "));
    Serial.println(state);
    while (true);
  }

  // set the function that will be called 
  // when new packet is received
  lora.setDio0Action(setFlag);
  
  // start listening for LoRa packets
  Serial.print(F("Starting to listen ... "));
  state = lora.startReceive();
  //state = lora.scanChannel();
  //state = lora.standby();
/*  if (state == ERR_NONE) {
    Serial.println(F("success!"));
  } else {
    Serial.print(F("failed, code "));
    Serial.println(state);
    while (true);
  }
*/
  // NOTE: 'listen' mode will be disabled 
  // automatically by calling any of the 
  // following methods:
  //
  // lora.standby()
  // lora.sleep()
  // lora.transmit()
  // lora.receive()
  // lora.scanChannel()
  //
  // LoRa module will not receive any new
  // packets until 'listen' mode is re-enabled
  // by calling lora.startReceive()


  // Configure wake up pin as input.
  // This will consumes few uA of current.
   
   pinMode(wakeUpPin, INPUT);
   delay(50);
}



void loop() {


        // Allow wake up pin to trigger interrupt on low.
    attachInterrupt(0, wakeUp, RISING);
    
    // Enter power down state with ADC and BOD module disabled.
    // Wake up when wake up pin is low.
    LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF); 
  //  LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF); 
    
    
    // Disable external pin interrupt on wake up pin.
    detachInterrupt(0); 

    // check if the flag is set
    // if(receivedFlag) {
    // disable the interrupt service routine while
    // processing the data
    enableInterrupt = false;

    // reset flag
    receivedFlag = false;
    
    // you can read received data as an Arduino String
    String str;
    int state = lora.readData(str);
  
    // you can also read received data as byte array
    /*
      byte byteArr[8];
      int state = lora.readData(byteArr, 8);
    */
    
    if (state == ERR_NONE) {
      // packet was successfully received
      Serial.println("Received packet!");
  
      // print data of the packet
      Serial.print("Data:\t\t\t");
      Serial.println(str);
  
      // print RSSI (Received Signal Strength Indicator) 
      Serial.print("RSSI:\t\t\t");
      Serial.print(lora.getRSSI());
      Serial.println(" dBm");
  
      // print SNR (Signal-to-Noise Ratio) 
      Serial.print("SNR:\t\t\t");
      Serial.print(lora.getSNR());
      Serial.println(" dB");

      // print frequency error
      Serial.print("Frequency error:\t");
      Serial.print(lora.getFrequencyError());
      Serial.println(" Hz");
  
    } else if (state == ERR_CRC_MISMATCH) {
      // packet was received, but is malformed
      Serial.println("CRC error!");
  
    }
    Blink(LED, 20, 10);
    // we're ready to receive more packets,
    // enable interrupt service routine
    enableInterrupt = true;
    Serial.println("End Loop");

    delay(50);
       
  //}
    
    // Do something here
    // Example: Read sensor, data logging, data transmission.
  }

  void Blink(byte PIN, int DELAY_MS, byte loops)
{
  pinMode(PIN, OUTPUT);
  while (loops--)
  {
    digitalWrite(PIN, HIGH);
    delay(DELAY_MS);
    digitalWrite(PIN, LOW);
    delay(DELAY_MS);
  }
}


2019-09-09   #16

Hi,


We are not that good at code, and can only provide simple demo for it. For the CAD mode, we are not sure about it, please try by yourself. SPI Flash is for storing the mass data.

Requires Login

Log in
Information Bar
Hello World! Reclamation land, waiting for the mining of tags.
Loading...