Achieving lower power on MKR WAN 1310 with P2P

I have 2 MKR WAN 1310. One is the receiver which controls an LED, the other one is the sender which controls the LED of the receiver. The rate at which commands are sent is totally random, so the receiving Arduino must constantly be on. Therefore I want to reduce the power consumption of the receiver Arduino. The MKR currently uses around 32 mA when connected to an LED and 220 Ohm resistor. Here is my current code. I tried various power reduction commands but most of them like LowPower.Sleep() or LowPower.deepSleep() disables the LoRa communication.

#include <SPI.h>
#include <LoRa.h>
#include "ArduinoLowPower.h"

String contents = "";
bool ledStatus = false;  // Track LED state
int led = 2;  // LED pin

// Timer variables for LED auto-off after 6 hours 
unsigned long startMillis = 0;
unsigned long ledOnDuration = 6 * 60 * 60 * 1000;  // 60 hours in milliseconds

void setup() {
  pinMode(led, OUTPUT);  // Initialize the LED pin

  // Initialize LoRa communication
  if (!LoRa.begin(868E6)) {
    // Flash LED to indicate failure
    while (1) {
      digitalWrite(led, HIGH);
      delay(200);
      digitalWrite(led, LOW);
      delay(200);
    }
  }

  // Start with LED off
  digitalWrite(led, LOW);

  Serial.end();  
  USBDevice.detach(); 
  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(LED_BUILTIN, HIGH);  

  for (int i = 0; i < 15; i++) {
    if (i != led) {  // Skip pin 2 (the LED pin)
      pinMode(i, INPUT);  // Set unused pins to INPUT to save power
    }
  }

}

void loop() {

  // Check for incoming LoRa packets
  int packetSize = LoRa.parsePacket();
  if (packetSize) {
    // Read the packet content
    contents = "";
    while (LoRa.available()) {
      contents += (char)LoRa.read();
    }

    // If the packet matches "button pressed"
    if (contents.equals(buttonPress)) {
      // Turn on the LED when the message is received
      ledStatus = !ledStatus;
      startMillis = millis();  // Start the timer for the 6 hours duration
    }

    if (ledStatus){
      digitalWrite(led, HIGH);
    }
    else{
      digitalWrite(led, LOW);
    }

    contents = "";  
  }

  // Auto turn-off the LED after 6 hours
  if (ledStatus && (millis() - startMillis >= ledOnDuration)) {
    ledStatus = false;
    digitalWrite(led, LOW);  // Turn off LED
  }

  LowPower.idle(10);
}

Does anyone know how to reduce the power consumption for an MKR WAN 1310 receiver using LoRa in a P2P connection?

The lowest current you can reduce the LoRa module to when in receive mode is circa 12mA.

In sleep mode the LoRa device consumes as little as 1uA, but then of course receiving is disabled.

Interesting. Getting the power consumption down to 12 mA would help a lot. Do you perhaps know why my use case requires more than double the current? And how could I improve the code to get close to the 12mA? Is this achieved by lowering the range with setTxPower()?

Do not know anything about lowering the current for MKR WAN itself.

There are Arduinos or compatibles that can be put into a deep sleep that consumes a few uA and be made to wake up when the LoRa device receives a packet, in which case overall current is circa 12mA.

Adjusting the TX power has no effect on the receive current.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.