ESP32 DevKit V1 Pinout: Every Pin on the 30-Pin Board, Explained

Last updated: 2026-11-22

The ESP32 DevKit V1 pinout has 30 pins in two rows of 15, with 25 usable GPIOs: 21 inputs and outputs plus 4 input-only pins. Start with GPIO 4, 13, 16, 17, 18, 19, 21, 22, 23, 25, 26, 27, 32, and 33, which have no boot role and nothing pulling them. Avoid GPIO 1 and 3, which carry USB serial. Watch the strapping pins GPIO 2, 5, 12, and 15, which decide whether the board boots. Wire analog sensors to the ADC1 pins GPIO 32, 33, 34, 35, 36, and 39, because the ADC2 pins stop working with WiFi on.

Every pin number below was checked twice, against the Espressif DevKitC V4 header tables and the DOIT board tables, and the strapping rules come from the Espressif ESP32 Series Datasheet v5.3.

Table of contents

Which board is this guide for?

This guide is for the ESP32 DevKit V1, the 30-pin DOIT board built around an ESP32-WROOM-32 module. It carries a dual-core Xtensa LX6 chip at 240 MHz, WiFi 802.11 b/g/n at 2.4 GHz, Bluetooth 4.2 and BLE, 520 KB of SRAM, and 4 MB of SPI flash. It has a Micro-USB port, a USB-to-serial chip, an AMS1117-3.3 regulator, and EN and BOOT buttons.

Count the pins before you trust any pinout. This board has 30 pins in two rows of 15. The 38-pin ESP32-DevKitC is a different board: it breaks out the flash pins GPIO 6 to 11 and the BOOT pin GPIO 0. If your board says DevKit V1, DOIT, NodeMCU-32, or ESP32 30-pin, this guide is for your board.

Clones are everywhere, and most follow the same DOIT design. What changes is the USB-to-serial chip (CP2102 on the original, CH340 or CH9102 on clones), the module revision (WROOM-32, 32D, or 32E), and the USB connector (Micro-USB or USB-C). The GPIO numbers never change, but on rare clones the last few power pins sit in a different order, so read the silkscreen on your own board.

What is the full ESP32 DevKit V1 pinout?

Hold the board with the antenna at the top and the USB port at the bottom. The left header runs from EN to VIN, and the right header runs from D23 to 3V3. In Arduino code you always use the GPIO number: D23 is GPIO 23. VP and VN are GPIO 36 and 39, TX0 and RX0 are GPIO 1 and 3, and TX2 and RX2 are GPIO 17 and 16.

Left header, top to bottom

Silkscreen GPIO Main functions Watch out for
EN – Reset Active LOW, 10k pull-up
VP 36 ADC1_CH0 Input only, no pull-ups
VN 39 ADC1_CH3 Input only, no pull-ups
D34 34 ADC1_CH6 Input only, no pull-ups
D35 35 ADC1_CH7 Input only, no pull-ups
D32 32 ADC1_CH4, Touch 9 Safe pin, ADC1 with WiFi
D33 33 ADC1_CH5, Touch 8 Safe pin, ADC1 with WiFi
D25 25 ADC2_CH8, DAC1 ADC2 stops with WiFi
D26 26 ADC2_CH9, DAC2 ADC2 stops with WiFi
D27 27 ADC2_CH7, Touch 7 ADC2 stops with WiFi
D14 14 ADC2_CH6, Touch 6, HSPI clock Signal at boot, avoid relays
D12 12 ADC2_CH5, Touch 5, HSPI MISO Strapping, must be LOW at reset
D13 13 ADC2_CH4, Touch 4, HSPI MOSI Safe pin
GND – Ground Common ground
VIN – 5 V to 12 V input About 4.7 V on USB

Right header, top to bottom

Silkscreen GPIO Main functions Watch out for
D23 23 VSPI MOSI Safe pin
D22 22 I2C SCL I2C clock
TX0 1 UART0 TX USB serial
RX0 3 UART0 RX USB serial
D21 21 I2C SDA I2C data
D19 19 VSPI MISO Safe pin
D18 18 VSPI clock Safe pin
D5 5 VSPI chip select Strapping, HIGH at reset
TX2 17 UART2 TX Safe pin
RX2 16 UART2 RX Safe pin
D4 4 ADC2_CH0, Touch 0 ADC2 stops with WiFi
D2 2 ADC2_CH2, Touch 2, onboard LED Strapping, LOW or floating at reset
D15 15 ADC2_CH3, Touch 3, HSPI chip select Strapping, HIGH at reset
GND – Ground Common ground
3V3 – 3.3 V output or input Regulator output

Not on the headers: GPIO 0 is the BOOT button, GPIO 6 to 11 run the module SPI flash, and GPIO 37 and 38 are not bonded out.

Which pins are safe to use first?

The safest pins are the 14 GPIOs with no boot role and nothing on the board pulling them: GPIO 4, 13, 16, 17, 18, 19, 21, 22, 23, 25, 26, 27, 32, and 33. Use these first for buttons, LEDs, sensors, and relays.

GPIO 5, 14, and 15 output a signal for a moment at boot, so they suit sensors and status LEDs but not relays, motor drivers, or buzzers. GPIO 34, 35, 36, and 39 are input only. GPIO 2, 5, 12, and 15 are strapping pins, covered below. GPIO 1 and 3 carry USB serial, so avoid them for anything else. A button on GPIO 33, an LED on GPIO 23, and a sensor on GPIO 32 cannot go wrong.

Which pins are input only?

GPIO 34, 35, 36, and 39 are input only. They have no output driver, so digitalWrite does nothing on them, and they have no internal pull-up or pull-down resistors, so a floating pin reads random values. The silkscreen calls GPIO 36 VP and GPIO 39 VN.

Use these four pins for analog input and for buttons with an external resistor. They are all ADC1 pins, so they keep working with WiFi on: VP is ADC1 channel 0, VN is channel 3, D34 is channel 6, and D35 is channel 7. A button here needs a 10k pull-up to 3V3 or a 10k pull-down to ground, because INPUT_PULLUP does nothing here. Do not wire an LED, a relay, or any output to these pins.

Which pins decide whether the board boots?

Five pins decide how the ESP32 boots, and the chip reads them once at reset. After reset they work as normal pins, but the level at reset is latched until the next power cycle. Per the Espressif ESP32 Series Datasheet v5.3, they are GPIO 0, 2, 5, 12, and 15.

Pin Must be at reset What it controls
GPIO 0 (BOOT button) HIGH to run, LOW for download mode Boot mode, with GPIO 2
GPIO 2 (D2) LOW or floating Boot mode, with GPIO 0; onboard blue LED
GPIO 5 (D5) HIGH SDIO slave timing
GPIO 12 (D12) LOW Flash voltage: LOW is 3.3 V, HIGH is 1.8 V
GPIO 15 (D15) HIGH Boot log on UART0: HIGH prints, LOW silences

GPIO 0 and GPIO 2 together select the boot mode. GPIO 0 HIGH boots from flash and runs your sketch. GPIO 0 LOW with GPIO 2 LOW means joint download boot mode, which is how the Arduino IDE uploads over USB. The DOIT schematic holds GPIO 0 HIGH, pulls GPIO 2 LOW, and pulls GPIO 5 HIGH with 10k resistors, so the board boots normally out of the box.

GPIO 12 is the one that catches people. It is the MTDI pin, and it selects the flash voltage at reset. The WROOM-32 flash runs at 3.3 V, so GPIO 12 must be LOW at reset. Pull it HIGH and the chip selects 1.8 V, and the board will not boot. Never wire a pull-up resistor or a sensor that drives HIGH to D12.

To enter download mode by hand, hold BOOT, press and release EN, then release BOOT. You rarely need to: the auto-reset circuit does it when the Arduino IDE starts an upload.

Which pins are taken by USB and flash?

GPIO 1 and GPIO 3 are UART0, the serial port wired to the USB-to-serial chip. TX0 (GPIO 1) sends the boot log and your Serial prints to the computer, and RX0 (GPIO 3) receives uploads. The USB chip shares these lines through 1k resistors, so anything else wired to TX0 or RX0 fights it. Do not use GPIO 1 or 3 for sensors, buttons, or LEDs. For a second serial port, use UART2 on TX2 and RX2 (GPIO 17 and 16), or remap UART1 to two free pins.

GPIO 6 to 11 are wired to the SPI flash chip inside the WROOM-32 module. They are not broken out on the 30-pin headers: connecting anything to a flash pin corrupts flash reads and the board will not boot.

How do the ADC pins work?

The ESP32 has two 12-bit analog to digital converters, ADC1 and ADC2, with 18 channels between them. A 12-bit reading runs from 0 to 4095. The headers carry 15 ADC pins: 6 on ADC1 and 9 on ADC2. The ADC is not linear near the rails, so readings compress near 0 V and near 3.3 V.

The rule that matters most: ADC2 stops working while WiFi is on. The WiFi driver takes over ADC2, so an analogRead on an ADC2 pin returns garbage or fails while the radio runs. ADC1 keeps working with WiFi on, so wire the sensor to an ADC1 pin when the project uses WiFi.

ADC unit Header pins Channels Works with WiFi
ADC1 VP (36), VN (39), D34, D35, D32, D33 CH0, CH3, CH6, CH7, CH4, CH5 Yes
ADC2 D4, D2, D15, D13, D12, D14, D27, D25, D26 CH0, CH2, CH3, CH4, CH5, CH6, CH7, CH8, CH9 No

GPIO 0 is ADC2 channel 1 and GPIO 37 and 38 are ADC1 channels 1 and 2, but none of the three is on the headers.

Where are the DAC and touch pins?

The ESP32 has two 8-bit digital to analog converters, DAC1 on GPIO 25 (D25) and DAC2 on GPIO 26 (D26). An 8-bit DAC writes values from 0 to 255 and outputs a true analog voltage, not a PWM square wave. Use dacWrite in Arduino code. Both DAC pins are also ADC2 pins, so do not read them as analog inputs with WiFi on.

The ESP32 has 10 capacitive touch channels, and nine sit on the headers: T0 on D4, T2 on D2, T3 on D15, T4 on D13, T5 on D12, T6 on D14, T7 on D27, T8 on D33, and T9 on D32. T1 is GPIO 0, the BOOT button, so it is not available as a touch pin here. Read a touch pin with touchRead in Arduino code. A touch pin reads lower when a finger is near it, and the threshold depends on the wire length and the board layout, so calibrate it in your sketch.

Which pins do I2C, SPI, and UART use?

The ESP32 routes peripherals through a GPIO matrix, so I2C, SPI, and UART can move to almost any free pin. The table below gives the defaults.

Bus Default pins on this board Notes
I2C (Wire) SDA D21, SCL D22 Needs pull-ups
VSPI MOSI D23, MISO D19, clock D18, chip select D5 Arduino default
HSPI MOSI D13, MISO D12, clock D14, chip select D15 Second SPI bus
UART0 (Serial) TX TX0 (GPIO 1), RX RX0 (GPIO 3) USB serial
UART2 TX TX2 (GPIO 17), RX RX2 (GPIO 16) Free second port
UART1 No fixed pins Remap to free pins

I2C needs pull-up resistors on SDA and SCL; most sensor boards include them, but if your bus hangs, check for them first. SPI chip select is D5 for VSPI, and D5 is a strapping pin that must be HIGH at reset, so do not pull it LOW with a sensor that drives the line at boot. For HSPI the chip select is D15 and the MISO line is D12, both strapping pins, so VSPI is the safer default.

UART1 has no usable default pins here: its hardware defaults are GPIO 9 and 10, which are flash pins. For a third serial port, call Serial1.begin with explicit RX and TX pins on two safe GPIOs. In the Arduino-ESP32 core 3.x, Serial1 defaults to RX GPIO 26 and TX GPIO 27, and Serial2 defaults to RX GPIO 4 and TX GPIO 25. Set them explicitly so a core update cannot move them.

Can every pin do PWM?

Every output-capable pin on the ESP32 DevKit V1 can do PWM through the LEDC peripheral, which has 16 channels. There is no fixed list of PWM pins. Pick any pin from the safe list, attach it to an LEDC channel with ledcAttach, and set the duty. The 4 input-only pins cannot do PWM, because they cannot drive an output.

GPIO 5, 14, and 15 output a signal for a moment at boot. A sensor or a status LED on these pins is fine, but a relay, a motor driver, or a buzzer wired here can switch on briefly at every reset. If your project drives something that must stay off at boot, use a safe pin.

How do you power the DevKit V1?

The DevKit V1 takes power from exactly one source at a time: Micro-USB at 5 V, VIN at 5 V to 12 V, or 3V3 at a regulated 3.3 V. Using more than one at once can damage the board or the power supply.

USB power reaches VIN through an SS14 Schottky diode, so VIN reads about 4.7 V when the board runs from USB, and a supply on VIN cannot back-feed your computer. The AMS1117-3.3 regulator is a 1 A class part with about 1.1 V of dropout, so VIN needs at least about 4.5 V. The 3V3 pin can power small sensors and logic, but budget it at a few hundred mA.

Every pin on this board is 3.3 V logic only. No pin is 5 V tolerant. A 5 V sensor output wired straight to a GPIO pin will damage the input, so use a level shifter or a voltage divider for 5 V sensors. Never power a servo or a motor from a GPIO pin or from the 3V3 rail: they need their own power supply with a shared ground. Battery power, charging, protection, and run-time math are covered in How to Power ESP32 and Arduino Projects on LiPo Power.

How do you test the pins?

This sketch tests three pins at once: the onboard blue LED on D2, a potentiometer on D32, and a button on D33. Wire the potentiometer wiper to D32 with its ends to 3V3 and GND, and wire a push button between D33 and GND; the button needs no resistor because the sketch uses the internal pull-up on D33. Open the Serial Monitor at 115200 baud: the ADC reading on D32 runs from 0 to 4095 as you turn the pot, and the button lights the LED.

// ESP32 DevKit V1 pin test: onboard LED, ADC1 potentiometer, button.
// Arduino-ESP32 core, built-in libraries only. No extra libraries needed.
// Board: DOIT ESP32 DevKit V1, 30-pin, ESP32-WROOM-32.
// Wiring: potentiometer wiper to D32, ends to 3V3 and GND.
//         push button between D33 and GND (internal pull-up, no resistor).
#include <Arduino.h>

const int LED_PIN = 2;      // D2, blue onboard LED. Strapping pin, LOW or floating at boot.
const int POT_PIN = 32;     // D32, ADC1_CH4. ADC1 keeps working with WiFi on.
const int BUTTON_PIN = 33;  // D33, ADC1_CH5. Safe pin, internal pull-up.

void setup() {
  Serial.begin(115200);
  delay(1000);
  pinMode(LED_PIN, OUTPUT);
  pinMode(BUTTON_PIN, INPUT_PULLUP);
  analogReadResolution(12);  // 12-bit ADC: readings 0 to 4095.
  Serial.println("ESP32 DevKit V1 pin test running.");
  Serial.println("Turn the pot on D32, press the button on D33.");
}

void loop() {
  int pot = analogRead(POT_PIN);
  bool pressed = digitalRead(BUTTON_PIN) == LOW;
  digitalWrite(LED_PIN, pressed ? HIGH : LOW);
  Serial.print("D32 ADC: ");
  Serial.print(pot);
  Serial.print("  D33 button: ");
  Serial.println(pressed ? "pressed" : "released");
  delay(500);
}

The sketch uses only the built-in Arduino-ESP32 core, and it compiles with PlatformIO on esp32dev. If the upload fails, hold BOOT, press and release EN, then release BOOT to force download mode. If the Serial Monitor shows nothing, check the USB cable: a charge-only cable carries power but no data.

What mistakes do people make?

First, wiring an analog sensor to an ADC2 pin and turning on WiFi. The reading goes wrong the moment the radio starts. Wire analog sensors to the ADC1 pins VP, VN, D34, D35, D32, and D33 with WiFi on.

Second, pulling GPIO 12 HIGH at boot. D12 selects the flash voltage, and HIGH selects 1.8 V, but the WROOM-32 flash runs at 3.3 V, so the board will not boot. Keep D12 LOW at reset.

Third, using GPIO 1 and 3 for a sensor or a button. TX0 and RX0 carry USB serial, and anything wired there fights the USB chip and breaks uploads.

Fourth, wiring an output to an input-only pin. GPIO 34, 35, 36, and 39 cannot drive an LED or a relay, and a button here needs an external resistor.

Fifth, trusting the chip GPIO count instead of the board pinout. The ESP32 chip has 34 GPIOs, but this board breaks out 25. Check the board pinout before you wire anything.

Frequently asked questions

How many pins does the DevKit V1 have?

The ESP32 DevKit V1 has 30 pins in two rows of 15, with 25 usable GPIOs: 21 inputs and outputs plus 4 input-only pins (GPIO 34, 35, 36, and 39). GPIO 0 is the BOOT button, GPIO 6 to 11 run the SPI flash, and GPIO 37 and 38 are not bonded out.

Which pins are safe to use?

GPIO 4, 13, 16, 17, 18, 19, 21, 22, 23, 25, 26, 27, 32, and 33 are the safest pins: no strapping role and nothing on the board pulling them. Use these first for buttons, LEDs, sensors, and relays. Avoid GPIO 1 and 3, which carry USB serial.

What are the strapping pins?

The strapping pins are GPIO 0, 2, 5, 12, and 15, per the Espressif ESP32 Series Datasheet v5.3. At reset, GPIO 0 must be HIGH to run and LOW to enter download mode, GPIO 2 must be LOW or floating, GPIO 5 must be HIGH, GPIO 12 must be LOW for 3.3 V flash, and GPIO 15 must be HIGH to print the boot log.

Can I use ADC pins with WiFi on?

Yes, but only the ADC1 pins: VP (GPIO 36), VN (GPIO 39), D34, D35, D32, and D33. ADC2 covers D4, D2, D15, D13, D12, D14, D27, D25, and D26, and it stops working while WiFi runs. With WiFi on, wire the sensor to an ADC1 pin.

Is the DevKit V1 5 V tolerant?

No. Every pin on the ESP32 DevKit V1 is 3.3 V logic only, and no pin is 5 V tolerant. A 5 V sensor output wired straight to a GPIO pin will damage the input, so use a level shifter or a voltage divider for 5 V sensors. Power the board from USB at 5 V, from VIN at 5 V to 12 V, or from a regulated 3.3 V supply on the 3V3 pin.

Parts used in this guide

The board and the bench parts below are in stock in the store. The DevKit V1 programs over a Micro-USB data cable, so use a cable that carries data, not a charge-only cable.

In this series

This is post 2 of 10 in the ESP32 series. The pillar is Which ESP32 Should I Buy? Pick the Right Board for Your Project. The other spokes are plain text until they publish.

  • Post 1: Which ESP32 Should I Buy? (pillar).
  • Post 2: ESP32 DevKit V1 (30-pin) pinout (this post).
  • Post 3: ESP32-S3 DevKitC-1 pinout.
  • Post 4: ESP32-CAM pinout, boot mode, and flashing.
  • Post 5: ESP32-CAM troubleshooting.
  • Post 6: ESP32-CAM streaming.
  • Post 7: ESP32-CAM on battery.
  • Post 8: ESP-NOW explained.
  • Post 9: Arduino IDE vs PlatformIO vs ESP-IDF vs MicroPython.
  • Post 10: ESP32 not detected over USB.

Sources

  • Espressif ESP32 Series Datasheet v5.3 (2026-07): pin functions, strapping pins Tables 3-1, 3-3, and 3-4, ADC, DAC, touch. https://documentation.espressif.com/esp32_datasheet_en.pdf
  • Espressif ESP32-DevKitC V4 Getting Started Guide: J2 and J3 header tables, power options, flash pin warning. https://documentation.espressif.com/esp-dev-kits/en/latest/esp32/esp32-devkitc/user_guide.html
  • Espressif ESP-IDF GPIO and RTC GPIO docs: ADC channel map, strapping pins, ADC2 and WiFi rule, input-only pins. https://docs.espressif.com/projects/esp-idf/en/v5.2-beta1/esp32/api-reference/peripherals/gpio.html
  • DeepBlueMbedded ESP32 Pinout (DevKit V1 30-Pin DOIT): DOIT header tables, schematic notes, board specs. https://deepbluembedded.com/esp32-pinout-devkit-v1-datasheet-schematic/

LVGL ESP32 Display Guide: Setup, Widgets, Touch

LVGL turns a plain TFT display into a real interface. With TFT_eSPI alone, your code draws pixels, lines, and text by hand. With LVGL on top, you get buttons, sliders, gauges, menus, and touch input.

Short answer: install the LVGL 9 library in the Arduino IDE, set up TFT_eSPI for your display driver, connect the two with a flush callback or the LVGL TFT_eSPI helper, then build your screen from widgets. The worked example uses the 2.4 inch touch ILI9341 module from the store. This draft is written against LVGL 9.x, verified against the LVGL docs and the Random Nerd Tutorials LVGL 9.2 example.

What is LVGL, and when should you use it instead of TFT_eSPI alone?

LVGL stands for Light and Versatile Graphics Library. It is a free and open-source graphics library for microcontrollers, released under the MIT license. It gives you widgets (buttons, labels, sliders, charts, lists, images), layout management, event handling, animations, CSS-like styling, multi-language support with UTF-8, and support for touchpads, mice, keyboards, and encoders. It is written in C. Source: LVGL docs and Random Nerd Tutorials.

LVGL does not drive your display. LVGL renders your interface into a memory buffer, then calls a function you provide, the flush callback, to move those pixels to the screen. The display driver, usually TFT_eSPI on an ESP32 SPI display, does the actual SPI transfer.

Use TFT_eSPI alone when the screen shows fixed text, a simple readout, or a static gauge. Use LVGL when the screen needs buttons, menus, sliders, or screens the user navigates. If you have not installed TFT_eSPI yet, follow our TFT_eSPI setup guide first.

Which LVGL version is this guide written against?

This guide is written against LVGL 9.x. The worked Arduino example follows the Random Nerd Tutorials guide, which installs LVGL version 9.2 from the Arduino Library Manager. The LVGL documentation site currently serves the 9.4 docs.

Item LVGL 8.x LVGL 9.x (this guide)
Display driver lv_disp_drv_t, lv_disp_drv_register lv_display_t, lv_display_create
Draw buffer lv_disp_draw_buf_t Buffers passed to lv_display_create
Flush ready call lv_disp_flush_ready lv_display_flush_ready
Input device lv_indev_drv_t, lv_indev_drv_register lv_indev_t, lv_indev_create
Active screen lv_scr_act() lv_screen_active()
Button create lv_btn_create lv_button_create
Main loop call lv_task_handler lv_timer_handler

Source: LVGL 9 docs and the ElectricalFlux LVGL ESP32-S3 guide.

What do you need before you start?

  • An ESP32 board. This guide uses the ESP32 DevKit V1, the same board as the TFT_eSPI setup guide, because its hardware SPI pins match the library examples.
  • A separate SPI TFT module. The worked examples use the 2.4 inch touch ILI9341 module and the 0.96 inch ST7735 module from the store.
  • The Arduino IDE with the ESP32 board package installed, version 2.x or later.
  • TFT_eSPI installed and configured for your display, per our TFT_eSPI setup guide. A setup that already passes its Colour_Test sketch is the starting point.
  • Jumper wires and a breadboard. Keep the SPI wires short: long wires cause signal problems at full SPI speed.

How do you install LVGL in the Arduino IDE?

Open the Library Manager: Sketch, Include Library, Manage Libraries. Search for “lvgl”, find the entry by kisvegabor, and install version 9.2 or later in the 9.x line. Do not install a version 8 release alongside it: one LVGL version per project, and the code in this guide is written for 9.x.

Then prepare the LVGL config file, lv_conf.h. LVGL ships with a template file, lv_conf_template.h, inside the library folder. Copy it, rename the copy to lv_conf.h, and place it in your Arduino libraries folder, not inside the lvgl folder.

Open lv_conf.h and check two settings: the guard near the top that disables the whole file when it is set to 0 must be set to 1, and color depth LV_COLOR_DEPTH must be 16 (RGB565, the 16-bit color TFT_eSPI sends to the display). Your sketch starts with two lines that tell LVGL to use this config file:

#define LV_CONF_INCLUDE_SIMPLE
#include <lvgl.h>

Source: Random Nerd Tutorials LVGL 9.2 guide and the CircuitDigest LVGL Arduino tutorial. If the sketch fails to compile with errors about lv_conf.h not found, the file is in the wrong folder.

How do you wire the display?

Use the same wiring as the TFT_eSPI setup guide. LVGL does not change the wiring: TFT_eSPI still owns the SPI bus, and LVGL only hands it pixels. For an ESP32 DevKit V1 the display wires to the hardware SPI pins: MOSI 23, MISO 19, SCLK 18, CS 15, DC 2, RST 4, with VCC at 3.3V and BLK at 3V3 or a free GPIO for dimming. Connect MISO even if you think you do not need it: the display ID read and the touch controller need it. The full wiring table and the User_Setup.h edit for each driver are in our TFT_eSPI setup guide.

Which display drivers does LVGL work with?

LVGL works with any display driver that can move a rectangle of pixels to the screen. For the store TFT modules, the driver is TFT_eSPI: it supports the ST7735, ST7789, ILI9341, ILI9488, and ST7796 chips, per the TFT_eSPI README. The GC9A01 round display needs its own low-level driver code, as in the CircuitDigest LVGL tutorial. The built-in 1.9 inch ST7789 board (ID 17819) works the same way: TFT_eSPI with the ST7789 driver at 170 by 320, CS 5, RST 4, BL 32, and MOSI 23.

How do you bind LVGL to your display driver?

Binding means telling LVGL three things: how big the screen is, where to put rendered pixels while they wait, and which function moves them to the display. Route A is the one to use with TFT_eSPI. Route B is the manual route, for other display drivers.

Route A: the TFT_eSPI helper (use this first)

LVGL 9 ships a helper that binds TFT_eSPI in one call. The Random Nerd Tutorials LVGL 9.2 example uses it, and it needs no flush callback of your own:

#define SCREEN_WIDTH 240
#define SCREEN_HEIGHT 320

#define DRAW_BUF_SIZE (SCREEN_WIDTH * SCREEN_HEIGHT / 10 * (LV_COLOR_DEPTH / 8))
uint32_t draw_buf[DRAW_BUF_SIZE / 4];

void setup() {
  Serial.begin(115200);
  lv_init();
  lv_display_t * disp;
  disp = lv_tft_espi_create(SCREEN_WIDTH, SCREEN_HEIGHT, draw_buf, sizeof(draw_buf));
  lv_display_set_rotation(disp, LV_DISPLAY_ROTATION_270);
}

lv_tft_espi_create creates the LVGL display, registers the TFT_eSPI flush function behind the scenes, and attaches your draw buffer. The rotation call turns the portrait 240 by 320 panel into landscape. Source: Random Nerd Tutorials.

DRAW_BUF_SIZE is one tenth of the screen, in 16-bit pixels: 7,680 pixels, or 15,360 bytes, for a 240 by 320 screen. A bigger buffer means smoother animation but costs RAM. If animations stutter, raise it to one quarter. If the sketch crashes on boot, shrink it.

Route B: the manual flush callback

If your display driver is not TFT_eSPI, write the flush callback yourself. LVGL calls it whenever a rectangle of the screen needs updating. The callback receives the display, the rectangle (area), and the pixel data (px_map), sends that rectangle to the screen, then tells LVGL the buffer is free:

void my_disp_flush(lv_display_t *disp, const lv_area_t *area, uint8_t *px_map)
{
  uint32_t w = (area->x2 - area->x1 + 1);
  uint32_t h = (area->y2 - area->y1 + 1);
  lcd.startWrite();
  lcd.setAddrWindow(area->x1, area->y1, w, h);
  lcd.pushColors((uint16_t *)px_map, w * h, true);
  lcd.endWrite();
  lv_display_flush_ready(disp);
}

The area coordinates are inclusive, so both dimensions need plus 1. lv_display_flush_ready(disp) is not optional: without it, LVGL waits forever for a buffer that never comes back, and the screen freezes after the first frame. Register the callback with lv_display_create, lv_display_set_buffers, and lv_display_set_flush_cb. Source: SmartDocs. Two buffers give double buffering; one buffer works too and uses half the RAM.

How do you build the first screen?

Once the display is bound, the rest is widgets. This example is adapted from the Random Nerd Tutorials LVGL 9.2 sketch: a label, a button that counts clicks, and a slider that prints its value.

void lv_create_main_gui(void) {
  lv_obj_t * text_label = lv_label_create(lv_screen_active());
  lv_label_set_text(text_label, "Hello, world!");
  lv_obj_align(text_label, LV_ALIGN_CENTER, 0, -90);

  lv_obj_t * btn1 = lv_button_create(lv_screen_active());
  lv_obj_add_event_cb(btn1, event_handler_btn1, LV_EVENT_ALL, NULL);
  lv_obj_align(btn1, LV_ALIGN_CENTER, 0, -50);
  lv_obj_t * btn_label = lv_label_create(btn1);
  lv_label_set_text(btn_label, "Button");
  lv_obj_center(btn_label);

  lv_obj_t * slider = lv_slider_create(lv_screen_active());
  lv_obj_align(slider, LV_ALIGN_CENTER, 0, 60);
  lv_obj_add_event_cb(slider, slider_event_callback, LV_EVENT_VALUE_CHANGED, NULL);
  lv_slider_set_range(slider, 0, 100);
}

The event callback reads the event code and acts on it:

static void event_handler_btn1(lv_event_t * e) {
  lv_event_code_t code = lv_event_get_code(e);
  if(code == LV_EVENT_CLICKED) {
    btn1_count++;
  }
}

And the main loop hands time to LVGL. LVGL needs a millisecond tick and regular calls to its handler, or nothing moves: no animations, no touch, no screen updates.

void loop() {
  lv_timer_handler();
  lv_tick_inc(5);
  delay(5);
}

Source: Random Nerd Tutorials. Note that their code calls the handler lv_task_handler, the LVGL 8 name. In LVGL 9 the function is lv_timer_handler. If your loop blocks for more than a few milliseconds, the interface freezes for the same time.

Which widgets should you use?

Every widget follows the same pattern: create it on a parent, set its size and position, style it, and add an event callback if it takes input.

Widget Create call (LVGL 9) Use it for
Label lv_label_create Text, readouts, titles
Button lv_button_create Actions, toggles, navigation
Slider lv_slider_create Brightness, volume, setpoints from 0 to 100
Bar lv_bar_create Progress, battery level, signal strength

LVGL also has arcs, charts, images, dropdowns, switches, keyboards, text areas, menus, tabs, tables, and animations; the full list is in the LVGL docs widget section. Two rules apply to all of them. First, every object has a parent: a widget created with no parent goes on the active screen, and a widget created on a button becomes part of that button, like the label inside btn1 above. Second, styles are CSS-like: set colors, fonts, padding, and radius per widget, or per state, such as pressed or checked. Source: Random Nerd Tutorials and the LVGL docs widget examples.

How do you add touch input?

A touch display needs a second driver: one for the screen, one for the touch controller. The touch modules in the store use the XPT2046 resistive touch controller. The steps below follow the Random Nerd Tutorials LVGL 9.2 example.

Install the XPT2046_Touchscreen library from the Library Manager, then define the touch pins and start a second SPI bus for the touch chip. The touch chip has its own chip select, so it shares MOSI, MISO, and SCK with the display:

#define XPT2046_IRQ 36
#define XPT2046_MOSI 32
#define XPT2046_MISO 39
#define XPT2046_CLK 25
#define XPT2046_CS 33

SPIClass touchscreenSPI = SPIClass(VSPI);
XPT2046_Touchscreen touchscreen(XPT2046_CS, XPT2046_IRQ);

In setup, start the touch SPI, begin the touchscreen, and set its rotation to match the display rotation. Then register the touch input device with LVGL and give it a read callback:

touchscreenSPI.begin(XPT2046_CLK, XPT2046_MISO, XPT2046_MOSI, XPT2046_CS);
touchscreen.begin(touchscreenSPI);
touchscreen.setRotation(2);

lv_indev_t * indev = lv_indev_create();
lv_indev_set_type(indev, LV_INDEV_TYPE_POINTER);
lv_indev_set_read_cb(indev, touchscreen_read);

The read callback checks the touch state, reads the point, and maps the raw touch values to screen pixels:

void touchscreen_read(lv_indev_t * indev, lv_indev_data_t * data) {
  if(touchscreen.tirqTouched() && touchscreen.touched()) {
    TS_Point p = touchscreen.getPoint();
    x = map(p.x, 200, 3700, 1, SCREEN_WIDTH);
    y = map(p.y, 240, 3800, 1, SCREEN_HEIGHT);
    data->state = LV_INDEV_STATE_PRESSED;
    data->point.x = x;
    data->point.y = y;
  }
  else {
    data->state = LV_INDEV_STATE_RELEASED;
  }
}

Source: Random Nerd Tutorials. Two warnings. First, the calibration numbers in the map calls, 200 to 3700 on X and 240 to 3800 on Y, are the values for the 2.8 inch touch module in that tutorial, not the 2.4 inch touch module in the store. Read the raw touch values from your own module, then set the map limits to your module. A button that only responds on one side of the screen is almost always a calibration problem. Second, if the touch picture is upside down or mirrored, change the touchscreen rotation value, not the LVGL rotation.

How do you use fonts and images?

LVGL ships with built-in fonts, and it can load custom fonts and images.

Built-in fonts. LVGL includes the Montserrat font in several sizes, enabled in lv_conf.h. A label uses the default font unless you set another one with lv_obj_set_style_text_font. Keep the enabled set small: every font size adds flash use.

Custom fonts. For a font LVGL does not ship, use the LVGL font converter linked from the LVGL docs. It converts a font file into a C array you add to your sketch. Generate it for LVGL 9, not LVGL 8.

Images. LVGL shows images from C arrays compiled into the sketch, or from files on a filesystem such as an SD card. The LVGL image converter, also linked from the LVGL docs, turns a PNG or JPG into a C array. A full-screen photo at 240 by 320 in 16-bit color is about 150 kB, so keep images small or load them from a card.

What about the ESP-IDF path?

The Arduino path above is the fastest way to a working screen. The ESP-IDF path gives more control, and it is the path Espressif documents for production firmware. The LVGL docs page “Add LVGL to an ESP32 IDF project” covers it.

The simplest ESP-IDF route is the esp_lvgl_port component, which provides helper functions for installing LVGL and display drivers, plus touch, encoder, button, and USB HID input support:

idf.py create-project my_lvgl_app
cd my_lvgl_app
idf.py add-dependency "espressif/esp_lvgl_port^2.3.0"

The esp_lvgl_port component supports LVGL versions 8 and 9 and is compatible with ESP-IDF v5.2 and above. By default it pulls the latest stable LVGL, so pin a version if your project must stay on one. To add LVGL without the port component, use idf.py add-dependency “lvgl/lvgl^9.*”. Then configure LVGL with idf.py menuconfig and add a display driver and a touch driver from the ESP component registry. Source: LVGL docs, “Add LVGL to an ESP32 IDF project”.

What are the common mistakes?

  • Mixing LVGL 8 code with LVGL 9. lv_disp_drv_t, lv_btn_create, lv_scr_act, and lv_task_handler are LVGL 8 names. LVGL 9 uses lv_display_t, lv_button_create, lv_screen_active, and lv_timer_handler. One version per project.
  • A lv_conf.h from another tutorial. The config file must match your LVGL version and your display. Copy the template from your own installed library.
  • Forgetting lv_display_flush_ready in a manual flush callback. The screen draws one frame, then freezes forever.
  • No tick and no handler in loop. LVGL needs lv_tick_inc and lv_timer_handler called regularly. A blocking loop freezes the interface.
  • A draw buffer that is too small or too big. Too small and animations stutter. Too big and the sketch crashes on boot. Start at one tenth of the screen, and set LV_COLOR_DEPTH to 16: the store TFT modules use 16-bit color.

How do you fix an LVGL display that does not work?

Work through the stack from the bottom up: wiring, TFT_eSPI, LVGL config, then your code.

The screen stays white or black after upload. Check the backlight first, then run Colour_Test without LVGL. If Colour_Test fails, the problem is wiring or User_Setup.h, not LVGL. Source: our TFT_eSPI setup guide.

The screen shows the first frame, then freezes. The flush callback never told LVGL the buffer was free. Check that lv_display_flush_ready(disp) runs at the end of your flush callback.

The picture is there but the colors are wrong. Check LV_COLOR_DEPTH is 16, and check the byte swap setting in TFT_eSPI. The SmartDocs guide lists enabling byte swapping with tft.setSwapBytes(true) as the fix for garbled colors. Source: SmartDocs.

Buttons do not respond to touch. Check lv_indev_create and lv_indev_set_read_cb ran in setup, check the touch CS pin, and check the calibration map limits. Source: SmartDocs and Random Nerd Tutorials.

Which route should you pick?

Match the tool to the job. For display selection, see our display buying guide.

Project Pick Why
Temperature readout, clock, status text TFT_eSPI alone No buttons, no menus, less code
Thermostat with setpoint buttons LVGL on TFT_eSPI, Route A Buttons and a slider, one afternoon of work
Production firmware LVGL on ESP-IDF with esp_lvgl_port Version-pinned components and full control

Parts used in this guide

Prices and stock were verified live on qualityrcparts.com on 2026-11-21 through the public Store API. All four items are in stock.

Shipped fast and securely from our secure facility in Queensbury, NY. QRC ships within the USA only.

Related guides

FAQ

What is LVGL? LVGL is the Light and Versatile Graphics Library, a free and open-source graphics library under the MIT license. It provides widgets such as buttons, labels, sliders, charts, and lists, plus layouts, styles, animations, and touch input. Source: LVGL docs and Random Nerd Tutorials.

Can I use LVGL with an ESP32 and a TFT display? Yes. Install LVGL 9 in the Arduino IDE, set up TFT_eSPI for your display driver, bind them with the TFT_eSPI helper or a flush callback, then build your screen from widgets. Source: Random Nerd Tutorials LVGL 9.2 guide.

Which LVGL version should I install? Install LVGL 9.x for a new project. This guide is written against LVGL 9.2, and the LVGL docs currently serve the 9.4 line. LVGL 9 changed the display, input device, button, and screen function names, so LVGL 8 code will not compile against LVGL 9 without changes. Source: LVGL docs and the ElectricalFlux LVGL ESP32-S3 guide.

Why is my LVGL screen blank after upload? Check the backlight first, then run the TFT_eSPI Colour_Test sketch without LVGL. If Colour_Test fails, the problem is wiring or User_Setup.h, not LVGL. If it passes, check lv_conf.h placement and that loop calls lv_timer_handler and lv_tick_inc. Source: our TFT_eSPI setup guide and SmartDocs.

How do I add touch to LVGL on ESP32? Use the XPT2046 touch controller on touch TFT modules. Install the XPT2046_Touchscreen library, start a second SPI bus for the touch chip with its own chip select pin, register an LVGL input device with lv_indev_create, and set a read callback that maps raw touch values to screen pixels. Source: Random Nerd Tutorials.

Can I use LVGL with ESP-IDF instead of Arduino? Yes. Add the esp_lvgl_port component with idf.py add-dependency “espressif/esp_lvgl_port^2.3.0”, or add LVGL directly with idf.py add-dependency “lvgl/lvgl^9.*”. Source: LVGL docs, “Add LVGL to an ESP32 IDF project”.

Sources

Last updated: 2026-11-21

OLED vs TFT Display: Which Is Best for ESP32 Projects?

Pick the display by what the screen has to show. An OLED display makes its own light, pixel by pixel. A TFT display filters light from a backlight that stays on the whole time the screen is on. That one difference decides contrast, viewing angle, power use, speed, cost, and how long the screen lasts.

Short answer: buy the OLED for crisp text, sensor readouts, clocks, and battery builds where the screen is mostly dark. Buy the TFT for color menus, graphs, gauges, photos, and touch screens. If your project shows one color of text on a small screen, the OLED wins. If it needs color or a bigger picture, the TFT wins.

How does an OLED display work?

OLED means organic light-emitting diode. Each pixel is its own tiny light source. When current passes through the organic layer, that pixel glows. When the pixel is off, it makes no light at all. There is no backlight, no light to filter, and no light leaking through a dark pixel. That is why OLED text looks so sharp: a black background is truly black, and a lit pixel sits next to a fully dark one.

The OLED modules in the store use the SSD1306 driver chip, a single-chip CMOS OLED driver with controller for a 128 by 64 dot matrix, with built-in contrast control, display RAM, and an oscillator. The common 0.96 inch module is 128 by 64 pixels, one color, over I2C with four wires: power, ground, SDA, and SCL.

Adafruit publishes the power figure for its 128 by 64 OLED breakout: on average the display uses about 20 mA from the 3.3 V supply, and the draw depends on how much of the display is lit. A mostly dark screen with a few lines of text draws less than a mostly lit one.

Small mono OLED modules are cheap and common. Bigger OLED panels and color OLED panels cost far more than a TFT of the same size. The organic pixels age with use, and a pixel left on for weeks can leave a permanent ghost image, called burn-in.

How does a TFT display work?

TFT means thin-film transistor, and a TFT display is a type of LCD. The liquid crystals in the panel do not make light. They sit in front of a backlight and twist to let that light through, pixel by pixel. A tiny transistor behind every pixel controls how much light passes. Color comes from red, green, and blue filters over the pixels. The backlight is the price of the design: it draws current the whole time the screen is on, no matter what the picture shows.

The TFT modules in the store use SPI and one of three common driver chips. The ST7735 drives small color modules such as the 0.96 inch 80 by 160 and the 1.8 inch 128 by 160. The ST7789 drives larger color modules such as the 1.9 inch 170 by 320 board. The ILI9341 drives the 2.4 inch and 2.8 inch 240 by 320 modules, including the touch versions. All three show 65,536 colors (16-bit color).

A TFT needs more pins than an I2C OLED. SPI needs five signal wires: clock, data, chip select, data/command, and reset, plus the backlight pin. TFT strengths are color, size, brightness, and lifespan. The weaknesses are backlight power draw, extra wiring, and weaker contrast: a black pixel still lets some backlight through.

OLED vs TFT: the full comparison

Feature OLED (SSD1306 module) TFT (ST7735 / ST7789 / ILI9341 module)
How it makes light Each pixel makes its own light, no backlight Backlight shines through liquid crystals
Colors One color (blue, white, or yellow-blue) Full color, 65,536 colors
Typical sizes in the store 0.91 to 1.3 inch 0.96 to 3.2 inch
Resolution 128 by 64 (0.96 inch), 128 by 32 (0.91 inch) 80 by 160 up to 320 by 240
Interface I2C, 2 data wires, 4 wires total SPI, 5 signal wires plus backlight
Libraries Adafruit SSD1306, U8g2 TFT_eSPI, Adafruit ILI9341, Adafruit ST7735
Contrast True black, effectively infinite contrast Black leaks backlight; IPS panels around 1000:1
Viewing angle Wide, colors hold off-axis Narrow on TN panels; IPS is wider but still shifts
Sunlight readability Poor in direct sun Better, backlight fights glare
Power behavior Varies with content; dark screens draw less Near constant; backlight sets the draw
Published current draw About 20 mA average (Adafruit) None published for the store TFT modules
Response speed Under 0.1 ms per pixel (panel class) 8 to 25 ms per pixel (panel class)
Burn-in Yes, static images can leave a ghost No
Lifespan (panel class) 20,000 to 50,000 hours 50,000 to 100,000 hours
Cost in the store 0.96 inch module $7.49 From $10.99 by size; 2.4 inch module $14.99

Sources: SSD1306 datasheet; Adafruit OLED guide; Golden Vision; OPL Display. Panel-class figures are industry figures, not measurements of the store modules.

Which display has better contrast?

OLED, by a wide margin. An OLED pixel that is off makes no light, so black is truly black and contrast is effectively infinite. A TFT pixel that is supposed to be black still lets some backlight leak through, so black looks dark gray. Golden Vision puts it plainly: an OLED screen reaches infinite static contrast, a VA LCD reaches 3,000:1, and an IPS LCD reaches 1,000:1.

That gap shows up in dark rooms. White text on a black OLED background is crisp because the background adds no light at all. The same screen on a TFT has a faint glow across the whole panel. IPS panels are better than older TN panels, but even a good IPS TFT cannot turn a pixel fully off.

Which display is easier to read at an angle or in sunlight?

Two different questions, two different winners. At an angle, OLED wins. In sunlight, TFT wins.

An OLED pixel makes its own light, so the picture looks the same from the side as from the front. Colors stay stable and brightness holds steady. A TFT passes backlight through liquid crystal layers, and off-axis viewing changes what the eye receives: contrast drops, colors shift, and a dark scene can look gray from the side.

In sunlight the result flips. A TFT backlight can be pushed bright enough to fight glare, and a TFT stays readable outdoors. An OLED struggles in direct sun: its pixels cannot reach the same peak brightness without risking damage or rapid aging, and the screen looks washed out. If the project lives outdoors, on a dashboard, or in a bright window, pick the TFT.

Which display uses less power?

It depends on what the screen shows. There is no single power winner, and any guide that names one without saying “it depends” is guessing.

An OLED draws power per lit pixel. A dark screen with a few lines of text draws very little. A bright, mostly white screen draws much more. Adafruit publishes about 20 mA average from the 3.3 V supply for its 128 by 64 OLED breakout, with the note that the draw depends on how much of the display is lit.

A TFT draws power near constantly. The backlight stays on at a set level no matter what the picture shows, so a white document and a black menu consume almost the same energy. Lowering the backlight saves power without hurting the picture much indoors, and that makes TFT power budgeting simple: the backlight setting decides the draw.

No published current-draw figure exists for the TFT modules in the store, so this guide gives none. For a battery build, the practical rule is: OLED for screens that are mostly dark and update rarely, TFT only when the project genuinely needs color.

Which display is faster?

OLED pixels switch faster than liquid crystals can twist. OPL Display lists OLED response under 0.1 ms against 8 to 25 ms for TFT LCD panels.

But the panel is not the only speed limit. A standard 128 by 64 OLED over I2C at 400 kHz manages only about 10 frames per second for full-screen updates, because the bus, not the panel, is the bottleneck. An SPI TFT moves far more pixels per second and suits real-time charts and menus. If the project animates, pick the TFT on SPI.

Which display lasts longer?

TFT, for always-on and static content. OLED pixels age with use, and the blue organic material ages fastest. A static menu, logo, or status bar left on the same pixels for weeks can leave a permanent ghost image. TFT liquid crystals do not wear unevenly, so a TFT shows fixed content for years without visible burn-in.

OPL Display gives panel-class lifespan figures: TFT LCD 50,000 to 100,000 hours, OLED 20,000 to 50,000 hours depending on color and usage. Those are industry figures for the panel classes, not measurements of the store modules. For a wall display, a kiosk, or any screen that shows the same image for months, pick the TFT

Which display costs less?

For small mono screens, OLED. For color and larger screens, TFT.

The 0.96 inch OLED module is $7.49 in the store. TFT modules start at $10.99 and run to $25.49 by size, with the 2.4 inch module at $14.99. As the screen gets bigger and gains color, TFT takes over: color OLED panels cost far more than a TFT of the same size, and above 1.3 inch TFT is the economical choice for color.

A TFT also needs more pins, more code, and more power, which can mean a bigger battery or a bigger board.

Which display should you buy?

Match the display to the job, not to the spec sheet. This section is the short pick list. For the full size and price picker, see How to Choose the Right Display for Arduino or ESP32.

Project Pick Why
Sensor readout, temperature, humidity 0.96 inch OLED Crisp text, 4 wires, lowest cost
Clock, timer, counter 0.96 inch OLED Dark background, low draw, sharp digits
Weather station with graphs 2.4 inch TFT Color graphs need pixels and color
Color menu or settings screen 1.9 inch TFT board or 2.4 inch TFT module Full color, room for buttons and icons
Touch interface 2.8 inch TFT with touch Resistive touch, needs calibration once
Battery sensor node 0.96 inch OLED Dark screen, sleep mode, 4 wires
Outdoor or bright-room display TFT Backlight beats sunlight
Always-on status screen TFT No burn-in on static content
First display project 0.96 inch OLED Four wires, Adafruit SSD1306 library, $7.49

What are the common mistakes?

  • Buying a color OLED when a TFT costs less. Small mono OLED modules are cheap. Color OLED panels are not.
  • Assuming OLED always uses less power. OLED wins on dark screens and loses on bright ones. A mostly white OLED screen can draw more than a TFT at low backlight.
  • Using the wrong driver chip. The 0.96 inch module uses the SSD1306. The 1.3 inch OLED looks the same but uses the SH1106 driver. Code written for the SSD1306 shows shifted or noisy pixels on an SH1106, so use a library that supports the SH1106, such as U8g2.
  • Wiring the OLED power pins backwards. OLED modules come with VCC and GND in either order.
  • Leaving a static image on an OLED for months. Burn-in is permanent.
  • Expecting a TFT to match OLED contrast. A TFT black pixel still leaks backlight.
  • Forgetting the backlight pin on a TFT. The backlight needs power and, on most modules, a pin to control it.

How do I troubleshoot a display problem?

The OLED shows nothing. Check power first: VCC and GND order varies by module, so read the labels on your module. Then check the I2C address. The SSD1306 address is usually 0x3C

The OLED shows shifted or noisy pixels. The driver chip is wrong for the library. A 1.3 inch module with the SH1106 chip shows shifted pixels under SSD1306 code. Switch to a library that supports the SH1106, such as U8g2,

The TFT shows a white screen. The display is powered but never initialized. Check that the driver in the code matches the chip on the module: ST7735, ST7789, and ILI9341 need different init code.

The TFT updates slowly. The bus is the limit.

The TFT looks washed out from the side. That is normal for a TN panel. An IPS panel holds color better off-axis, and an OLED holds it best of all.

The OLED fades or ghosts after weeks of the same image. That is burn-in.

Parts used in this guide

Prices below were verified live on 2026-11-21 in the step 3 draft for the built-in display boards guide, via the WooCommerce Store API and authed product reads. This draft did NOT re-verify them live: the store returned HTTP 429 on every fetch in this session. Re-verify every price and stock state at publish time.

Shipped fast and securely from our secure facility in Queensbury, NY. QRC ships within the USA only.

Related guides

FAQ

Is OLED better than TFT? Neither is better in every case. OLED wins on contrast, viewing angle, and dark-screen power. TFT wins on brightness, sunlight readability, color at larger sizes, cost for color screens, and lifespan with static content. Source: Golden Vision TFT vs OLED comparison; OPL Display TFT LCD vs OLED guide.

Does OLED use less power than TFT? It depends on the image. OLED draws power per lit pixel, so a dark screen draws little and a bright screen draws much more. TFT draws near-constant power because the backlight stays on. Adafruit publishes about 20 mA average for its 128 by 64 OLED breakout. Source: Adafruit monochrome OLED breakouts guide; Golden Vision power comparison.

Does OLED burn in? Yes. OLED pixels age with use, and a static image left on the same pixels for weeks can leave a permanent ghost. TFT displays do not burn in. Source: Golden Vision burn-in section; OPL Display head-to-head table.

Which display is best for a first ESP32 project? A 0.96 inch SSD1306 OLED. It needs only four wires, shows sharp text, and draws very little power. Source: Medium, Compoden Electronics, Best Display for ESP32 Projects.

Should I choose an OLED or a TFT for an ESP32? Choose an OLED for text and simple readouts with minimal wiring. Choose a TFT when you need color, more pixels, graphics, or touch. Source: Medium, Compoden Electronics, Best Display for ESP32 Projects.

What is the difference between the SSD1306 and the SH1106? They are different OLED driver chips. The SSD1306 is usual on 0.96 inch modules and the SH1106 on 1.3 inch modules. Code for one shows shifted or noisy pixels on the other, so the library must match the chip. Source: Medium, Compoden Electronics, Best Display for ESP32 Projects.

How many pins does a TFT display need on an ESP32? An SPI TFT needs five signal pins: clock, data, chip select, data/command, and reset. A touch layer and a microSD slot each add a chip-select pin. Source: Medium, Compoden Electronics, Best Display for ESP32 Projects.

Sources

Last updated: 2026-11-21

Change log

  • 2026-11-21: Draft created. Technology comparison of OLED vs TFT for Arduino and ESP32 projects: how each works, contrast, viewing angle, power, speed, lifespan, cost, decision table, common mistakes, troubleshooting, 7 FAQs. Board selection and board setup are not re-taught; they live in post 18364. The size and price picker is not re-taught; it lives in the which-display-to-buy guide. Product prices carried from the step 3 draft verified 2026-11-21; live re-verification blocked by store HTTP 429 in this session.

TFT_eSPI Setup Guide: Arduino, ESP32, User_Setup.h

TFT_eSPI is the library most ESP32 display projects use, and the one that confuses the most first-time users. It does not ask your sketch which display you wired up. It reads that answer from a setup file at compile time, and if the setup file is wrong, the screen stays white even though the sketch uploads fine.

This guide sets up TFT_eSPI from Bodmer’s GitHub repo for a separate SPI TFT module wired to an ESP32 board: install, wiring, driver pick, the User_Setup.h edit, the first test sketch, and the errors that stop most builds. Every step was checked against the TFT_eSPI README and the User_Setup.h file in the repo.

What is TFT_eSPI, and what do you need before you start?

TFT_eSPI is a feature-rich Arduino IDE graphics and fonts library for 32-bit processors, written by Bodmer. The README says it is targeted at 32-bit processors and performance optimised for RP2040, STM32, ESP8266, and ESP32 types, and that it works with Arduino boards as well but will be slower. On the ESP32 it can use Direct Memory Access (DMA) with SPI displays, and it has built-in support for the XPT2046 touch controller.

The one fact that shapes this whole guide is in the README: the screen controller, the interface pins, and the library configuration settings must be defined inside the library, not in the Arduino sketch. PlatformIO users can define the same settings in platformio.ini instead, covered below.

What you need:

  • An ESP32 board. This guide uses the ESP32 DevKit V1 (30-pin WROOM-32), because its hardware SPI pins are the ones in the library’s own example setup files.
  • A separate SPI TFT module. The worked examples use the 0.96 inch ST7735 module and the 2.4 inch touch ILI9341 module from the store.
  • The Arduino IDE with the ESP32 board package installed. The README says the library requires board package 2.x.x or later.
  • Jumper wires and a breadboard. Keep the SPI wires short: long wires cause signal problems.

How do you install TFT_eSPI in the Arduino IDE?

Open the Library Manager: Sketch, Include Library, Manage Libraries. Search for “TFT_eSPI”, find the entry by Bodmer, and press Install.

Two README warnings apply from the first install. First, a library update overwrites your setup: keep custom setup files in a TFT_eSPI_Setups folder in your Arduino libraries folder, pointed at from User_Setup_Select.h. Second, install the ESP32 board package first, at version 2.x or later, or the library may not compile for your board. PlatformIO users install it with one line in platformio.ini:

lib_deps = bodmer/TFT_eSPI

Source: Lopaka TFT_eSPI guide.

How do you wire a TFT module to an ESP32 DevKit V1?

The QRC TFT modules wire over SPI with 8 pins: GND, VCC, SCL, SDA, RES, DC, CS, and BLK. SCL is the SPI clock (SCLK), SDA is MOSI, RES is reset (RST), DC is data/command, CS is chip select, and BLK is the backlight. The pin numbers below are from the library’s own ESP32 example setup (Setup42_ILI9341_ESP32.h).

Module pin ESP32 DevKit V1 GPIO Library name
GND GND –
VCC 3V3 –
SCL GPIO 18 TFT_SCLK
SDA GPIO 23 TFT_MOSI
MISO / SDO GPIO 19 TFT_MISO
RES GPIO 4 TFT_RST
DC GPIO 2 TFT_DC
CS GPIO 15 TFT_CS
BLK 3V3, or a free GPIO for dimming TFT_BL

Three wiring rules. Power the module at 3.3V, not 5V. The QRC modules run on 3.3V power, and the ESP32 is a 3.3V board, so wire VCC to 3V3. A 5V Arduino Uno needs level shifting; see our logic level shifting guide. Use the hardware SPI pins for clock and data. MOSI 23, MISO 19, and SCLK 18 are the DevKit V1 VSPI pins. CS, DC, and RST can be any free GPIO. Connect MISO even if you think you do not need it. The screen draws without it, but the display ID read and the touch controller need it, and an SD card on the same bus needs all three SPI pins defined explicitly. Backlight: BLK can go straight to 3V3 for always-on backlight. Wire it to a GPIO and define TFT_BL only if the sketch must control it.

Which driver do you pick for your display?

The driver is the chip on the display, not the size of the screen. Two modules the same size can need different drivers, and the wrong driver gives a white screen even with perfect wiring. Read the driver chip name from the store listing first.

Size Resolution Driver Touch Store price
0.96 inch, 2-pack 80 by 160 ST7735 No $13.99
1.3 inch 240 by 240 ST7789 No $11.99
1.44 inch, 2-pack 128 by 128 ST7735 No $20.99
1.8 inch, SD slot 128 by 160 ST7735 No $10.99
2.0 inch 240 by 320 ST7789 No $14.99
2.2 inch, SD slot 240 by 320 ILI9341 No From $18.99
2.4 inch, no touch 320 by 240 ST7789 No $14.99
2.4 inch, touch 240 by 320 ILI9341 Yes $20.99
2.8 inch, touch 240 by 320 ILI9341 Yes $24.99
3.2 inch, touch 240 by 320 ILI9341 Yes $25.49
3.5 inch, touch 480 by 320 ILI9488 Yes $26.99
4.0 inch, touch 480 by 320 ST7796S Yes $29.99

Sizes, resolutions, and drivers follow our TFT LCD displays guide, and prices were verified against the live store on 2026-11-21. The README lists ST7735, ST7789, ILI9341, ILI9488, and ST7796 as supported, and recommends ILI9341 and ST7796 SPI displays as the starting point. If the listing does not name a driver, do not guess: a 2.4 inch module can be ST7789 without touch or ILI9341 with touch.

How do you set up User_Setup.h?

This is the step the whole guide exists for. User_Setup.h is the file inside the TFT_eSPI library folder that names your driver, your screen size, your pins, and your fonts. The library reads it at compile time. The default file ships set up for an ILI9341 display, so ST7735 or ST7789 owners must change it. Find the file in your Arduino libraries folder, under TFT_eSPI.

1. Pick exactly one driver

In Section 1 of the file, uncomment the line for your driver and leave every other driver line commented out. Only one driver may be defined.

For the 0.96 inch module:

#define ST7735_DRIVER      // Define additional parameters below for this display

For a 1.3 inch, 2.0 inch, or 2.4 inch non-touch module:

#define ST7789_DRIVER      // Full configuration option, define additional parameters below for this display

For a 2.2 inch, 2.4 inch touch, 2.8 inch, or 3.2 inch module:

#define ILI9341_DRIVER       // Generic driver for common displays

The default file ships with ILI9341_DRIVER uncommented. If two driver lines are uncommented, the sketch will not compile, or the library will send the wrong init sequence and the screen stays white.

2. Set the screen size

Set TFT_WIDTH and TFT_HEIGHT to your panel’s pixel size: 80 by 160 for the 0.96 inch ST7735 module, 240 by 320 for the 2.4 inch touch ILI9341 module, 240 by 240 for the 1.3 inch ST7789 module.

#define TFT_WIDTH  240
#define TFT_HEIGHT 320

Getting the size wrong does not stop the screen from working, but the drawing will be shifted or cut off.

3. Set the pins

Set the pin defines to match your wiring. The ESP32 example values in the file are MISO 19, MOSI 23, SCLK 18, CS 15, DC 2, and RST 4, which match the wiring table above.

#define TFT_MISO 19
#define TFT_MOSI 23
#define TFT_SCLK 18
#define TFT_CS   15  // Chip select control pin
#define TFT_DC    2  // Data Command control pin
#define TFT_RST   4  // Reset pin (could connect to RST pin)

If your module’s reset pin is tied to the board reset or to 3.3V, set TFT_RST to -1.

4. Check the fonts and the SPI speed

Leave the font lines as they are. You need LOAD_GLCD at minimum; without it, basic text drawing will not compile. The default SPI frequency is 27 MHz; the bundled Setup42 uses 40 MHz. If the display shows noise or tearing, drop the speed to 20 MHz or 10 MHz. Save the file, then recompile and upload: the library reads User_Setup.h at compile time, so every edit needs a fresh compile.

What are the other ways to configure TFT_eSPI?

Editing User_Setup.h is the standard route, but it is not the only one. There are three, and you should pick one and stick to it. Mixing them is a common cause of “it worked yesterday” failures.

Option 1: Edit User_Setup.h. The route above. Simple, and every example sketch then works without changes. The cost is that a library update overwrites the file, so keep a copy in the TFT_eSPI_Setups folder the README suggests, outside the library folder.

Option 2: Use a bundled setup file. Open User_Setup_Select.h in the library folder. Comment out the #include <User_Setup.h> line and uncomment the include for a setup file that matches your board. The repo ships Setup42_ILI9341_ESP32.h for an ESP32 with an SPI ILI9341 display (MISO 19, MOSI 23, SCLK 18, CS 15, DC 2, RST 4, 40 MHz), Setup70b_ESP32_S3_ILI9341.h for the ESP32-S3, Setup70c_ESP32_C3_ILI9341.h for the ESP32-C3, and Setup71_ESP32_S2_ST7789.h for the ESP32-S2 with ST7789. Only one setup include may be active at a time.

Option 3: Define the setup in the sketch or in PlatformIO. If you define USER_SETUP_LOADED before including the library, the library skips User_Setup.h and uses the defines in your sketch instead. The library header TFT_eSPI.h checks for USER_SETUP_LOADED and defines it itself if it is missing, so a sketch that defines it first takes control:

#define USER_SETUP_LOADED
#define ILI9341_DRIVER
#define TFT_WIDTH  240
#define TFT_HEIGHT 320
#define TFT_MOSI 23
#define TFT_MISO 19
#define TFT_SCLK 18
#define TFT_CS   15
#define TFT_DC    2
#define TFT_RST   4
#define SPI_FREQUENCY 40000000
#include <TFT_eSPI.h>
#include <SPI.h>

Source: the USER_SETUP_LOADED check in TFT_eSPI.h and the ElectricalFlux ESP32 graphics guide. PlatformIO users can pass the same defines as build flags instead, which survives library updates. Source: Lopaka TFT_eSPI guide. The in-sketch route keeps the setup with the project, the right choice when two projects use two different displays on one computer.

What is the first sketch to upload?

Run the library’s own test sketch before you write any of your own code. If the test sketch works, the wiring and the setup file are right, and any later problem is in your code.

Open File, then Examples, then TFT_eSPI, then Test and diagnostics, then Colour_Test. Select your ESP32 board and port, and upload. A working screen shows clean colour bands with no noise or tearing.

If Colour_Test runs but the colours look wrong, run the Read_User_Setup example from the same folder. It prints the setup the library actually compiled with to the serial monitor: driver, pins, and SPI frequency.

Once Colour_Test passes, a minimal hello sketch confirms text drawing:

#include <TFT_eSPI.h>

TFT_eSPI tft = TFT_eSPI();

void setup() {
  tft.init();
  tft.setRotation(1);
  tft.fillScreen(TFT_BLACK);
  tft.setTextColor(TFT_WHITE, TFT_BLACK);
  tft.setTextSize(2);
  tft.drawString("Hello TFT", 10, 10);
}

void loop() {
}

tft.init() starts the display with the settings from the setup file. If this sketch shows “Hello TFT”, the setup is done.

How do you set up the built-in 1.9 inch TFT board?

Short answer: you do not use this guide for it. The built-in 1.9 inch ST7789 board (ID 17819) is covered in full in our ESP32 boards with built-in displays guide: ST7789 driver at 170 by 320, with CS 5, RST 4, BL 32, and MOSI 23. Follow that guide for that board.

What are the common mistakes?

  • Two drivers uncommented: only one driver define may be active. Two break the compile or send the wrong init sequence.
  • Editing the setup and not recompiling: the library reads User_Setup.h at compile time.
  • Pins in the file do not match the wiring: file and breadboard must agree on every pin.
  • Default ILI9341 setup with an ST7735 or ST7789 module: the default file ships set for ILI9341.
  • A library update wiping the setup: keep your setup in a TFT_eSPI_Setups folder outside the library, or use the in-sketch defines.
  • 5V logic on a 3.3V module: the QRC modules run on 3.3V power. A 5V Uno needs level shifting.
  • Long jumper wires at full SPI speed: shorten the wires or drop SPI_FREQUENCY to 20 MHz or 10 MHz.
  • MISO left unconnected: the screen draws without it, but the display ID read and touch need it.

How do you fix a TFT_eSPI display that does not work?

Check the config before you suspect broken hardware: a white screen usually means the driver or pins in User_Setup.h do not match the board.

The screen stays white after upload. White means the backlight works and the controller never got a valid init sequence. Check the driver line first, then the pins, then the backlight pin, then a lower SPI speed. Sources: Protoship and RoboticsEngineering white screen guides.

The screen stays black. Check the backlight first. A sketch that never turns it on shows nothing even when the code runs. If BLK is wired to a GPIO, the setup must define TFT_BL and the sketch must drive it.

The colours are wrong or inverted. The colour order or the inversion setting does not match the panel. User_Setup.h has TFT_RGB_ORDER (TFT_RGB or TFT_BGR) and TFT_INVERSION_ON / TFT_INVERSION_OFF defines. Swap the colour order define and recompile.

The picture is shifted, cut off, or noisy. The size is wrong, or the SPI speed is too high for the wiring. Check TFT_WIDTH and TFT_HEIGHT, then drop SPI_FREQUENCY to 20 MHz or 10 MHz.

The sketch will not compile. Read the first error, not the last. Two driver defines active, a missing LOAD_GLCD font define, or a board package older than 2.x are the usual causes. An Arduino forum thread also reports TFT_eSPI sketches failing to compile for the ESP32-C6 board; update the board package and the library before changing the code.

The touch panel does not respond. TFT_eSPI has built-in XPT2046 touch support on SPI displays, and the touch chip shares the display SPI bus with its own chip select. Define TOUCH_CS with the touch CS pin: the bundled Setup42 file shows TOUCH_CS 5, commented out by default. Run Test_Touch_Controller to check the touch wiring.

The display works but the SD card on the same bus stops working. The README warns that an SD card on the same SPI bus needs TFT_MISO, TFT_MOSI, and TFT_SCLK defined explicitly in User_Setup.h, even with the default SPI pins. Define all three and recompile.

Parts used in this guide

Prices and stock were verified live on qualityrcparts.com on 2026-11-21 through the public Store API. All four items are in stock and purchasable.

Shipped fast and securely from our secure facility in Queensbury, NY. QRC ships within the USA only.

Related guides

FAQ

What is TFT_eSPI? TFT_eSPI is a fast Arduino IDE graphics and fonts library for 32-bit processors by Bodmer, optimised for RP2040, STM32, ESP8266, and ESP32. It drives SPI TFT displays and supports the XPT2046 touch controller. Source: TFT_eSPI README on GitHub.

Do I have to edit User_Setup.h to use TFT_eSPI? Yes, in the standard route: the driver, size, pins, and fonts must be defined in the library’s setup file, because the README states they cannot be defined in the Arduino sketch. Alternatives: a bundled setup file, in-sketch defines with USER_SETUP_LOADED, or PlatformIO build flags. Source: TFT_eSPI README.

Which driver do I pick in TFT_eSPI for my display? Pick the driver that matches the chip on your display: ST7735 for the 0.96, 1.44, and 1.8 inch modules; ST7789 for the 1.3, 2.0, and 2.4 inch non-touch modules; ILI9341 for the 2.2, 2.4 touch, 2.8, and 3.2 inch modules; ILI9488 for the 3.5 inch touch; ST7796 for the 4.0 inch touch. Only one driver define may be active. Source: TFT_eSPI README and the QRC TFT displays guide.

Why is my TFT screen white after uploading a TFT_eSPI sketch? White means the backlight works but the controller never got a valid init sequence. Check the driver first, then the pins, then the backlight pin, then a lower SPI speed. Source: Protoship and RoboticsEngineering white screen guides.

Can I use TFT_eSPI with an Arduino Uno? The library targets 32-bit processors and works with Arduino boards but will be slower, per the README. The bigger issue is voltage: the QRC modules run on 3.3V, and a 5V Uno needs level shifting. An ESP32 is the simpler first choice.

Why does my TFT_eSPI setup disappear after a library update? A new copy of the library overwrites User_Setup.h inside the library folder. The README suggests a TFT_eSPI_Setups folder outside the library, or the in-sketch USER_SETUP_LOADED defines or PlatformIO build flags, which survive updates. Source: TFT_eSPI README tips section.

How do I know which setup the library actually compiled with? Run Read_User_Setup from File, Examples, TFT_eSPI, Test and diagnostics. It prints the compiled driver, pins, and SPI frequency to the serial monitor. Source: TFT_eSPI repo examples listing.

Sources

Last updated: 2026-11-21

Change log

  • 2026-11-21: Draft created. Full TFT_eSPI setup procedure from the Bodmer GitHub repo: install, DevKit V1 wiring, driver-selection table for all 12 store TFT sizes, User_Setup.h walkthrough, two alternate configuration routes, Colour_Test first-sketch walkthrough, common mistakes, troubleshooting. Built-in 1.9 inch board covered only as a pointer to post 18364; size selection cross-linked to posts 17851 and 15484, not re-taught.

ESP32 SuperMini vs XIAO: Which Tiny Board Wins?

Pick the XIAO for battery builds, WiFi range, or a board that solders flat onto a carrier PCB. Pick the SuperMini for the lowest price per board, a breadboard-friendly header, or an on-board LED for blink and debugging.

The two families share the same chips, so the decision is about the board around the chip: the antenna, the battery circuit, the pins, the mounting, the documentation, and the price per board. Both run the same Arduino, MicroPython, and ESP-IDF code for the same chip once the pin names are changed: the XIAO uses D0 to D10 names and the SuperMini uses GPIO numbers.

How big is each board, and how does it mount?

Board Size Mounting
XIAO ESP32C3 21 x 17.8 mm (Seeed wiki) Castellated, solders flat onto a carrier PCB
ESP32-C3 SuperMini About 22.5 x 18 mm (seller listings only) Through-hole header pins, fits a breadboard
XIAO ESP32S3 21 x 17.8 mm (Seeed wiki) Castellated, solders flat onto a carrier PCB
ESP32-S3 SuperMini About 23.5 x 18 mm (espboards) Through-hole header pins, fits a breadboard

The XIAO is smaller by about a millimetre and a half in each direction, and its castellated edges let it solder flat onto a carrier board like a module. That suits a finished product, a wearable, or a sensor tag that has to sit flat inside a case.

The SuperMini is the breadboard board. Its through-hole header pins plug straight into a breadboard with room to spare, which is why it is the easier pick for a first build, a classroom set, or a prototype you plan to rewire. The trade off is height.

Measure your own SuperMini before you design a case around it. There is no single manufacturer, so pin labels, LED color, flash size, and antenna layout can vary between sellers and revisions.

Which board has more pins?

The SuperMini breaks out more pins on both chips. The XIAO keeps the same 11-pin header on every board: a feature when a sketch moves between XIAO boards, a limit when the build needs more pins.

XIAO C3 SuperMini C3 XIAO S3 SuperMini S3
Broken-out GPIO 11 (D0 to D10) 13 (GPIO0 to GPIO10, 20, 21) 11 (D0 to D10) 13 plus TX/RX
Analog header pins 4 (D0 to D3) 6 (GPIO0 to GPIO5) 9 (D0 to D5, D8 to D10) 13 (GPIO1 to GPIO13)

Sources: Seeed wiki pin maps; NuttX docs; TeachMeMicro.

Three pin differences matter. First, the XIAO bus pins never move: I2C is always D4 and D5, SPI is always D8, D9, and D10, and UART is always D6 and D7 on every XIAO board. The SuperMini has no such promise: the bus pins follow the chip, and the I2C pins on the C3 SuperMini sit on GPIO8 and GPIO9, which are also strapping pins, so the NuttX docs recommend GPIO0 and GPIO1 for I2C instead.

Second, the SuperMini gives you more analog pins: 6 ADC-capable pins on the C3 against 4 on the XIAO C3, and 13 on the S3 against 9 on the XIAO S3. The store listing states 4 analog pins for the C3 SuperMini against 6 in the NuttX table; the gap is the ADC2 channel on GPIO5, which reads unreliably while WiFi is running. Use GPIO0 to GPIO4 for analog reads when WiFi is on.

Third, strapping pins need care on both families, but on different pins. On the XIAO C3, D0, D8, and D9 decide the boot mode. On the C3 SuperMini, GPIO2, GPIO8, and GPIO9 do. On the XIAO S3, D2 (GPIO3) is the strapping pin on the header. On the S3 SuperMini, GPIO3 is the one to use with care. A sensor that pulls a strapping pin to the wrong level at reset can stop either board from booting. Full pin tables are in our SuperMini guide and our XIAO pinout guide.

How do the C3 boards compare?

The C3 comparison is the cleanest one, because the chips are identical. The ESP32-C3 datasheet v2.5 is the source for the chip figures.

Feature XIAO ESP32C3 ESP32-C3 SuperMini
Chip ESP32-C3, single-core RISC-V, up to 160 MHz Same chip
SRAM / flash 400 KB SRAM, 4 MB flash Same
Deep sleep, board level 44 uA per the Seeed wiki No board-level figure published for the generic board
QRC price $13.99 for one board $22.99 for four boards ($5.75 per board)

Sources: Espressif C3 datasheet v2.5; Seeed wiki C3 page; Mischianti; NuttX docs.

The C3 decision comes down to two questions. Does the build run on a battery? The XIAO charges a LiPo over USB with no extra parts, and its 44 uA board-level deep sleep figure is published by Seeed. The SuperMini usually has no charging circuit, and no board-level figure is published for the generic board. The bare C3 chip can sleep near 5 uA, but a finished board draws more.

Does the build need WiFi range? The XIAO needs its external antenna connected, and with it fitted Seeed states over 100 m line of sight. The SuperMini ceramic antenna needs nothing fitted and works well at short range, but range varies by batch. One user test on the Seeed forum measured the SuperMini at -33 dBm next to a phone against about -60 dBm for a XIAO with no antenna fitted: with its antenna fitted, the XIAO is the stronger board.

How do the S3 boards compare?

The S3 comparison is where the memory gap shows up, and it is the biggest spec difference between the two families.

Feature XIAO ESP32S3 ESP32-S3 SuperMini
Chip ESP32-S3R8, dual-core Xtensa LX7, up to 240 MHz ESP32-S3, dual-core Xtensa LX7, up to 240 MHz
PSRAM / flash 8 MB PSRAM, 8 MB flash 4 MB flash, 2 MB PSRAM on the common FH4R2 version
Deep sleep, board level 14 uA per the Seeed wiki About 43 uA per the store listing
User LED User LED on GPIO21, plus charge LED RGB LED, typically WS2812 on GPIO48
QRC price $21.49 for one board $31.99 for five boards ($6.40 per board)

Sources: Seeed wiki S3 page; Espressif S3 datasheets; TeachMeMicro; Lingflux.

The memory gap is the whole S3 story. The XIAO ESP32S3 carries the S3R8 chip with 8 MB of PSRAM and 8 MB of flash. The common S3 SuperMini carries the S3FH4R2 chip with 4 MB of flash and 2 MB of PSRAM: four times the PSRAM and twice the flash on the XIAO. PSRAM holds camera frames, display buffers, and audio at runtime, so the XIAO S3 is the board for camera work, displays, and edge AI. The SuperMini S3 still handles bigger sketches, more sensors, and small displays, but with less headroom.

Check the chip marking on any S3 SuperMini before you trust a memory figure: FH4R2 means 4 MB of flash and 2 MB of PSRAM. Run the memory check sketch in our SuperMini guide to confirm flash size and PSRAM before you write code that needs them.

The S3 boards are closer on the other rows: both have a user LED, USB OTG, and battery charging in some form. The XIAO S3 still wins on range, deep sleep, and documentation; the SuperMini S3 on price per board and breadboard use. The Sense version is the XIAO-only option, adding a detachable camera, a digital microphone, and a microSD slot on an expansion board. There is no SuperMini equivalent. Camera projects are covered in our XIAO S3 Sense guide.

Which board is better on battery power?

The XIAO is the better battery board on both chips. Every XIAO has a built-in LiPo charging circuit with BAT pads on the back: plug a LiPo in and the board charges it over USB, with no extra module. The Seeed wiki publishes board-level deep sleep figures of 44 uA for the C3 and 14 uA for the S3, and the XIAO C3 has no user LED at all, so nothing drains the cell in deep sleep. The C3 SuperMini usually has no charging circuit, so a battery build needs an external charging module, and no board-level deep sleep figure is published for the generic board. The S3 SuperMini is better here: some S3 boards have battery pads with a charger, and the listing states deep sleep around 43 uA.

One safety note: the XIAO C3 charging circuit delivers a fast charge near 370 mA, so use a battery of 370 mAh or larger unless the battery has its own protection circuit. Source: Mischianti XIAO ESP32-C3 guide.

How much does each board cost?

Prices below are the live QRC store prices. The SuperMini boards sell as packs, so the per-board price is arithmetic from the pack price.

Board QRC listing Pack price Price per board
XIAO ESP32C3, 1-pack ID 17820 $13.99 $13.99
ESP32-C3 SuperMini, 4-pack ID 19646 $22.99 $5.75
XIAO ESP32S3, 1-pack ID 17839 $21.49 $21.49
ESP32-S3 SuperMini, 5-pack ID 19649 $31.99 $6.40

The SuperMini is far cheaper per board: about $5.75 against $13.99 on the C3, and about $6.40 against $21.49 on the S3. A four-pack of C3 SuperMinis costs less than two single XIAO C3 boards, and a five-pack of S3 SuperMinis costs about one and a half XIAO S3 boards.

Prices were verified against the live SuperMini guide (updated 2026-11-21) and the batch 2 verification of the same day. The public Store API returned HTTP 429 at draft time, so re-verify every price live before publishing.

Which one should you buy?

Pick by the build, not by the brand.

Buy the XIAO ESP32C3 if the build is a battery sensor, a wearable, a BLE beacon, or a node that has to sit in another room and stay connected. The charging circuit, the external antenna, and the 44 uA deep sleep are the reasons.

Buy the ESP32-C3 SuperMini if the build is a set of cheap sensor nodes, a classroom set, or a first ESP32 project, or anything where the lowest cost per board matters most. At $5.75 per board in the 4-pack, it is the cheapest way to put WiFi and Bluetooth on a tiny board, and the blue LED makes Blink work out of the box.

Buy the XIAO ESP32S3 if the build needs memory: camera work, a display with a frame buffer, audio, edge AI, or a large sketch. The 8 MB of PSRAM and 8 MB of flash are the reasons. Buy the Sense version instead for a camera, a microphone, and a microSD slot.

Buy the ESP32-S3 SuperMini if the build needs two cores, more pins, and some PSRAM, but does not need 8 MB of it: bigger sensor builds, small displays, and multi-node projects where $6.40 per board beats $21.49. Check the chip marking for FH4R2 before relying on the PSRAM figure.

If you are still unsure, buy the C3 SuperMini 4-pack first. It is the cheapest way to learn the setup, and the steps transfer to the other boards.

What are the common mistakes?

  • Running a XIAO with no antenna. The XIAO has no built-in antenna. WiFi and Bluetooth will barely work until the included external antenna is fitted to the U.FL connector.
  • Using a SuperMini pinout on a XIAO, or the reverse. D4 is GPIO6 on the XIAO C3 and GPIO4 on the C3 SuperMini. Use the pin table for your exact board.
  • Expecting Blink to work on the XIAO C3. There is no user LED on the XIAO C3, only a charge LED. Wire an external LED before you run Blink.
  • Assuming the S3 SuperMini has 8 MB of PSRAM. The common FH4R2 version has 2 MB of PSRAM and 4 MB of flash. Check the chip marking.
  • Comparing a chip deep sleep figure against a board deep sleep figure. The bare C3 chip can sleep near 5 uA, but a finished board draws more through its regulator, LEDs, and USB circuitry. Seeed publishes board-level figures for the XIAO (44 uA C3, 14 uA S3). No equivalent figure is published for the generic SuperMini.

How do I troubleshoot a SuperMini vs XIAO problem?

The board does not appear as a USB port. Try a USB-C data cable, not a charge-only cable. Then hold BOOT, connect the cable, release BOOT, and upload Blink. Full steps are in our SuperMini guide.

The Serial Monitor is blank but the sketch runs. Set USB CDC On Boot to Enabled under Tools and re-upload. Full steps are in our SuperMini guide.

WiFi will not connect on a XIAO. Check the antenna first. If the external antenna is not fitted, fit it and test again. If it is fitted, check the connector is fully seated.

WiFi will not connect on a SuperMini. Move the board closer to the router first. Some batches have weak WiFi that improves when the transmit power is lowered in code.

Parts used in this guide

Prices and stock were verified against the live SuperMini guide (updated 2026-11-21) and the batch 2 verification of the same day. The public Store API returned HTTP 429 at draft time. Re-verify every price and stock live before publishing.

Shipped fast and securely from our secure facility in Queensbury, NY. QRC ships within the USA only.

Related guides

FAQ

What is the difference between an ESP32 SuperMini and a XIAO ESP32? Same chip, different board. The XIAO has an external U.FL antenna, a built-in LiPo charging circuit, and no user LED on the C3. The SuperMini has a ceramic antenna, usually no charging circuit, and a blue LED typically on GPIO8. Pick the XIAO for battery sensors and range, the SuperMini for the lowest cost and breadboard work. Source: Mischianti; our SuperMini guide FAQ.

Can I use the same code on a SuperMini and a XIAO? Yes, with the pin names changed. Both run the same Arduino, MicroPython, and ESP-IDF code for the same chip. The XIAO uses D0 to D10 names and the SuperMini uses GPIO numbers. Source: The Engineering Projects XIAO ESP32-C3 guide.

Which board is better for battery projects? The XIAO, on both chips. It charges a LiPo over USB with no extra parts, and Seeed publishes board-level deep sleep figures of 44 uA for the C3 and 14 uA for the S3. The C3 SuperMini usually has no charging circuit and no published deep sleep figure. Source: Seeed wiki C3 and S3 pages; Mischianti XIAO ESP32-C3 guide.

Does the XIAO need an external antenna? Yes. The XIAO has a U.FL connector only and no built-in antenna. The antenna ships in the box and must be fitted before WiFi or Bluetooth will work properly. Source: Seeed wiki S3 page; Seeed forum BLE signal thread.

Which S3 board should I buy, the SuperMini or the XIAO S3? Buy the XIAO S3 if the build needs memory: camera work, displays, audio, or large sketches. It has 8 MB of PSRAM and 8 MB of flash against 2 MB of PSRAM and 4 MB of flash on the common S3 SuperMini FH4R2 version. Buy the S3 SuperMini for two cores, more pins, and some PSRAM at $6.40 per board in the 5-pack. Check the chip marking for FH4R2 before trusting the memory figure. Source: Seeed wiki S3 page; TeachMeMicro; Lingflux.

Sources

Last updated: 2026-11-21

Change log

  • 2026-11-21: Draft created. Direct SuperMini vs XIAO comparison across the C3 and the S3: size, pins, antenna, battery, memory, and price per board. Overlap checked against live posts 15176 (SuperMini guide, one C3-only comparison section) and 18592 (XIAO four-board comparison, no SuperMini coverage). Batch 2 XIAO pinout draft not live yet at draft time, so no link to it is included. Product prices carried from the live SuperMini guide (updated 2026-11-21) and batch 2 verification of the same day; the public Store API returned HTTP 429 at draft time, so prices and stock must be re-verified live before publishing, and the slug 404 must be re-checked at publish time for the same reason.
  • 2026-11-21: Trimmed from 3,492 to 2,797 publishable words (H1 through FAQ, plain wc -w; 2,969 H1 through Last updated, Sources included). Cut one FAQ, shortened table cells and Sources lines, and trimmed prose across size, pins, C3, S3, battery, price, buy, mistakes, troubleshooting, and parts sections. No facts, prices, or safety notes changed.

XIAO ESP32 Pinout: C3, C6, S3, and C5 GPIO Tables

Every XIAO ESP32 board breaks out the same 11 GPIO pins, D0 through D10, on the same 14-pin header with 5V, GND, and 3V3. What changes is the GPIO number behind each D pin, how many pins can read analog voltages, and which pins the chip watches at boot.

This guide gives the pin table for the C3, the C6, and the C5 from the Seeed wiki pin map for each board, and points to our full S3 pinout guide for the S3. It also covers shared pins, free pins, and strapping pins. Verify every table against the Seeed wiki page for your board variant before you solder. Pin tables conflict across sources.

Which pins do all four XIAO ESP32 boards share?

The header layout is the same on all four boards. The bus positions never move: I2C is always D4 and D5, SPI is always D8, D9, and D10, and UART is always D6 and D7. What moves is the GPIO number and the analog count.

Function C3 C6 S3 C5
I2C SDA / SCL D4 / D5 D4 / D5 D4 / D5 D4 / D5
SPI SCK / MISO / MOSI D8 / D9 / D10 D8 / D9 / D10 D8 / D9 / D10 D8 / D9 / D10
UART TX / RX D6 / D7 D6 / D7 D6 / D7 D6 / D7
Analog pins on the header 4 (D0 to D3) 3 (D0 to D2) 9 (D0 to D5, D8 to D10) 1 (D0)

Sources: Seeed wiki pin maps; our S3 pinout post for the S3 row. The C3 has a charge LED only, per the Seeed C3 wiki pin map.

How do I read a XIAO pinout diagram?

Three names describe the same physical pin, and mixing them up is the most common wiring mistake on these boards.

  • D name: the printed pad name, D0 through D10. Use it in Arduino code, for example digitalWrite(D4, HIGH).
  • GPIO number: the chip pin number, for example GPIO2 or GPIO22. Use it in ESP-IDF code and in datasheets.
  • A name: the analog name, A0 through A3 on the C3, A0 through A2 on the C6, A0 on the C5. Use it with analogRead(A0).

The Seeed wiki diagram for each board shows the front and the back: the D pins and USB-C port on the front, the battery pads and JTAG test pads (MTDO, MTDI, MTCK, MTMS) on the back. Keep the Seeed wiki page for your board open while you wire. Some third party pages number the same D pads differently, and a table built for the wrong board will compile cleanly and do nothing.

What is the XIAO ESP32C3 pinout?

The C3 is the cheapest board of the four, with one catch: three of its header pins are strapping pins, so what you connect to them at reset matters. The table below follows the Seeed wiki C3 pin map.

Pad GPIO Main function Shared with
D0 GPIO2 Analog A0, ADC1_CH2 Strapping
D1 GPIO3 Analog A1, ADC1_CH3 Wake
D2 GPIO4 Analog A2, ADC1_CH4 JTAG MTMS, wake
D3 GPIO5 Analog A3, ADC2_CH0 JTAG MTDI, wake
D4 GPIO6 I2C SDA JTAG MTCK
D5 GPIO7 I2C SCL JTAG MTDO
D6 GPIO21 UART TX Console
D7 GPIO20 UART RX Console
D8 GPIO8 SPI SCK Strapping
D9 GPIO9 SPI MISO Strapping, BOOT
D10 GPIO10 SPI MOSI Flash CS
5V / GND / 3V3 – Power 5 V, GND, 3.3 V out (700 mA max per Seeed wiki)

Source: Seeed wiki C3 pin map.

D3 is the only ADC2 channel on the header, and ADC2 readings can be unreliable while WiFi is running, so use D0 to D2 (ADC1) for analog sensors when WiFi is on. Source: studiopieters C3 pinout guide. Only D0 to D3 can wake the chip from deep sleep. The C3 has no onboard antenna.

What is the XIAO ESP32C6 pinout?

The C6 is the Matter, Thread, and Zigbee board, and the friendliest to wire: none of its header pins is a strapping pin. The table below follows the Seeed wiki C6 pin map.

Pad GPIO Main function Shared with
D0 GPIO0 Analog A0, ADC LP GPIO, wake
D1 GPIO1 Analog A1, ADC LP GPIO, wake
D2 GPIO2 Analog A2, ADC LP GPIO, wake
D3 GPIO21 GPIO SDIO DATA1
D4 GPIO22 I2C SDA SDIO DATA2
D5 GPIO23 I2C SCL SDIO DATA3
D6 GPIO16 UART TX Console
D7 GPIO17 UART RX Console
D8 GPIO19 SPI SCK SDIO clock
D9 GPIO20 SPI MISO SDIO DATA0
D10 GPIO18 SPI MOSI SDIO command
5V / GND / 3V3 – Power 5 V, GND, 3.3 V out

Source: Seeed wiki C6 pin map. The chip has 7 ADC channels, but only D0, D1, and D2 are broken out as analog header pins.

The board carries both a small onboard ceramic antenna and a U.FL connector, and the choice is made in firmware through an RF switch. Pull GPIO3 low to enable the switch, then GPIO14 low selects the built-in antenna (the default) and GPIO14 high selects the external antenna. Neither GPIO is a header pin. Source: Seeed wiki C6 RF switch section. Only the low-power GPIOs, GPIO0 to GPIO7, can wake the chip from deep sleep, and the XIAO breaks out three of them.

What is the XIAO ESP32-C5 pinout?

The C5 is the newest board and the only one with dual-band WiFi, 2.4 GHz and 5 GHz. Its GPIO numbers jump around, but the bus positions are the same as the other boards. The table below follows the Seeed wiki C5 pin map.

Pad GPIO Main function Shared with
D0 GPIO1 Analog A0, ADC LP GPIO, wake
D1 GPIO0 GPIO LP GPIO
D2 GPIO25 GPIO Strapping
D3 GPIO7 GPIO SDIO DATA1, strapping
D4 GPIO23 I2C SDA –
D5 GPIO24 I2C SCL –
D6 GPIO11 UART TX –
D7 GPIO12 UART RX –
D8 GPIO8 SPI SCK –
D9 GPIO9 SPI MISO –
D10 GPIO10 SPI MOSI –
5V / GND / 3V3 – Power 5 V, GND, 3.3 V out

Source: Seeed wiki C5 pin map. The chip has 5 ADC channels, but only D0 is broken out as an analog header pin.

The battery voltage reading is built in: GPIO6 reads the battery and GPIO26 enables the measurement circuit, so you can read the cell voltage in code with no divider to solder. Source: Seeed wiki C5 battery section. The user LED is GPIO27.

What is the XIAO ESP32S3 pinout?

The S3 pinout is covered in full in our dedicated guide, Seeed XIAO ESP32S3 Pinout: GPIO, Camera, and Power, so this section is a summary only. The S3 breaks out the same 11 D pins: D0 to D5 are GPIO1 to GPIO6, D6 and D7 are GPIO43 and GPIO44 for UART, and D8 to D10 are GPIO7, GPIO8, and GPIO9 for SPI. I2C is D4 and D5, and 9 of the 11 pins can read analog voltages. The boot button is GPIO0. The Sense version adds a detachable camera and a microSD slot on an expansion board on the back, and the microSD chip select is GPIO21.

Which pins are shared with other hardware?

A pin that looks free on the header may already have a job. Check this table before you assign pins.

Shared hardware Board Pins involved What it means for your wiring
Antenna RF switch C6 GPIO3 (power), GPIO14 (select) Internal, not header pins. GPIO3 low, then GPIO14 low for onboard or high for external. Source: Seeed wiki C6.
Antenna C3 U.FL connector only No onboard antenna. Attach the external antenna or WiFi range will be poor.
Battery voltage read C5 GPIO6 (read), GPIO26 (enable) Built-in divider. Drive GPIO26 high to read the battery on GPIO6. Source: Seeed wiki C5.
Camera, mic, microSD S3 Sense only Board-to-board connector, SD CS GPIO21 On the expansion board, not the D header. See the S3 pinout guide.

Which pins are free for your project on each board?

Free means no boot-time duty, no bus duty, and no shared hardware.

The bus pins are the same on all four boards (D4/D5 I2C, D6/D7 UART, D8 to D10 SPI) and are free whenever that bus is unused.

Board Free pins, no conditions Pins that need care
C3 D1 (GPIO3), D10 (GPIO10) D0, D8, D9 (strapping); D2, D3, D4, D5 (JTAG)
C6 D0, D1, D2, D3, D4, D5, D8, D9, D10 D6, D7 (UART console)
C5 D0, D1, D4, D5, D6, D7, D8, D9, D10 D2, D3 (strapping)
S3 D0, D1, D3, D4, D5, D8, D9 D2 (strapping), D6, D7, D10 (see the S3 pinout guide)

Sources: Seeed wiki pin maps; the S3 row follows our S3 pinout post.

Which pins are strapping and boot pins on each board?

Strapping pins are read by the chip at reset to pick the boot mode. A sensor that pulls one to the wrong level at reset can stop the board from booting or accepting an upload.

Board Strapping pins on the header Boot button GPIO
C3 D0 (GPIO2), D8 (GPIO8), D9 (GPIO9) GPIO9
C6 None on the header GPIO9
C5 D2 (GPIO25), D3 (GPIO7) GPIO28
S3 D2 (GPIO3), plus GPIO0 on the BOOT button GPIO0

The C3 pins come from the Seeed wiki C3 strapping section. The Seeed wiki has no strapping section for the C6 or the C5: the C6 list (GPIO4, GPIO5, GPIO8, GPIO9, GPIO15, all internal) comes from the SolderHub C6 guide, and the C5 pins come from the ESP32-C5 datasheet via the espboards C5 page, both secondary sources. Full S3 detail is in the S3 pinout guide.

If a board stops appearing as a USB port or refuses uploads after you wire something new, check the strapping pins first. Disconnect the new wiring, confirm the board uploads again, then rewire with the strapping pin left alone at boot.

What are the common mistakes?

  • Using a pin table from the wrong board. D4 is GPIO6 on the C3, GPIO22 on the C6, GPIO5 on the S3, and GPIO23 on the C5. The D name is the same and the GPIO number is not.
  • Wiring a sensor to a strapping pin on the C3. D0, D8, and D9 decide the boot mode. A sensor that pulls one low at reset can leave the board unresponsive.
  • Expecting analog reads on every D pin. Only D0 to D3 read analog on the C3, only D0 to D2 on the C6, and only D0 on the C5. The S3 is the analog-rich board with 9 analog header pins.
  • Running the C3 with no antenna. The C3 has no onboard antenna. WiFi will barely work without the external antenna on the U.FL connector.

How do I troubleshoot a XIAO pinout problem?

The board does not appear as a USB port. Try a different USB-C cable, one that carries data, not a charge-only cable. Then try bootloader mode: on the C6, hold BOOT, connect the cable, release BOOT, and upload Blink. Source: Seeed wiki C6 bootloader section.

Uploads fail after new wiring. Disconnect the new wiring and try again. If the upload works, a strapping pin is held at the wrong level. On the C3 check D0, D8, and D9 first. On the C5 check D2 and D3. On the S3 check D2.

analogRead returns 4095 or 0 all the time. Check that the pin is an analog pin on your board. On the C5 only D0 reads analog on the header. On the C6 only D0 to D2 do. On the C3 only D0 to D3 do. Also check that the sensor output stays inside 0 to 3.3 V.

Which pins can I use for my project?

Pick the board first, then the pins. If you have not picked a board, see XIAO ESP32C3 vs C6 vs S3 vs C5: Pick the Right Board.

Project Board Pins to use
I2C sensor or OLED Any D4 SDA, D5 SCL
SPI display or SD card Any D8 SCK, D9 MISO, D10 MOSI, plus a free pin for chip select (on the C3, use D1, not D0)
Analog sensor S3 first, C3 second S3: D0 to D5, D8 to D10; C3: D0 to D2
Battery-powered sensor node C6 or C5 C6: D0 to D2 for wake and analog; C5: D0 for wake

Parts used in this guide

Prices and stock were verified live on qualityrcparts.com on 2026-11-21 through the public Store API. All four items are in stock and purchasable.

Shipped fast and securely from our secure facility in Queensbury, NY. QRC ships within the USA only.

Related guides

FAQ

How many GPIO pins does a XIAO ESP32 board have? 11, named D0 through D10, on all four boards. The header also carries 5V, GND, and 3V3. Source: Seeed wiki pin maps.

Which pins are I2C on the XIAO ESP32 boards? D4 is SDA and D5 is SCL on all four boards. Source: Seeed wiki pin maps.

Which pins are SPI on the XIAO ESP32 boards? D8 is SCK, D9 is MISO, and D10 is MOSI on all four boards. Source: Seeed wiki pin maps.

Can I use 5 volt sensors with a XIAO ESP32 board? No. All four boards run 3.3 V logic, and a voltage above 3.3 V on a GPIO pin can damage the chip. Use a level shifter. Source: Seeed wiki power sections.

Which XIAO pins are strapping pins? On the C3, D0 (GPIO2), D8 (GPIO8), and D9 (GPIO9). On the C5, D2 (GPIO25) and D3 (GPIO7). On the S3, D2 (GPIO3). On the C6, none of the header pins is a strapping pin.

Why does my XIAO ESP32C3 not boot after I wire a sensor? The usual cause is a strapping pin held at the wrong level at reset. D0, D8, and D9 decide the boot mode on the C3. Disconnect the new wiring, confirm the board boots, then move the sensor to D1 or D10.

Does the XIAO ESP32-C5 have an analog pin? Yes, one on the header: D0 (GPIO1). The chip has 5 ADC channels in total, but the others are not broken out on the header. Source: Seeed wiki C5 pin map.

Sources

Last updated: 2026-11-21

Change log

  • 2026-11-21: Draft created. Full C3, C6, and C5 pin tables from the Seeed wiki pin maps; S3 covered as a summary with a link to the dedicated S3 pinout post. Shared-pin, free-pin, and strapping tables added. No live post gives full C3, C6, or C5 pin tables, verified against posts 23363, 22718, and 18592.

ESP32-S3 Face Detection Guide: XIAO Sense and S3-CAM

The ESP32-S3 can look at a camera frame and tell you where the faces are, on the chip itself, with no cloud account and no video leaving the board.

This guide covers what the ESP32-S3 can and cannot do with faces, detection vs recognition, which boards work, the no-code and Arduino routes, and the mistakes that waste the most time. Nothing here needs a paid app or a cloud account for the on-device routes.

What is face detection on the ESP32-S3, and what can it actually do?

Face detection on the ESP32-S3 means a small neural network model runs on the chip, looks at each camera frame, and returns a box around every face it finds, plus a confidence score for each box. Your code gets the boxes: light an LED, count people, trigger a relay, send an MQTT message, or save a snapshot.

It works on the ESP32-S3 and not well on the classic ESP32 because of the hardware. The ESP32-S3 has vector instructions that speed up neural network math, and camera boards built on it carry 8 MB of PSRAM, which holds the frame and the model weights. Source: Espressif edge AI workshop and ESP-WHO docs.

Detection runs on small frames. The models are trained on small inputs, so the camera captures at a low resolution for inference even when the sensor can shoot much higher. Espressif’s workshop lists QVGA (320 by 240) as the typical frame size for face detection and HVGA (480 by 320) for face recognition. Source: Espressif edge AI workshop, Assignment 4.

What is the difference between face detection and face recognition?

Detection and recognition are two different jobs, and mixing them up is the most common source of disappointment with these boards.

Face detection answers “is there a face in this frame, and where”. It returns boxes and confidence scores and knows nothing about who the person is. A doorbell that lights up when someone approaches and a people counter at a doorway need detection only.

Face recognition answers “whose face is this”. It runs detection first, then turns each detected face into a numerical embedding and compares it against faces you enrolled earlier. You show the board each person’s face and give it a name, and the board stores the result. A door lock that opens for family members needs recognition.

Recognition is harder, slower, and more fragile than detection. It needs the face to be larger in the frame, better lit, and facing the camera more directly. It also stores face data on the board: tell everyone in the household what the camera stores, and do not use recognition to identify people who have not agreed to be enrolled. This guide gives no accuracy percentage for recognition, because no primary source we checked publishes one.

Task Question it answers Needs enrollment Typical use
Face detection Is there a face, and where No Doorbell alert, people counting, intruder alert
Face recognition Whose face is this Yes, one enrollment per person Door lock for family, attendance
Person detection Is there a person in frame No Room occupancy, trail camera trigger

Which ESP32-S3 boards work for face detection?

Any ESP32-S3 camera board with PSRAM can run a face detection model. The classic ESP32-CAM is the exception: on-device face detection models were removed from the Arduino ESP32 core version 3, so the classic board is a poor choice for new on-device face projects. It can still capture a picture and send it to a cloud API for detection. Source: Robojax tutorial.

Board Chip Camera PSRAM Face detection
XIAO ESP32S3 Sense ESP32-S3 detachable camera 8 MB Yes, on device
ESP32-S3-N16R8 CAM ESP32-S3 OV5640, 5 MP 8 MB Yes, on device
Classic ESP32-CAM ESP32 OV2640 4 MB Not recommended on device

The XIAO ESP32S3 Sense is the smallest option: an ESP32-S3 dual-core 240 MHz board with 8 MB PSRAM and 8 MB flash, a detachable camera, a digital microphone, a microSD slot, WiFi and Bluetooth 5.0, in a 21 by 17.5 mm footprint. The detachable camera matters: mount the tiny camera where the faces are and keep the board tucked away.

The ESP32-S3-N16R8 CAM is the larger, cheaper bench board: a dual-core ESP32-S3 with 16 MB flash plus 8 MB PSRAM and an OV5640 5 MP camera, with two USB-C ports that split OTG and serial duties, so it programs over USB with no adapter. The higher resolution sensor does not make detection better, because detection runs on small frames.

Which approach should you pick?

There are four working routes. Pick one row and follow its section.

Approach Code needed Toolchain Best for
SenseCraft AI (Seeed) None, deploy in a browser Web platform, USB cable Fastest first detection
Arduino IDE with esp-dl models Arduino sketch Arduino IDE, ESP32 core 2.0.17 Full control, offline recognition
ESP-WHO with ESP-IDF C, ESP-IDF project ESP-IDF v5.5.x Espressif reference examples
Cloud API detection Arduino sketch plus an API key Arduino IDE, internet Classic ESP32-CAM

How do I run face detection with SenseCraft AI, with no code?

SenseCraft AI is Seeed’s edge AI platform. It deploys a prebuilt model to a supported board from a browser, with no machine learning code and no toolchain install. This is the fastest route to a working face detector.

  1. Plug the XIAO ESP32S3 Sense into your computer with a USB-C data cable. A charge-only cable will power the board but the browser will never see it.
  2. Open the SenseCraft AI model page at https://sensecraft.seeed.cc/ai/model. Under Pretrained Models, set Task to Detection and Supported Devices to XIAO ESP32S3 Sense, then search “Face”.
  3. Pick the Swift-YOLO face detection model. As of July 2025 there were two face models listed, and the Makerguides tutorial reports only the Swift-YOLO one worked.
  4. Click Deploy Model, then Connect Device, pick the COM port the board is on, and confirm. The model downloads to the board in about 1 to 2 minutes. Source: Seeed SenseCraft AI wiki.
  5. The preview starts on its own, with bounding boxes drawn around detected faces in the live feed, each box carrying a confidence score.

Two settings control what counts as a detection. The confidence threshold filters detections by how sure the model is that something is a face: every detection scores 0 to 100 percent, and anything below the threshold is discarded. A lower threshold catches more faces but also flags more non-faces. The IoU (Intersection over Union) threshold decides which overlapping boxes to keep when the model draws several boxes around one face. Source: Makerguides tutorial.

SenseCraft models also offer outputs from the sidebar: a GPIO pin that goes high when a face is detected, serial output over UART, I2C or SPI with the face count and confidence, or MQTT over WiFi for a home automation system. GPIO is enough for a door opener or an alarm; MQTT is for Home Assistant. Source: Makerguides tutorial and Seeed wiki.

How do I run face detection with Arduino IDE?

Use the Arduino route when you want the detection inside your own sketch, for example a camera that also drives a relay or serves a web page. The Robojax XIAO face recognition tutorial is the clearest Arduino reference we found, and its settings are strict: get one wrong and the sketch will not compile or will not detect anything.

  1. Install Arduino IDE and add the ESP32 board package. In Boards Manager, install ESP32 core version 2.0.17. This version matters most: Espressif removed the on-device face detection models in core 3, so the project cannot compile there. Version 2.0.17 is the last 2.x release with both those models and the XIAO_ESP32S3 board definition. Source: Robojax tutorial.
  2. Select the board as XIAO_ESP32S3, not ESP32S3 Dev Module. The board definition carries the right camera pins and PSRAM settings.
  3. Set PSRAM to OPI PSRAM. It is off by default, and nothing works without it. Set Flash Size to 8 MB, Partition Scheme to Default with SPIFFS, USB CDC On Boot to Enabled, and Upload Speed to 921600, dropping to 460800 if uploads fail. Source: Robojax tutorial.
  4. Use the face detection models from the ESP32 core: HumanFaceDetectMSR01 as stage one to find candidate faces, and HumanFaceDetectMNP01 as stage two to refine the boxes and add five facial keypoints. The pipeline captures at 240 by 240 in RGB565, runs both stages, draws the boxes into the frame, then compresses to JPEG for streaming. Source: Robojax tutorial.
  5. Get the camera stream working before adding detection. Flash a plain camera sketch first and confirm the video shows in a browser. If the stream fails, the fault is in the camera setup, not the model. Our ESP32-S3-CAM setup guide covers the first-stream steps.

How do I add face recognition, so the board knows who it is?

Recognition adds two steps after detection: enroll faces, then match new faces against them.

Enrollment means showing the board each person’s face and storing the result. In the Robojax offline recognition project, enrollment happens from the board’s own web page: you type a name into a roster slot, point the camera at the person, and save. The board makes its own WiFi network for this, so no router and no internet are involved, and no face ever leaves the board. The stored data is a numerical embedding, not a photo, but it still identifies a person.

Matching means each new detected face is turned into an embedding and compared against every stored embedding. The EloquentEsp32cam docs describe the pipeline: align the face, generate a 512-dimensional embedding, compare it against stored embeddings, and return the best match if the similarity passes a threshold. Recognition typically takes 80 to 150 ms on ESP32-S3 hardware, for the recognition step alone. Source: EloquentEsp32cam DeepWiki docs.

The ESP-WHO framework is the Espressif reference route for recognition, with a state machine for ENROLL, RECOGNIZE, and DELETE operations. It targets ESP-IDF v5.5.x and the ESP32-S3 and ESP32-P4 chips. Source: Espressif ESP-WHO get started guide.

Do not use recognition as a security lock on its own. A small on-device model can be fooled by a printed photo, and no primary source we checked publishes a spoof resistance claim for these models. Keep a separate lock, code, or key for anything that must stay secure.

What are the accuracy and speed limits?

No source we checked publishes one tested accuracy number or one tested frame rate for ESP32-S3 face detection, so this guide gives neither as a universal claim. The limits below are what named sources state on their own setups.

  • Resolution for inference is small. Face detection runs at QVGA (320 by 240) and face recognition at HVGA (480 by 320) in Espressif’s workshop, and the Arduino recognition pipeline captures at 240 by 240. A face that is small in the frame will not be detected, whatever the sensor’s maximum resolution is. Source: Espressif edge AI workshop, Robojax tutorial.
  • Recognition is slower than detection. The EloquentEsp32cam docs state recognition typically takes 80 to 150 ms on ESP32-S3 hardware, for the recognition step alone, or roughly 7 to 12 recognitions per second before capture and streaming are counted. Source: EloquentEsp32cam DeepWiki docs.
  • Frame rate depends on resolution and settings. The Tokay Lite vendor page, for an ESP32-S3 camera board with 8 MB PSRAM, states its face detection model runs at 1 to 10 frames per second depending on resolution and settings. That is a vendor claim for their board, not a measured number for the XIAO Sense or the S3-N16R8 CAM. Source: Maxlab Tokay Lite page.
  • Lighting and angle matter more than the sensor. Faces that face the camera, are well lit, and fill a reasonable part of the frame detect reliably. Backlit faces, faces in profile, and faces at a steep angle do not. Test where the camera will live before mounting it permanently.

What are the common mistakes?

  • Using Arduino ESP32 core 3 for an on-device face sketch. The face detection models were removed in core 3. Use 2.0.17. If a sketch fails to compile with a missing face detect header, check the core version first.
  • Leaving PSRAM off. OPI PSRAM is off by default on the XIAO board definition, and the face pipeline will not run without it. Set it before the first upload.
  • Picking the wrong board definition. XIAO_ESP32S3, not ESP32S3 Dev Module. The wrong definition gives the wrong camera pins.
  • Running detection at full sensor resolution. The models are trained on small inputs. Capture small for detection.
  • Trusting recognition as the only lock. No spoof resistance claim exists for these small models. Keep a separate lock or code.

How do I troubleshoot face detection that does not work?

Work through this list in order.

The camera never shows a picture. Flash a plain camera sketch first. If that fails, the fault is wiring, pins, or power, not the model. Check the USB cable is a data cable and reseat the camera ribbon cable. Our ESP32-CAM getting started guide covers first-stream failures.

The sketch will not compile, missing human face detect headers. Check the ESP32 core version in Boards Manager. It must be 2.0.17 for the on-device face models. Source: Robojax tutorial.

The board boots but detection never fires. Check PSRAM is set to OPI PSRAM in the Arduino IDE tools menu, and that the frame size is 240 by 240 or QVGA. Then lower the confidence threshold and test with a face close to the camera, well lit, facing the lens.

Faces are detected but with many false positives. Raise the confidence threshold until non-faces stop triggering, then check real faces still trigger.

Which board should you buy?

  • Buy the XIAO ESP32S3 Sense if you want the smallest camera that runs face detection or the no-code SenseCraft AI route.
  • Buy the ESP32-S3-N16R8 CAM if you want the cheapest bench board, you prefer dual USB-C with no adapter, or you want the extra flash headroom.
  • Keep the classic ESP32-CAM if you only need to stream video or send a picture to a cloud API for detection.
  • Buy neither yet if you need to identify strangers, read faces at long range, or run a security system. No small on-device model does those jobs well. Our Arducam camera guide covers the Pi side.

Parts used in this guide

Prices and stock were verified live on qualityrcparts.com on 2026-11-21. All three items are in stock and purchasable.

Shipped fast and securely from our secure facility in Queensbury, NY. QRC ships within the USA only.

Related guides

FAQ

Can the ESP32-S3 do face detection? Yes. The ESP32-S3 runs small on-device face detection models with no cloud. Detection runs on small frames, typically QVGA (320 by 240) or 240 by 240. Source: Espressif ESP-WHO docs and edge AI workshop.

What is the difference between face detection and face recognition on ESP32-S3? Detection finds faces and returns boxes. Recognition identifies whose face it is by comparing it against faces you enrolled earlier. Detection needs no enrollment; recognition needs one per person, stores face embeddings on the board, and is slower and more sensitive to lighting and angle. Source: Espressif ESP-WHO docs, EloquentEsp32cam docs.

Which ESP32 board is best for face detection? The XIAO ESP32S3 Sense is the best small board, and the ESP32-S3-N16R8 CAM is the best cheap bench board. Both are ESP32-S3 with 8 MB PSRAM and run the same on-device models. The classic ESP32-CAM is not recommended for new on-device face work. Source: Robojax tutorial, QRC live listings.

Can I do face detection on ESP32-S3 with Arduino? Yes, with Arduino IDE and ESP32 core version 2.0.17. Core 3 removed the on-device face detection models, so 2.0.17 is required. Select XIAO_ESP32S3, set PSRAM to OPI PSRAM, and capture at 240 by 240. Source: Robojax tutorial.

Can the ESP32-S3 do face recognition offline? Yes. Recognition runs on the board with no internet: the Robojax offline project enrolls faces from the board’s own web page over its own WiFi network. No face data leaves the board. Source: Robojax tutorial, Espressif ESP-WHO docs.

How far away can the ESP32-S3 detect a face? No primary source we checked publishes a detection range in feet or meters. Detection depends on how large the face is in the small inference frame, plus lighting and angle. Test at the real mounting distance.

Sources

Last updated: 2026-11-21

ESP32-CAM RTSP Streaming: Setup Guide for VLC and NVR

The ESP32-CAM is a cheap way to build a WiFi camera, but the sketch most beginners start with does not speak RTSP. The stock Espressif CameraWebServer example streams MJPEG over HTTP, and that is all it does. If you want VLC, Frigate, Blue Iris, or an NVR to pick the camera up as a standard network camera, you need RTSP, which needs different firmware or a different library.

This guide covers the working routes, the board each one fits, the exact RTSP URL each serves, VLC viewing, Frigate and Home Assistant setup, and expected frame rate. Nothing here needs a paid app or a cloud account.

What is RTSP, and when does it beat MJPEG?

RTSP, Real Time Streaming Protocol, is the standard way network cameras hand video to players and recorders. A client asks for a stream, the two agree on transport settings, and video flows over RTP. VLC, ffmpeg, Frigate, Blue Iris, ZoneMinder, and most NVR software all speak RTSP.

MJPEG over HTTP, the /stream endpoint in the stock CameraWebServer sketch, is simpler: the camera sends one JPEG image after another in a single HTTP response, and any browser can show it. NVR software generally cannot record it, and detection tools cannot consume it directly.

Use RTSP to record footage, run motion or person detection, watch several cameras in one app, or feed the camera into Home Assistant through Frigate or go2rtc. Stick with MJPEG over HTTP for a quick live view in a browser. If you have not set up the board yet, start with our ESP32-CAM getting started guide first.

Which board works for RTSP?

Any ESP32 camera board with PSRAM can run an RTSP server. The classic AI-Thinker style ESP32-CAM has an ESP32 chip with 4 MB PSRAM and an OV2640 camera. The ESP32-S3-N16R8 CAM board runs an ESP32-S3 chip with 8 MB PSRAM and an OV5640 camera, and its two USB-C ports mean no serial adapter is needed. Both boards stream MJPEG video over RTSP, not H.264, which matters for bandwidth and Home Assistant (see the frame rate section).

Pin tables conflict across sources. A wrong camera pin map is the most common reason a build compiles cleanly and shows no video, so verify the pins against your exact board variant before flashing, using that variant’s own documentation.

What are the RTSP setup options?

There is no single official RTSP example from Espressif for the classic ESP32-CAM. The working routes are community firmware and libraries. Pick one row and follow its section.

Approach Best for Boards RTSP URL pattern Code or config needed
esp32cam-rtsp firmware by rzeldent Fastest setup, no code changes ESP32, ESP32-S2, ESP32-S3 camera modules rtsp://IP:554/mjpeg/1 Flash with PlatformIO, configure in a browser
Micro-RTSP library by geeksville Arduino or PlatformIO sketch you control Classic ESP32-CAM (OV2640) rtsp://IP:8554/mjpeg/1 Arduino sketch plus the Micro-RTSP library
Tasmota32 webcam firmware Users who already run Tasmota and want MQTT control Classic ESP32-CAM (AI-Thinker template) rtsp://IP:8554/mjpeg/1 Flash the webcam binary, run one command
ESPHome rtsp_server component ESP32-S3 boards already in ESPHome ESP32 camera boards running ESPHome rtsp://IP:554/ Add two lines to your ESPHome YAML

Sources: esp32cam-rtsp at https://www.esp32.diy/esp32cam-rtsp/ ; Micro-RTSP at https://github.com/geeksville/Micro-RTSP ; circuit.rocks tutorial at https://learn.circuit.rocks/esp32-cam-with-rtsp-video-streaming ; Tasmota guide at https://cgomesu.com/blog/Esp32cam-tasmota-webcam-server/ ; ESPHome docs at https://beta.esphome.io/components/rtsp_server/ .

How do I set up esp32cam-rtsp, the no-code route?

Recommended route for most buyers. The firmware turns the board into an RTSP server, an HTTP MJPEG streamer, and a snapshot endpoint at once, all configured through a web page, with no code changes. Latest release at the time of writing: 1.0.8 (2026-09-29).

  1. Install PlatformIO (VS Code extension or CLI) and clone the project: git clone https://github.com/rzeldent/esp32cam-rtsp.git.
  2. Enter download mode. USB-C boards do this on their own; if an upload fails, hold BOOT, press and release RESET, then release BOOT. On a classic ESP32-CAM, use a 3.3 V USB-to-serial adapter or an ESP32-CAM-MB carrier, and hold GPIO0 low while resetting. 5 V logic damages the board.
  3. Flash your board target, for example pio run -t upload -e esp32cam_ai_thinker for the AI-Thinker board.
  4. On first boot the firmware starts its own WiFi access point. Join it, open the config page shown in the serial monitor, enter your WiFi credentials and camera settings, then save. The board reboots onto your network.
  5. Open VLC and play rtsp://<ip address>:554/mjpeg/1.

The same firmware also serves MJPEG at http://<ip address>/stream and a still at http://<ip address>/snapshot. Turn on RTSP authentication in the web interface if anyone outside your household can reach your network, and never forward port 554 through your router.

How do I set up Micro-RTSP in an Arduino sketch?

Use this route when you want the RTSP server inside your own sketch, for example a camera that also reads sensors or drives outputs. Micro-RTSP is a small RTSP server library implementing RTSP and JPEG-over-RTP, with a reference streamer built for the OV2640 on the classic ESP32-CAM.

  1. Install Micro-RTSP from the ZIP in the circuit.rocks ESP32-RTSP repo, or as a PlatformIO dependency; it is not in the Arduino Library Manager. Full example: https://github.com/circuitrocks/ESP32-RTSP .
  2. Put your WiFi credentials in the sketch’s credentials header before compiling.
  3. Wire the classic ESP32-CAM: 5 V and ground to the header pins, adapter TX to board U0R and RX to U0T, and a button between IO0 and ground. Use a 5 V, 2 A supply; a computer USB port is often not enough.
  4. Hold the download button while powering up or resetting, then upload. The serial monitor at 115200 baud shows the boot message and board IP.
  5. In VLC play rtsp://<ip address>:8554/mjpeg/1. Note the port: 8554, not 554.

The example loop sends a frame about every 100 ms, roughly 10 fps at 800 by 600, per the Micro-RTSP docs for that example. Run only one streaming server at a time; enabling both web and RTSP makes streaming very slow.

How do I enable RTSP on Tasmota?

Use this route only if you already run Tasmota or want its MQTT control and web interface. Flash the tasmota32-webcam firmware, apply the AI-Thinker template, then enable the RTSP server from the Tasmota console:

WcRtsp 1

The stream is then live at rtsp://<device IP>:8554/mjpeg/1. Enable it once; the RTSP server runs independently of the HTTP stream. The Tasmota guide reports VLC is the most reliable viewer. Full steps: https://cgomesu.com/blog/Esp32cam-tasmota-webcam-server/ .

How do I add RTSP to an ESPHome camera?

If your camera already runs ESPHome, add the RTSP server component next to your configured esp32_camera block:

rtsp_server:

That is the whole configuration. The stream is served at rtsp://<device IP>:554/ with no path after the port. Optional settings: port (default 554), max_connections (1 to 4, default 2), and allowed_ips (addresses or networks allowed to connect).

Two facts catch people out. First, the stream is MJPEG over RTSP, and the camera only streams while at least one client is playing. Second, there is no encryption or authentication; allowed_ips filters by address but authenticates nobody, so use it only on a trusted local network. Source: ESPHome RTSP docs.

How do I watch the stream in VLC?

VLC is the best first test for any of the four routes, because its RTSP support is solid and its error messages point at the real problem.

  1. Open VLC, go to Media, then Open Network Stream, or press Ctrl+N.
  2. Paste the RTSP URL for your firmware: port 554 for esp32cam-rtsp and ESPHome, port 8554 for Micro-RTSP and Tasmota. The path is /mjpeg/1 for esp32cam-rtsp, Micro-RTSP, and Tasmota, and the root path / for ESPHome.
  3. Click Play. If the picture appears, the camera, firmware, and network path all work, and any later failure is in the next app, not the camera.

If the video lags by a second or more, the cause is usually VLC network caching, not the camera. VLC buffers network streams at 1000 ms by default. In the stream dialog, click Show more options and lower caching to 300 ms, or to 0 ms for the lowest delay. Zero caching makes the picture more sensitive to WiFi jitter, so on a weak signal keep some caching and fix the signal instead.

How do I add the camera to Home Assistant and Frigate?

Two warnings first, because most tutorials get this part wrong.

Warning one: Home Assistant Generic Camera cannot play this stream. Its pipeline plays only H.264 and HEVC, and every RTSP route in this guide serves MJPEG. The ESPHome docs state this directly. Source: ESPHome RTSP docs.

Warning two: if the camera runs ESPHome, Home Assistant does not need RTSP at all. The ESPHome native API already exposes the camera entity. RTSP is for other software.

The route that works is Frigate, with go2rtc if your Frigate version uses it. Frigate reads the MJPEG RTSP stream with ffmpeg and handles detection and recording. A working Frigate camera entry from the Home Assistant community, using the Tasmota or Micro-RTSP URL:

cameras:
  esp32_cam:
    ffmpeg:
      inputs:
        - path: rtsp://192.168.1.72:8554/mjpeg/1
          roles:
            - detect
            - record
    detect:
      width: 640
      height: 360
      fps: 5

Replace the IP address with your camera IP, and use port 554 with the matching path for esp32cam-rtsp or ESPHome. Keep detection resolution low; community users run 640 by 360 at 5 frames per second. Source: Home Assistant community Frigate thread.

If you only want a live dashboard view, skip RTSP and use the ESPHome native camera entity or the HTTP MJPEG stream. RTSP earns its place when Frigate or an NVR must record or analyze the feed.

What latency and frame rate should I expect?

No source gives one tested frame rate for every board and firmware, so this guide gives no universal number. The numbers below are what named sources measured on their own setups. Your result moves with resolution, JPEG quality, WiFi signal, and client count.

  • ESPHome measured about 5 fps over WiFi and 10 over Ethernet at 640 by 480 on an ESP32-S3 with an OV5640, using its high performance network settings; without them the same test ran at about 1 fps over WiFi. Source: ESPHome RTSP docs.
  • The Micro-RTSP example sends a frame about every 100 ms, roughly 10 fps at 800 by 600 in its own documentation. Source: Micro-RTSP docs.
  • The esp32cam-rtsp project states that resolution and frame rate are bounded by the ESP32 processor and available PSRAM. Source: esp32cam-rtsp project page.

Start at 640 by 480 and raise resolution only after the stream is stable. MJPEG uses more bandwidth than H.264 at the same picture quality, since every frame is a full JPEG. Assume one viewer at a time on a classic ESP32-CAM; ESPHome defaults to two RTSP clients.

What are the common mistakes?

  • Flashing the stock CameraWebServer sketch and expecting RTSP. It serves MJPEG over HTTP only.
  • Using the wrong port. Port 554 belongs to esp32cam-rtsp and ESPHome; port 8554 belongs to Micro-RTSP and Tasmota. The wrong port gives a connection refused error even when the camera runs fine.
  • Using the wrong path. The path is /mjpeg/1 for esp32cam-rtsp, Micro-RTSP, and Tasmota, and the root path / for ESPHome.
  • Powering the classic ESP32-CAM from a weak USB port. The board needs a stable 5 V, 2 A supply. Brownouts during WiFi connection look like firmware bugs and are usually power.
  • Running two streaming servers at once in the Micro-RTSP sketch. The tutorial warns this makes streaming very slow. Pick one.
  • Pointing Home Assistant Generic Camera at an MJPEG RTSP URL. It cannot play it. Use Frigate or go2rtc, or the ESPHome native camera entity.
  • Opening RTSP to the internet. None of these routes is built for that, and ESPHome RTSP has no authentication at all. Keep the camera on your local network.
  • Trusting a pin table from a different board variant. Pin maps conflict across sources. Verify the camera pins against your exact board variant before blaming the firmware.

How do I troubleshoot a stream that will not play?

Work through this list in order; each step rules out one layer.

VLC says “Your input can’t be opened” or times out. Check the board IP in the serial monitor or your router, confirm the camera and computer share a network, and confirm the port and path match your firmware in the table above. Check the router is not isolating WiFi clients (AP isolation) and that no firewall blocks the RTSP port.

VLC connects but shows a black or frozen frame. Drop to 640 by 480 and move closer to the router. The ESP32-CAM is 2.4 GHz only, so a 5 GHz network name will never work.

The stream stutters or drops frames. Lower the resolution and frame rate, disconnect other viewers, and check the power supply, since a marginal 5 V supply causes this under load. In VLC, force RTP over RTSP (TCP) when UDP packets drop.

The camera boots but never joins WiFi. Re-enter the network name and password, watching case and trailing spaces. Check the serial monitor at 115200 baud for connection messages and the assigned IP. A reboot loop usually means power first, then a loose camera ribbon cable.

The camera works in VLC but Frigate reports “Unable to read frames”. Confirm the URL in VLC first, then copy it exactly into Frigate. The common cause is port 554 when the firmware serves on 8554, or an ESPHome web server port, which is HTTP, not RTSP. Source: Home Assistant community thread.

Wrong colors or artifacts. Reseat the camera ribbon cable and lower the resolution.

Parts used in this guide

Prices and stock were verified live on qualityrcparts.com on 2026-11-21 through the public Store API. All three items are in stock and purchasable; the live product page is the current price.

Shipped fast and securely from our secure facility in Queensbury, NY. QRC ships within the USA only.

Related guides

FAQ

Does the ESP32-CAM support RTSP out of the box? No. The stock CameraWebServer example serves MJPEG over HTTP only, with no RTSP server. Add RTSP with esp32cam-rtsp firmware, the Micro-RTSP library, Tasmota webcam firmware, or the ESPHome rtsp_server component. Source: Home Assistant community, Tasmota guide.

What is the RTSP URL for an ESP32-CAM? It depends on the firmware: rtsp://IP:554/mjpeg/1 for esp32cam-rtsp, rtsp://IP:8554/mjpeg/1 for Micro-RTSP and Tasmota, rtsp://IP:554/ for ESPHome. Replace IP with the camera IP from your router or serial monitor. Source: esp32cam-rtsp, Micro-RTSP, Tasmota, and ESPHome docs.

Can I add an ESP32-CAM RTSP stream to Home Assistant? Not through Generic Camera: its pipeline plays only H.264 and HEVC, and ESP32-CAM RTSP serves MJPEG. Feed the stream to Frigate or go2rtc instead, or use the ESPHome native camera entity. Source: ESPHome RTSP docs.

Why does VLC say it cannot open my ESP32-CAM stream? The usual causes are a wrong IP address, the wrong port (554 vs 8554), the wrong path (/mjpeg/1 vs the ESPHome root path), AP isolation, or a firewall blocking the RTSP port. Check the stream in VLC first, then copy that working URL into any other app. Source: Micro-RTSP and circuit.rocks docs.

What frame rate will I get from an ESP32-CAM over RTSP? There is no single tested number. ESPHome measured about 5 fps over WiFi and 10 over Ethernet at 640 by 480 on an ESP32-S3 with an OV5640, and the Micro-RTSP example runs about 10 fps at 800 by 600. Start at 640 by 480. Source: ESPHome and Micro-RTSP docs.

Is RTSP better than MJPEG for an ESP32-CAM? RTSP is better when a recorder, NVR, or detection tool needs the feed, because those tools speak RTSP and generally cannot consume an MJPEG HTTP stream. MJPEG over HTTP is better for a quick live view in a browser. Both carry the same MJPEG video, so RTSP does not improve the picture, it makes the feed usable by more software. Source: ESPHome docs, esp32cam-rtsp page.

Can I view an RTSP stream in a web browser? No, not directly. Browsers do not play RTSP. Use VLC or an NVR app for RTSP, the HTTP MJPEG stream at http://IP/stream for a browser view, or Frigate or go2rtc between the camera and the browser. Source: circuit.rocks docs, esp32cam-rtsp page.

Sources

Last updated: 2026-11-21

Hexapod Spider Robot Kit Build: 18 Servos, Six Legs

Hexapod spider robot kit with six legs and 18 servos

Hexapod Spider Robot Kit Build: 18 Servos, Six Legs

Build the hexapod spider robot kit with 18 servos across six legs, driven by PCA9685 boards over I2C. Three legs lift and swing while the other three hold the body up, which is the tripod gait. The servos need a 5 to 6 V supply rated at 10 A, because 18 servos can draw more than any USB port supplies.

Quick facts

Item Value
Legs 6 legs, 3 servos per leg, 18 servos total
Gait Tripod gait: 3 legs lift, 3 legs support
Drivers PCA9685 boards, 16 channels each; two boards cover 18 servos
Controller Freenove Crawling Robot Controller in the kit, Arduino IDE compatible; wireless remote included
Servo supply Separate 5 to 6 V, sized for stall current
Battery Not included; 2x 3.7 V 18650 flat-top cells plus a charger, bought separately

Hexapod spider robot kit: how does it walk?

A hexapod walks with a tripod gait. At any moment, three legs touch the ground and hold the body up, while the other three lift, swing forward, and set down. Then the two tripods swap. The body never has fewer than three legs on the ground, so it stays stable without balancing.

Each leg has three servos: a hip servo that swings the leg forward and back, a knee servo that lifts the leg, and an ankle servo that sets the foot angle. Three servos per leg times six legs is 18 servos. No Arduino has 18 PWM pins to spare, which is why the build uses PCA9685 boards.

The two tripods are the front left, middle right, and rear left legs in one group, and the front right, middle left, and rear right legs in the other. Lift one tripod, swing it forward, set it down, then lift the other. That is the whole walk. Turning shifts the swing direction, and strafing shifts the foot targets sideways.

Why do 18 servos need two PCA9685 boards?

One PCA9685 drives 16 servos. Eighteen servos need two boards, with 16 channels on the first and 2 on the second. The boards share one I2C bus, so the wiring stays at two wires plus power. Set the first board to address 0x40 and the second to 0x41 with its A0 solder pad, then pass each address to its own library object.

Both boards share the same 50 Hz servo frequency, and each channel is independent. The sketch below creates two driver objects, one per address, and a helper that maps a servo number from 0 to 17 onto the right board and channel. The gait code then thinks in legs and joints, not in boards and channels.

The kit as shipped needs no PCA9685 at all: its own Freenove Crawling Robot Controller drives all 18 servos directly from ports 22 to 39, with the yellow servo wire to S, red to +, and black to -. The kit ships with a remote, and the kit controller plus its provided library handle the first walks. The PCA9685 wiring in this post is the path for builders who drive the servos from their own board instead of the kit controller. The kit tutorial also requires the batteries to be fully charged before assembly, with about 8.0 to 8.4 V across the two 18650 cells, and warns that wrong batteries can damage the servos.

How do you size power for 18 servos?

Size for stall current, not idle current. Eighteen servos starting or stalling together draw several amps, far more than any USB port or board regulator supplies. No single authoritative figure exists for the stall current of the servos in this kit, and the common SG90 stall figures disagree across resellers, so this post states no per-servo current number. Size generously and meter the rail on your own build.

Use a separate 5 to 6 V supply rated at 10 A or more for the servo rail, and feed it to the PCA9685 V+ terminals. A 5 V 10 A bench supply works on the bench. That 10 A rating is a planning rating with headroom, not a computed stall total. The kit itself runs from 2x 3.7 V 18650 cells, which is a separate power path from the PCA9685 servo rail in this post; do not feed the 18650 pack straight into the servo rail.

Add a large capacitor across each V+ terminal, 1000 microfarads or more, close to the board. Eighteen servos starting at once draw a sharp spike, and the capacitor absorbs it. Use thick wire for the V+ feed, because thin jumper wires drop voltage at 10 A and heat up. Never route servo current through the Arduino 5 V pin.

How do you assemble and test the legs?

Assemble one leg at a time and test it before you fit the next. Center each servo at 90 degrees with the sketch before you fit the horn, so the leg starts at its middle position. A horn fitted 30 degrees off center steals a third of that joint travel and the leg will never reach its full step.

Test the tripod gait with the body held up in your hand first. Lift the robot, run the gait, and watch the feet. Three feet should lift and swing while the other three stay still, then swap. If a leg swings the wrong way, its hip servo is reversed in the mapping, so flip its direction sign in the code, not the wiring.

Set the robot down only after the lifted test looks right. On the floor, start with short steps and low speed. A hexapod that steps too far tips forward, because the support tripod moves behind the center of mass. Short steps keep the body over its feet.

Wiring

Wire the build with the power off. Check every connection in the table before you connect any battery or USB cable.

From To Notes
PCA9685 board 1 VCC Controller 5 V or 3V3 Logic only; use 3.3 V on an ESP32 so the I2C pull-ups stay at 3.3 V
PCA9685 board 1 GND Controller GND and servo supply negative Common ground for all three
PCA9685 board 1 SDA Controller SDA I2C data; address 0x40, A0 pad open
PCA9685 board 1 SCL Controller SCL I2C clock
PCA9685 board 2 VCC Controller 5 V or 3V3 Logic only
PCA9685 board 2 GND Controller GND and servo supply negative Common ground
PCA9685 board 2 SDA Controller SDA Shared I2C bus; address 0x41, A0 pad bridged
PCA9685 board 2 SCL Controller SCL Shared I2C bus
Both boards V+ terminals Separate 5 to 6 V supply, 10 A or more Servo power only; thick wire, one feed per board
Board 1 channels 0 to 15 Servos 0 to 15 Legs 1 to 5 full sets plus one joint of leg 6
Board 2 channels 0 and 1 Servos 16 and 17 Remaining two joints of leg 6
Capacitor 1000 uF or more Across each V+ terminal and ground Absorbs the 18-servo start-up spike; mind the polarity

Power budget

Eighteen micro servos draw several amps while walking and far more if they all stall at once, so the supply must cover the walking current with margin, and the fuse or pack must survive the stall spike without cutting out mid-step. A 5 V 10 A bench supply is the bench choice. A battery pack needs the same current rating. The kit battery is 2x 3.7 V 18650 flat-top cells plus a charger, none of which are included.

The logic side draws only a few milliamps. The controller, the two PCA9685 chips, and the remote receiver run from the controller supply. The servo rail is separate, and only the grounds join. Never power the servos from the controller 5 V pin, and never feed the servo supply into the controller.

Heat matters at 10 A. Use thick wire for the V+ feeds, keep the runs short, and check the terminal screws after the first hour of walking. A loose screw at 10 A heats up and drops voltage, and the legs will jitter and stall.

Build steps

  1. Unbox the kit and count the parts: frame, six legs, 18 servos, horns, screws, the Freenove Crawling Robot Controller, and remote. Confirm the battery is not included: buy 2x 3.7 V 18650 flat-top cells plus a charger, and fully charge them before assembly.
  2. Run the kit as shipped first if you can: load the provided code on the kit controller, calibrate the servos with the calibration graph in the kit tutorial, and walk it on the remote. The PCA9685 steps below are the own-board alternative, not the kit default.
  3. Center every servo at 90 degrees with the sketch before you fit any horn. Fit each horn at the middle position.
  4. Assemble one leg at a time: hip, knee, then ankle. Test each leg by hand for free movement before you fit the next.
  5. Fit the six legs to the body in the tripod groups: front left, middle right, rear left in one group, and the other three in the second group.
  6. Wire the two PCA9685 boards from the wiring table. Set board 1 to 0x40 and board 2 to 0x41 with the A0 pad.
  7. Connect the servos to the boards in order, 0 to 17, and connect the separate servo supply to both V+ terminals. Join the grounds.
  8. Upload the sketch below. Hold the body up and run the tripod gait. Confirm three legs lift and swing while the other three hold still, then swap.
  9. Set the robot on the floor and walk it forward in short steps. Shorten the step if it tips forward.

Code

Library: Adafruit PWM Servo Driver library. Board: Arduino IDE compatible controller. The sketch maps servo numbers 0 to 17 across two PCA9685 boards and runs a basic tripod gait. Tune the step size and the per-leg direction signs for your kit.

// Hexapod spider robot: 18 servos, 2 x PCA9685, tripod gait
// Board: Arduino IDE compatible controller.
// Library: Adafruit PWM Servo Driver (Adafruit_PWMServoDriver).
#include 
#include 

Adafruit_PWMServoDriver pwmA = Adafruit_PWMServoDriver(0x40);  // Servos 0-15
Adafruit_PWMServoDriver pwmB = Adafruit_PWMServoDriver(0x41);  // Servos 16-17

#define SERVOMIN 150   // About 730 microseconds at 50 Hz; calibrate per servo
#define SERVOMAX 600   // About 2930 microseconds at 50 Hz; calibrate per servo
#define SERVO_FREQ 50

// Legs 0-5, joints 0=hip, 1=knee, 2=ankle. Servo number = leg*3 + joint.
// Tripod 1: legs 0, 2, 4. Tripod 2: legs 1, 3, 5.
const uint8_t TRIPOD1[3] = {0, 2, 4};
const uint8_t TRIPOD2[3] = {1, 3, 5};

uint16_t angleToPulse(int angle) {
  return map(constrain(angle, 0, 180), 0, 180, SERVOMIN, SERVOMAX);
}

void setServo(uint8_t servo, int angle) {
  uint16_t pulse = angleToPulse(angle);
  if (servo < 16) pwmA.setPWM(servo, 0, pulse);
  else pwmB.setPWM(servo - 16, 0, pulse);
}

void setLeg(uint8_t leg, int hip, int knee, int ankle) {
  setServo(leg * 3 + 0, hip);
  setServo(leg * 3 + 1, knee);
  setServo(leg * 3 + 2, ankle);
}

void setTripod(const uint8_t legs[3], int hip, int knee, int ankle) {
  for (uint8_t i = 0; i < 3; i++) setLeg(legs[i], hip, knee, ankle);
}

void setup() {
  pwmA.begin();
  pwmA.setOscillatorFrequency(27000000);
  pwmA.setPWMFreq(SERVO_FREQ);
  pwmB.begin();
  pwmB.setOscillatorFrequency(27000000);
  pwmB.setPWMFreq(SERVO_FREQ);
  delay(10);
  // Park every servo at 90 degrees: legs centered, feet down.
  for (uint8_t s = 0; s < 18; s++) setServo(s, 90);
  delay(500);
}

void loop() {
  // Tripod gait, one step per cycle. Tune the angles for your kit.
  // Lift tripod 1, swing forward, set down.
  setTripod(TRIPOD1, 110, 60, 90);  // Lift and swing forward
  delay(300);
  setTripod(TRIPOD1, 110, 90, 90);  // Set down
  setTripod(TRIPOD2, 70, 90, 90);   // Push body forward
  delay(300);
  // Lift tripod 2, swing forward, set down.
  setTripod(TRIPOD2, 110, 60, 90);
  delay(300);
  setTripod(TRIPOD2, 110, 90, 90);
  setTripod(TRIPOD1, 70, 90, 90);
  delay(300);
}

Test and tune it

Hold the body up and run the gait. Three legs should lift and swing while the other three stay still, then swap. If a leg in the wrong tripod moves, its leg number is wrong in the TRIPOD table.

If a leg swings backward instead of forward, flip its hip direction sign in the gait code. Do not rewire the servo, because the mapping is the fault.

Set the robot down and walk it 3 feet. If it tips forward, shorten the swing from 110 degrees toward 100 degrees. Short steps keep the body over the support tripod.

FAQ

How many servos does a hexapod need?

Eighteen servos: three per leg times six legs. Each leg has a hip servo, a knee servo, and an ankle servo. One PCA9685 drives 16 servos, so this build uses two boards.

What is the tripod gait?

Three legs hold the body up while the other three lift, swing forward, and set down. Then the two tripods swap. The body always has three legs on the ground, so it stays stable without balancing.

Why does my hexapod jitter when it walks?

The servo supply sags under the start-up spike of 18 servos. Add a 1000 microfarad capacitor across each V+ terminal, check the supply current rating, and tighten the terminal screws.

Can I power 18 servos from USB?

No. Eighteen micro servos together draw several amps while walking and far more at stall. Use a separate 5 to 6 V supply rated at 10 A or more for the servo rail.

Does the kit include a battery?

No. The kit needs 2x 3.7 V 18650 flat-top cells plus a charger, none included, and the remote takes 1x 9 V battery or USB power. For the PCA9685 servo rail in this post, use a bench supply for indoor testing.

Parts used

Build it with the Hexapod Spider Robot Kit with Remote, Six Legs with 18 Motors, Arduino IDE Compatible, Walking and Crawling STEM Project (Battery Not Included) and the PCA9685 16-Channel PWM Servo Driver Board, 12-Bit IIC Interface, Arduino + Raspberry Pi, 2-Pack (two boards cover 18 servos; one board drives only 16). For a servo arm build without the driver board, see How to Build a Robot Arm with ESP32 and Servo Motors, and the arm build uses the same driver in Joystick Robot Arm: 4-Axis Control with PCA9685. For the servo signal behind the positions, see Digital vs Analog Servo Guide: Which Servo Holds Center.

Sources

Last updated: 2026-11-21. Search volume: not verified. Product links use the store short link form with the product ID; confirm the product slug at publish time.

ESP32 Battery Sensor Node: Deep Sleep and Power Budget

Battery powered ESP32 sensor node with DHT22 sensor and buck converter

ESP32 Battery Sensor Node: Deep Sleep and Power Budget

This battery sensor node runs an ESP32 on battery by waking it on a timer, reading a DHT22 sensor, and putting it back into deep sleep. The ESP32 chip draws about 10 microamps in deep sleep, against 160 to 240 mA with Wi-Fi transmitting. The board keeps drawing milliamps: the regulator, the USB serial chip, and the power LED.

Quick facts

Item Value
Sleep current, chip About 10 uA in deep sleep, ESP32 Series Datasheet v5.3
Awake current 80 to 160 mA, peaks near 240 mA on Wi-Fi transmit
Wake source RTC timer, every 10 minutes
Sensor DHT22, temperature and humidity
Power Battery pack through an XL4015 buck converter set to 5 V
No solar This build uses battery power only; no solar panel is fitted

Battery sensor node: how does deep sleep save battery?

Deep sleep powers down the main CPUs, the Wi-Fi and Bluetooth radios, and most peripherals. Only the RTC domain stays alive, with its timer and a small block of RTC memory. The chip draws about 10 microamps in that state, against 160 to 240 mA with Wi-Fi transmitting. That is a reduction of about 24,000 times.

Deep sleep is effectively a reboot. When the timer fires, the bootloader runs, the sketch loads from flash again, and setup() starts from the top. Normal variables are lost. Only variables tagged RTC_DATA_ATTR survive, in the 8 KB RTC slow memory, so the sketch keeps its boot count there and does its work in setup().

The pattern is wake, work, sleep. The node wakes every 10 minutes, reads the DHT22, connects to Wi-Fi, sends the reading, and sleeps again. The awake time is a few seconds. The sleep time is 597 seconds. Average current is what decides battery life, and the average is dominated by the few awake seconds, not the long sleep.

Why does a dev board never reach 10 microamps?

The 10 microamp figure is the bare ESP32 chip, from the Espressif ESP32 Series Datasheet v5.3. A DevKit V1 board adds an always-on power LED, a USB to serial chip, and a linear regulator, and each of those draws current around the clock. A typical DevKit V1 measures a few milliamps in deep sleep, not 10 microamps. That is still a large saving over 160 mA awake, but it changes the battery math by a factor of 100.

Measure your own board before you promise battery life. Put a USB power meter inline, or a multimeter on the battery lead, and read the current in deep sleep. Write the number down. Every battery estimate in this post uses a 1 mA planning figure for the whole node, not a measured board value, because no bench measurement of the stocked board exists. Replace the planning figure with your measured value before you promise a battery life.

You can cut the board overhead further by removing the power LED or by using a bare module, but that is a hardware modification and it voids any return. For a first build, measure the board as it ships and size the battery for the measured figure.

How do you work out the battery life?

Average current is the awake share times the awake current, plus the sleep share times the sleep current. Wake for 3 seconds at 150 mA every 600 seconds, and sleep at 1 mA the rest of the time. The awake share is 3 divided by 600, or 0.5 percent. The average is 0.005 times 150 mA plus 1 mA, which is about 1.75 mA.

Divide the battery capacity by the average current to get the life. A 2500 mAh pack at 1.75 mA average lasts about 1400 hours, or about 59 days. That is an estimate, not a promise. Cold weather cuts capacity, the buck converter wastes 10 to 20 percent, and the Wi-Fi connect time varies with signal strength.

The biggest lever is the awake time. Every second of Wi-Fi connect time at 150 mA costs as much as 150 seconds of sleep at 1 mA. Keep the awake work short: read the sensor first, connect, send one small packet, and sleep. Do not wait for a slow server, and do not retry forever. Three tries, then sleep and try again next cycle.

How do you power the node from a battery?

The XL4015 buck converter steps the battery voltage down to a steady 5 V for the ESP32 USB input or the 5 V pin. Set the output to 5 V with a multimeter before you connect the board, and never adjust the trimmer while the board is connected. A wrong turn can send the full battery voltage into the board.

The buck converter itself draws current, even with no load. That quiescent draw joins the sleep current, so measure the whole node, converter included, not the board alone. The XL4015 chip draws 2.1 mA typical and 5 mA maximum quiescent current (XLSEMI datasheet Rev 1.6), and the stocked module adds an LED display that draws more, so a converter that draws 5 mA idle will dominate a node that sleeps at 1 mA. The chip runs from 8 to 36 V in and 1.25 to 32 V out; the module is advertised at 4 to 38 V in, 1.25 to 36 V out, and 5 A. Feed it from a battery inside the module range and set the output to 5 V.

This build uses battery power only. No solar panel is fitted, and no solar claim is made, because no solar panel is stocked for this build. If you add solar later, size the panel for the average current plus the charge controller losses, and test it through a cloudy week before you trust it.

Wiring

Wire the build with the power off. Check every connection in the table before you connect any battery or USB cable.

From To Notes
Battery pack positive XL4015 IN+ Battery input to the buck converter; set the output before connecting the board
Battery pack negative XL4015 IN- and ESP32 GND Common ground
XL4015 OUT+ ESP32 5 V pin or USB 5 V Regulated 5 V output; set to 5.0 V with a multimeter first
XL4015 OUT- ESP32 GND Common ground
DHT22 VCC ESP32 3V3 Module supply 3.3 to 6 V per the Aosong datasheet; the stocked module is a wired 3-wire module (+, -, Out)
DHT22 GND ESP32 GND Common ground
DHT22 DATA ESP32 GPIO 4 Single-wire data; 10 k pull-up resistor between DATA and 3V3 if the module has none

Power budget

The budget below uses a 1 mA planning figure for the sleep current of the whole node, board plus buck converter, because that is the honest planning figure for a DevKit V1 as shipped. It is a planning figure, not a bench measurement: no measured sleep current exists for the stocked board. The chip alone sleeps at about 10 microamps, but the board overhead dominates. Measure your node and redo the math with the measured value.

Awake for 3 seconds at 150 mA every 600 seconds, asleep at 1 mA otherwise, gives an average of about 1.75 mA. A 2500 mAh pack lasts about 59 days at that average, before converter losses and cold weather. Cut the wake interval to 30 minutes and the same pack lasts about 83 days, not 4 months: the awake share falls to one third, but the 1 mA sleep current dominates the average, so tripling the interval only stretches the life by about 40 percent. A slow Wi-Fi join stretches the awake time too: about 13 seconds awake per cycle cuts the same pack to about 25 days.

The DHT22 draws 1 to 1.5 mA while measuring and 40 to 50 uA in standby, per the Aosong datasheet, and the bare sensor pins run VCC, DATA, NC, GND with the grille facing you. Do not read it more often than once every 2 seconds. It is a rounding error next to the Wi-Fi radio. The radio is the cost. Keep the awake time short, send one small packet, and sleep.

Build steps

  1. Set the XL4015 output to 5.0 V with a multimeter, with no board connected. Lock the trimmer and recheck the output.
  2. Wire the battery, the buck converter, and the ESP32 from the wiring table. Wire the DHT22 to GPIO 4 with its pull-up resistor.
  3. Install the Adafruit DHT sensor library and the Adafruit Unified Sensor library from the Library Manager.
  4. Upload the sketch below. Open the serial monitor at 115200 baud and confirm the node reads the DHT22 and prints the boot count.
  5. Measure the deep sleep current with a USB power meter or a multimeter on the battery lead. Record the value and update the battery math in this post.
  6. Leave the node running on battery for 24 hours. Confirm it wakes every 10 minutes and the boot count rises by about 144 per day.
  7. Calculate the battery life from your measured sleep current, not from the 10 microamp chip figure. Replace the planning figure in this post with the measured value.

Code

Libraries: Adafruit DHT sensor library, Adafruit Unified Sensor library. Board: ESP32 DevKit V1. The sketch does its work in setup() because deep sleep restarts the chip on every wake.

// Battery ESP32 sensor node: DHT22 + deep sleep, timer wake
// Board: ESP32 DevKit V1. Libraries: Adafruit DHT sensor library.
#include 
#include 
#include 

#define DHT_PIN 4
#define DHT_TYPE DHT22
#define uS_TO_S 1000000ULL
#define SLEEP_SECONDS 600  // Wake every 10 minutes

const char* WIFI_SSID = "YOUR_WIFI_NAME";      // Replace with your network
const char* WIFI_PASS = "YOUR_WIFI_PASSWORD";  // Replace with your password

DHT dht(DHT_PIN, DHT_TYPE);

// RTC memory survives deep sleep; normal variables do not.
RTC_DATA_ATTR int bootCount = 0;

void setup() {
  Serial.begin(115200);
  bootCount++;
  Serial.print("Boot count: ");
  Serial.println(bootCount);

  dht.begin();
  float temperature = dht.readTemperature();
  float humidity = dht.readHumidity();
  if (isnan(temperature) || isnan(humidity)) {
    Serial.println("DHT22 read failed");
  } else {
    Serial.print("Temp: "); Serial.print(temperature, 1);
    Serial.print(" C, Hum: "); Serial.print(humidity, 1);
    Serial.println(" %");
    // Join Wi-Fi with a bounded wait, then send the reading here:
    // HTTP POST, MQTT, or ESP-NOW. Keep it short: connect, send
    // once, then sleep. A slow join stretches the awake time, so
    // the 10 second cap below keeps one bad cycle from draining
    // the battery.
    WiFi.begin(WIFI_SSID, WIFI_PASS);
    unsigned long wifiStart = millis();
    while (WiFi.status() != WL_CONNECTED && millis() - wifiStart < 10000) {
      delay(500);
    }
  }

  // Arm the RTC timer, then sleep. This call never returns.
  esp_sleep_enable_timer_wakeup(SLEEP_SECONDS * uS_TO_S);
  Serial.println("Going to sleep for 10 minutes");
  Serial.flush();  // Let the text leave before power drops
  esp_deep_sleep_start();
}

void loop() {
  // Never reached: deep sleep restarts the chip from setup().
}

Test and tune it

Confirm the node wakes every 10 minutes by watching the boot count rise by 6 per hour. A count that rises faster means the node is resetting instead of sleeping, usually from a weak battery or a loose wire.

Measure the sleep current with the USB cable unplugged and the battery connected. If the meter reads over 5 mA in sleep, the buck converter quiescent draw or the power LED is the cause. Measure the board alone, then the converter alone, to find which one dominates.

Run the node for a week on battery and log the battery voltage at each wake. A steady fall is normal. A sudden drop means the Wi-Fi connect time grew, usually from a weak signal, so move the node closer to the router.

FAQ

How long will an ESP32 sensor node last on battery?

It depends on the measured sleep current, not the 10 microamp chip figure. At 1.75 mA average, a 2500 mAh pack lasts about 59 days. Measure your board in deep sleep and redo the math with that number.

Why does my ESP32 use more power asleep than the datasheet says?

The datasheet figure is the bare chip. The DevKit board adds a power LED, a USB serial chip, and a regulator, and each draws current around the clock. Measure the whole board, not the chip.

What wakes the ESP32 from deep sleep?

The RTC timer is the workhorse: wake every N minutes to sample and report. A pin, a touch pad, or the ULP coprocessor can also wake it. This build uses the timer only.

Does deep sleep keep my variables?

No. Deep sleep restarts the chip, so normal variables are lost. Only variables tagged RTC_DATA_ATTR survive, in the 8 KB RTC slow memory. Keep counters and last readings there.

Can I add solar power to this node?

Not in this build. No solar panel is stocked for it, so no solar claim is made here. A solar version needs a panel, a charge controller, and a cloudy-week test before you trust it.

Parts used

Build it with the ESP32 DevKit V1 Development Board, 30-Pin WROOM-32, the DHT22 / AM2302 Digital Temperature & Humidity Sensor Module, and the XL4015 5A DC-DC Step Down Buck Converter Module with LED Display, 2-Pack. The always-on version is ESP32 WiFi Sensor Telemetry: Live Dashboard with BME280, and the flash logging version is ESP32 Sensor Data Logger: Flash Logging and WiFi Download. For the chip radios behind the choice, see ESP32 vs ESP32-S3 vs ESP32-C3 vs ESP32-C6.

Sources

Last updated: 2026-11-21. Search volume: not verified. Product links use the store short link form with the product ID; confirm the product slug at publish time.