Advice for deep sleep setup with wake on interrupt


I could not easily find the information I was after, most likely because I am still learning all this but would love some advice to achieve a board setup with deep sleep.

At the moment I am really enjoying this ecosystem and am using a RAK19007 board and have incorporated the RAK12500 (GPS) and RAK5860 (Modem). I am currently also using a RAK11200 (ESP) core but not sure if that is the way to go. I have everything working at the moment but I want to put the unit into a deep sleep only to be waken by a timer or an interrupt. I just got the RAK1905 accelerometer to do the wakeup but can change that if needed.

What I could not easily find was how to wake up the ESP from a deep sleep using either a timer or an interrupt (preferably from the RAK1905). I assume the ESP does not have an RTC on board so I would have to get it as another module?

I also saw some posts that maybe the Arduino variants are not the best for this? I am also open to changing to a different core like the RAK4631 or RAK3372.

Anyway, hopefully that makes some sense and if anyone has any guidance to a board combination setup with those sensor modules where I can deep sleep the core that would be great. Sorry I should add that I also power off the other sensor modules by turning their pins to low (WB_IO1/2/3 etc).

The ESP32 is a little bit tricky when it is about deep sleep and low power.

I wrote (a long time ago) an example that is waking up the ESP32 from the interrupt of a LoRa transceiver ==> DeepSleep.ino

Maybe it is good to see how ESP32 deep sleep works.

Thanks @beegee, will indeed have a look at the code.

Would a different core be recommended over the ESP32?

If you don’t need WiFi, I would go for the RAK4631 (LoRa + BLE) which has a much lower power consumption or, if your application is not too large, for the RAK3172 (RUI3 API, slightly different for Arduino BSP’s) which is the lowest power consumption module we have.

So I had a look at your code @beegee and am sleeping the ESP in the same way you are. I also got the RAK1905 to wake the device on movement which is great.

However, I noticed when I go into deep sleep it is consuming about 3.2mA.

I did some isolation testing (after spending a few days on my code thinking that might be the issue) and found the following results. I made a basic program that does nothing but turn the Blue LED on and off 4 times then puts the unit into deep sleep. I include no other libraries and do not touch or interact with any other pins. I found the following results of power consumption in deep sleep:

RAK19007 (board) = 4ua       
RAK19007 (board) + RAK11200 (RAK11200 (esp32)) = 99ua    
RAK19007 (board) + RAK11200 (esp32) + RAK12500 (gps) = 99ua    
RAK19007 (board) + RAK11200 (esp32) + RAK12500 (gps) + RAK1905 (9AXIS MPU9250) = 2.88mA
RAK19007 (board) + RAK11200 (esp32) + RAK12500 (gps) + RAK12032 (3AXIS adxl313) = 172ua  
RAK19007 (board) + RAK11200 (esp32) + RAK12500 (gps) + RAK12032 (3AXIS adxl313)  + RAK5860 (modem) = 426ua  
RAK19007 (board) + RAK11200 (esp32) + RAK12500 (gps) + RAK12032 (3AXIS adxl313)  + RAK5860 (modem) + RAK1905 (9AXIS MPU9250) = 3.2mA

So my main two concerns are:

  1. Why is the ESP32 on its own reporting 10 times the amount of current draw from the tech docs, from everything I have read, deep sleep should be around 10uA?

  2. Why is the RAK1905 consuming 2.7mA without even being used? And again this is after calling the ESP deep sleep.

Would you have any idea why the power consumption seems to be this high?

Thanks again for all the help so far.

I don’t have answers for your two questions.

What you can try for the RAK1905, check the datasheet if it has any sleep mode, disable as many axis as possible.

The MPU9250 on the RAK1905 is really an old chip, it is EOL since some time already and might not be power optimized compared to newer MPU’s.