Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By Barabba
#92633 i! I would monitor temperatures of a remote water system, there isn't wifi there so the only way I have is local storage. As the amount of data is few (about one read per minute for 2 sensors) I would get advance of the flash inside ESP8266 (4MB) to store datas, and read it them back hosting a web server which show a chart. I have some questions about ESP, I hope you can clear me them, thank you:

I read the EOF of flash cycles is about 10.000, so I need to care about reducing at maximum writes, may I address directly the Flash to point locations? I would keep in RAM the time value for the first location used, and calculate then all the next ones. When the last location is reached I proceed to overwrite. THis is ideal, there is a library for that? Which address I should start and end considering Sketch and OTA?

If not possible to address directly the Flash, and I shoud use the file system SPIFFS, how can I reduce the writes in the file table? I suppose every time I access a file to store a data it will change fomthing there, and soon it will fail. Maybe a chance to create a big file and access it to the next location and store data?

Thanks for you kind answers
User avatar
By btidey
#92636 Although it is possible to write to flash yourself, it is much easier to use a Flash FS.

LittleFS is now the preferred FS; SPIFFS is deprecated but still supported.

Both have wear leveling across the Flash so you should not have to worry about wrtie limits with the amount and period of data you are talking about.

LittleFS, in particular, has a sophisticated wear scheme and can also detect bad blocks and skip them as required.

See ... / for all the gory details.