Help for storing variables in memory (non-volatile) #87
Replies: 10 comments
-
My (open-source) project involves the construction of an IoT device that notifies the owner if the home's electricity fails. The goal is to create something very cheap. There will be an external server (probably on amazon) that receives keepalives from various IoT devices. Thanks! 🙏 |
Beta Was this translation helpful? Give feedback.
-
You can use built-in and better LittleFS feature of ESP32/ESP8266 for this purpose. EEPROM or RTC has very limited storage and is not advisable to use, unless having very good reason (deep-sleep to save power, etc.).
It's also better to use my ESP_WiFiManager_Lite library to save you lots of headache and unnecessary complexity (such as to understand and use Json to store / parse data by yourself). This library as well as Good Luck with your seemingly helpful and interesting project. When you have more experience,I suggest you use the much better ESPAsync_WiFiManager_Lite library. Have a look at Why Async is better |
Beta Was this translation helpful? Give feedback.
-
Thanks @khoih-prog, your words are very useful to me, like gold! The string that I need to save into the ESP32/ESP8266 is the url of the external amazon server that the IoT device will have to contact every 60 seconds to send the keepalives. This string will presumably remain fixed but ... never say never! I will study the LittleFS. One question: why do you advise me to use the Lite version of your library? I just managed to get the normal version to work .. should I change and switch to Lite? 😪 Remember: you are talking to a person who lives on powerpoint and excel and every time he has to write code .. he starts to sweat! Currently I have mixed your library (the full, not the Lite) with a library for making HTTPS calls. The Client part is quite ready, the Server (AWS) part is almost ready. My wife is designing the 3D case of the device! Greetings from Milan (Italy) |
Beta Was this translation helpful? Give feedback.
-
Ok, I saw that in your repositories there is always written "why" to choose one library or the other. |
Beta Was this translation helpful? Give feedback.
-
@khoih-prog sorry if i contact you for this question. I just bought five 5️⃣ ESP32-WROOM-32 and would like to have a unique key to distinguish them. I noticed that the ESP_getChipId() function returns the same value for all 5 devices!! 😨 Do you have any quick-win tips? Thanks you |
Beta Was this translation helpful? Give feedback.
-
For ESP32, ESP_getChipId() is defined as
Try the official ESP32 example GetChipID to see if OK. You have to use 64 bit to avoid duplication, such as
Modified code
|
Beta Was this translation helpful? Give feedback.
-
Tested on several ESP32 boards.
|
Beta Was this translation helpful? Give feedback.
-
BTW, this is the better code, to identify Organizational Unique Identifier (OUI) as well as 24-bit chipID
Output
|
Beta Was this translation helpful? Give feedback.
-
Hi @MattiaCC93 The new ESP_WiFiManager releases v1.11.0 has just been published to fix the Be confident now and spot many more bugs 👍 Best Regards, Releases v1.11.0
|
Beta Was this translation helpful? Give feedback.
-
Thank you @khoih-prog ! For me it is an honor |
Beta Was this translation helpful? Give feedback.
-
Good morning,
I started from this (fantastic) project to make another one, open-source, and I need a suggestion.
I would need to store some variables ( short strings and integers) on non-volatile memory and I would like it to work with both ESP32 and ESP8266. Unfortunately I am not an EEPROM and RTC memory expert.
➡️ Which library / method should be used to avoid compatibility problems between ESP32 and ESP8622?
➡️ On which memory areas can I write?
I would like my project to work with both hardware.
I will have to read these variables very frequently but, fortunately, I will write infrequently.
As soon as my project is at a good point I will make it public and insert the link of this, or I will fork!
A thousand thanks! 🙏🙏🙏
Beta Was this translation helpful? Give feedback.
All reactions