ESP32 AI Camera: What It Is, Boards, Setup and Pitfalls

What is an ESP32 AI camera?
There is no single product called the "ESP32 AI camera". When people search for it they usually mean one of two things, and it helps to separate them early.
The first meaning is an ESP32 board with a camera sensor attached. The best-known example is the ESP32-CAM made by AI Thinker, which carries an OV2640 sensor. Note that the "AI" here is simply part of the board name; in the sources this board is used as a plain JPEG streaming camera and a camera-to-TFT viewer, not as a machine-learning device.
The second meaning is running machine learning on the camera board itself — what the maker community calls TinyML. Here the standout example is the Seeed Studio XIAO ESP32S3 Sense. It bundles a detachable OV2640 camera, a digital microphone and an SD card slot on a 21 x 17.5 mm board, and the accompanying tutorials walk through image classification and object detection running directly on the ESP32-S3.
Underneath both is the ESP32 family from Espressif: low-cost microcontrollers with Wi-Fi and Bluetooth, built on either Xtensa LX6/LX7 cores or RISC-V. The S3 variant with its dual-core Xtensa processor up to 240 MHz and external PSRAM is what makes on-device vision practical. The original ESP32 in the ESP32-CAM is fine for capturing and shipping frames to something more powerful over Wi-Fi.
\2Seeed Studio XIAO ESP32S3 Sense with its detachable OV2640 camera module and microphone expansion board.
Which ESP32 camera module should I use for AI?
The two boards that appear in the sources cover the two use cases well.
| ESP32-CAM AI Thinker | XIAO ESP32S3 Sense | |
|---|---|---|
| Chip | Original ESP32 | ESP32-S3, dual-core Xtensa, up to 240 MHz |
| Camera | OV2640 (fixed) | Detachable OV2640, 1600x1200; OV5640 compatible |
| Memory | Not stated in sources | 8 MB PSRAM + 8 MB flash |
| Storage | SD slot (shares GPIO 12/13/14/15/2/4) | SD slot, up to 32 GB FAT |
| Other I/O | Flash LED on GPIO 4, GPIO 16 free | Digital microphone, battery charging |
| Wireless | Wi-Fi + Bluetooth | 2.4 GHz Wi-Fi + BLE, 100 m+ with U.FL antenna |
| Power | Prone to brownouts (see pitfalls) | Deep sleep down to 14 uA |
| Size | Larger module | 21 x 17.5 mm |
| Best for | Wi-Fi streaming, multi-camera setups | On-device TinyML: image classification, object detection, keyword spotting |
If your goal is "esp32 camera with AI" in the literal sense — a model running on the board — the XIAO ESP32S3 Sense is the one the tutorials target. Its 8 MB PSRAM is the key resource for holding frames and model buffers. If you just want many cheap cameras feeding a central server (one source describes a 30-camera home surveillance setup), the ESP32-CAM AI Thinker is still the usual choice, with the "AI" happening on the server.
A useful add-on for the XIAO is Seeed's Round Display: a 1.28-inch, 240x240, 65k-colour touch screen with an RTC holder, charge chip and TF card slot. The example sketch camera_round_display_save_jpeg in the Mjrovai repo uses it to preview and save JPEGs to the card — a convenient way to collect training images in the field.
\2Seeed Round Display for XIAO: a 1.28-inch 240x240 touch screen with TF card slot used for previewing and saving camera images.
How does the camera connect to the ESP32?
Camera sensors talk to the ESP32 over one of a few interfaces, and the one you get depends on the chip. According to the ESP-IDF camera controller driver documentation, the family supports:
- MIPI CSI — a high-speed serial camera interface, on chips that have it.
- ISP DVP — a parallel digital video port routed through the Image Signal Processor.
- LCD_CAM DVP — a parallel DVP port handled by the LCD_CAM peripheral.
The OV2640 on the ESP32-CAM and XIAO Sense is a parallel DVP sensor: you wire eight data lines plus pixel clock, VSYNC, HREF and an I2C-style control pair. The pin map for the AI Thinker board, as used in one of the sources, is:
| Signal | GPIO |
|---|---|
| PWDN | 32 |
| RESET | -1 (not used) |
| XCLK | 0 |
| SIOD / SIOC | 26 / 27 |
| Y9..Y2 (data) | 35, 34, 39, 36, 21, 19, 18, 5 |
| VSYNC | 25 |
| HREF | 23 |
| PCLK | 22 |
On newer chips with MIPI CSI or ISP DVP, ESP-IDF requires you to create an ISP processor handle with esp_isp_new_processor before creating the camera controller, even if you do not want any image processing; a bypass_isp option lets you skip the pipeline. The ISP itself provides hardware stages including black level correction, dead pixel correction, Bayer noise filtering, lens shading correction, demosaic, white balance gain, colour correction matrix, gamma, sharpening and crop, plus statistics for auto focus, auto white balance, auto exposure and histograms. The CSI peripheral also needs a stable 2.5 V supply, which on supported chips can come from the internal adjustable LDO.
For the 8-bit DVP path the docs recommend keeping the CAM_PCLK frequency below 80 MHz, and the driver can convert between YUV and RGB in hardware.
\2Collecting training images on the XIAO ESP32S3 Sense with the camera_round_display_save_jpeg sketch.
How do I get started with an ESP32 camera and AI?
The practical path, based on what the sources support:
1. Pick the board for the job. For on-device models, start with the XIAO ESP32S3 Sense. It is supported in Arduino and MicroPython, and Seeed's wiki has a getting-started page. For a streaming camera, the ESP32-CAM AI Thinker is well trodden.
2. Get frames out first. Before thinking about models, prove that you can capture an image. In Arduino the camera API comes from esp_camera.h; the ESP32-CAM project in the sources also pulls in two headers to work around power brownouts:
#include "esp_camera.h"
#include "soc/soc.h" // Disable brownout problems
#include "soc/rtc_cntl_reg.h" // Disable brownout problems
If you are using ESP-IDF on a chip with MIPI CSI, the controller is configured with a struct and created in one call:
esp_cam_ctlr_csi_config_t csi_config = {
.ctlr_id = 0,
.input_data_color_type = CAM_CTLR_COLOR_RAW8,
.output_data_color_type = CAM_CTLR_COLOR_RGB565,
.data_lane_num = 2,
.queue_items = 1,
};
esp_cam_ctlr_handle_t handle = NULL;
ESP_ERROR_CHECK(esp_cam_new_csi_ctlr(&csi_config, &handle));
3. Collect a dataset on the device. The Mjrovai XIAO-ESP32S3-Sense repository contains the code for the TinyML tutorials, and the camera_round_display_save_jpeg sketch is intended for data collection — you see the live image on the round display and save JPEGs to the SD card.
4. Follow the tutorials. The same repository links to step-by-step guides for Image Classification and Object Detection on the XIAO ESP32S3 Sense, as well as Keyword Spotting using the onboard microphone and motion classification with an accelerometer. Working through the image classification one first is the gentlest introduction to the capture-train-deploy loop.
5. Decide where inference happens. If the model does not fit the board, the fallback is the ESP32-CAM approach: stream JPEGs over Wi-Fi and let a server do the heavy lifting.
How fast can an ESP32 camera actually run?
Expectations matter. One source measured an ESP32-CAM AI Thinker (original ESP32, OV2640) pushing 240x240 frames to an ST7789 TFT over SPI, with no Wi-Fi or SD activity:
| Operation | Frames per second | Time per frame |
|---|---|---|
| Capture RGB565 only | 12.71 | 78.68 ms |
| Capture RGB565 and push to screen | 12.52 | 79.87 ms |
| Capture JPEG only | 50.97 | 19.62 ms |
| Capture JPEG and decode | 22.35 | 44.74 ms |
| Capture JPEG, decode, push to screen | 13.34 | 74.96 ms |
Two lessons follow. First, the sensor delivers JPEG far faster than raw RGB on this hardware, so if you only need to forward frames, JPEG is the format to use. Second, the moment the ESP32 has to touch pixels — decoding, drawing, and by extension running a neural network — the frame rate collapses to roughly a dozen frames per second or less. On-device AI on an ESP32 is therefore a low-frame-rate affair, which is fine for "is there a person at the door" but not for tracking fast motion.
The author of that test suspected DMA on the SPI bus and use of the second core could help; the sources do not report whether that reached the 30 fps target.
What are the common pitfalls with ESP32 AI cameras?
Assuming "AI Thinker" means AI. The ESP32-CAM AI Thinker is a camera board from a company called AI Thinker. In the sources it streams JPEG and drives a TFT; nothing about it implies built-in machine learning.
One viewer at a time. The simple web server on an ESP32-CAM serves a JPEG stream (content type image/jpeg), and a second browser tab will hang until the first disconnects. A maker running 30 cameras solved this with a re-streamer: one process per camera reads the stream and publishes frames to Redis pub/sub, and the dashboard reads from there. Plan for a middle layer if more than one client needs the feed.
Brownouts. The ESP32-CAM project in the sources explicitly includes soc/soc.h and soc/rtc_cntl_reg.h to disable brownout detection, a sign that the camera plus radio can dip the supply. Use a solid power source.
Pin conflicts. On the AI Thinker board the SD card uses GPIO 14, 15, 2, 4, 12 and 13, while GPIO 4 also drives the flash LED. The TFT example reused GPIO 12 and 13 for SCLK and DC — which only works because the SD card was not in use. Only GPIO 4 and 16 are genuinely free when both camera and SD are active.
Picking RGB when you wanted speed. As the table above shows, raw RGB565 capture ran at about 13 fps versus 51 fps for JPEG on the same board.
Forgetting the ISP on newer chips. With MIPI CSI or ISP DVP in ESP-IDF, the ISP driver must be installed even if you do not need its functions; set bypass_isp if you want it out of the way. The CSI block also needs a 2.5 V supply.
SD card limits. The XIAO ESP32S3 Sense supports external cards up to 32 GB formatted as FAT; larger cards are not covered by the stated spec.
Frequently asked questions
Does the ESP32-CAM AI Thinker run AI models?
Not in the sources. "AI Thinker" is the board maker's name. The board is used to stream JPEG over Wi-Fi or push frames to a TFT; on-device ML examples target the ESP32-S3-based XIAO ESP32S3 Sense instead.
Which ESP32 is best for a camera with AI?
The XIAO ESP32S3 Sense is the board used in the TinyML image classification and object detection tutorials. It has a dual-core ESP32-S3 at up to 240 MHz, 8 MB PSRAM, 8 MB flash and a detachable OV2640 camera.
Can several people watch an ESP32 camera stream at once?
Not directly — the simple on-board web server handles one connection, so a second viewer waits until the first disconnects. A re-streamer on a PC or server that reads each camera once and republishes (for example via Redis pub/sub) solves it.
What resolution does the ESP32 camera give?
The OV2640 on the XIAO ESP32S3 Sense is rated for 1600x1200, and the board is also compatible with an OV5640 sensor.
Can I program an ESP32 AI camera in MicroPython?
MicroPython is one of the listed ESP32 languages, and Seeed states the XIAO ESP32S3 Sense supports both Arduino and MicroPython. The TinyML tutorials in the sources use Arduino.
An ESP32 AI camera is a realistic weekend project if you choose the right board for the job: the XIAO ESP32S3 Sense for running small vision models on-device, or the ESP32-CAM AI Thinker for cheap JPEG streaming to a server that does the thinking. Keep expectations modest on frame rate, give the board clean power, and plan for a re-streamer if more than one client needs the feed.
Sources
en.wikipedia.orgESP32 (Wikipedia)github.comCamera Controller Driver (esp-idf docs)github.comImage Signal Processor (ISP) (esp-idf docs)stackoverflow.comRe-streaming of ESP32 JPEG video streamelectronics.stackexchange.comHow can I get higher fps with ESP32-CAM and ST7789 TFT LCD?github.comMjrovai/XIAO-ESP32S3-Sense (GitHub README)This guide summarises the public sources listed above in our own words. Check the original documentation before relying on exact figures.


