Esp32 RTC memory

Hello all,

Is there a way to have a variable declared in the RTC_memroy while using esphome ?

I would like to use an esp32-c3 as a pulsecounter, my idea is the following

have a variable counter holding the number of pulse in RTC_DATA_ATTR
each time the gpio go to low, esp wake up and increment the counter then go to deep sleep
every 15min , esp wake up, power up wifi, send the counter value, reset to zero, stop wifi, go to deep sleep

for this I need to access RTC_DATA_ATTR, but I don’t know if I can do it with epshome

No. Can’t be done. What’s incrementing the pulse counter during deep sleep?

If you know your way in ESPHome, this might help you

1 Like

I’m already using it for my esp32-S3, but I have plenty of esp32-c3 which doesn’t have ulp. I’m looking a solution to use them. I can do it in platformio directly, and was trying to figure out if there is the possibility to achieve this also with esphome.

Aren’t global variables saved in RTC before going to sleep by default??