Using ESP32’s Flash Memory for data storage

Using ESP32’s Flash Memory for data storage

1673
Views
0 Comments
DOIT ESP32 DevKit v1

The ESP32 has about 4MB of internal flash memory and since the data stored within the flash memory is retained even when power is recycled, it becomes super useful for applications where you need to keep certain amount of data even after power off. For today’s tutorial, we will learn how to read and write data to the ESP32’s Flash Memory.

The flash memory is similar to the EEPROM memory which is common in most microcontrollers. It is a Non-Volatile memory which means that the data stored, remain even when the ESP undergoes a reset or power is cycled.  This can be very useful in applications where you need to store particular device settings, remember the last state of a particular variable, or store some important runtime data for later use, etc. To give an example, say a piece of equipment being controlled by the ESP32 was ON when power was cut, in most cases, the equipment will stay OFF when power returns depending on the set parameters but with the help of Flash memory, the system can be programmed to return to the last state that was stored.

As cool as non-volatility is, flash memories, however, have a downside which limits their applications; they usually have a fixed number of write operations. Thus the data in flash memories should only be overwritten when it has been compared and a difference has been established.

To demonstrate the use and capabilities of the flash memory, we will build a dimmer circuit in which a potentiometer is used to vary the brightness of an LED and the system is required to remember the brightness level after a reset. Alongside the use of the Flash memory for storage, at the end of this tutorial, you will know how to use an analog sensor with the ESP32 and how PWM works with it.

Using ESP32’s Flash Memory for data storage – [Link]

Mike is the founder and editor of Electronics-Lab.com, an electronics engineering community/news and project sharing platform. He studied Electronics and Physics and enjoys everything that has moving electrons and fun. His interests lying on solar cells, microcontrollers and switchmode power supplies. Feel free to reach him for feedback, random tips or just to say hello :-)

view all posts by admin

Leave a Reply

Archives