Embedded Systems • Published August 20, 2026

ESP32-CAM Image Capture & Base64 JSON Transmission with ArduinoJson

Capture OV2640 camera frames on ESP32-CAM, encode to Base64, and stream inside ArduinoJson payloads over HTTP/MQTT to cloud servers. Complete working C++ code.

Step-by-step tutorial on capturing JPEG frames with ESP32-CAM (OV2640), encoding raw image buffers to Base64 in C++, and transmitting via ArduinoJson payloads to cloud APIs.

Frequently Asked Questions

Q1. Why does my ESP32-CAM crash with Out of Memory when encoding Base64 in JSON?

ESP32 internal SRAM is only ~300KB. A 50KB JPEG needs ~67KB for Base64 plus ArduinoJson memory overhead. You must enable PSRAM (External SPI RAM) in Arduino IDE / PlatformIO by setting board options.

Q2. Can I view the Base64 image captured by ESP32-CAM in my browser?

Yes! You can copy the Base64 string into our Base64 to Image Tool or prepend data:image/jpeg;base64, directly into any web browser URL bar.