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

RC Servo Brackets and Mounts: How to Pick and Install Them

A servo bracket is the mount that holds a servo motor square to the frame so the output shaft stays lined up with the load it drives. Get the bracket right and the servo steers clean, the arm repeats its position, and the screws stay put. Get it wrong and the servo shifts, the horn binds, or the mount cracks.

What is a servo bracket, and why does it matter?

A servo bracket is a shaped mount, usually a U-shaped holder, a flat plate, or a two-piece pan-tilt frame, that bolts to a chassis, frame, robot arm, or project board and cradles the servo body. The servo’s mounting ears screw to the bracket, and the bracket screws to the frame. It holds the servo body rigid so the case cannot flex under load, and it sets the output shaft in line with the linkage it drives.

Without a solid mount the servo can shift under load: a loose servo shows up as sloppy steering or a wandering arm.

Which bracket type fits your job?

The five brackets in the store cover the four shapes most RC and robotics builds need.

| Bracket type | What it does | Store bracket | |—|—|—|—| | Flat install holder | Bolts a standard servo straight to a flat surface | CNC install holder, ID 13458, $23.99 | | U-shaped holder | Cradles the servo body in a rigid U frame | CNC U-shaped holder, ID 19665, $8.99 sale | | U-shaped 2-set | Two U-shaped holders in one pack | CNC 2-set, ID 19666, $14.99 sale | | Pan-tilt bracket | Pairs two standard servos for two-axis movement | Pan tilt 2-set, ID 22925, $20.99 | | Micro plate bracket | Flat acrylic plate with a cutout sized for a 9 g servo | SG90 acrylic 10-pack, ID 13465, $12.99 |

Flat install holder (ID 13458). It bolts flat to the chassis. CNC aluminum, hardware included, for S3003 and MG995 class servos.

U-shaped holder (ID 19665). The U cradles the servo body. CNC aluminum, 55 x 26 mm, adjustable plate, screws included, for S3003, MG995, and MG996R class servos.

U-shaped 2-set (ID 19666). The same U-shaped holder, two in one pack with M3 screws, nuts, washers, and hex socket screws. For two-servo builds or as a spare: at $14.99 on sale it costs less per bracket than two singles.

Pan-tilt bracket (ID 22925). Two brackets that work as a pair: one servo pans, the second tilts, building a 2-degree-of-freedom head with a ball bearing on the pan axis. Each set includes the multi-function bracket, the short U-type bracket, a ball bearing, metal horns, and the screw set. It fits standard 40 x 20 x 36 mm servos including MG995, MG996R, and S3003.

Micro plate bracket (ID 13465). A flat acrylic plate with a cutout sized for the SG90 body plus a mounting slot and holes, so the servo sits flush and bolts to a chassis, frame, or project board. Ten brackets with screws, nuts, and washers.

Which material should you pick: aluminum, acrylic, or plastic?

The bracket material decides how much load the mount can take before it flexes, cracks, or loosens.

| Material | Strength | Best for | |—|—|—|—|—| | CNC aluminum alloy | High, rigid, resists vibration | Standard servos, steering, robot arms, high-torque joints | | Acrylic plate | Low, stiff but brittle | SG90 micro servos, light indoor builds, bulk packs | | Injection-molded nylon or ABS | Medium, some flex | Micro pan-tilt kits, light camera heads |

CNC aluminum alloy is the right pick for any standard servo that works hard: steering, robot arm joints, a pan-tilt head carrying a camera. It resists vibration and keeps the servo aligned run after run.

Acrylic plate is the right pick for 9 g micro servos in light builds: a 9 g servo cannot load it hard. Acrylic cracks rather than bends, so tighten only until snug and never use threadlocker on it: Kpower’s guide warns it can crack the plastic.

Nylon and ABS sit between the two. Adafruit’s Mini Pan-Tilt Kit uses injection-molded nylon. For a standard servo, plastic is the wrong pick: Kpower’s guide describes a plastic pan-tilt bracket that cracked after 20 minutes on a six-axis arm, and the fix was an aluminum bracket.

Which bracket fits your servo size?

Standard and micro mounts are not interchangeable: a standard servo will not fit a micro bracket, and a micro servo rattles loose in a standard bracket. Measure your servo, then match it to the bracket listing.

| Servo class | Body size | Stall torque | Bracket to buy | |—|—|—|—|—| | Micro, SG90 9 g | 23 x 12.2 x 29 mm | 1.8 kg·cm at 4.8 V | SG90 acrylic 10-pack, ID 13465 | | Standard, S3003 / MG995 class | About 40 x 20 x 36 mm | Check the servo datasheet | CNC U-shaped holder, ID 19665, or install holder, ID 13458 | | Standard, MG996R | 40.7 x 19.7 x 42.9 mm | 9.4 kg·cm at 4.8 V, 11 kg·cm at 6 V | CNC U-shaped holder, ID 19665, or pan-tilt 2-set, ID 22925 |

Sources: SG90 figures are TowerPro’s; cheap SG90 clones vary, so measure your own servo. MG996R figures are TowerPro’s datasheet figures, mirrored by Cornell University. The 40 x 20 x 36 mm fit is the pan-tilt listing (ID 22925).

Measure before you order. The numbers that decide the fit are the servo body length, width, and height, and the mounting-hole pattern on the servo’s ears. Measure the body with calipers, then the hole spacing on each ear. The listing states the servo class it fits, so the class match is the check that matters. Kpower’s bracket guide gives the pattern rule for micro servos: most follow a standard pattern of two holes spaced 26 to 28 mm center to center, with M2 or M2.5 screws, most commonly 27 mm. Verify it on your own servo.

Check the flange thickness too. A metal-gear micro servo can share a body size with its plastic-gear twin but carry a thicker mounting flange. Protosupplies warns that MG90 metal-gear servos do not fit its SG90 pan-tilt kit because the flange is thicker. Test-fit a metal-gear micro before tightening anything.

How do you install a servo bracket?

The steps below work for every bracket in the store. Read the horn clearance section before you tighten anything.

Step 1: Dry-fit the servo. Set the servo into the bracket without screws. The body should sit square and flush, the ears flat on the mounting face, and the shaft pointing where the linkage needs it. If the servo rocks, the bracket is the wrong size.

Step 2: Center the servo, then fit the horn. Power the servo and drive it to center, 90 degrees on a standard 180-degree servo. Push the horn onto the splined shaft at the centered position, then fix it with the short screw that came with the servo. Use the short screw: Adafruit’s guide warns that the longer mounting screws packed with some servos will damage the servo if screwed in too far.

Step 3: Screw the servo to the bracket. Insert the screws through the servo’s mounting ears and tighten evenly, finger-tight plus a quarter turn and no more. Kpower’s guide caps micro-servo screw torque at about 0.2 N·m: more strips plastic threads or deforms the bracket. A drop of medium threadlocker on metal screw threads stops vibration loosening. Threadlocker only on metal-to-metal screws, never on the acrylic SG90 plate.

Step 4: Bolt the bracket to the frame. Make sure the bracket sits level and the servo shaft lines up with the linkage axis. Do not mount the bracket reversed: test the full range of motion before final fastening.

Step 5: Assemble a pan-tilt bracket as a pair. Mount the pan servo in the base bracket first, with its horn fitted at center, then attach the base to the horn so the pan axis turns the whole head. Then mount the tilt servo in the tilt bracket, fit its horn, and join the tilt bracket to the pan base on the pivot pin. If the tilt bracket cannot move through the full 180 degrees, take it off the horn, rotate it, and re-install it.

Step 6: Test the full travel, then check the screws after the first run. Power the servo and sweep it slowly from one end to the other. The horn must clear the bracket at both ends, the linkage must not bind, and the wires must not snag. If anything touches, stop and fix it before running the build: a servo stalled against its own bracket draws stall current and heats up fast. After the first hour of running, check every bracket screw again.

Servo horn clearance: the step everyone skips

Most bracket failures are horn failures: the horn hits the bracket at one end of the travel, the servo stalls against it, and the gears strip or the bracket cracks. Check clearance before you tighten the bracket to the frame.

Center the servo first, then fit the horn. A horn fitted off-center gives uneven travel: full range one way, binding the other.

Trim the horn if it has to fit inside the bracket. Adafruit’s Mini Pan-Tilt Kit guide shows exactly this: the outer horns are trimmed with a hobby knife or wire cutters so they fit inside the pan-tilt base, while the center horns stay unmodified.

Keep the tilt travel inside the bracket. Limit the tilt range so the top servo cannot crash into the bracket: the Thinking Robot SG90 guide limits tilt to 30 to 150 degrees.

Route the wires clear of the horn. The servo lead must not cross the horn’s sweep. Route it along the bracket base, away from the moving parts, with enough slack for the full travel.

Which bracket should you buy?

Standard servo in an RC plane, boat, or car: the CNC install holder (ID 13458), $23.99. Machined aluminum, hardware included, for S3003 and MG995 class servos.

Standard servo in a robot arm or upright build: the CNC U-shaped holder (ID 19665), $8.99 on sale, regular $10.99. The cheapest metal mount in the store. Its adjustable plate fits S3003, MG995, and MG996R class servos. Size 55 x 26 mm.

Two standard servos: the CNC 2-set (ID 19666), $14.99 on sale, regular $17.99. Two U-shaped holders with M3 screws, nuts, washers, and hex socket screws per set. It costs less per bracket than two singles, and the second bracket is a spare.

A camera head, sensor mount, or robot joint that needs two axes: the pan-tilt 2-set (ID 22925), $20.99. Two full pan-tilt sets, each with a ball bearing, metal horns, and hardware, for standard 40 x 20 x 36 mm servos including MG996R, MG995, and S3003.

SG90 micro servos: the SG90 acrylic 10-pack (ID 13465), $12.99. Ten plates with screws, nuts, and washers, sized for the SG90 body. One pack covers a whole smart car or small robot build.

If you are not sure which servo you need yet: read the servo chooser guides first, then come back. Buying the bracket first and the servo second is the order that causes most fit problems.

What are the common mistakes?

  • Wrong size class. A standard servo in a micro bracket, or a micro servo in a standard bracket. Match the servo class to the listing before ordering.
  • Over-tightening the screws. Finger-tight plus a quarter turn is enough. More strips plastic threads or warps the bracket. Kpower’s guide calls over-tightening the number one cause of bracket failure.
  • Threadlocker on plastic. Medium threadlocker belongs on metal-to-metal screws only. On acrylic or nylon it can crack the bracket.
  • Mounting the bracket reversed. The servo shaft ends up on the wrong side of the linkage axis. Test the range of motion before final fastening.
  • Fitting the horn off-center. The servo binds at one end of travel and stalls. Center the servo at 90 degrees first.

How do you fix a servo bracket that does not work?

The servo jitters or stalls in the bracket. Check for an obstruction first: a misaligned screw, a wire caught under the servo, or a horn touching the bracket. Then check power: a servo starved of current jitters even in a perfect bracket. A single MG996R can draw 1,400 mA at stall, per TowerPro’s datasheet, so a small board regulator or a USB port cannot feed it.

The screws keep loosening. Clean the screws, apply a drop of medium threadlocker, and re-tighten, but only on metal-to-metal joints. Kpower’s guide describes exactly this case: screws loosened after one hour of RC driving, fixed by cleaning, threadlocker, and a re-torque, with no loosening after 10 hours. In an acrylic plate, do not use threadlocker: check for cracks instead.

The bracket cracked. Replace it, and go up a material: acrylic to aluminum for a standard servo, or nylon to aluminum for a micro servo that works hard. A cracked bracket has already told you the load is too much for the material. Check the servo size match at the same time.

The servo will not fit the bracket. Do not force it. Measure the servo body and the bracket opening with calipers and compare the numbers. If the bracket is the wrong size class, order the right one. Shimming a too-small servo into a too-big bracket with strips of plastic is a stopgap, not a fix.

The horn hits the bracket at one end. Take the horn off, re-center the servo, and refit the horn one spline over. If it still hits, trim the horn or limit the travel in code so the servo never reaches the contact point.

Parts used in this guide

Prices and stock verified live on qualityrcparts.com on 2026-11-21 via the public Store API. All five are in stock. Servos are not included.

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

Related guides

FAQ

What is a servo bracket? A servo bracket is a shaped mount, usually a U-shaped holder, a flat plate, or a two-piece pan-tilt frame, that bolts to a chassis or frame and cradles the servo body so the output shaft stays lined up with the load. Source: QRC servo-mounts category description and Kpower micro servo bracket guide.

How do you mount a servo to a bracket? Dry-fit the servo first, center it at 90 degrees, fit the horn with the short screw, screw the servo to the bracket finger-tight plus a quarter turn, then sweep the full travel to check clearance. Source: Kpower micro servo bracket guide and Kpower servo mounting guide.

What size bracket do I need for an SG90 servo? An SG90 needs a micro bracket sized for its 23 x 12.2 x 29 mm body; the acrylic SG90 10-pack (ID 13465) is cut for that body. A standard servo bracket will not hold it. Source: TowerPro SG90 datasheet figures and the QRC servo-mounts category description.

What size bracket do I need for an MG996R servo? An MG996R needs a standard bracket. Its body is 40.7 x 19.7 x 42.9 mm and it weighs 55 g, so it fits the standard brackets in the store: the CNC U-shaped holder (ID 19665), the CNC 2-set (ID 19666), and the pan-tilt 2-set (ID 22925). Source: TowerPro MG996R datasheet and the QRC pan-tilt bracket listing.

Can I use a standard servo bracket for a micro servo? No. A micro servo rattles loose in a standard bracket: an SG90 is 23 mm long against a standard servo at about 40 mm. Source: QRC servo-mounts category description.

Do servo brackets come with screws? The brackets in the store do: screws, nuts, and washers with the CNC brackets and the SG90 10-pack, plus ball bearings and metal horns with the pan-tilt set. Servos are not included. Source: QRC product listings for IDs 22925, 19666, 19665, 13465, and 13458.

Why does my servo buzz or jitter in its bracket? Check for an obstruction first: a horn, wire, or screw blocking travel. Then check power: a servo starved of current jitters even in a perfect bracket, and a single MG996R can draw 1,400 mA at stall. Source: Kpower micro servo bracket troubleshooting and TowerPro MG996R datasheet.

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-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