ESP32 Projects
Start a build

Take a Photo and Save to microSD with ESP32-CAM

Save a JPEG to the onboard microSD card with an Arduino sketch that runs once on boot.

AI Thinker ESP32-CAMArduinoBeginner
Parts and source

Before you start

The upstream sketch selects the AI Thinker camera pinout, writes a numbered JPEG through SD_MMC and enters deep sleep. It can run without Wi-Fi.

Getting started

  1. Open the upstream sketch, select AI Thinker ESP32-CAM in Arduino IDE and insert a FAT32 microSD card. Back up any files before formatting.
  2. Upload in download mode, leave download mode and reset with Serial Monitor open at 115200 baud.
  3. Check the serial output for the saved file path. Power off before removing the card and open the JPEG on a computer.

Check the JPEG on the card

Expect a numbered file such as picture1.jpg after the first successful boot. The sketch stores its counter in flash, then sleeps. Reset to capture the next photo. This example is suited to checking a new camera and card before trying scheduled captures.

If the card remains empty

Use Serial Monitor to distinguish a camera init failure from a card mount failure. Check the selected board and camera ribbon for the first error. For a card error, check the inserted card and retry with a backed-up card of a known working type.

Upstream documentation

Read the original documentation ↗