ElectronicZoologyfield notes from the garage
Memory • ESP32

ESP32 memory explained:
flash, RAM, with PSRAM

Board: ESP32 Dev Board or ESP32-C3
Topic: Flash, RAM, PSRAM, PROGMEM, LittleFS, Compression
ESP32 Memory Series - Introduction
✓ Confirmed Working

What This Covers

Most people will never need to think about memory on a microcontroller. But if you are here, you are asking that tiny chip to earn its keep.

This series breaks it down into small standalone pieces that build knowledge with each guide. Reading them in order is recommended, but if you know what you need feel free to teleport.

By the end you will understand the difference between flash, RAM, and PSRAM, why PROGMEM is AVR legacy you can skip on ESP32, how NVS lets you save small values that survive reflashing, how LittleFS gives you a real filing system, and how compression gives your chip the Tardis treatment.

The Series

Flash

Permanent storage. Your sketch lives here. Non-volatile - survives power loss. Slow to read, limited write cycles. Think filing cabinet.

RAM

Working memory. Your variables live here at runtime. Fast, flexible, but tiny (around 300KB) and wiped at power-off. Think workbench.

The core constraint

Flash is large but slow and permanent. RAM is fast and flexible but tiny and temporary. Everything you write is a negotiation between the two. When later guides talk about keeping large data in flash, or spilling things out to PSRAM, it is always in service of the same goal: keeping your workbench clear enough to actually work.

PSRAM

A second, much larger workbench. An extra chip bolted on - 4 to 8MB on supported modules. Volatile like RAM but big enough for framebuffers, audio buffers, and large data structures.

PROGMEM

An AVR legacy keyword that does nothing on ESP32. const arrays are already kept in flash by the compiler - no hint needed. This guide explains where PROGMEM came from and why you can skip it for ESP32-only projects.

NVS

A small notepad that lives in flash. Write a value by name and it survives power-off, power-on, and reflashing. The right tool for settings, calibration values, boot counters, and any small persistent state.

Board Health

Build on NVS to track total boot count, last project name, and accumulated uptime across every sketch ever flashed to a board. Pull up any board and immediately know its history.

LittleFS

A filing system inside the filing cabinet. Gives you named files, folders, and the ability to read and write at runtime. The right place for images, web files, and config that needs to survive a reboot.

Compression

Store your data compressed in flash, decompress in small chunks into RAM as you need it. The Tardis treatment - smaller on the outside. No PSRAM required.

Compression with PSRAM

Decompress everything into PSRAM at boot and access it freely with a normal pointer. No chunking, no decompressor state. The next dimension.