• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Any way to store data in the flash memory of an ESP8266 at runtime?

Q&A Forum › Category: ESP8266 › Any way to store data in the flash memory of an ESP8266 at runtime?
0 Vote Up Vote Down
Enzo Pontone asked 5 years ago

Hi, I need to store some variables and retrieve them also when power goes down: may I do this in an ESP8266 (and in ESP32) at runtime? Without an external flash card I mean.
Thanks.

Question Tags: Flash memory runtime
5 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 5 years ago

Hi.
Yes.
You can use the EEPROM library to save variables permanently. 
Then, at the beginning of you code read the variables saved on the EEPROM.
Learn more here: https://arduino-esp8266.readthedocs.io/en/latest/libraries.html#eeprom
We have a tutorial about that with the ESP32: https://randomnerdtutorials.com/esp32-flash-memory/
I hope this helps.
Regards,
Sara

0 Vote Up Vote Down
Enzo Pontone answered 5 years ago

Thanks Sara,
I need it in uPython but following your hint I found this: https://github.com/dda/MicroPython/blob/master/EEPROM.py.
I’ll give it a try and let you know if it works. In the meanwhile if you know other uPython libs to read/write ESP 82266 EEPROM please let me know.
Have a nice day.
Enzo

0 Vote Up Vote Down
Sara Santos Staff answered 5 years ago

Hi Enzo.
That library seems to be used with external EEPROM modules. I’m not sure if it works with the internal ESP32 flash memory.
Alternatively, you can create a file, write to the file, and then read the file if needed. See here: http://docs.micropython.org/en/latest/esp8266/tutorial/filesystem.html
Regards,
Sara
 

0 Vote Up Vote Down
Enzo Pontone answered 5 years ago

Hi Sara,
of course! Silly question! I didn’t think about this way.
Thanks a lot!
Enzo

0 Vote Up Vote Down
Sara Santos Staff answered 5 years ago

Great!
I’ll mark this question as resolved. If you need further help, you just need to open a new question in our forum.
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.