Wifi LoRa v4 deep sleep current

Hi!

Newbie here! I’m trying to reach μA deep sleep current on my Wifi Lora V4 card since it will be used off-grid and send data occasionally (once an hour approx.). However, despite my efforts the lowest I’ve managed to reach is 1,8mA (which is with a very minimal code which puts the ESP32 in deep sleep basically…).

Could someone help me, where should I begin to be able to lower the deep sleep power consumption?

NB: I power the card through the 2p battery connection with an 18650 battery.

BR
niklas

Hi

Did you put all pins as deactivated ? Did your out Lora module to sleep?

I actually managed, yesterday, to get down to 40microamp in deep sleep mode with a few modifications. Thanks anyway!

Could you please share what exactly you did? I’m in the same situation and can’t get below about 715 uA. I’d LOVE to get to less than 100 :slight_smile:

Sure! I’m not sure how to paste it in an indented, neat way but here’s the code!

#include <Arduino.h>
#include <RadioLib.h>
#include "esp_sleep.h"
#include "driver/gpio.h"

// === Heltec V4 pinout (officiellt) ===
#define RADIO_NSS   8
#define RADIO_RST   12
#define RADIO_BUSY  13
#define RADIO_DIO1  14

#define VEXT_PIN    36
#define LED_PIN     35

SX1262 radio = new Module(RADIO_NSS, RADIO_DIO1, RADIO_RST, RADIO_BUSY);

void VextOFF() {
  pinMode(VEXT_PIN, OUTPUT);
  digitalWrite(VEXT_PIN, HIGH);   // HIGH = OFF on Heltec
}

void ledOFF() {
  pinMode(LED_PIN, OUTPUT);
  digitalWrite(LED_PIN, HIGH);    // HIGH = OFF on Heltec
}

void go_to_sleep() {
  ledOFF();
  VextOFF();

  // Put SX1262 into sleep
  radio.sleep();

  // Keep NSS high and hold it during deep sleep
  pinMode(RADIO_NSS, OUTPUT);
  digitalWrite(RADIO_NSS, HIGH);
  gpio_hold_en((gpio_num_t)RADIO_NSS);
  gpio_deep_sleep_hold_en();

  Serial.println("GOING TO SLEEP NOW");
  Serial.flush();

  esp_deep_sleep_start();
}

void setup() {
  Serial.begin(115200);
  delay(2000);

  Serial.println("Init radio...");

  SPI.begin(9, 11, 10); // SCK, MISO, MOSI Heltec V4
  int state = radio.begin();

  if (state != RADIOLIB_ERR_NONE) {
    Serial.println("Radio init failed!");
  } else {
    Serial.println("Radio OK");
  }

  delay(1000);
  go_to_sleep();
}

void loop() {}
1 Like

Thank you very much @vange80!

1 Like

Hi,
I’m having a similar issue with deep sleep on a lora 32 V4 (Both no OLED and OLED vesions) . no matter what i do the lowest i can get the current draw is 7mA. Im pretty new to this and i even loaded the code above with the same result. I must be missing something? I need this thing to last 12months in an 18650 but i have no chance with that current draw in deep sleep.

HELP!

Hi there,
I have a lora 32 V4 board as well and no matter what I do it draws about 8mA (seen in my power profiler).
@vange80 , I tried your code but still 8mA. You’re sure that’s all you did? Are there hardware revisions and some are bad. Did you change anything at the board?
I checked to start wifi only to disable it, checked for the external flash to be disabled, also tried to isolate all pins with something like that
for (gpio_num_t pin : RTC_PINS_TO_ISOLATE) {
rtc_gpio_isolate(pin);
}

initialised the radio only to put it to sleep, tried to hold the radio in reset while in sleep and what not.
But still the lowest I can get is 8mA with that board.

Ok, I found it. gpio 7 controls the enable pin of U3 (power regulator for the RF front-end). This one needs to go low and stay low during deep sleep. That (together with all the other tips) brought me down to 17uA. My board is v4.3.1

Here’s a bare minimum code to get the Wifi LoRa v4.3.1 below 20uA in deep sleep.

#include <Arduino.h>
#include <RadioLib.h>
#include "esp_sleep.h"
#include "driver/gpio.h"


// === Radio Pins ===
#define RADIO_VFEM  7 
#define RADIO_NSS   8
#define RADIO_RST   12
#define RADIO_BUSY  13
#define RADIO_DIO1  14

// ---- Display pins -----------------------------------------
#define VEXT_PIN 36
#define LED_PIN 35

SX1262 radio = new Module(RADIO_NSS, RADIO_DIO1, RADIO_RST, RADIO_BUSY);

void go_to_sleep(uint64_t sleepUs) {
  
  radio.sleep(); //  Put SX1262 into sleep
  //  Keep NSS and RST high and VFEM low and hold it during deep sleep
  pinMode(RADIO_NSS, OUTPUT);
  digitalWrite(RADIO_NSS, HIGH);
  pinMode(RADIO_RST, OUTPUT);
  digitalWrite(RADIO_RST, HIGH);
  pinMode(RADIO_VFEM, OUTPUT);
  digitalWrite(RADIO_VFEM, LOW);
  pinMode(VEXT_PIN, OUTPUT);
  digitalWrite(VEXT_PIN, HIGH); 
  gpio_hold_en((gpio_num_t)VEXT_PIN);
  gpio_hold_en((gpio_num_t)RADIO_NSS);
  gpio_hold_en((gpio_num_t)RADIO_VFEM);
  gpio_hold_en((gpio_num_t)RADIO_NSS);
  gpio_deep_sleep_hold_en();    // keep the pins state while sleeping

  esp_sleep_enable_timer_wakeup(sleepUs);
  esp_deep_sleep_start(); // sleeps with aprox 15.5uA at 5V and 13.8uA at 3.3V
}

void setup() {
  setCpuFrequencyMhz(80);  // saves a lot of current while running

  gpio_deep_sleep_hold_dis();
  gpio_hold_dis((gpio_num_t)RADIO_VFEM);
  gpio_hold_dis((gpio_num_t)RADIO_NSS);
  gpio_hold_dis((gpio_num_t)RADIO_RST);
  gpio_hold_dis((gpio_num_t)VEXT_PIN);

  int state = radio.begin();  // needed to get it to sleep later
            
  // ======== do your stuff =========

  go_to_sleep(5000000);
}

void loop() {

}
1 Like