LMIC arduino wake from sleep issue

Hi, I am new to the forum so please excuse me if this is has already been answered but I have searched both the forum and the LMIC lib for answers.

My Setup: I am using an esp32 and rfm95 with arduino to connect my nodes. The device trasnmits evey 30minutes and then goes back to sleep.

My Problem: Every time the device wakes up it takes 6 seconds for my message to send, is there a way to reduce the wait time of the LMIC lib, I see it only checks for joins every 2 seconds.

If someone can just point me in the right direction, that would be great.


Your device must not do a new join every time it wakes up, this would use up your usage allowance in no time and is simply not allowed.

A LoRaWAN device must retain state in between transmission; this is a bit harder to achieve on the ESP32 than more typical MCUs, but it can be done, and there are existing threads on it here.

Given that it needs 6 seconds to wait for the Rx1 & Rx2 windows, that would seem to be pretty speedy and therefore a good thing.

Hi thanks for the reply. I am saving the old LMIC state before going to sleep, I was wondering if there was a way to disable the waiting for RX windows and to only try sending?

That would make the device non compliant and not a LoRaWAN capable device, which then should not be used on TTN. The V3 stack is more rigorous in enforcing and needing a more fully capable device. Indeed the forum is awash with instances where old loosely implemented devices (and specifically not handling downlinks correctly, if at all) that were tollerated by the NS under V2 no longer function under V3 and/or cause multiple (disruptive) downlinks/MAC commands etc.

A solution for that problem would be to implement the LMIC hal_sleep() and hal_checkTimer() functions properly. The hal_sleep() should put the MCU to sleep, and the hal_checkTimer() should setup a timer that wakes it up again by interrupt. In addition the GPIOs of the LoRa modem should also wake the CPU by interrupt. With that it is possible that the CPU enters low power mode for the wait time between TX and RX1/RX2.

Should, but LMIC doesn’t. So if you want the OP to go down that path, you’ll have to provide some code.

The LMIC does, but the Arduino layer for LMIC does not. This was the reason for me not to use Arduino for my nodes working with STM32, where I used LMIC with an adapted HAL to support low power whenever the LMIC triggers that by calling hal_sleep(). Unfortunately I do not have such a ready to use example for ESP32. I’m not sure if the OP wants to go away from Arduino, which is for beginners a big step. The lmic-arduino community seems to be aware of that issue, there is a open discussion about low power on the arudino-lmic issues list: Low power example · Issue #533 · mcci-catena/arduino-lmic · GitHub

If you have anything working, could that not act as an example for someone to apply to another platform? Can you share your implementation?

I copied the code together to an example, tested on hardware and uploaded it to github here: GitHub - fk0815/lora-node-example: Low power lora example with LMIC and STM32

For the STM32L431CB example part it is possible to go down to a few µA with the LMIC sleep.


It there was more than one :heart: button, I’d have pressed it! This will hopefully expand the possibilities for using smaller 32-bit MCU’s which in these desperate times of MCU Unobtainium is sorely needed.

Extra :heart: for

or got ahead of yourself and skipped the --recurse-submodules you can fix things by running git submodule update --init


There is some discussion here: Sleeping with interrupts disabled? · Issue #849 · mcci-catena/arduino-lmic · GitHub, including why the LMIC hal layer is a bit tricky to use.

There are some notes from the library maintainer and an example of how to do it from someone else.