Guides · 9 min read

ESP32-CAM Timelapse: Interval Photos to microSD and Video

ESP32-CAM timelapse guide: save JPEGs to microSD at an interval, run for weeks on a battery with deep sleep, turn them into video with ffmpeg. Capacity tables.

An ESP32-CAM timelapse means letting the camera take single photos at fixed intervals and later turning them into a video that plays back fast. The inexpensive ESP32-CAM, with its 2-megapixel OV2640 camera and microSD slot, is ready-made hardware for the job: it shoots a JPEG every 10 seconds or every 5 minutes, writes it to the card and runs for days without a computer. A flower opening, clouds drifting, a building going up or a seed sprouting all fit into a few seconds of video this way.

In this guide you will first work out the relationship between interval, shooting time and number of photos with tables, and see how many days your microSD card lasts at each resolution. Then we will write one sketch that stays awake for short intervals and one battery-friendly sketch that goes into deep sleep for long intervals. The last sections cover battery life, turning the photos into a video on your computer with ffmpeg, and fixes for the most common errors.

ESP32-CAM board with OV2640 camera and microSD slot
ESP32-CAM: with its OV2640 camera and microSD slot it is all you need for timelapse photography.

How does timelapse photography with the ESP32-CAM work?

The logic is simple: the ESP32-CAM starts the camera, grabs a frame, writes the JPEG data to the microSD card as a numbered file and waits until the next shot. The wait happens either with millis() while the board stays awake, or the board goes into deep sleep and wakes up on a timer. When shooting is done, you put the card in a computer and join the photos at 30 frames per second (fps). The speed-up factor is the interval multiplied by the fps: shoot every 10 seconds and play at 30 fps and time runs 300 times faster, so one hour becomes 12 seconds. The ESP32-CAM has no USB port, so you upload the code with a USB-TTL converter or an ESP32-CAM-MB base board.

PartWhy you need it
ESP32-CAM (AI Thinker)Camera, processor and microSD slot on one board
microSD card (up to 32 GB, FAT32)Stores the photos; 64 GB and larger exFAT cards must be reformatted to FAT32 first
USB-TTL converter or ESP32-CAM-MBFor uploading code and the Serial Monitor
5 V / 2 A adapterReliable power for a fixed setup
18650 cell, TP4056 module, 5 V boost converterFor a battery setup away from a socket
Tripod, clamp or a fixed boxThe camera must not move at all between frames

Interval, duration and photo count table

When you plan a timelapse you use three simple formulas. Number of photos = shooting time / interval. Video length = number of photos / fps. Speed-up = interval × fps. For example, if you shoot a sunset for 1 hour at a 10-second interval you get 3600 / 10 = 360 photos and a 12-second video at 30 fps. If you shoot two weeks of a seed growing every 5 minutes, you get 14 × 288 = 4032 photos and a video of about 2 minutes 14 seconds. The slower the motion, the longer the interval can be; for fast-changing subjects like clouds, going beyond 5–10 seconds makes the video look choppy.

IntervalPhotos per hourPhotos in 24 hours24 hours as a 30 fps videoGood subject
5 s72017,2809 min 36 sClouds, traffic, crowds
10 s3608,6404 min 48 sSunset, sunrise
30 s1202,8801 min 36 s3D printer job, moving shadows
1 min601,44048 sDay to night, one day of construction
5 min122889.6 sPlant growth, seed germination
15 min4963.2 sMonths of construction, changing seasons

Resolution and microSD card capacity

The size of a JPEG depends on the resolution, the jpeg_quality value and how detailed the scene is; a garden full of leaves can produce files twice as large as a plain wall. You work out capacity like this: usable space / average file size = number of photos, and number of photos × interval = time until the card is full. A 16 GB card has about 14.8 GB of usable space; at UXGA with an average of 200 KB per photo that gives 14,800,000 / 200 = 74,000 frames, which at one shot per minute is about 51 days. The table shows approximate values for jpeg_quality 12 and an average outdoor scene. UXGA has a 4:3 aspect ratio; if you want 16:9 video straight away, choose HD (1280×720) or crop with ffmpeg.

Resolution (frame_size)PixelsAverage JPEGPhotos on a 16 GB cardTime to fill at one shot per minute
FRAMESIZE_UXGA1600×1200≈ 200 KB≈ 74,000≈ 51 days
FRAMESIZE_SXGA1280×1024≈ 150 KB≈ 98,000≈ 68 days
FRAMESIZE_HD1280×720≈ 100 KB≈ 148,000≈ 103 days
FRAMESIZE_SVGA800×600≈ 50 KB≈ 296,000≈ 206 days
FRAMESIZE_VGA640×480≈ 35 KB≈ 423,000≈ 294 days

Wiring and Arduino IDE settings

Connection or settingValueNote
USB-TTL TXESP32-CAM U0R (GPIO3)Crossed over
USB-TTL RXESP32-CAM U0T (GPIO1)Crossed over
USB-TTL 5V and GNDESP32-CAM 5V and GND3.3 V power is often not enough
GPIO0 (IO0)To GND while uploadingRemove after uploading and press RST
BoardAI Thinker ESP32-CAMesp32:esp32:esp32cam
PSRAMEnabledRequired for UXGA and two frame buffers
Partition SchemeHuge APP (3MB No OTA)The board's default
Flash LEDGPIO4Kept off in the code with 1-bit SD mode
The ESP32-CAM can briefly draw more than 300 mA while starting the camera and writing to the card. A weak USB-TTL output or a thin cable leads to the Brownout detector was triggered error and random restarts; for long shoots use a 5 V / 2 A adapter. For fixes see the ESP32 brownout guide, and for details of the first setup the ESP32-CAM getting started guide.

Step by step: your first timelapse

  1. Format the microSD card as FAT32 on your computer and insert it into the ESP32-CAM's slot.
  2. Install the ESP32 board package in the Arduino IDE, select AI Thinker ESP32-CAM as the board and check that PSRAM is Enabled.
  3. Wire the USB-TTL as in the table, pull GPIO0 to GND and press the RST button.
  4. Upload one of the sketches below; when it finishes, remove the GPIO0 wire and press RST.
  5. Open the Serial Monitor at 115200 baud; for every shot you should see a line like /tl/00001.jpg.
  6. Fix the camera in place, take a few photos and check the card on your computer, then start the real shoot.

Sketch 1: always-on timelapse for short intervals

For intervals of 5–60 seconds deep sleep brings little benefit, because on every wake-up the board spends 2–3 seconds restarting the camera and waiting for the exposure to settle. That is why the first sketch keeps the board awake, starts the camera once and takes a photo every INTERVAL_MS with millis(). Thanks to CAMERA_GRAB_LATEST and two frame buffers, the saved frame is always the newest one, not an old one. The photo number is written to permanent memory with Preferences, so even after a power cut the numbering continues where it left off and old files are not overwritten. Because the microSD card is opened in 1-bit mode, the flash LED on GPIO4 does not blink on every save.

C++ (Arduino IDE)
1// ESP32-CAM zaman atlamalı çekim: kart uyanık, kısa aralıklar için (5-60 sn)
2// ESP32-CAM timelapse: board stays awake, for short intervals (5-60 s)
3// Kart / Board: AI Thinker ESP32-CAM, PSRAM: Enabled
4#include "esp_camera.h"
5#include "FS.h"
6#include "SD_MMC.h"
7#include <Preferences.h>
8
9const unsigned long INTERVAL_MS = 10000;   // Çekim aralığı (ms) / capture interval (ms)
10const int STATUS_LED = 33;                 // Kart üstü kırmızı LED, LOW = yanar / onboard red LED, LOW = on
11
12// AI Thinker kamera pinleri / AI Thinker camera pins
13#define PWDN_GPIO_NUM  32
14#define RESET_GPIO_NUM -1
15#define XCLK_GPIO_NUM   0
16#define SIOD_GPIO_NUM  26
17#define SIOC_GPIO_NUM  27
18#define Y9_GPIO_NUM    35
19#define Y8_GPIO_NUM    34
20#define Y7_GPIO_NUM    39
21#define Y6_GPIO_NUM    36
22#define Y5_GPIO_NUM    21
23#define Y4_GPIO_NUM    19
24#define Y3_GPIO_NUM    18
25#define Y2_GPIO_NUM     5
26#define VSYNC_GPIO_NUM 25
27#define HREF_GPIO_NUM  23
28#define PCLK_GPIO_NUM  22
29
30Preferences prefs;
31uint32_t photoNo = 0;
32unsigned long lastShot = 0;
33
34bool initCamera() {
35  camera_config_t c = {};
36  c.ledc_channel = LEDC_CHANNEL_0;
37  c.ledc_timer = LEDC_TIMER_0;
38  c.pin_d0 = Y2_GPIO_NUM;  c.pin_d1 = Y3_GPIO_NUM;  c.pin_d2 = Y4_GPIO_NUM;  c.pin_d3 = Y5_GPIO_NUM;
39  c.pin_d4 = Y6_GPIO_NUM;  c.pin_d5 = Y7_GPIO_NUM;  c.pin_d6 = Y8_GPIO_NUM;  c.pin_d7 = Y9_GPIO_NUM;
40  c.pin_xclk = XCLK_GPIO_NUM;
41  c.pin_pclk = PCLK_GPIO_NUM;
42  c.pin_vsync = VSYNC_GPIO_NUM;
43  c.pin_href = HREF_GPIO_NUM;
44  c.pin_sccb_sda = SIOD_GPIO_NUM;
45  c.pin_sccb_scl = SIOC_GPIO_NUM;
46  c.pin_pwdn = PWDN_GPIO_NUM;
47  c.pin_reset = RESET_GPIO_NUM;
48  c.xclk_freq_hz = 20000000;
49  c.pixel_format = PIXFORMAT_JPEG;
50  c.frame_size = FRAMESIZE_UXGA;           // 1600x1200, PSRAM gerekir / needs PSRAM
51  c.jpeg_quality = 12;                     // 0-63, küçük = daha iyi / lower = better
52  c.fb_count = 2;
53  c.fb_location = CAMERA_FB_IN_PSRAM;
54  c.grab_mode = CAMERA_GRAB_LATEST;        // Hep en yeni kare / always the newest frame
55  return esp_camera_init(&c) == ESP_OK;
56}
57
58bool savePhoto() {
59  camera_fb_t* fb = esp_camera_fb_get();
60  if (!fb) return false;
61  char path[24];
62  snprintf(path, sizeof(path), "/tl/%05lu.jpg", (unsigned long)(photoNo + 1));
63  File f = SD_MMC.open(path, FILE_WRITE);
64  bool ok = f && f.write(fb->buf, fb->len) == fb->len;
65  if (f) f.close();
66  esp_camera_fb_return(fb);
67  if (ok) {
68    photoNo++;
69    prefs.putUInt("n", photoNo);           // Sayaç elektrik kesilse de kalır / counter survives power loss
70    Serial.printf("%s kaydedildi / saved\n", path);
71  }
72  return ok;
73}
74
75void setup() {
76  Serial.begin(115200);
77  pinMode(STATUS_LED, OUTPUT);
78  digitalWrite(STATUS_LED, HIGH);
79  if (!initCamera()) { Serial.println("Kamera hatasi / camera error"); while (true) delay(1000); }
80  if (!SD_MMC.begin("/sdcard", true)) {    // 1 bit mod: flaş LED'i (GPIO4) yanmaz / 1-bit mode: flash LED stays off
81    Serial.println("microSD yok / no microSD"); while (true) delay(1000);
82  }
83  pinMode(4, OUTPUT);                      // Flaş LED'ini kapalı tut / keep the flash LED off
84  digitalWrite(4, LOW);
85  SD_MMC.mkdir("/tl");
86  prefs.begin("timelapse", false);
87  photoNo = prefs.getUInt("n", 0);
88  for (int i = 0; i < 3; i++) {            // Pozlama otursun diye ilk kareleri at / discard first frames for exposure
89    camera_fb_t* fb = esp_camera_fb_get();
90    if (fb) esp_camera_fb_return(fb);
91    delay(200);
92  }
93  lastShot = millis() - INTERVAL_MS;       // İlk fotoğrafı hemen çek / take the first photo right away
94}
95
96void loop() {
97  if (millis() - lastShot >= INTERVAL_MS) {
98    lastShot += INTERVAL_MS;               // Kayma olmasın / no drift
99    digitalWrite(STATUS_LED, LOW);
100    if (!savePhoto()) Serial.println("Kayit hatasi / save error");
101    digitalWrite(STATUS_LED, HIGH);
102  }
103}
Code partWhat does it do?
SD_MMC.begin("/sdcard", true)Opens the card in 1-bit mode; GPIO4 is freed and the flash LED stays off
c.grab_mode = CAMERA_GRAB_LATESTReturns the newest frame, not an old one from the buffer
c.jpeg_quality = 120–63; a lower value means a sharper but larger file
prefs.putUInt("n", photoNo)Saves the last photo number to NVS
lastShot += INTERVAL_MSStops the interval from drifting over time
Discarding the first three framesRemoves greenish frames shot before auto exposure and white balance settle

Sketch 2: battery-friendly timelapse with deep sleep

Once the interval reaches several minutes, keeping the board awake just wastes energy. In the second sketch everything happens in setup(): the board wakes up, starts the camera, throws away a few frames, takes a photo, writes it to the card and goes back into deep sleep; loop() never runs. RAM is cleared during deep sleep, so the counter is again kept in Preferences. Two pins are held before going to sleep: GPIO4 is kept LOW so the flash LED does not glow faintly during sleep, and the camera's PWDN pin (GPIO32) is set HIGH to put the sensor into power-down mode. The sketch measures the time spent awake with micros() and subtracts it from the sleep time, so a 300-second interval does not drift to 303 seconds. For more about deep sleep see the ESP32 deep sleep guide.

C++ (Arduino IDE)
1// ESP32-CAM zaman atlamalı çekim + derin uyku: uzun aralıklar ve pil için
2// ESP32-CAM timelapse + deep sleep: for long intervals and battery power
3// Kart / Board: AI Thinker ESP32-CAM, PSRAM: Enabled
4#include "esp_camera.h"
5#include "FS.h"
6#include "SD_MMC.h"
7#include <Preferences.h>
8#include "driver/rtc_io.h"
9
10const uint32_t INTERVAL_SEC = 300;         // İki fotoğraf arası süre (sn) / time between photos (s)
11
12// AI Thinker kamera pinleri / AI Thinker camera pins
13#define PWDN_GPIO_NUM  32
14#define RESET_GPIO_NUM -1
15#define XCLK_GPIO_NUM   0
16#define SIOD_GPIO_NUM  26
17#define SIOC_GPIO_NUM  27
18#define Y9_GPIO_NUM    35
19#define Y8_GPIO_NUM    34
20#define Y7_GPIO_NUM    39
21#define Y6_GPIO_NUM    36
22#define Y5_GPIO_NUM    21
23#define Y4_GPIO_NUM    19
24#define Y3_GPIO_NUM    18
25#define Y2_GPIO_NUM     5
26#define VSYNC_GPIO_NUM 25
27#define HREF_GPIO_NUM  23
28#define PCLK_GPIO_NUM  22
29
30bool initCamera() {
31  camera_config_t c = {};
32  c.ledc_channel = LEDC_CHANNEL_0;
33  c.ledc_timer = LEDC_TIMER_0;
34  c.pin_d0 = Y2_GPIO_NUM;  c.pin_d1 = Y3_GPIO_NUM;  c.pin_d2 = Y4_GPIO_NUM;  c.pin_d3 = Y5_GPIO_NUM;
35  c.pin_d4 = Y6_GPIO_NUM;  c.pin_d5 = Y7_GPIO_NUM;  c.pin_d6 = Y8_GPIO_NUM;  c.pin_d7 = Y9_GPIO_NUM;
36  c.pin_xclk = XCLK_GPIO_NUM;
37  c.pin_pclk = PCLK_GPIO_NUM;
38  c.pin_vsync = VSYNC_GPIO_NUM;
39  c.pin_href = HREF_GPIO_NUM;
40  c.pin_sccb_sda = SIOD_GPIO_NUM;
41  c.pin_sccb_scl = SIOC_GPIO_NUM;
42  c.pin_pwdn = PWDN_GPIO_NUM;
43  c.pin_reset = RESET_GPIO_NUM;
44  c.xclk_freq_hz = 20000000;
45  c.pixel_format = PIXFORMAT_JPEG;
46  c.frame_size = FRAMESIZE_UXGA;           // 1600x1200
47  c.jpeg_quality = 12;
48  c.fb_count = 2;
49  c.fb_location = CAMERA_FB_IN_PSRAM;
50  c.grab_mode = CAMERA_GRAB_LATEST;
51  return esp_camera_init(&c) == ESP_OK;
52}
53
54void sleepNow() {
55  esp_camera_deinit();
56  pinMode(4, OUTPUT);                      // Flaş LED'i uykuda kapalı tut / keep the flash LED off in sleep
57  digitalWrite(4, LOW);
58  rtc_gpio_hold_en(GPIO_NUM_4);
59  pinMode(PWDN_GPIO_NUM, OUTPUT);          // Kamerayı güç kesme moduna al / put the camera in power-down
60  digitalWrite(PWDN_GPIO_NUM, HIGH);
61  rtc_gpio_hold_en(GPIO_NUM_32);
62  uint64_t awakeUs = micros();             // Uyanık geçen süreyi düş, aralık kaymasın / subtract awake time
63  uint64_t intervalUs = (uint64_t)INTERVAL_SEC * 1000000ULL;
64  uint64_t sleepUs = intervalUs > awakeUs + 1000000ULL ? intervalUs - awakeUs : 1000000ULL;
65  Serial.printf("%llu sn uyku / s sleep\n", sleepUs / 1000000ULL);
66  Serial.flush();
67  esp_sleep_enable_timer_wakeup(sleepUs);
68  esp_deep_sleep_start();
69}
70
71void setup() {
72  Serial.begin(115200);
73  rtc_gpio_hold_dis(GPIO_NUM_4);           // Uykudaki kilitleri çöz / release the sleep holds
74  rtc_gpio_hold_dis(GPIO_NUM_32);
75  if (!initCamera()) { Serial.println("Kamera hatasi / camera error"); sleepNow(); }
76  if (!SD_MMC.begin("/sdcard", true)) { Serial.println("microSD yok / no microSD"); sleepNow(); }
77  SD_MMC.mkdir("/tl");
78
79  for (int i = 0; i < 3; i++) {            // Otomatik pozlama ve beyaz dengesi otursun / let auto exposure settle
80    camera_fb_t* fb = esp_camera_fb_get();
81    if (fb) esp_camera_fb_return(fb);
82    delay(150);
83  }
84
85  camera_fb_t* fb = esp_camera_fb_get();
86  if (fb) {
87    Preferences prefs;
88    prefs.begin("timelapse", false);
89    uint32_t n = prefs.getUInt("n", 0) + 1; // Sıradaki fotoğraf numarası / next photo number
90    char path[24];
91    snprintf(path, sizeof(path), "/tl/%05lu.jpg", (unsigned long)n);
92    File f = SD_MMC.open(path, FILE_WRITE);
93    if (f && f.write(fb->buf, fb->len) == fb->len) {
94      prefs.putUInt("n", n);
95      Serial.printf("%s (%u bayt / bytes)\n", path, fb->len);
96    }
97    if (f) f.close();
98    prefs.end();
99    esp_camera_fb_return(fb);
100  }
101  SD_MMC.end();
102  sleepNow();
103}
104
105void loop() {
106  // Buraya hiç gelinmez / never reached
107}

Battery life calculation

Average current = (awake time × awake current + sleep time × sleep current) / interval. With Wi-Fi off, an awake ESP32-CAM draws about 150 mA, and one shot takes about 3 seconds. Sleep current depends on the board: the ESP32 itself drops to the µA range, but because of the on-board regulator and other parts most AI Thinker boards draw 2–6 mA in deep sleep; we used 5 mA in the calculation. A 3000 mAh 18650 cell used through a 5 V boost converter gives about 2550 mAh of useful capacity because of the converter's efficiency. At a 5-minute interval the average current is (3 × 150 + 297 × 5) / 300 = 6.45 mA, and the cell lasts 2550 / 6.45 ≈ 395 hours, or 16 days. You can run the numbers with your own values in the battery life tool and read more about the concepts in the mAh and battery capacity guide.

Mode and intervalAverage currentApproximate runtime on a 3000 mAh 18650
Sketch 1, always awake≈ 120 mA≈ 21 hours
Sketch 2, 1 minute≈ 12.3 mA≈ 8.7 days
Sketch 2, 5 minutes≈ 6.5 mA≈ 16 days
Sketch 2, 15 minutes≈ 5.5 mA≈ 19 days
Sketch 2, 60 minutes≈ 5.1 mA≈ 21 days
The table shows something important: beyond 5 minutes a longer interval hardly increases battery life, because most of the energy goes into the sleep current. If you need more runtime, lower the sleep current: remove the board's power LED, use a regulator with low quiescent current, or top up the cell during the day with a solar panel and a TP4056 charging module.

Turning the photos into a video on your computer

When shooting is done, power off the ESP32-CAM, put the microSD card into your computer and copy the /tl folder. Because the files are numbered as 00001.jpg, 00002.jpg and so on, the free and open-source ffmpeg tool turns them into a video with a single command. Change to that folder in a terminal and run the command below: -framerate 30 uses 30 photos per second, -crf 20 balances good quality and a reasonable file size (lower means better quality), and -pix_fmt yuv420p makes the video play smoothly on phones and social media. If the numbering does not start at 00001 because of the Preferences counter, give the first number with -start_number.

Code
1# Fotoğrafları 30 fps MP4 videoya çevir / turn the photos into a 30 fps MP4 video
2ffmpeg -framerate 30 -i %05d.jpg -c:v libx264 -pix_fmt yuv420p -crf 20 timelapse.mp4
3
4# Sıra 00001'den başlamıyorsa (ör. 01250) / if the sequence does not start at 00001 (e.g. 01250)
5ffmpeg -framerate 30 -start_number 1250 -i %05d.jpg -c:v libx264 -pix_fmt yuv420p -crf 20 timelapse.mp4
6
7# Parlaklık titremesini azalt ve 1080p'ye küçült / reduce flicker and scale to 1080p
8ffmpeg -framerate 30 -i %05d.jpg -vf "deflicker,scale=-2:1080" -c:v libx264 -pix_fmt yuv420p -crf 20 timelapse_1080p.mp4

On cloudy days auto exposure makes small brightness jumps from frame to frame; the deflicker filter smooths out this flicker. If you want a smoother video try 24 fps, for a faster one 60 fps: the same 1440 photos last 60 seconds at 24 fps and 24 seconds at 60 fps. If you prefer not to use the command line, any video editor that can import an image sequence will do; just make sure each photo lasts exactly one frame.

Tips for a better ESP32-CAM timelapse

  • Fix the camera in place: even a millimetre of movement shows up as a shake in the video; mount the board with a screw or clamp and route the cable so it cannot pull.
  • If you shoot through a window, bring the lens close to the glass and cover the back with a dark cloth to block reflections from the room.
  • Outdoors, put silica gel in the enclosure; morning condensation fogs the lens and ruins dozens of frames.
  • If you want the date and time, get the time with NTP on the first boot; the ESP32's RTC timer keeps counting through deep sleep, so you can put the date in the file name.
  • For long shoots, FAT32 allows at most 65,534 entries per folder and folder scans slow down as the file count grows; empty the card every few weeks or change the folder name.
  • For motion-triggered shots, have a look at the PIR and bird box ideas in the ESP32-CAM projects article.

Common errors and how to fix them

SymptomLikely causeFix
Camera init failed with error 0x105PSRAM disabled, wrong board selected or loose camera ribbonSelect AI Thinker ESP32-CAM, set PSRAM to Enabled, reseat the ribbon
No microSD / Card Mount FailedCard is exFAT, larger than 32 GB or has a contact problemFormat the card as FAT32 and use 32 GB or smaller
First photos are green or darkAuto exposure has not settled yetDiscard the first 2–3 frames as the code does
Flash LED lights up on every shotSD card in 4-bit mode, GPIO4 is a data lineUse 1-bit mode with SD_MMC.begin("/sdcard", true)
Interval a few seconds longer than setAwake time and drift of the internal RC oscillatorUse the sketch that subtracts awake time; accept a few percent of drift on long shoots
Brownout and constant restartsWeak power supply or thin cableUse a 5 V / 2 A adapter and a short, thick cable
ffmpeg cannot find the filesPattern or start number does not matchCheck the %05d pattern and the -start_number value

An ESP32-CAM timelapse is a fun project that turns a cheap board into a camera running on its own for weeks; if you choose the right interval and work out card capacity and battery life in advance, there are no surprises. If you want to try deep sleep, microSD logging and Wi-Fi basics one by one, the BlueGrays app has step-by-step circuit diagrams and code for ESP32 deep sleep, microSD data logger and NTP clock projects.

Frequently asked questions

How do you make a timelapse with the ESP32-CAM?

You upload a sketch to the ESP32-CAM that takes a photo at a fixed interval and saves it to the microSD card as a numbered JPEG. When shooting is finished, you copy the photos to a computer and join them into a 30 fps video with a tool such as ffmpeg.

What is the largest microSD card the ESP32-CAM supports?

With the Arduino core the most reliable results come from FAT32 cards up to 32 GB. Cards of 64 GB and above usually come as exFAT; to use them you first have to format them as FAT32.

How long does an ESP32-CAM run on a battery?

In always-on mode a 3000 mAh 18650 cell lasts about one day. With deep sleep and one photo every 5 minutes it can run for 2–3 weeks depending on the board's sleep current; the sleep current is what mostly decides the runtime.

Why does the ESP32-CAM flash LED turn on?

The flash LED is connected to GPIO4, which the microSD card uses as a data line in 4-bit mode, so the LED blinks on every write. If you open the card in 1-bit mode with SD_MMC.begin("/sdcard", true) and keep GPIO4 LOW, the LED stays off.

How do you turn the photos into a video?

The easiest way is the command ffmpeg -framerate 30 -i %05d.jpg -c:v libx264 -pix_fmt yuv420p timelapse.mp4. You can get the same result with a video editor that imports image sequences by giving each photo a duration of one frame.

What interval should I use for a timelapse?

For fast-changing scenes such as clouds and traffic 2–5 seconds works well, for a sunset 5–10 seconds, and for slow events like plant growth and construction 5–15 minutes. To work out the video length in advance, divide the number of photos by the fps.

See all projects
ESP32 Deep Sleep — Battery Saving (OLED + RTC RAM Counter)
ES-33Advanced
Premium

ESP32 Deep Sleep — Battery Saving (OLED + RTC RAM Counter)

The ESP32's Deep Sleep mode shuts down the CPU and most peripherals, cutting current draw to about 10µA, which is vital for battery-powered IoT devices. This project uses three wake-up sources: a timer (15 s), an external pin (EXT0, the button on GPIO 33) and a touch pin (T0/GPIO 4). Counters marked with RTC_DATA_ATTR survive deep sleep.

4.3(10)
17
ESP32 Temperature Data Logger (DHT22 + DS1307 RTC + microSD + OLED)
ES-40Advanced
Premium

ESP32 Temperature Data Logger (DHT22 + DS1307 RTC + microSD + OLED)

Build a timed temperature and humidity logger with the ESP32! A DHT22 sensor reads temperature and humidity once a minute, and each reading is saved to a microSD card in CSV format with a real-time stamp from the DS1307 RTC module. The OLED display shows the latest temperature, humidity, timestamp and total number of records live, in large text.

4.7(7)
12
LED Blink with ESP32
ES-1Beginner

LED Blink with ESP32

Teaches basic GPIO output usage with ESP32. We achieve a blinking effect by turning an LED on and off from a digital pin. ESP32 version of the classic blink project on Arduino UNO; the basic blink commands in the Arduino environment are the same, but the ESP32's pin layout and 3.3 V GPIO levels differ from those of the Arduino UNO.

4.7(38)
114
ESP32 Built-in LED Blink
ES-4Beginner

ESP32 Built-in LED Blink

Blinking the built-in blue LED on the ESP32 DevKit V1. No external components required! The first project you should try when you buy an ESP32. GPIO 2 is connected to the built-in LED.

4.8(29)
55
ESP32 Wi-Fi STA Connection (with LCD Screen)
ES-25Advanced

ESP32 Wi-Fi STA Connection (with LCD Screen)

In this project, we connect the ESP32 to the home Wi-Fi network in Station (STA) mode in a secure, fault-tolerant manner. We store the SSID and password in a separate secrets.h file to prevent leaking to Git, set up an auto-reconnect mechanism, and display the RSSI signal level and IP address on an I2C LCD screen. The internal LED works as a status indicator. It is a production-grade connection manager.

4.4(21)
40
Real-Time Clock from the Internet via ESP32 NTP
ES-26Advanced
Premium

Real-Time Clock from the Internet via ESP32 NTP

The ESP32 connects to Wi-Fi and fetches the real time from NTP (Network Time Protocol) servers with millisecond precision. configTzTime() applies the Turkey time zone (TRT, UTC+3) automatically, and in countries with daylight saving time the DST switch is handled by a POSIX TZ string. The time is printed both to the Serial Monitor and to an optional I2C LCD.

4.5(13)
22
ESP32 Asynchronous Web Server (with IP Display on LCD)
ES-27Advanced

ESP32 Asynchronous Web Server (with IP Display on LCD)

In this project, we’re turning the ESP32 into an asynchronous web server that you can control from your phone or computer on the same Wi-Fi network. Thanks to the ESPAsyncWebServer library, the server can process multiple requests simultaneously (unlike the classic WebServer.h, which blocks on a single request). You’ll be able to open the ESP32’s IP address in a browser and click the ON/OFF buttons (the /on and /off routes) to turn the LED connected to GPIO 5 on and off.

4.8(16)
27