I have spent some time reducing the power consumption of the Wio-SX1262 module in this kit. To save time for anyone else using this kit, here are my findings:
- Putting the nRF52840 SPI interface to sleep is necessary to prevent repeatedly waking the transceiver and increasing current consumption drastically.
- Putting the RF switch pin HIGH to enable single pin mode of the antenna switch increases current consumption by 55 µA, so keep it LOW when not in use.
- In warm-start sleep mode, current consumption of the SX1262 is 1.2 µA, trivially higher than cold-start mode that draws 0.6 µA and remembers all modem settings except for boosted gain mode.
- With the voltage divider enabled and an external interrupt enabled, I am measuring about 16 µA total current draw including the nRF52840. This is about 20 years on 3 lithium AA cells.
A function to switch between wake and sleep for the SX1262 module:
#include <Arduino.h>
#include <RadioLib.h>
const uint32_t kPinRF_SW = D5;
const bool kRxBoostedGainMode = true;
pinMode(kPinRF_SW, OUTPUT);
// Set transceiver wake/sleep mode
// Receives bool: true = wake up, false = go to sleep
// Returns Radiolib error status code, otherwise RADIOLIB_ERR_NONE = 0
int16_t TransceiverWake(const bool& is_awake) {
int16_t state;
if (is_awake) {
SPI.begin();
// set RF_SW high to allow single pin control by DIO2
digitalWrite(kPinRF_SW, HIGH);
// force immediate wake to standby mode, use external crystal oscillator
// takes 340 µs
if ((state = radio.standby(RADIOLIB_SX126X_STANDBY_XOSC, true)) != RADIOLIB_ERR_NONE) {
return state;
}
// data sheet specifies that warm start does not restore boosted gain mode, so set it again
if ((state = radio.setRxBoostedGainMode(kRxBoostedGainMode, true)) != RADIOLIB_ERR_NONE) {
return state;
}
} else {
// data sheet specifies that transceiver should be in STDBY_RC mode 1st to put to sleep
if ((state = radio.standby(RADIOLIB_SX126X_STANDBY_RC)) != RADIOLIB_ERR_NONE) {
return state;
}
// put to sleep with warm start - i.e. retain modem configuration
// warm start increases current consumption from 600 nA to 1.2 µA
if ((state = radio.sleep(true)) != RADIOLIB_ERR_NONE) {
return state;
}
// leaving high increases current consumption by 55 µA!
digitalWrite(kPinRF_SW, LOW);
// stop SPI to prevent transceiver wakes
SPI.end();
}
return RADIOLIB_ERR_NONE;
}