Saving data to ESP32 C3 Super Mini when powering off

Hi! I've been working with my ESP32 C3 Super Mini and I wanted to try saving data without any form of external storage (such as SD/microSD cards).

I've looked up some tutorials online and the only way to perform this that I've seen is using the EEPROM library, which saves the data on the Flash Memory of the device, but it seems that there's is a limit of which I previously didn't know about, where you can only perform the write operation about 10.000 to 100.000 times, which may seem a lot, but for the purpose I'm looking for those are few operations.

I wanted to ask and get to know about other ways of performing this data savings in case there are more efficient ways to save data "between sessions" (between powering on and off the device).

maybe a F-ram module..
never used one myself but have seen some other use them here..
it's non-volatile, usually i2c..

good luck.. ~q

How often do you expect those power interruptions to happen.

You basically only need to save when the power goes down, not every time that something changes.

You can not do this without external components. You will need an electrolytic capacitor that can keep your ESP32 boarde alive long enough to save data to flash when a power failure is detected. Power failure can be detected by reading the supply voltage and when it drops under a safe level, save the data. E.g. if your ESP32 board is powered by 5V, detect 4.5V (or 4V) and if the level is lower you save to flash.

If your project already contains an RTC module with EEPROM, you can use that as well.

EEPROM (flash) wear levelling will help to an extent. I'm not familiar with the ESP32 implementations but I'm reasonably sure that SPIFFS or LittleFS implement wear leveling. Just research that, one of them is deprecated as far as I know.

Now that I have thought about it for some days, I think it's less of a hustle to implement a system that stores data, but not on the Flash Memory, so that when the project itself goes to deep sleep mode or just turns off, there's a previous function that then saves all that data on the Flash Memory.

Thanks for the recomendation!

Will look it up but the project idea is to make it as small as possible, but still, the F-ram is pretty small from what I can see ^^.

Thanks a lot!

If you want to save a few settings, then the easy way is with "Preferences", which comes with the ESP32 core.
Leo..