An ESP32-S3 can run a small SPI display without PSRAM if the UI draws in strips and the display controller stores the picture. Put an 800 × 480 RGB panel and a camera on the same board and I’d start with 8 MB PSRAM. That’s a starting point for the parts list. You can still run out of internal DMA memory on a board with several megabytes free, or get a flickering display when the camera and Wi-Fi start together.
This esp32.co.uk/ guide works out the memory for the buffers you’ll actually keep alive. There’s a small SPI display example, a camera capture example and a larger RGB preview budget. At the end there’s a short ESP-IDF probe to check the free heap and the largest block in the right place. The worked figures are calculations. Use the probe on your own build to find the runtime figures.

Read the module marking first
The marking on the metal shield is more useful than a listing that says “16 MB ESP32-S3”. Find the full module code. On Espressif’s WROOM modules in the table below, the N number is the flash size and the R number is the PSRAM size. You could buy an N16R8 to fit a larger firmware and still have the same PSRAM as an N8R8. A plain N8 in this family has no PSRAM.
| Example Espressif module | Flash | PSRAM |
|---|---|---|
| ESP32-S3-WROOM-1-N8 | 8 MB Quad SPI | None |
| ESP32-S3-WROOM-1-N8R2 | 8 MB Quad SPI | 2 MB Quad SPI |
| ESP32-S3-WROOM-1-N8R8 | 8 MB Quad SPI | 8 MB Octal SPI |
| ESP32-S3-WROOM-1-N16R8 | 16 MB Quad SPI | 8 MB Octal SPI |
| ESP32-S3-WROOM-2-N32R16V | 32 MB Octal SPI | 16 MB Octal SPI |
Use the module datasheet and board schematic together. Flash and PSRAM can use different bus modes even on one module. Some otherwise familiar GPIOs are reserved by the memory interface on certain variants. If your display or camera board is already wired at the factory, use its actual board definition or schematic. On a custom carrier, check the module’s restrictions before picking pins for the camera clock or display bus. Pick PSRAM type and speed from the board’s known configuration. Guessing Octal mode because you saw it in a different project can leave your build with zero usable PSRAM. ESP32-S3-WROOM-1 and WROOM-1U datasheet, ESP32-S3-WROOM-2 datasheet, N8R8 vs N16R8 board settings.
Flash stores the firmware, partitions and any assets kept there. PSRAM is volatile working space. The datasheet’s 512 KB of on-chip SRAM also isn’t a free 512 KB heap. Static sections, the system and drivers already use some of it. The numbers you can allocate from at runtime depend on the configuration. That’s why it helps to keep a separate budget for byte-addressable internal RAM and for allocations that specifically need internal DMA memory. Those two figures overlap. Never add them together.
Count pixels, copies and lifetimes
For a tightly packed raw image, multiply width by height and then by bytes per pixel. RGB565 is 2 bytes per pixel. RGB888 is 3. If an API uses a padded stride, take the actual bytes per row multiplied by the number of rows. A 16-bit layout can still require extra alignment at the start of the buffer or per row. Check what your producer and consumer expect before you pass one buffer to both.
| Image size | One RGB565 buffer | Two RGB565 buffers | One packed RGB888 buffer |
|---|---|---|---|
| 320 × 240 | 153,600 bytes | 307,200 bytes | 230,400 bytes |
| 480 × 272 | 261,120 bytes | 522,240 bytes | 391,680 bytes |
| 640 × 480 | 614,400 bytes | 1,228,800 bytes | 921,600 bytes |
| 800 × 480 | 768,000 bytes | 1,536,000 bytes | 1,152,000 bytes |
| 1024 × 600 | 1,228,800 bytes | 2,457,600 bytes | 1,843,200 bytes |

Write down who owns each buffer, where it is allocated, and when it can be reused. A camera frame, a JPEG decoder’s output and the panel’s scanout buffer can describe the same picture and still be three allocations. If the decoder writes directly into an existing draw buffer, count that backing allocation once. Check whether the decoder is allowed to write while the display or DMA is reading. The savings disappear if you need a scratch copy to get the timing right.
Keep the unit straight too. The module markings use MB and the arithmetic here uses bytes and KiB, where 1 KiB is 1,024 bytes. One 800 × 480 RGB565 frame is 768,000 bytes, or 750 KiB. Two are 1,500 KiB. Those figures are image payloads. Allocator bookkeeping, stride, frame descriptors and any alignment padding still have to fit. Record the actual requested allocation if the driver logs it.
Here’s where a small mismatch can creep in. Say the image you’re moving is 481 pixels wide and your application pads every RGB565 row to a multiple of 32 bytes. You have 962 bytes of pixels per row but a 992-byte stride. For 272 rows, use 269,824 bytes. If your display transfer takes only the active pixels, advance the source pointer by the full stride when you move to the next row. If the driver expects packed data, repack the region or use its stride-aware interface. The memory requirement and the length to send on the bus can be different.
Check the colour format at both ends of a conversion too. A library may keep each pixel in four bytes even if only three are colour channels. The RGB888 figures in the table are for packed output. For a full 800 × 480 buffer at four bytes per pixel the payload alone is 1,536,000 bytes. It’s the same space as two RGB565 frames. If it’s an occasional image, decode or convert into a smaller working area and see whether the library can release that area afterwards.
A small SPI screen can draw in strips
A common 320 × 240 SPI TFT has its own display RAM. The ESP32 sends changed pixels into that RAM. In LVGL partial mode you can render into a draw buffer much shorter than the display and flush each part as it’s ready. At full display width, a 40-line RGB565 buffer is 320 × 40 × 2 = 25,600 bytes. With two such buffers the draw payload is 51,200 bytes, or 50 KiB. One buffer needs 25 KiB. The controller handles the full picture on its side.

Two draw buffers let one flush run while LVGL renders into the other, provided the driver really flushes asynchronously. If the SPI function blocks until the whole strip is sent, the second buffer can add memory use with little benefit. If it queues DMA, keep each strip intact until its transfer finishes. Signal LVGL that a flush is ready at that point. Calling lv_display_flush_ready() just after queuing can give the renderer a buffer that’s still on the wire. That often looks like torn or strangely coloured strips.
LVGL v9’s lv_display_set_buffers() takes the byte size of each supplied buffer. For the 40-line example, pass 25,600 bytes per buffer, assuming RGB565 with tightly packed rows. It’s worth checking the configured format and stride when the same UI is reused on another display. Larger strips can reduce how often you set up a transaction. Smaller strips leave more room in the internal heap. Try one buffer first if the UI mostly changes small areas. Watch how long a busy full-screen redraw takes before you spend memory on a second one. LVGL 9.3 display buffer setup.
On a driver that needs internal DMA buffers, budget for them in internal RAM. If your integration allows a PSRAM render buffer and copies strips into an internal staging buffer, count the staging buffer too. Sometimes a port does that copy for you, so the app still appears to work after moving a draw buffer to PSRAM. Check how much memory was allocated after the display starts and how long flushes take. Icons, fonts and decoded images are another part of the budget. A UI with one small tile and a big image cache can use much more memory than the tile calculation suggests.
This is the display I’d try first on a board with no PSRAM. Use a simple UI, limit the number of large decoded assets and initialise the radio if the product needs it. Make room for the peak, not just the home screen. If you also need a camera, start a separate camera budget before assuming the same board can take both.
A parallel RGB panel keeps reading a framebuffer
With the ESP-IDF RGB LCD driver and the usual framebuffer setup, the ESP32-S3 supplies a continuous stream of pixels to an RGB panel. The panel’s small timing interface and the SPI screen’s on-board display memory are doing different jobs. A small LVGL tile can reduce drawing memory on the RGB setup. The framebuffer the panel scans still has to exist unless you explicitly design a different streaming mode.
For 800 × 480 with RGB565, start with the 750 KiB framebuffer. Add another 750 KiB if the LCD driver allocates two full framebuffers. Double buffering can keep the renderer from changing the frame being scanned if you follow the driver’s frame-switch rules. It does not halve the data the panel reads per refresh. If LVGL directly renders into those same framebuffers in a supported setup, count the two allocations once. If LVGL has separate draw tiles, add those as separate lines.
In ESP-IDF v5.5.1 the RGB driver can place framebuffers in PSRAM using fb_in_psram, with the framebuffer count configured by num_fbs. The driver also documents a single PSRAM framebuffer with two smaller internal bounce buffers, configured using a nonzero bounce_buffer_size_px. In that mode DMA reads one internal buffer while the other is filled from PSRAM. The size setting is in pixels per bounce buffer. At 800 pixels wide, 10 lines means 8,000 pixels per buffer. With RGB565 that’s 16,000 bytes per buffer and 32,000 bytes in total, before alignment and overhead. Keep the driver’s rules for buffer sizing and alignment. The example uses a whole number of rows and divides evenly into the 800 × 480 frame. ESP-IDF v5.5.1 RGB LCD driver.
Bounce buffering can get you through short bandwidth spikes, but the CPU has filling work to do. It isn’t free memory or free bandwidth. Test the mode with Wi-Fi transferring, with the camera active and with any flash writes you actually do. Espressif documents cache limitations for bounce buffering and settings such as PSRAM XIP. Check your IDF release and its restrictions before picking those settings. If a static screen is perfect and a preview shifts sideways as soon as the network starts, check that the scanout can keep up under load.
Here’s the quick throughput calculation I use to see the scale. An 800 × 480 RGB565 picture at 60 full refreshes per second is 46.08 MB/s of active pixel payload. That number comes from 768,000 × 60, in decimal bytes per second. It is an illustration, not a claim that the ESP32-S3 sustains that combination. The panel’s pixel clock depends on the full timing, including blanking. At the same time the CPU may be rendering, the camera may be writing and the decoder may be reading PSRAM. A UI that only changes at 10 frames per second can still sit on a panel that scans more often. Measure both activities if you’re comparing boards. LVGL display benchmark guide.
Camera capture and decoded preview need separate space
For an ESP32-S3 board using Espressif’s esp32-camera component, start with one framebuffer and JPEG capture if the sensor supports it and JPEG suits the job. Set fb_location to CAMERA_FB_IN_PSRAM when you intend to use external RAM. Espressif’s driver documentation calls out its limited low-resolution JPEG exception for operation without PSRAM. Treat that as a configuration to verify for your sensor and driver. If you’re buying a camera board for streaming or a sizable preview, get PSRAM on the board. Espressif camera driver documentation, Camera configuration and frame type.
A JPEG has a variable length. A low-detail scene can give you a much smaller result than outdoors with foliage or a textured scene. camera_fb_t.len tells you how many bytes the returned capture contains. The driver’s reserved receive buffer can be larger. Use the component’s configuration and the heap change at camera initialisation to understand allocation, then log the JPEG lengths across actual scenes to plan upload and storage. Multiplying an average JPEG length by the queue depth misses the reserved space and any held copies.
Two or more driver buffers can keep continuous capture going while the consumer deals with the last result. Espressif recommends that mode for JPEG. Don’t automatically double the raw capture buffers to make an RGB preview faster. Increase fb_count only after you’ve seen what one buffer is doing. esp_camera_fb_get() returns a buffer from the driver. When every user of those bytes has finished, return it with esp_camera_fb_return(). If a sender takes ownership through an asynchronous queue, don’t return it early. If you make a copy for that queue, return the original when the copy is complete and put the copy in the memory budget. Espressif camera driver example.
Say your capture is a JPEG and you decode it for a live preview. One VGA RGB565 work surface is 600 KiB. A packed RGB888 surface at that size is 900 KiB. If your decoder outputs RGB888 and you then make a full RGB565 copy, their combined payload is 1,500 KiB while both are alive. If the decoder supports producing strips or scaling down to the actual preview size, you can often avoid keeping the full decoded picture. A display showing a small preview usually doesn’t need the camera’s full resolution on every update.
The driver’s CONFIG_CAMERA_PSRAM_DMA setting and the framebuffer location are two separate decisions. The driver supports a PSRAM DMA mode on the S3, while exact behaviour depends on the component version and configuration. Let the driver allocate and manage its buffers. Test the mode using your sensor, capture size and concurrent workload. A raw capture can return errors or missing data when memory traffic is heavy. Keep the code that checks frame validity and accounts for timeouts and dropped frames. Camera configuration options.
For a camera that only uploads JPEGs, start by getting one known capture all the way through to the receiver. Put the lens on a textured scene as well as a plain wall. Record the largest payload you saw and how long the sender held a capture. Then deliberately slow down the receiver and check what happens. If the program waits with one frame in hand it might slow the next capture, which is fine for a still camera. In a live view you may want to drop stale frames and send a newer one. Make that decision before increasing the buffer count. A queue of frame pointers also holds the underlying camera slots until they are returned, even though the pointers themselves take very little space.
Work out a combined camera and display budget
Suppose you’re making a preview panel with an 800 × 480 RGB display. You’ve chosen two LCD framebuffers in PSRAM and a separate VGA RGB565 preview surface, also in PSRAM. Your renderer will have two independent 20-line RGB565 draw strips in internal memory for this example. The path assumes your decoder provides RGB565 to the preview surface without an additional full RGB888 output. If it does allocate one, add it. The JPEG receive slots and any decoder workspace are extra and have to be checked with the selected component.
| Allocation in the example | Intended memory | Payload |
|---|---|---|
| Two 800 × 480 RGB565 LCD framebuffers | PSRAM | 1,536,000 bytes |
| One 640 × 480 RGB565 preview surface | PSRAM | 614,400 bytes |
| Two 800 × 20 RGB565 draw strips | Internal RAM in this example | 64,000 bytes |
| Known PSRAM subtotal | PSRAM | 2,150,400 bytes (2,100 KiB) |
| Known internal subtotal | Internal RAM | 64,000 bytes (62.5 KiB) |

The known PSRAM payload alone is 2,100 KiB. It’s already larger than a fully available 2 MiB. On an 8 MB board you get useful room for the uncounted camera and UI allocations. There’s still an internal cost and a timing cost. If the network or DMA allocations fail, another 8 MB of PSRAM won’t necessarily help. Start with one framebuffer or a smaller preview as well, so you have a configuration that proves each path before you run them together.
If you change to the driver’s single-framebuffer bounce-buffer example instead, the PSRAM subtotal here becomes 1,382,400 bytes for one LCD frame and the separate preview. Allow the extra 32,000 bytes of internal bounce space. With the same render strips, that’s 96,000 bytes of known internal payload rather than 64,000. These are two different driver configurations. The table’s first case uses two scanout frames without the bounce buffers; the alternative trades a full external frame for additional internal space and CPU copies.
Do the same calculation with the panel and sensor you can actually buy. Work from the busiest screen. Include a still capture that gets saved while the preview is running, a firmware update if the UI stays active during it, or a reconnect that makes the app allocate networking buffers while the camera is already producing frames. Keep one row for each of those peaks. Two modes that never run together can reuse working memory if the program really frees or repurposes it before the next mode starts.
Check the free heap in the right place
In ESP-IDF, enable the board’s external RAM configuration and make it available to the capability allocator. The boot log should tell you what was detected and added. If external RAM is only mapped into the address space without being registered with the allocator, this probe will show zero for the external heap. That’s a statement about what the heap API can allocate. If you expect PSRAM and see zero, check the module marking, startup messages, the PSRAM bus mode and CONFIG_SPIRAM_USE. Check the external RAM guide for your build. ESP-IDF 5.5 external RAM configuration.
Add the included C helper to your existing ESP-IDF application component. Add the source to the component’s source list if you list sources explicitly. The probe uses the heap component and its public esp_heap_caps.h header. Call log_memory_budget("boot") from task context and use other phase names after each driver or major allocation. Declare the function in the caller, or put the declaration in your project’s own header. Keep the log out of LCD callbacks and camera ISRs.
#include <stdint.h>
#include <stdio.h>
#include "esp_heap_caps.h"
static void log_pool(const char *name, uint32_t caps)
{
const size_t total = heap_caps_get_total_size(caps);
const size_t free_now = heap_caps_get_free_size(caps);
const size_t largest = heap_caps_get_largest_free_block(caps);
const size_t low = heap_caps_get_minimum_free_size(caps);
printf("%s total=%zu free=%zu largest=%zu low=%zu B\n",
name, total, free_now, largest, low);
}
void log_memory_budget(const char *phase)
{
printf("Memory at %s\n", phase);
log_pool("PSRAM 8-bit", MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT);
log_pool("Internal 8-bit", MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
log_pool("Internal DMA 8-bit",
MALLOC_CAP_INTERNAL | MALLOC_CAP_DMA | MALLOC_CAP_8BIT);
}
Free bytes tell you the total left for the requested capabilities. Largest tells you the largest allocation the heap reports for that capability set. A total of 180 KiB is little use to a request for one 100 KiB buffer if the largest compatible block is 70 KiB. A driver can also require padding or a particular alignment, so leave margin above the bare payload and verify the allocation result. The low-water figure sums the minima of regions in the selected capability set. Those minimum values can have happened at different times. This probe takes several readings in order while other tasks may run, so treat a row as a diagnostic snapshot. ESP-IDF heap allocation APIs.
The internal DMA row deliberately asks for internal memory. Some S3 peripherals with an appropriate EDMA path can read or write external RAM, with their own alignment and cache requirements. Those paths are useful when the driver supports them. An ordinary pointer into PSRAM doesn’t establish that a specific SPI or camera driver can use it directly. Start with the peripheral driver’s documented placement, then use the heap figures to see where the pressure is.
Log after the camera, after the display, after UI assets load and after the network comes up. Take another snapshot during the busiest realistic mix. Make the largest allocation you’ll need while the other buffers are still live. The first allocation can succeed and the second one can fail, so actually test both when you plan to double-buffer. Watch repeated capture, screen changes and reconnects. A consistently shrinking largest block can justify inspecting allocation lifetimes even when free bytes look fairly steady.

If your build uses TinyML as well, include the tensor arena and any model input copy. Both can coexist with the camera frame, and the camera buffer may still be held while the model runs. Use the measured arena requirement and the model’s actual input shape, particularly if it is only consuming a small crop. TinyML inference and memory guide.
Check the workload in the order it happens
First run the camera by itself at the intended size and record how often it can return a usable frame. Then run the display alone with the busiest screen you have. If something fails during one of those passes, adding the other driver makes the problem harder to read. After both work separately, run them together. Start the Wi-Fi traffic after you’ve seen the preview working, then repeat with networking started first if your product supports that boot order. This reveals both the timing problems and those allocations that only fail when a large buffer goes in late.
Leave the same scene and screen activity running for each comparison. Count frames the camera delivered, frames the preview actually displayed and any capture or flush errors. One number for FPS can hide a slow decoder, a deep queue, or a stale preview being scanned out repeatedly. Keep serial logging light while timing the run. Take the memory snapshots at useful transitions, then write a short summary rather than printing several lines for every frame.
If you’re replacing a module because the buffers didn’t fit, use the same test to check the replacement. The 8 MB Octal variant and the smaller Quad variant may differ in bus mode as well as space. Record both. A different board can also change the display wiring, allowed clock or the camera sensor. Don’t use one smooth frame on a new screen as proof the old problem was only memory capacity.
Know when more PSRAM will help
When PSRAM is detected and its largest block cannot fit the next required external buffer, reduce the number or size of live buffers or pick a larger module. Work out if the extra space is needed all the time. A snapshot queue with an unbounded consumer backlog will eat more memory eventually, even on a larger board. Give the queue a limit and choose what happens when the slow side falls behind.
If the failing allocation is internal DMA memory, first check the internal DMA row. Reduce tiles or staging sizes where the driver allows it, move eligible assets elsewhere, and look at which subsystem grabs internal blocks first. ESP-IDF has settings for how ordinary allocations use PSRAM and for reserving a part of internal memory for explicit internal requests. Change them with a log of what improved, because moving everything to external memory can introduce extra latency or change cache behaviour. Keep the buffers that the hardware specifically needs in their required memory.
If allocations succeed and the screen or camera fails only under traffic, look at data rates and timing. Try a slower panel pixel clock within the panel spec, a smaller camera preview, or separate bursts of network and camera work. Change one thing and repeat the same workload. On a SPI screen with intermittent stripes, also check whether the draw buffer is reused before the flush completes. On an RGB screen that shifts during writes, check the driver’s underflow and cache guidance. A host monitor may disappear when you are testing sleep over native USB. Keep that separate from the memory fault by checking the boot log on a suitable console. USB and boot recovery guide.
I’d start without PSRAM only for a simple tiled SPI UI when its full workload fits internally. For a modest JPEG project or a smaller display with a tight budget, 2 MB is worth checking with the intended buffers and settings. For an 800 × 480 RGB panel, especially with a camera, 8 MB is the variant I’d put on the bench first. Look at 16 MB when the calculated external buffers, asset caches or multiple working images leave little margin in 8 MB. In all four cases, keep the internal DMA check and run the busiest scene before committing to the board.


