<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>spi &#8211; Quality RC Parts</title>
	<atom:link href="https://qualityrcparts.com/tag/spi/feed/" rel="self" type="application/rss+xml" />
	<link>https://qualityrcparts.com</link>
	<description>SHIPS FAST FROM NY, USA</description>
	<lastBuildDate>Sun, 22 Nov 2026 03:30:34 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.5</generator>

<image>
	<url>https://i0.wp.com/qualityrcparts.com/wp-content/uploads/2026/09/qrc-logo-6-com-inside-short-512x512-1.png?fit=32%2C32&#038;ssl=1</url>
	<title>spi &#8211; Quality RC Parts</title>
	<link>https://qualityrcparts.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">257527959</site>	<item>
		<title>LVGL ESP32 Display Guide: Setup, Widgets, Touch</title>
		<link>https://qualityrcparts.com/lvgl-esp32-display-guide/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sun, 22 Nov 2026 03:30:34 +0000</pubDate>
				<category><![CDATA[ESP32]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[arduino-ide]]></category>
		<category><![CDATA[esp32]]></category>
		<category><![CDATA[esp32-s3]]></category>
		<category><![CDATA[lvgl]]></category>
		<category><![CDATA[spi]]></category>
		<category><![CDATA[tft-display]]></category>
		<category><![CDATA[troubleshooting]]></category>
		<guid isPermaLink="false">https://qualityrcparts.com/lvgl-esp32-display-guide/</guid>

					<description><![CDATA[LVGL turns a plain TFT display into a real interface: buttons, sliders, gauges, and menus on an ESP32. This guide installs LVGL 9 in the Arduino IDE, binds it to a TFT driver, builds the first screen, adds touch, and fixes the errors that stop most builds.]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">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.</p>



<p class="wp-block-paragraph">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.</p>



<h2 class="wp-block-heading">What is LVGL, and when should you use it instead of TFT_eSPI alone?</h2>



<p class="wp-block-paragraph">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.</p>



<p class="wp-block-paragraph">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.</p>



<p class="wp-block-paragraph">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.</p>



<h2 class="wp-block-heading">Which LVGL version is this guide written against?</h2>



<p class="wp-block-paragraph">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.</p>



<figure class="wp-block-table">
<table>
<thead>
<tr>
<th>Item</th>
<th>LVGL 8.x</th>
<th>LVGL 9.x (this guide)</th>
</tr>
</thead>
<tbody>
<tr>
<td>Display driver</td>
<td>lv_disp_drv_t, lv_disp_drv_register</td>
<td>lv_display_t, lv_display_create</td>
</tr>
<tr>
<td>Draw buffer</td>
<td>lv_disp_draw_buf_t</td>
<td>Buffers passed to lv_display_create</td>
</tr>
<tr>
<td>Flush ready call</td>
<td>lv_disp_flush_ready</td>
<td>lv_display_flush_ready</td>
</tr>
<tr>
<td>Input device</td>
<td>lv_indev_drv_t, lv_indev_drv_register</td>
<td>lv_indev_t, lv_indev_create</td>
</tr>
<tr>
<td>Active screen</td>
<td>lv_scr_act()</td>
<td>lv_screen_active()</td>
</tr>
<tr>
<td>Button create</td>
<td>lv_btn_create</td>
<td>lv_button_create</td>
</tr>
<tr>
<td>Main loop call</td>
<td>lv_task_handler</td>
<td>lv_timer_handler</td>
</tr>
</tbody>
</table>
</figure>



<p class="wp-block-paragraph">Source: LVGL 9 docs and the ElectricalFlux LVGL ESP32-S3 guide.</p>



<h2 class="wp-block-heading">What do you need before you start?</h2>



<ul class="wp-block-list">

<li>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.</li>
<li>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.</li>
<li>The Arduino IDE with the ESP32 board package installed, version 2.x or later.</li>
<li>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.</li>
<li>Jumper wires and a breadboard. Keep the SPI wires short: long wires cause signal problems at full SPI speed.</li>

</ul>



<h2 class="wp-block-heading">How do you install LVGL in the Arduino IDE?</h2>



<p class="wp-block-paragraph">Open the Library Manager: Sketch, Include Library, Manage Libraries. Search for &#8220;lvgl&#8221;, 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.</p>



<p class="wp-block-paragraph">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.</p>



<p class="wp-block-paragraph">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:</p>



<pre class="wp-block-code"><code>#define LV_CONF_INCLUDE_SIMPLE
#include &lt;lvgl.h&gt;
</code></pre>



<p class="wp-block-paragraph">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.</p>



<h2 class="wp-block-heading">How do you wire the display?</h2>



<p class="wp-block-paragraph">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.</p>



<h2 class="wp-block-heading">Which display drivers does LVGL work with?</h2>



<p class="wp-block-paragraph">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.</p>



<h2 class="wp-block-heading">How do you bind LVGL to your display driver?</h2>



<p class="wp-block-paragraph">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.</p>



<h3 class="wp-block-heading">Route A: the TFT_eSPI helper (use this first)</h3>



<p class="wp-block-paragraph">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:</p>



<pre class="wp-block-code"><code>#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);
}
</code></pre>



<p class="wp-block-paragraph">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.</p>



<p class="wp-block-paragraph">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.</p>



<h3 class="wp-block-heading">Route B: the manual flush callback</h3>



<p class="wp-block-paragraph">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:</p>



<pre class="wp-block-code"><code>void my_disp_flush(lv_display_t *disp, const lv_area_t *area, uint8_t *px_map)
{
  uint32_t w = (area-&gt;x2 - area-&gt;x1 + 1);
  uint32_t h = (area-&gt;y2 - area-&gt;y1 + 1);
  lcd.startWrite();
  lcd.setAddrWindow(area-&gt;x1, area-&gt;y1, w, h);
  lcd.pushColors((uint16_t *)px_map, w * h, true);
  lcd.endWrite();
  lv_display_flush_ready(disp);
}
</code></pre>



<p class="wp-block-paragraph">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.</p>



<h2 class="wp-block-heading">How do you build the first screen?</h2>



<p class="wp-block-paragraph">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.</p>



<pre class="wp-block-code"><code>void lv_create_main_gui(void) {
  lv_obj_t * text_label = lv_label_create(lv_screen_active());
  lv_label_set_text(text_label, &quot;Hello, world!&quot;);
  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, &quot;Button&quot;);
  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);
}
</code></pre>



<p class="wp-block-paragraph">The event callback reads the event code and acts on it:</p>



<pre class="wp-block-code"><code>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++;
  }
}
</code></pre>



<p class="wp-block-paragraph">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.</p>



<pre class="wp-block-code"><code>void loop() {
  lv_timer_handler();
  lv_tick_inc(5);
  delay(5);
}
</code></pre>



<p class="wp-block-paragraph">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.</p>



<h2 class="wp-block-heading">Which widgets should you use?</h2>



<p class="wp-block-paragraph">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.</p>



<figure class="wp-block-table">
<table>
<thead>
<tr>
<th>Widget</th>
<th>Create call (LVGL 9)</th>
<th>Use it for</th>
</tr>
</thead>
<tbody>
<tr>
<td>Label</td>
<td>lv_label_create</td>
<td>Text, readouts, titles</td>
</tr>
<tr>
<td>Button</td>
<td>lv_button_create</td>
<td>Actions, toggles, navigation</td>
</tr>
<tr>
<td>Slider</td>
<td>lv_slider_create</td>
<td>Brightness, volume, setpoints from 0 to 100</td>
</tr>
<tr>
<td>Bar</td>
<td>lv_bar_create</td>
<td>Progress, battery level, signal strength</td>
</tr>
</tbody>
</table>
</figure>



<p class="wp-block-paragraph">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.</p>



<h2 class="wp-block-heading">How do you add touch input?</h2>



<p class="wp-block-paragraph">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.</p>



<p class="wp-block-paragraph">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:</p>



<pre class="wp-block-code"><code>#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);
</code></pre>



<p class="wp-block-paragraph">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:</p>



<pre class="wp-block-code"><code>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);
</code></pre>



<p class="wp-block-paragraph">The read callback checks the touch state, reads the point, and maps the raw touch values to screen pixels:</p>



<pre class="wp-block-code"><code>void touchscreen_read(lv_indev_t * indev, lv_indev_data_t * data) {
  if(touchscreen.tirqTouched() &amp;&amp; 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-&gt;state = LV_INDEV_STATE_PRESSED;
    data-&gt;point.x = x;
    data-&gt;point.y = y;
  }
  else {
    data-&gt;state = LV_INDEV_STATE_RELEASED;
  }
}
</code></pre>



<p class="wp-block-paragraph">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.</p>



<h2 class="wp-block-heading">How do you use fonts and images?</h2>



<p class="wp-block-paragraph">LVGL ships with built-in fonts, and it can load custom fonts and images.</p>



<p class="wp-block-paragraph"><strong>Built-in fonts.</strong> 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.</p>



<p class="wp-block-paragraph"><strong>Custom fonts.</strong> 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.</p>



<p class="wp-block-paragraph"><strong>Images.</strong> 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.</p>



<h2 class="wp-block-heading">What about the ESP-IDF path?</h2>



<p class="wp-block-paragraph">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 &#8220;Add LVGL to an ESP32 IDF project&#8221; covers it.</p>



<p class="wp-block-paragraph">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:</p>



<pre class="wp-block-code"><code>idf.py create-project my_lvgl_app
cd my_lvgl_app
idf.py add-dependency &quot;espressif/esp_lvgl_port^2.3.0&quot;
</code></pre>



<p class="wp-block-paragraph">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 &#8220;lvgl/lvgl^9.*&#8221;. Then configure LVGL with idf.py menuconfig and add a display driver and a touch driver from the ESP component registry. Source: LVGL docs, &#8220;Add LVGL to an ESP32 IDF project&#8221;.</p>



<h2 class="wp-block-heading">What are the common mistakes?</h2>



<ul class="wp-block-list">

<li><strong>Mixing LVGL 8 code with LVGL 9.</strong> 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.</li>
<li><strong>A lv_conf.h from another tutorial.</strong> The config file must match your LVGL version and your display. Copy the template from your own installed library.</li>
<li><strong>Forgetting lv_display_flush_ready in a manual flush callback.</strong> The screen draws one frame, then freezes forever.</li>
<li><strong>No tick and no handler in loop.</strong> LVGL needs lv_tick_inc and lv_timer_handler called regularly. A blocking loop freezes the interface.</li>
<li><strong>A draw buffer that is too small or too big.</strong> 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.</li>

</ul>



<h2 class="wp-block-heading">How do you fix an LVGL display that does not work?</h2>



<p class="wp-block-paragraph">Work through the stack from the bottom up: wiring, TFT_eSPI, LVGL config, then your code.</p>



<p class="wp-block-paragraph"><strong>The screen stays white or black after upload.</strong> 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.</p>



<p class="wp-block-paragraph"><strong>The screen shows the first frame, then freezes.</strong> 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.</p>



<p class="wp-block-paragraph"><strong>The picture is there but the colors are wrong.</strong> 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.</p>



<p class="wp-block-paragraph"><strong>Buttons do not respond to touch.</strong> 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.</p>



<h2 class="wp-block-heading">Which route should you pick?</h2>



<p class="wp-block-paragraph">Match the tool to the job. For display selection, see our display buying guide.</p>



<figure class="wp-block-table">
<table>
<thead>
<tr>
<th>Project</th>
<th>Pick</th>
<th>Why</th>
</tr>
</thead>
<tbody>
<tr>
<td>Temperature readout, clock, status text</td>
<td>TFT_eSPI alone</td>
<td>No buttons, no menus, less code</td>
</tr>
<tr>
<td>Thermostat with setpoint buttons</td>
<td>LVGL on TFT_eSPI, Route A</td>
<td>Buttons and a slider, one afternoon of work</td>
</tr>
<tr>
<td>Production firmware</td>
<td>LVGL on ESP-IDF with esp_lvgl_port</td>
<td>Version-pinned components and full control</td>
</tr>
</tbody>
</table>
</figure>



<h2 class="wp-block-heading">Parts used in this guide</h2>



<p class="wp-block-paragraph">Prices and stock were verified live on qualityrcparts.com on 2026-11-21 through the public Store API. All four items are in stock.</p>



<ul class="wp-block-list">

<li><a href="https://qualityrcparts.com/product/2-4-inch-spi-tft-lcd-touch-display-module-240x320-ili9341-driver/">2.4 Inch SPI TFT LCD Touch Display Module, 240&#215;320, ILI9341 driver</a> (ID 17813) &#8211; $20.99. The touch module for the worked example: ILI9341 driver, touch panel and pen.</li>
<li><a href="https://qualityrcparts.com/product/0-96-inch-tft-display-module-2-pack-color-ips-lcd-80x160-st7735-spi-for-arduino-esp32/">0.96 Inch TFT Display Module 2-Pack, Color IPS LCD 80&#215;160, ST7735 SPI for Arduino ESP32</a> (ID 19625) &#8211; $13.99. Two ST7735 modules for a small LVGL status screen without touch.</li>
<li><a href="https://qualityrcparts.com/product/esp32-development-board-with-1-9-inch-st7789-tft-lcd-display-16mb-wifi-bluetooth-usb-c/">ESP32 Development Board with 1.9 Inch ST7789 TFT LCD Display, 16MB, WiFi + Bluetooth, USB-C</a> (ID 17819) &#8211; $19.99. The built-in display board: no wiring, LVGL on TFT_eSPI with the ST7789 driver at 170 by 320.</li>
<li><a href="https://qualityrcparts.com/product/2-4-inch-tft-lcd-display-module-320x240-st7789-spi-color-screen-no-touch-for-arduino-esp32-esp8266/">2.4 Inch TFT LCD Display Module, 320&#215;240 ST7789 SPI Color Screen, No Touch, for Arduino ESP32 ESP8266</a> (ID 19630) &#8211; $14.99. The no-touch 2.4 inch module for LVGL status screens and gauges.</li>

</ul>



<p class="wp-block-paragraph">Shipped fast and securely from our secure facility in Queensbury, NY. QRC ships within the USA only.</p>



<h2 class="wp-block-heading">Related guides</h2>



<ul class="wp-block-list">

<li><a href="/tft-espi-setup-guide/">TFT_eSPI Setup Guide: Install, User_Setup.h, First Sketch</a></li>
<li><a href="/esp32-built-in-display-boards-tft-oled-guide/">ESP32 Boards with Built-In Displays: TFT vs OLED Compared</a></li>
<li><a href="/oled-vs-tft-display/">OLED vs TFT Display: Which Is Best for ESP32 Projects?</a></li>
<li><a href="/which-display-to-buy/">How to Choose the Right Display for Arduino or ESP32</a></li>
<li><a href="/best-esp32-boards-for-robotics-usa/">How to Choose ESP32 Boards for Your Robotics Projects</a></li>
<li><a href="/xiao-esp32-pinout-guide/">XIAO ESP32 Pinout: C3, C6, S3, and C5 GPIO Tables</a></li>

</ul>



<h2 class="wp-block-heading">FAQ</h2>



<p class="wp-block-paragraph"><strong>What is LVGL?</strong>
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.</p>



<p class="wp-block-paragraph"><strong>Can I use LVGL with an ESP32 and a TFT display?</strong>
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.</p>



<p class="wp-block-paragraph"><strong>Which LVGL version should I install?</strong>
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.</p>



<p class="wp-block-paragraph"><strong>Why is my LVGL screen blank after upload?</strong>
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.</p>



<p class="wp-block-paragraph"><strong>How do I add touch to LVGL on ESP32?</strong>
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.</p>



<p class="wp-block-paragraph"><strong>Can I use LVGL with ESP-IDF instead of Arduino?</strong>
Yes. Add the esp_lvgl_port component with idf.py add-dependency &#8220;espressif/esp_lvgl_port^2.3.0&#8221;, or add LVGL directly with idf.py add-dependency &#8220;lvgl/lvgl^9.*&#8221;. Source: LVGL docs, &#8220;Add LVGL to an ESP32 IDF project&#8221;.</p>



<h2 class="wp-block-heading">Sources</h2>



<ul class="wp-block-list">

<li>LVGL docs, Adding LVGL to Your Project (LVGL 9.4): <a href="https://docs.lvgl.io/master/details/integration/adding-lvgl-to-your-project/index.html" target="_blank" rel="noopener">https://docs.lvgl.io/master/details/integration/adding-lvgl-to-your-project/index.html</a></li>
<li>LVGL docs, Add LVGL to an ESP32 IDF project: <a href="https://lvgl.io/docs/open/integration/chip_vendors/espressif/add_lvgl_to_esp32_idf_project" target="_blank" rel="noopener">https://lvgl.io/docs/open/integration/chip_vendors/espressif/add_lvgl_to_esp32_idf_project</a></li>
<li>LVGL blog, ESP32 plus LVGL Quick Start Guide: <a href="https://lvgl.io/blog/tutorial-esp32-getting-started" target="_blank" rel="noopener">https://lvgl.io/blog/tutorial-esp32-getting-started</a></li>
<li>Random Nerd Tutorials, LVGL with ESP32 TFT Touchscreen, ILI9341 (Arduino), LVGL 9.2: <a href="https://randomnerdtutorials.com/lvgl-esp32-tft-touchscreen-display-ili9341-arduino/" target="_blank" rel="noopener">https://randomnerdtutorials.com/lvgl-esp32-tft-touchscreen-display-ili9341-arduino/</a></li>
<li>CircuitDigest, Arduino LVGL Tutorial: Build ESP32 GUI Step-by-Step: <a href="https://circuitdigest.com/tutorial/getting-started-with-arduino-lvgl" target="_blank" rel="noopener">https://circuitdigest.com/tutorial/getting-started-with-arduino-lvgl</a></li>
<li>SmartDocs, ESP32 plus TFT_eSPI plus LVGL Complete Guide: <a href="https://smartdocs.solvosync.ca/en/article/arduino-readme-2/" target="_blank" rel="noopener">https://smartdocs.solvosync.ca/en/article/arduino-readme-2/</a></li>
<li>ElectricalFlux, Getting Started with LVGL ESP32 S3: 8048S043 RGB Display Build and Debug Guide: <a href="https://electricalflux.com/mcu-projects/lvgl-esp32-s3-8048s043-rgb-build-debug" target="_blank" rel="noopener">https://electricalflux.com/mcu-projects/lvgl-esp32-s3-8048s043-rgb-build-debug</a></li>
<li>Elecrow Wiki, LVGL Arduino 2.4 inch ESP32 Touchscreen Environment Monitoring and LED Control: <a href="https://www.elecrow.com/wiki/2.4-inch-esp32-dispaly-arduino-tutorial.html" target="_blank" rel="noopener">https://www.elecrow.com/wiki/2.4-inch-esp32-dispaly-arduino-tutorial.html</a></li>
<li>Bodmer TFT_eSPI GitHub repo README: <a href="https://github.com/Bodmer/TFT_eSPI" target="_blank" rel="noopener">https://github.com/Bodmer/TFT_eSPI</a></li>
<li>Quality RC Parts, TFT_eSPI Setup Guide: <a href="https://qualityrcparts.com/tft-espi-setup-guide/">https://qualityrcparts.com/tft-espi-setup-guide/</a></li>
<li>Quality RC Parts, ESP32 Boards with Built-In Displays: TFT vs OLED Compared: <a href="https://qualityrcparts.com/esp32-built-in-display-boards-tft-oled-guide/">https://qualityrcparts.com/esp32-built-in-display-boards-tft-oled-guide/</a></li>
<li>Quality RC Parts, OLED vs TFT Display: <a href="https://qualityrcparts.com/oled-vs-tft-display/">https://qualityrcparts.com/oled-vs-tft-display/</a></li>
<li>Quality RC Parts, How to Choose the Right Display for Arduino or ESP32: <a href="https://qualityrcparts.com/which-display-to-buy/">https://qualityrcparts.com/which-display-to-buy/</a></li>

</ul>



<p class="wp-block-paragraph">Last updated: 2026-11-21</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">23589</post-id>	</item>
		<item>
		<title>TFT_eSPI Setup Guide: Arduino, ESP32, User_Setup.h</title>
		<link>https://qualityrcparts.com/tft-espi-setup-guide/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 21 Nov 2026 23:59:40 +0000</pubDate>
				<category><![CDATA[ESP32]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[arduino-ide]]></category>
		<category><![CDATA[esp32]]></category>
		<category><![CDATA[esp32-s3]]></category>
		<category><![CDATA[spi]]></category>
		<category><![CDATA[tft-display]]></category>
		<category><![CDATA[troubleshooting]]></category>
		<guid isPermaLink="false">https://qualityrcparts.com/tft-espi-setup-guide/</guid>

					<description><![CDATA[TFT_eSPI is fast, but it will not draw anything until its setup file names your driver, your pins, and your screen size. This guide walks through the install, the wiring, the User_Setup.h edit, and the first test sketch, with the exact settings for the ST7735, ST7789, and ILI9341 displays sold in the store.]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">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.</p>



<p class="wp-block-paragraph">This guide sets up TFT_eSPI from Bodmer&#8217;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.</p>



<h2 class="wp-block-heading">What is TFT_eSPI, and what do you need before you start?</h2>



<p class="wp-block-paragraph">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.</p>



<p class="wp-block-paragraph">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.</p>



<p class="wp-block-paragraph">What you need:</p>



<ul class="wp-block-list">

<li>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&#8217;s own example setup files.</li>
<li>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.</li>
<li>The Arduino IDE with the ESP32 board package installed. The README says the library requires board package 2.x.x or later.</li>
<li>Jumper wires and a breadboard. Keep the SPI wires short: long wires cause signal problems.</li>

</ul>



<h2 class="wp-block-heading">How do you install TFT_eSPI in the Arduino IDE?</h2>



<p class="wp-block-paragraph">Open the Library Manager: Sketch, Include Library, Manage Libraries. Search for &#8220;TFT_eSPI&#8221;, find the entry by Bodmer, and press Install.</p>



<p class="wp-block-paragraph">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:</p>



<pre class="wp-block-code"><code>lib_deps = bodmer/TFT_eSPI
</code></pre>



<p class="wp-block-paragraph">Source: Lopaka TFT_eSPI guide.</p>



<h2 class="wp-block-heading">How do you wire a TFT module to an ESP32 DevKit V1?</h2>



<p class="wp-block-paragraph">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&#8217;s own ESP32 example setup (Setup42_ILI9341_ESP32.h).</p>



<figure class="wp-block-table">
<table>
<thead>
<tr>
<th>Module pin</th>
<th>ESP32 DevKit V1 GPIO</th>
<th>Library name</th>
</tr>
</thead>
<tbody>
<tr>
<td>GND</td>
<td>GND</td>
<td>&#8211;</td>
</tr>
<tr>
<td>VCC</td>
<td>3V3</td>
<td>&#8211;</td>
</tr>
<tr>
<td>SCL</td>
<td>GPIO 18</td>
<td>TFT_SCLK</td>
</tr>
<tr>
<td>SDA</td>
<td>GPIO 23</td>
<td>TFT_MOSI</td>
</tr>
<tr>
<td>MISO / SDO</td>
<td>GPIO 19</td>
<td>TFT_MISO</td>
</tr>
<tr>
<td>RES</td>
<td>GPIO 4</td>
<td>TFT_RST</td>
</tr>
<tr>
<td>DC</td>
<td>GPIO 2</td>
<td>TFT_DC</td>
</tr>
<tr>
<td>CS</td>
<td>GPIO 15</td>
<td>TFT_CS</td>
</tr>
<tr>
<td>BLK</td>
<td>3V3, or a free GPIO for dimming</td>
<td>TFT_BL</td>
</tr>
</tbody>
</table>
</figure>



<p class="wp-block-paragraph">Three wiring rules. <strong>Power the module at 3.3V, not 5V.</strong> 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. <strong>Use the hardware SPI pins for clock and data.</strong> MOSI 23, MISO 19, and SCLK 18 are the DevKit V1 VSPI pins. CS, DC, and RST can be any free GPIO. <strong>Connect MISO even if you think you do not need it.</strong> 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. <strong>Backlight:</strong> 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.</p>



<h2 class="wp-block-heading">Which driver do you pick for your display?</h2>



<p class="wp-block-paragraph">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.</p>



<figure class="wp-block-table">
<table>
<thead>
<tr>
<th>Size</th>
<th>Resolution</th>
<th>Driver</th>
<th>Touch</th>
<th>Store price</th>
</tr>
</thead>
<tbody>
<tr>
<td>0.96 inch, 2-pack</td>
<td>80 by 160</td>
<td>ST7735</td>
<td>No</td>
<td>$13.99</td>
</tr>
<tr>
<td>1.3 inch</td>
<td>240 by 240</td>
<td>ST7789</td>
<td>No</td>
<td>$11.99</td>
</tr>
<tr>
<td>1.44 inch, 2-pack</td>
<td>128 by 128</td>
<td>ST7735</td>
<td>No</td>
<td>$20.99</td>
</tr>
<tr>
<td>1.8 inch, SD slot</td>
<td>128 by 160</td>
<td>ST7735</td>
<td>No</td>
<td>$10.99</td>
</tr>
<tr>
<td>2.0 inch</td>
<td>240 by 320</td>
<td>ST7789</td>
<td>No</td>
<td>$14.99</td>
</tr>
<tr>
<td>2.2 inch, SD slot</td>
<td>240 by 320</td>
<td>ILI9341</td>
<td>No</td>
<td>From $18.99</td>
</tr>
<tr>
<td>2.4 inch, no touch</td>
<td>320 by 240</td>
<td>ST7789</td>
<td>No</td>
<td>$14.99</td>
</tr>
<tr>
<td>2.4 inch, touch</td>
<td>240 by 320</td>
<td>ILI9341</td>
<td>Yes</td>
<td>$20.99</td>
</tr>
<tr>
<td>2.8 inch, touch</td>
<td>240 by 320</td>
<td>ILI9341</td>
<td>Yes</td>
<td>$24.99</td>
</tr>
<tr>
<td>3.2 inch, touch</td>
<td>240 by 320</td>
<td>ILI9341</td>
<td>Yes</td>
<td>$25.49</td>
</tr>
<tr>
<td>3.5 inch, touch</td>
<td>480 by 320</td>
<td>ILI9488</td>
<td>Yes</td>
<td>$26.99</td>
</tr>
<tr>
<td>4.0 inch, touch</td>
<td>480 by 320</td>
<td>ST7796S</td>
<td>Yes</td>
<td>$29.99</td>
</tr>
</tbody>
</table>
</figure>



<p class="wp-block-paragraph">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.</p>



<h2 class="wp-block-heading">How do you set up User_Setup.h?</h2>



<p class="wp-block-paragraph">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.</p>



<h3 class="wp-block-heading">1. Pick exactly one driver</h3>



<p class="wp-block-paragraph">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.</p>



<p class="wp-block-paragraph">For the 0.96 inch module:</p>



<pre class="wp-block-code"><code>#define ST7735_DRIVER      // Define additional parameters below for this display
</code></pre>



<p class="wp-block-paragraph">For a 1.3 inch, 2.0 inch, or 2.4 inch non-touch module:</p>



<pre class="wp-block-code"><code>#define ST7789_DRIVER      // Full configuration option, define additional parameters below for this display
</code></pre>



<p class="wp-block-paragraph">For a 2.2 inch, 2.4 inch touch, 2.8 inch, or 3.2 inch module:</p>



<pre class="wp-block-code"><code>#define ILI9341_DRIVER       // Generic driver for common displays
</code></pre>



<p class="wp-block-paragraph">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.</p>



<h3 class="wp-block-heading">2. Set the screen size</h3>



<p class="wp-block-paragraph">Set TFT_WIDTH and TFT_HEIGHT to your panel&#8217;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.</p>



<pre class="wp-block-code"><code>#define TFT_WIDTH  240
#define TFT_HEIGHT 320
</code></pre>



<p class="wp-block-paragraph">Getting the size wrong does not stop the screen from working, but the drawing will be shifted or cut off.</p>



<h3 class="wp-block-heading">3. Set the pins</h3>



<p class="wp-block-paragraph">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.</p>



<pre class="wp-block-code"><code>#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)
</code></pre>



<p class="wp-block-paragraph">If your module&#8217;s reset pin is tied to the board reset or to 3.3V, set TFT_RST to -1.</p>



<h3 class="wp-block-heading">4. Check the fonts and the SPI speed</h3>



<p class="wp-block-paragraph">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.</p>



<h2 class="wp-block-heading">What are the other ways to configure TFT_eSPI?</h2>



<p class="wp-block-paragraph">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 &#8220;it worked yesterday&#8221; failures.</p>



<p class="wp-block-paragraph"><strong>Option 1: Edit User_Setup.h.</strong> 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.</p>



<p class="wp-block-paragraph"><strong>Option 2: Use a bundled setup file.</strong> Open User_Setup_Select.h in the library folder. Comment out the <code>#include &lt;User_Setup.h&gt;</code> 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.</p>



<p class="wp-block-paragraph"><strong>Option 3: Define the setup in the sketch or in PlatformIO.</strong> 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:</p>



<pre class="wp-block-code"><code>#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 &lt;TFT_eSPI.h&gt;
#include &lt;SPI.h&gt;
</code></pre>



<p class="wp-block-paragraph">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.</p>



<h2 class="wp-block-heading">What is the first sketch to upload?</h2>



<p class="wp-block-paragraph">Run the library&#8217;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.</p>



<p class="wp-block-paragraph">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.</p>



<p class="wp-block-paragraph">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.</p>



<p class="wp-block-paragraph">Once Colour_Test passes, a minimal hello sketch confirms text drawing:</p>



<pre class="wp-block-code"><code>#include &lt;TFT_eSPI.h&gt;

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(&quot;Hello TFT&quot;, 10, 10);
}

void loop() {
}
</code></pre>



<p class="wp-block-paragraph"><code>tft.init()</code> starts the display with the settings from the setup file. If this sketch shows &#8220;Hello TFT&#8221;, the setup is done.</p>



<h2 class="wp-block-heading">How do you set up the built-in 1.9 inch TFT board?</h2>



<p class="wp-block-paragraph">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.</p>



<h2 class="wp-block-heading">What are the common mistakes?</h2>



<ul class="wp-block-list">

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

</ul>



<h2 class="wp-block-heading">How do you fix a TFT_eSPI display that does not work?</h2>



<p class="wp-block-paragraph">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.</p>



<p class="wp-block-paragraph"><strong>The screen stays white after upload.</strong> 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.</p>



<p class="wp-block-paragraph"><strong>The screen stays black.</strong> 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.</p>



<p class="wp-block-paragraph"><strong>The colours are wrong or inverted.</strong> 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.</p>



<p class="wp-block-paragraph"><strong>The picture is shifted, cut off, or noisy.</strong> 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.</p>



<p class="wp-block-paragraph"><strong>The sketch will not compile.</strong> 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.</p>



<p class="wp-block-paragraph"><strong>The touch panel does not respond.</strong> 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.</p>



<p class="wp-block-paragraph"><strong>The display works but the SD card on the same bus stops working.</strong> 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.</p>



<h2 class="wp-block-heading">Parts used in this guide</h2>



<p class="wp-block-paragraph">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.</p>



<ul class="wp-block-list">

<li><a href="https://qualityrcparts.com/product/0-96-inch-tft-display-module-2-pack-color-ips-lcd-80x160-st7735-spi-for-arduino-esp32/">0.96 Inch TFT Display Module 2-Pack, Color IPS LCD 80&#215;160, ST7735 SPI for Arduino ESP32</a> (ID 19625) &#8211; $13.99. Two ST7735 modules for the worked setup in this guide.</li>
<li><a href="https://qualityrcparts.com/product/2-4-inch-spi-tft-lcd-touch-display-module-240x320-ili9341-driver/">2.4 Inch SPI TFT LCD Touch Display Module, 240&#215;320, ILI9341 driver</a> (ID 17813) &#8211; $20.99. The touch module for the ILI9341 worked example, with touch panel and pen.</li>
<li><a href="https://qualityrcparts.com/product/esp32-development-board-with-1-9-inch-st7789-tft-lcd-display-16mb-wifi-bluetooth-usb-c/">ESP32 Development Board with 1.9 Inch ST7789 TFT LCD Display, 16MB, WiFi + Bluetooth, USB-C</a> (ID 17819) &#8211; $19.99. The built-in display board. Its setup is in the display-boards guide, linked below, not in this guide.</li>
<li><a href="https://qualityrcparts.com/product/esp32-devkit-v1-development-board-30-pin-wroom-32-wifi-bluetooth-dual-core/">ESP32 DevKit V1 Development Board, 30-Pin WROOM-32, WiFi + Bluetooth, Dual-Core</a> (ID 19639) &#8211; $9.99. The example board for the wiring table. Its hardware SPI pins match the library&#8217;s own ESP32 example setup.</li>

</ul>



<p class="wp-block-paragraph">Shipped fast and securely from our secure facility in Queensbury, NY. QRC ships within the USA only.</p>



<h2 class="wp-block-heading">Related guides</h2>



<ul class="wp-block-list">

<li><a href="/esp32-built-in-display-boards-tft-oled-guide/">ESP32 Boards with Built-In Displays: TFT vs OLED Compared</a></li>
<li><a href="/tft-lcd-displays-arduino-esp32-projects/">TFT LCD Displays for Arduino and ESP32 Projects</a></li>
<li><a href="/best-displays-for-arduino-esp32-usa/">How to Choose Displays for Arduino and ESP32 Projects</a></li>
<li><a href="/i2c-oled-display-ssd1306-wiring-guide/">I2C OLED Display Guide: Wire the SSD1306 to Arduino or ESP32</a></li>
<li><a href="/i2c-vs-spi-vs-uart/">I2C vs SPI vs UART: Which Protocol for Your Sensor or Display</a></li>
<li><a href="/logic-level-shifting-5v-3v3-esp32-arduino/">Logic Level Shifting 5V to 3.3V: Safe Wiring for ESP32, Arduino, Sensors, and Displays</a></li>

</ul>



<h2 class="wp-block-heading">FAQ</h2>



<p class="wp-block-paragraph"><strong>What is TFT_eSPI?</strong>
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.</p>



<p class="wp-block-paragraph"><strong>Do I have to edit User_Setup.h to use TFT_eSPI?</strong>
Yes, in the standard route: the driver, size, pins, and fonts must be defined in the library&#8217;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.</p>



<p class="wp-block-paragraph"><strong>Which driver do I pick in TFT_eSPI for my display?</strong>
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.</p>



<p class="wp-block-paragraph"><strong>Why is my TFT screen white after uploading a TFT_eSPI sketch?</strong>
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.</p>



<p class="wp-block-paragraph"><strong>Can I use TFT_eSPI with an Arduino Uno?</strong>
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.</p>



<p class="wp-block-paragraph"><strong>Why does my TFT_eSPI setup disappear after a library update?</strong>
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.</p>



<p class="wp-block-paragraph"><strong>How do I know which setup the library actually compiled with?</strong>
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.</p>



<h2 class="wp-block-heading">Sources</h2>



<ul class="wp-block-list">

<li>Bodmer TFT_eSPI GitHub repo README: <a href="https://github.com/Bodmer/TFT_eSPI" target="_blank" rel="noopener">https://github.com/Bodmer/TFT_eSPI</a></li>
<li>Bodmer TFT_eSPI User_Setup.h (master): <a href="https://github.com/Bodmer/TFT_eSPI/blob/master/User_Setup.h" target="_blank" rel="noopener">https://github.com/Bodmer/TFT_eSPI/blob/master/User_Setup.h</a></li>
<li>Bodmer TFT_eSPI User_Setup_Select.h (master): <a href="https://github.com/Bodmer/TFT_eSPI/blob/master/User_Setup_Select.h" target="_blank" rel="noopener">https://github.com/Bodmer/TFT_eSPI/blob/master/User_Setup_Select.h</a></li>
<li>Bodmer TFT_eSPI bundled ESP32 ILI9341 setup, Setup42_ILI9341_ESP32.h: <a href="https://github.com/Bodmer/TFT_eSPI/blob/master/User_Setups/Setup42_ILI9341_ESP32.h" target="_blank" rel="noopener">https://github.com/Bodmer/TFT_eSPI/blob/master/User_Setups/Setup42_ILI9341_ESP32.h</a></li>
<li>Makerguides, How to configure TFT_eSPI Library for TFT display: <a href="https://www.makerguides.com/how-to-configure-tft_espi-library-for-tft-display/" target="_blank" rel="noopener">https://www.makerguides.com/how-to-configure-tft_espi-library-for-tft-display/</a></li>
<li>ElectricalFlux, Driving High-Resolution ESP32 Graphics with TFT_eSPI and ILI9341: <a href="https://electricalflux.com/mcu-projects/esp32-graphics-tft-espi-ili9341-setup" target="_blank" rel="noopener">https://electricalflux.com/mcu-projects/esp32-graphics-tft-espi-ili9341-setup</a></li>
<li>Lopaka, TFT_eSPI ESP32 Color Display Guide: <a href="https://lopaka.app/pages/docs/guides/tft-espi" target="_blank" rel="noopener">https://lopaka.app/pages/docs/guides/tft-espi</a></li>
<li>Protoship, ESP32 display not working: white screen, wrong colours, dead touch: <a href="https://protoship.dev/guides/esp32-display-not-working" target="_blank" rel="noopener">https://protoship.dev/guides/esp32-display-not-working</a></li>
<li>RoboticsEngineering, SPI TFT display shows a white screen: <a href="https://roboticsengineering.in/fix/tft-spi-display-white-screen-wrong-driver/" target="_blank" rel="noopener">https://roboticsengineering.in/fix/tft-spi-display-white-screen-wrong-driver/</a></li>
<li>Arduino Forum, Sketches using TFT_eSPI library cannot compile for ESP32-C6 board: <a href="https://forum.arduino.cc/t/sketches-using-tft-espi-library-cannot-compile-for-esp32-c6-board/1378348" target="_blank" rel="noopener">https://forum.arduino.cc/t/sketches-using-tft-espi-library-cannot-compile-for-esp32-c6-board/1378348</a></li>
<li>Quality RC Parts, ESP32 Boards with Built-In Displays: TFT vs OLED Compared: <a href="https://qualityrcparts.com/esp32-built-in-display-boards-tft-oled-guide/">https://qualityrcparts.com/esp32-built-in-display-boards-tft-oled-guide/</a></li>
<li>Quality RC Parts, TFT LCD Displays for Arduino and ESP32 Projects: <a href="https://qualityrcparts.com/tft-lcd-displays-arduino-esp32-projects/">https://qualityrcparts.com/tft-lcd-displays-arduino-esp32-projects/</a></li>
<li>Quality RC Parts, How to Choose Displays for Arduino and ESP32 Projects: <a href="https://qualityrcparts.com/best-displays-for-arduino-esp32-usa/">https://qualityrcparts.com/best-displays-for-arduino-esp32-usa/</a></li>

</ul>



<p class="wp-block-paragraph">Last updated: 2026-11-21</p>



<h2 class="wp-block-heading">Change log</h2>



<ul class="wp-block-list">

<li>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.</li>

</ul>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">23532</post-id>	</item>
		<item>
		<title>Raspberry Pi Pico Pinout: RP2040 GPIO, ADC, and Power</title>
		<link>https://qualityrcparts.com/raspberry-pi-pico-pinout/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 21 Nov 2026 20:51:52 +0000</pubDate>
				<category><![CDATA[Drone Guides]]></category>
		<category><![CDATA[adc]]></category>
		<category><![CDATA[i2c]]></category>
		<category><![CDATA[micropython]]></category>
		<category><![CDATA[pinout]]></category>
		<category><![CDATA[pwm]]></category>
		<category><![CDATA[raspberry-pi-pico]]></category>
		<category><![CDATA[rp2040]]></category>
		<category><![CDATA[spi]]></category>
		<guid isPermaLink="false">https://qualityrcparts.com/raspberry-pi-pico-pinout-2/</guid>

					<description><![CDATA[This Raspberry Pi Pico pinout guide maps all 26 GPIO pins, 3 ADC inputs, PWM, I2C, SPI, UART, and the VSYS, VBUS, and 3V3 power pins.]]></description>
										<content:encoded><![CDATA[<h1>Raspberry Pi Pico Pinout: RP2040 GPIO, ADC, and Power</h1>
<p><strong>Answer in brief:</strong> The Raspberry Pi Pico has 26 GPIO pins, 3 ADC inputs, and PWM on every GPIO pin. It runs the RP2040 chip at a 133 megahertz clock and 3.3 volt logic. This guide maps each pin, the power pins, and the debug pins. It also covers the pins that are not general GPIO.</p>
<h2>Quick Facts</h2>
<table>
<tr>
<th>Item</th>
<th>Detail</th>
<th>Source</th>
</tr>
<tr>
<td>Chip</td>
<td>RP2040, dual-core Cortex-M0+</td>
<td>Raspberry Pi Pico Datasheet</td>
</tr>
<tr>
<td>Clock speed</td>
<td>133 megahertz</td>
<td>Raspberry Pi Pico Datasheet</td>
</tr>
<tr>
<td>Logic voltage</td>
<td>3.3 volts, not 5 volt tolerant</td>
<td>Raspberry Pi Pico Datasheet</td>
</tr>
<tr>
<td>Board edge</td>
<td>40 pins</td>
<td>Raspberry Pi Pico Datasheet</td>
</tr>
<tr>
<td>GPIO pins</td>
<td>26 pins: GP0 to GP22 and GP26 to GP28</td>
<td>Raspberry Pi Pico Datasheet</td>
</tr>
<tr>
<td>ADC inputs</td>
<td>3 inputs: GP26, GP27, GP28, 12-bit</td>
<td>RP2040 Datasheet</td>
</tr>
<tr>
<td>ADC range</td>
<td>0 counts to 4095 counts, 0 volts to 3.3 volts</td>
<td>RP2040 Datasheet</td>
</tr>
<tr>
<td>Onboard LED</td>
<td>GP25</td>
<td>Raspberry Pi Pico Datasheet</td>
</tr>
<tr>
<td>VSYS input range</td>
<td>1.8 volts to 5.5 volts</td>
<td>Raspberry Pi Pico Datasheet</td>
</tr>
<tr>
<td>VBUS pin</td>
<td>Pin 40, USB 5 volt input</td>
<td>Raspberry Pi Pico Datasheet</td>
</tr>
<tr>
<td>3V3 output, max</td>
<td>300 milliamperes</td>
<td>Raspberry Pi Pico Datasheet</td>
</tr>
<tr>
<td>PWM</td>
<td>Every GPIO pin, 8 slices</td>
<td>RP2040 Datasheet</td>
</tr>
</table>
<h2>Raspberry Pi Pico Pinout Table</h2>
<p>This table is an original pinout table built from the Raspberry Pi Pico Datasheet. It is not a copied image. The GP names are the printed pin names on the board. The pin numbers are the board edge numbers.</p>
<table>
<tr>
<th>Edge pin</th>
<th>GP name</th>
<th>Main function</th>
<th>Notes</th>
</tr>
<tr>
<td>1</td>
<td>GP0</td>
<td>GPIO</td>
<td>UART0 TX default</td>
</tr>
<tr>
<td>2</td>
<td>GP1</td>
<td>GPIO</td>
<td>UART0 RX default</td>
</tr>
<tr>
<td>3</td>
<td>GND</td>
<td>Ground</td>
<td>Common ground</td>
</tr>
<tr>
<td>4</td>
<td>GP2</td>
<td>GPIO</td>
<td>I2C1 SDA option</td>
</tr>
<tr>
<td>5</td>
<td>GP3</td>
<td>GPIO</td>
<td>I2C1 SCL option</td>
</tr>
<tr>
<td>6</td>
<td>GP4</td>
<td>GPIO</td>
<td>UART1 TX, I2C0 SDA default</td>
</tr>
<tr>
<td>7</td>
<td>GP5</td>
<td>GPIO</td>
<td>UART1 RX, I2C0 SCL default</td>
</tr>
<tr>
<td>8</td>
<td>GND</td>
<td>Ground</td>
<td>Common ground</td>
</tr>
<tr>
<td>9</td>
<td>GP6</td>
<td>GPIO</td>
<td>I2C1 SDA default</td>
</tr>
<tr>
<td>10</td>
<td>GP7</td>
<td>GPIO</td>
<td>I2C1 SCL default</td>
</tr>
<tr>
<td>11</td>
<td>GP8</td>
<td>GPIO</td>
<td>SPI1 RX default</td>
</tr>
<tr>
<td>12</td>
<td>GP9</td>
<td>GPIO</td>
<td>SPI1 CSn default</td>
</tr>
<tr>
<td>13</td>
<td>GND</td>
<td>Ground</td>
<td>Common ground</td>
</tr>
<tr>
<td>14</td>
<td>GP10</td>
<td>GPIO</td>
<td>SPI1 SCK default</td>
</tr>
<tr>
<td>15</td>
<td>GP11</td>
<td>GPIO</td>
<td>SPI1 TX default</td>
</tr>
<tr>
<td>16</td>
<td>GP12</td>
<td>GPIO</td>
<td>General use</td>
</tr>
<tr>
<td>17</td>
<td>GP13</td>
<td>GPIO</td>
<td>General use</td>
</tr>
<tr>
<td>18</td>
<td>GND</td>
<td>Ground</td>
<td>Common ground</td>
</tr>
<tr>
<td>19</td>
<td>GP14</td>
<td>GPIO</td>
<td>General use</td>
</tr>
<tr>
<td>20</td>
<td>GP15</td>
<td>GPIO</td>
<td>General use</td>
</tr>
<tr>
<td>21</td>
<td>GP16</td>
<td>GPIO</td>
<td>SPI0 RX default</td>
</tr>
<tr>
<td>22</td>
<td>GP17</td>
<td>GPIO</td>
<td>SPI0 CSn default</td>
</tr>
<tr>
<td>23</td>
<td>GND</td>
<td>Ground</td>
<td>Common ground</td>
</tr>
<tr>
<td>24</td>
<td>GP18</td>
<td>GPIO</td>
<td>SPI0 SCK default</td>
</tr>
<tr>
<td>25</td>
<td>GP19</td>
<td>GPIO</td>
<td>SPI0 TX default</td>
</tr>
<tr>
<td>26</td>
<td>GP20</td>
<td>GPIO</td>
<td>General use</td>
</tr>
<tr>
<td>27</td>
<td>GP21</td>
<td>GPIO</td>
<td>General use</td>
</tr>
<tr>
<td>28</td>
<td>GND</td>
<td>Ground</td>
<td>Common ground</td>
</tr>
<tr>
<td>29</td>
<td>GP22</td>
<td>GPIO</td>
<td>General use</td>
</tr>
<tr>
<td>30</td>
<td>RUN</td>
<td>Reset</td>
<td>Active low, pull low to reset</td>
</tr>
<tr>
<td>31</td>
<td>GP26</td>
<td>ADC0</td>
<td>Analog input, 12-bit</td>
</tr>
<tr>
<td>32</td>
<td>GP27</td>
<td>ADC1</td>
<td>Analog input, 12-bit</td>
</tr>
<tr>
<td>33</td>
<td>AGND</td>
<td>Analog ground</td>
<td>Ground for ADC use</td>
</tr>
<tr>
<td>34</td>
<td>GP28</td>
<td>ADC2</td>
<td>Analog input, 12-bit</td>
</tr>
<tr>
<td>35</td>
<td>ADC_VREF</td>
<td>ADC reference</td>
<td>3.3 volt reference input</td>
</tr>
<tr>
<td>36</td>
<td>3V3(OUT)</td>
<td>3.3 volt output</td>
<td>300 milliamperes max</td>
</tr>
<tr>
<td>37</td>
<td>3V3_EN</td>
<td>3.3 volt enable</td>
<td>Pull low to disable the regulator</td>
</tr>
<tr>
<td>38</td>
<td>GND</td>
<td>Ground</td>
<td>Common ground</td>
</tr>
<tr>
<td>39</td>
<td>VSYS</td>
<td>Power input</td>
<td>1.8 volts to 5.5 volts input</td>
</tr>
<tr>
<td>40</td>
<td>VBUS</td>
<td>Power input</td>
<td>USB 5 volt input</td>
</tr>
</table>
<h2>Power Pins</h2>
<p>Power the Pico through USB, the VBUS pin, or the VSYS pin. USB gives 5 volts to VBUS. VBUS is pin 40 on the board edge. VSYS is pin 39 on the board edge. VSYS accepts 1.8 volts to 5.5 volts. That range covers a battery pack and a 5 volt supply.</p>
<p>Use VSYS for battery power. A 3-cell pack or a single lithium cell with a boost stage can feed VSYS. Check the Pico Datasheet power section before you pick a battery. A battery above 5.5 volts can damage the board. A battery below 1.8 volts will not run the regulator.</p>
<p>The 3V3(OUT) pin is pin 36. It gives 3.3 volts at a max of 300 milliamperes. That value comes from the Raspberry Pi Pico Datasheet. Use it for sensors and small loads. A part that needs more current needs its own regulator.</p>
<p>Pin 37 is 3V3_EN. It enables the 3.3 volt regulator. Leave it alone for normal use. Pull it low only when you want to shut the regulator down. Pin 35 is ADC_VREF. It sets the ADC reference. Leave it at 3.3 volts for normal use.</p>
<h2>Boot and Reset Pins</h2>
<p>The Pico has a BOOTSEL button for firmware loading. Hold BOOTSEL while you plug in USB. The board then appears as a USB drive. Drag a UF2 file onto that drive to load new firmware. Release BOOTSEL after the drive appears. That path loads MicroPython, CircuitPython, or a C build.</p>
<p>Pin 30 is RUN. It resets the chip when pulled low. It is active low. Connect a button from RUN to ground for a manual reset. Release the button to let the chip run again. Do not hold RUN low for normal use.</p>
<h2>ADC Pins</h2>
<p>The Pico has 3 ADC inputs on the board edge: GP26, GP27, and GP28. They are ADC0, ADC1, and ADC2. Each input reads 12-bit values from 0 counts to 4095 counts. A 0 volt input reads 0 counts. A 3.3 volt input reads 4095 counts. That step size is about 0.8 millivolts per count at the default reference.</p>
<p>ADC3 is an internal channel. It reads VSYS through GP29. It does not appear on the board edge. Use ADC3 in code to check the supply voltage. That read helps a battery project track its own power.</p>
<h2>PWM Pins</h2>
<p>PWM works on every GPIO pin on the Pico. The RP2040 chip has 8 PWM slices. Each slice drives 2 pins. That gives 16 PWM channels across the 26 GPIO pins. The Pico Datasheet and the RP2040 Datasheet both list this layout.</p>
<p>PWM drives a signal, not a load. Use a transistor or a driver for a motor. Use a series resistor for an LED. RP2040 GPIO pins have four drive-strength settings, nominally 2, 4, 8, and 12 mA, per the RP2040 Datasheet, section 5.5.3.5. The highest setting is 12 mA per pin. The total current sourced by all GPIO and QSPI pins together must not exceed 50 mA, and the total sunk must not exceed 50 mA, per the same datasheet (IIOVDD_MAX and IIOVSS_MAX). Those are drive-strength modes, not hard per-pin limits, and the pin voltage sags as the load rises. Keep LED current low with a resistor.</p>
<h2>I2C Pins</h2>
<p>I2C0 uses GP4 for SDA and GP5 for SCL by default. I2C1 uses GP6 for SDA and GP7 for SCL by default. Those defaults are the common pin choices in Pico examples. The RP2040 chip can route I2C to many other pins. Check the RP2040 Datasheet pin function table before you move the bus.</p>
<p>I2C runs at 3.3 volt logic on this board. Check the device voltage before you connect it. A 5 volt I2C device needs a level shifter. A direct 5 volt connection can damage the Pico.</p>
<h2>SPI Pins</h2>
<p>SPI0 uses GP16 for RX, GP17 for CSn, GP18 for SCK, and GP19 for TX by default. SPI1 uses GP8 for RX, GP9 for CSn, GP10 for SCK, and GP11 for TX by default. Those defaults are the common pin choices in Pico examples. The RP2040 chip can route SPI to many other pins.</p>
<p>SPI runs at 3.3 volt logic on this board. Check the device voltage before you connect it. A 3.3 volt SPI device connects directly. A 5 volt SPI device needs a level shifter.</p>
<h2>UART Pins</h2>
<p>UART0 uses GP0 for TX and GP1 for RX by default. UART1 uses GP4 for TX and GP5 for RX by default. Those defaults are the common pin choices in Pico examples. The RP2040 chip can route UART to many other pins. Check the RP2040 Datasheet pin function table before you move the port.</p>
<p>The USB port carries a separate serial link for MicroPython and for debug output. That link does not use GP0 or GP1. You can use GP0 and GP1 for a device while the USB console stays open. That split is handy for GPS logging.</p>
<h2>USB and SWD Debug Pins</h2>
<p>For a Pico comparison, see the live post <a href="https://qualityrcparts.com/raspberry-pi-pico-vs-pico-w-vs-pico-2/">Raspberry Pi Pico vs Pico W vs Pico 2: Chip, Wireless, and Headers</a> (live post #20577). For starter kit options, see the live post <a href="https://qualityrcparts.com/raspberry-pi-pico-starter-kits-compared/">Raspberry Pi Pico Starter Kits Compared: SunFounder, LAFVIN, and More</a> (live post #20579).</p>
<h2>Pins to Avoid</h2>
<p>Avoid GP23, GP24, GP25, and GP29 as general GPIO. They are internal pins. GP25 is the onboard LED on the Pico. Use it only for the LED. GP24 senses VBUS. GP29 monitors VSYS. GP23 controls power save.</p>
<p>On the Pico WH, GP23, GP24, GP25, and GP29 are used by the onboard wireless chip instead, per the Raspberry Pi Pico W Datasheet. The onboard LED on the Pico WH is driven by the wireless chip, not by GP25, so the GP25 LED blink in the sketch below works on the Pico only, not on the Pico WH. In MicroPython, use Pin(&#8220;LED&#8221;, Pin.OUT) on the Pico WH.</p>
<p>Avoid 5 volt logic on any GPIO pin. This board uses 3.3 volt logic only. It is not 5 volt tolerant. A 5 volt signal needs a level shifter. A direct 5 volt input can damage the pin.</p>
<h2>Max Current and Logic Voltage</h2>
<p>Logic voltage is 3.3 volts on every GPIO pin. That value comes from the Raspberry Pi Pico Datasheet. Treat 3.3 volts as the high level. Treat 0 volts as the low level. The board is not 5 volt tolerant. That warning is in the datasheet.</p>
<p>The 3V3(OUT) pin gives 3.3 volts at a max of 300 milliamperes. That value comes from the Raspberry Pi Pico Datasheet. Treat 300 milliamperes as the working limit for that pin. A larger load needs its own regulator.</p>
<p>The RP2040 GPIO pins have four drive-strength settings, nominally 2, 4, 8, and 12 mA, per the RP2040 Datasheet, section 5.5.3.5. The highest setting is 12 mA per pin. The total current sourced by all GPIO and QSPI pins together must not exceed 50 mA, and the total sunk must not exceed 50 mA (IIOVDD_MAX and IIOVSS_MAX). Treat 12 mA per pin and 50 mA total as the working limits.</p>
<p>Use a driver for any load above a small LED. Keep LED current low with a series resistor. A 220 ohm resistor is a common bench value for a 3.3 volt LED test. Check the LED datasheet for its own forward voltage before you pick a resistor.</p>
<h2>Wiring and Power Warnings</h2>
<p>Power the board before you connect a sensor. Keep the USB cable short. Use a cable under 3 feet for bench tests when you can. Long wires pick up noise. Noise causes ADC jitter and I2C errors.</p>
<p>Do not feed 5 volts into a GPIO pin. Do not feed 5 volts into the 3V3(OUT) pin. Do not feed more than 5.5 volts into VSYS. Each of those mistakes can damage the board. Check the pin labels before every connection.</p>
<h2>Pin Test Sketch</h2>
<p>Language: MicroPython. Firmware: MicroPython version 1.22.2 for RP2040. No extra library install is needed for this test. Load the firmware with the BOOTSEL drive method. Code status: code not compiled. No arduino-cli or PlatformIO is installed in this environment.</p>
<pre><code># Raspberry Pi Pico pin test script
# Language: MicroPython version 1.22.2 for RP2040
# Board: Raspberry Pi Pico, RP2040
# Code status: code not compiled

from machine import Pin, ADC, PWM
import time

# Onboard LED is GP25 on the Pico. On the Pico WH the LED is on the wireless chip, not GP25.
led = Pin(25, Pin.OUT)

# ADC test uses GP26, which is ADC0.
adc = ADC(Pin(26))

# PWM test uses GP15 at 1000 hertz.
pwm = PWM(Pin(15))
pwm.freq(1000)  # Set PWM frequency to 1000 hertz.
pwm.duty_u16(0)  # Start with the output off.

# UART test uses UART0 on GP0 TX and GP1 RX.
# The USB console stays free for print output.
from machine import UART
uart = UART(0, baudrate=9600, tx=Pin(0), rx=Pin(1))

print("Pico pin test started")

while True:
    # Read the ADC value on GP26.
    # ADC range is 0 to 65535 counts in MicroPython.
    value = adc.read_u16()
    print("GP26 ADC value:", value)

    # Convert the ADC value to a voltage from 0 to 3.3 volts.
    volts = value * 3.3 / 65535
    print("GP26 volts:", volts)

    # Fade the PWM output on GP15 from off to full.
    for level in range(0, 65536, 4096):
        pwm.duty_u16(level)
        time.sleep(0.05)  # Wait 50 milliseconds per step.

    # Blink the onboard LED on GP25 once per loop.
    led.on()
    time.sleep(0.5)  # Wait 500 milliseconds.
    led.off()
    time.sleep(0.5)  # Wait 500 milliseconds.
</code></pre>
<p>Expected result: the console shows a GP26 ADC value and a voltage each loop. The value changes with the voltage on GP26. The PWM output on GP15 fades up in steps. The onboard LED blinks once per loop. If no console output appears, check the MicroPython firmware load and the serial port selection.</p>
<h2>Frequently Asked Questions</h2>
<h3>How many GPIO pins does the Pico have?</h3>
<p>It has 26 GPIO pins: GP0 through GP22, plus GP26, GP27, and GP28. GP23, GP24, GP25, and GP29 are internal pins. They do not appear on the board edge as general GPIO.</p>
<h3>Which pins are ADC on the Pico?</h3>
<p>GP26 is ADC0, GP27 is ADC1, and GP28 is ADC2. Each input reads 12-bit values from 0 counts to 4095 counts. ADC3 is an internal channel that reads VSYS.</p>
<h3>Is the Pico 5 volt tolerant?</h3>
<p>No, the Pico is not 5 volt tolerant. It uses 3.3 volt logic only. A 5 volt signal needs a level shifter. A direct 5 volt input can damage the pin.</p>
<h3>How do I load MicroPython on the Pico?</h3>
<p>Hold BOOTSEL while you plug in USB. The board appears as a USB drive. Drag the MicroPython UF2 file onto that drive. The board reboots with MicroPython running.</p>
<h2>Boards That Match This Pinout</h2>
<p>These boards use the pinout in this guide. Check the product page for current stock before you order. Stock changes over time.</p>
<ul>
<li><a href="https://qualityrcparts.com/product/raspberry-pi-pico-development-board-2-pack/">Raspberry Pi Pico Development Board, 2-Pack</a> (product #20323)</li>
<li><a href="https://qualityrcparts.com/product/raspberry-pi-pico-pre-soldered-header/">Raspberry Pi Pico Board with Pre-Soldered Header</a> (product #20329)</li>
<li><a href="https://qualityrcparts.com/product/raspberry-pi-pico-wh-pre-soldered-headers/">Raspberry Pi Pico WH</a> (product #20325)</li>
</ul>
<p>Related reading: compare this board with ESP32 boards in the staged pillar <a href="https://qualityrcparts.com/rp2040-vs-esp32/">RP2040 vs ESP32</a> (row 24, staged). For sibling pinouts, see <a href="https://qualityrcparts.com/arduino-uno-r3-pinout/">Arduino UNO R3 Pinout</a> and <a href="https://qualityrcparts.com/nano-v3-usb-c-arduino-projects-guide/">Nano V3.0 USB-C Guide: ATmega328P Board for Arduino IDE</a>.</p>
<h2>Sources</h2>
<ul>
<li>Raspberry Pi Pico Datasheet, https://datasheets.raspberrypi.com/pico/pico-datasheet.pdf</li>
<li>RP2040 Datasheet, https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf</li>
<li>Raspberry Pi Pico W Datasheet, https://pip.raspberrypi.com/documents/RP-008312-DS-pico-w-datasheet.pdf</li>
<li>Raspberry Pi Pico pinout guide, https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html</li>
</ul>
<p>Last updated 2026-11-21.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">23365</post-id>	</item>
		<item>
		<title>Arduino UNO R3 Pinout: Digital, Analog, PWM, and Power</title>
		<link>https://qualityrcparts.com/arduino-uno-r3-pinout/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 21 Nov 2026 20:51:17 +0000</pubDate>
				<category><![CDATA[Drone Guides]]></category>
		<category><![CDATA[adc]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[arduino-uno]]></category>
		<category><![CDATA[i2c]]></category>
		<category><![CDATA[pinout]]></category>
		<category><![CDATA[pwm]]></category>
		<category><![CDATA[spi]]></category>
		<category><![CDATA[uart]]></category>
		<guid isPermaLink="false">https://qualityrcparts.com/arduino-uno-r3-pinout-2/</guid>

					<description><![CDATA[This Arduino UNO R3 pinout guide maps all 14 digital pins, 6 analog inputs, 6 PWM pins, and the power pins, with current limits and wiring rules.]]></description>
										<content:encoded><![CDATA[<h1>Arduino UNO R3 Pinout: Digital, Analog, PWM, and Power</h1>
<p><strong>Answer in brief:</strong> The Arduino UNO R3 has 14 digital pins, 6 analog inputs, and 6 PWM pins. It runs on 5 volt logic at a 16 megahertz clock. This guide maps each pin, the power pins, and the current limits. It also covers I2C, SPI, UART, and the pins to avoid.</p>
<h2>Quick Facts</h2>
<table>
<tr>
<th>Item</th>
<th>Detail</th>
<th>Source</th>
</tr>
<tr>
<td>Chip</td>
<td>ATmega328P</td>
<td>Arduino UNO R3 documentation</td>
</tr>
<tr>
<td>Clock speed</td>
<td>16 megahertz</td>
<td>Arduino UNO R3 documentation</td>
</tr>
<tr>
<td>Logic voltage</td>
<td>5 volts</td>
<td>Arduino UNO R3 documentation</td>
</tr>
<tr>
<td>Digital pins</td>
<td>14 pins, D0 to D13</td>
<td>Arduino UNO R3 documentation</td>
</tr>
<tr>
<td>PWM pins</td>
<td>6 pins: D3, D5, D6, D9, D10, D11</td>
<td>Arduino UNO R3 documentation</td>
</tr>
<tr>
<td>Analog inputs</td>
<td>6 inputs, A0 to A5, 10-bit</td>
<td>Microchip ATmega328P datasheet DS40002061B</td>
</tr>
<tr>
<td>Analog range</td>
<td>0 counts to 1023 counts</td>
<td>Microchip ATmega328P datasheet DS40002061B</td>
</tr>
<tr>
<td>Per-pin current, recommended</td>
<td>20 milliamperes</td>
<td>Microchip ATmega328P datasheet DS40002061B</td>
</tr>
<tr>
<td>Per-pin current, absolute max</td>
<td>40 milliamperes</td>
<td>Microchip ATmega328P datasheet DS40002061B</td>
</tr>
<tr>
<td>Chip total current</td>
<td>200 milliamperes</td>
<td>Microchip ATmega328P datasheet DS40002061B</td>
</tr>
<tr>
<td>3V3 output, max</td>
<td>About 50 milliamperes</td>
<td>Arduino UNO R3 documentation</td>
</tr>
<tr>
<td>VIN range, recommended</td>
<td>7 volts to 12 volts</td>
<td>Arduino UNO R3 documentation</td>
</tr>
</table>
<h2>Arduino UNO R3 Pinout Table</h2>
<p>This table is an original pinout table built from the Arduino UNO R3 documentation. It is not a copied image. The D names are the printed header names on the board. Use the table with the board in front of you.</p>
<table>
<tr>
<th>Pin</th>
<th>Function</th>
<th>Shared functions</th>
</tr>
<tr>
<td>D0</td>
<td>Digital I/O</td>
<td>UART RX</td>
</tr>
<tr>
<td>D1</td>
<td>Digital I/O</td>
<td>UART TX</td>
</tr>
<tr>
<td>D2</td>
<td>Digital I/O</td>
<td>Interrupt INT0</td>
</tr>
<tr>
<td>D3</td>
<td>Digital I/O, PWM</td>
<td>Interrupt INT1, PWM at 490 hertz</td>
</tr>
<tr>
<td>D4</td>
<td>Digital I/O</td>
<td>None</td>
</tr>
<tr>
<td>D5</td>
<td>Digital I/O, PWM</td>
<td>PWM at 980 hertz</td>
</tr>
<tr>
<td>D6</td>
<td>Digital I/O, PWM</td>
<td>PWM at 980 hertz</td>
</tr>
<tr>
<td>D7</td>
<td>Digital I/O</td>
<td>None</td>
</tr>
<tr>
<td>D8</td>
<td>Digital I/O</td>
<td>None</td>
</tr>
<tr>
<td>D9</td>
<td>Digital I/O, PWM</td>
<td>PWM at 490 hertz</td>
</tr>
<tr>
<td>D10</td>
<td>Digital I/O, PWM</td>
<td>SPI SS, PWM at 490 hertz</td>
</tr>
<tr>
<td>D11</td>
<td>Digital I/O, PWM</td>
<td>SPI MOSI, PWM at 490 hertz</td>
</tr>
<tr>
<td>D12</td>
<td>Digital I/O</td>
<td>SPI MISO</td>
</tr>
<tr>
<td>D13</td>
<td>Digital I/O</td>
<td>SPI SCK, onboard LED</td>
</tr>
<tr>
<td>A0</td>
<td>Analog input</td>
<td>Digital pin D14</td>
</tr>
<tr>
<td>A1</td>
<td>Analog input</td>
<td>Digital pin D15</td>
</tr>
<tr>
<td>A2</td>
<td>Analog input</td>
<td>Digital pin D16</td>
</tr>
<tr>
<td>A3</td>
<td>Analog input</td>
<td>Digital pin D17</td>
</tr>
<tr>
<td>A4</td>
<td>Analog input</td>
<td>Digital pin D18, I2C SDA</td>
</tr>
<tr>
<td>A5</td>
<td>Analog input</td>
<td>Digital pin D19, I2C SCL</td>
</tr>
<tr>
<td>VIN</td>
<td>Power input</td>
<td>7 volts to 12 volts recommended</td>
</tr>
<tr>
<td>5V</td>
<td>Power output</td>
<td>5 volt rail from USB or regulator</td>
</tr>
<tr>
<td>3V3</td>
<td>Power output</td>
<td>3.3 volt output, about 50 milliamperes max</td>
</tr>
<tr>
<td>GND</td>
<td>Ground</td>
<td>Common ground for all wiring</td>
</tr>
<tr>
<td>IOREF</td>
<td>Reference</td>
<td>Board logic voltage, 5 volts</td>
</tr>
<tr>
<td>AREF</td>
<td>Reference</td>
<td>Analog reference input</td>
</tr>
<tr>
<td>RESET</td>
<td>Reset</td>
<td>Pull low to restart the chip</td>
</tr>
</table>
<h2>Power Pins</h2>
<p>Power the UNO R3 through USB, the barrel jack, or the VIN pin. The barrel jack and VIN accept 7 volts to 12 volts. The on-board regulator drops that input to 5 volts. A higher input makes the regulator run hotter. Keep the input near 9 volts for bench work when you can.</p>
<p>The 5V pin is a 5 volt output when USB or the jack powers the board. It can also act as a 5 volt input. Feed it only with a clean, regulated 5 volt supply. Do not feed it with a higher voltage. The 3V3 pin gives 3.3 volts at about 50 milliamperes max. Use it only for small 3.3 volt parts.</p>
<p>IOREF tells a shield the board logic voltage. On this board, IOREF is 5 volts. AREF sets the top of the analog range. Leave AREF unconnected for normal use. The default reference is 5 volts. Ground pins appear on both headers. Use the nearest ground for each part.</p>
<h2>Boot and Reset Pins</h2>
<p>The UNO R3 has no strapping pins like an ESP32 board. It starts code on power-up or reset. The RESET pin restarts the chip when pulled low. The on-board RESET button does the same job. A shield can also pull RESET low.</p>
<p>Uploads use the USB port and the on-board USB-to-serial chip. The IDE resets the board through the serial link. No jumper is needed for normal uploads. If an upload fails, press RESET once and try again. Check the board and port selection in the IDE first.</p>
<p>The ICSP header near the chip carries SPI and reset for direct programming. Most users never need it. Leave it alone unless you program the chip with an external programmer. A wrong ICSP connection can erase the bootloader.</p>
<h2>ADC Pins</h2>
<p>The UNO R3 has 6 analog inputs, A0 through A5. Each input reads 10-bit values from 0 counts to 1023 counts. A 0 volt input reads 0 counts. A 5 volt input reads 1023 counts. That step size is about 4.9 millivolts per count at the default reference.</p>
<p>A0 through A5 also work as digital pins D14 through D19. Use them as digital outputs when you run out of digital pins. Set the pin mode in code. A pin cannot read analog and drive digital at the same time.</p>
<h2>PWM Pins</h2>
<p>PWM is available on 6 pins: D3, D5, D6, D9, D10, and D11. The PWM frequency is 490 hertz on D3, D9, D10, and D11. It is 980 hertz on D5 and D6. That split matters for some loads. A motor driver may buzz at one frequency and run smooth at the other.</p>
<p>PWM drives a signal, not a load. Use a transistor or a driver for a motor. Use a series resistor for an LED. A PWM pin still follows the 20 milliampere recommended limit. Do not connect a motor directly to a PWM pin.</p>
<h2>I2C Pins</h2>
<p>I2C uses A4 for SDA and A5 for SCL. Those two analog pins carry the bus. Connect a display or a sensor to those two pins. Share the bus with more than one device when each device has a different address.</p>
<p>A4 and A5 cannot read analog while they run the I2C bus. Plan the pin budget when you need both I2C and analog reads. Use A0 through A3 for analog in that case. That leaves A4 and A5 free for the bus.</p>
<h2>SPI Pins</h2>
<p>SPI uses D10 for SS, D11 for MOSI, D12 for MISO, and D13 for SCK. Those four pins carry the bus. Pick a different digital pin for a second chip select when you add a second SPI device. D10 must stay an output for the board to act as SPI master.</p>
<p>SPI runs at 5 volt logic on this board. Check the device voltage before you connect it. A 3.3 volt SPI device needs a level shifter. A direct 5 volt connection can damage a 3.3 volt part.</p>
<h2>UART Pins</h2>
<p>UART uses D0 for RX and D1 for TX. Those pins connect to the USB-to-serial chip. They carry the serial monitor link. They also carry uploads. Do not connect a GPS module to D0 and D1 while you debug over USB. The two uses clash.</p>
<p>Keep the baud rate the same on both ends of a UART link. A mismatch gives garbled text. Start at 9600 baud for a new device. Raise the rate only after the link works.</p>
<h2>USB Pins</h2>
<p>The UNO R3 has a USB port for power and programming. The product in this guide uses a USB cable in the box. Check the product page for the cable type in your pack. The USB link powers the board at 5 volts. It also carries uploads and serial debug output.</p>
<p>The USB port does not expose D0 and D1 as separate pads. Those pins are the UART lines behind the USB chip. Treat D0 and D1 as busy during uploads. Free them only after the upload ends.</p>
<h2>Pins to Avoid</h2>
<p>Avoid D0 and D1 for sensors while you debug over USB. Avoid A4 and A5 for analog reads while I2C is active. Avoid D10 as a general input when SPI runs as master. It must stay an output in that mode.</p>
<p>Avoid AREF as a power output. It is a reference input only. Avoid feeding 5 volts into the 3V3 pin. Avoid feeding more than 5 volts into the 5V pin. Both mistakes can damage the regulator or the chip.</p>
<p>Avoid a load above 20 milliamperes on any single pin. Avoid a total load above 200 milliamperes across the chip. Those limits come from the Microchip ATmega328P datasheet DS40002061B. Stay under them for a long board life.</p>
<h2>Max Current and Logic Voltage</h2>
<p>Logic voltage is 5 volts on every digital pin. That value comes from the Arduino UNO R3 documentation. Treat 5 volts as the high level. Treat 0 volts as the low level. A 3.3 volt sensor output may read as high on a 5 volt input, but check the sensor datasheet first.</p>
<p>The recommended current per pin is 20 milliamperes. The absolute max per pin is 40 milliamperes. The chip total is 200 milliamperes. Those three numbers come from the Microchip ATmega328P datasheet DS40002061B. Treat 20 milliamperes as the working limit. Treat 40 milliamperes as a damage threshold, not a target.</p>
<p>The 3V3 output gives about 50 milliamperes max. That value comes from the Arduino UNO R3 documentation. Use it only for small 3.3 volt parts. A WiFi module or a large display needs its own regulator.</p>
<h2>Wiring and Power Warnings</h2>
<p>Power the board before you connect a sensor. Keep the USB cable short. Use a cable under 3 feet for bench tests when you can. Long wires pick up noise. Noise causes analog jitter and I2C errors.</p>
<p>Use a series resistor for every LED. A 220 ohm resistor is a common bench value for a 5 volt LED test. Check the LED datasheet for its own forward voltage before you pick a resistor. A LED with no resistor can draw too much current from the pin.</p>
<p>Use a driver for any motor, relay, or solenoid. The GPIO pin only signals the driver. The driver handles the load current. A direct motor connection can damage the pin and reset the board.</p>
<h2>Pin Test Sketch</h2>
<p>Language: Arduino. Library: Arduino AVR core version 1.8.6, with no extra library install. Code status: code not compiled. No arduino-cli or PlatformIO is installed in this environment.</p>
<pre><code>// Arduino UNO R3 pin test sketch
// Board: UNO R3, ATmega328P
// Arduino AVR core version 1.8.6
// Code status: code not compiled

// PWM test pin is D9. It runs at 490 hertz.
const int pwmPin = 9;
// Analog test pin is A0. It reads 0 to 1023 counts.
const int analogPin = A0;
// Onboard LED pin is D13.
const int ledPin = 13;

void setup() {
  // Start serial at 9600 baud for debug output.
  Serial.begin(9600);
  delay(500); // Wait 500 milliseconds for the monitor.

  // Set the PWM pin and the LED pin as outputs.
  pinMode(pwmPin, OUTPUT);
  pinMode(ledPin, OUTPUT);

  Serial.println("UNO R3 pin test started");
}

void loop() {
  // Read the analog value on A0.
  int adcValue = analogRead(analogPin);
  Serial.print("A0 value: ");
  Serial.println(adcValue);

  // Fade the PWM output on D9 from off to full.
  for (int level = 0; level &lt;= 255; level += 5) {
    analogWrite(pwmPin, level);
    delay(20); // Wait 20 milliseconds per step.
  }

  // Blink the onboard LED on D13 once per loop.
  digitalWrite(ledPin, HIGH);
  delay(500); // Wait 500 milliseconds.
  digitalWrite(ledPin, LOW);
  delay(500); // Wait 500 milliseconds.
}
</code></pre>
<p>Expected result: the serial monitor shows an A0 value each loop. The value changes with the voltage on A0. The PWM output on D9 fades up in steps. The onboard LED blinks once per loop. If no serial output appears, check the board and port selection in the IDE.</p>
<h2>Frequently Asked Questions</h2>
<h3>How many digital pins does the UNO R3 have?</h3>
<p>It has 14 digital pins, D0 through D13. Six of those pins support PWM. The analog pins A0 through A5 can also work as digital pins D14 through D19.</p>
<h3>Which pins are PWM on the UNO R3?</h3>
<p>PWM pins are D3, D5, D6, D9, D10, and D11. D5 and D6 run at 980 hertz. The other four PWM pins run at 490 hertz.</p>
<h3>What is the current limit per pin?</h3>
<p>The recommended limit is 20 milliamperes per pin. The absolute max is 40 milliamperes per pin. The chip total is 200 milliamperes. Stay under the recommended limit for normal use.</p>
<h3>Can I power the UNO R3 from the VIN pin?</h3>
<p>Yes, feed VIN with 7 volts to 12 volts. The on-board regulator drops that input to 5 volts. Keep the input near 9 volts for bench work. A higher input makes the regulator run hotter.</p>
<h2>Boards That Match This Pinout</h2>
<p>These boards use the pinout in this guide. Check the product page for current stock before you order. Stock changes over time.</p>
<ul>
<li><a href="https://qualityrcparts.com/product/elegoo-uno-r3-microcontroller-board-atmega328p-atmega16u2-with-usb-cable/">UNO R3 Microcontroller Board</a> (product #17891)</li>
<li><a href="https://qualityrcparts.com/product/r3-development-board-atmega328p-16u2-usb-cable/">R3 Development Board ATmega328P</a> (product #23113)</li>
</ul>
<p>Related reading: compare this board with other microcontroller families in the staged pillar <a href="https://qualityrcparts.com/rp2040-vs-esp32/">RP2040 vs ESP32</a> (row 24, staged). For a first project, see the live post <a href="https://qualityrcparts.com/uno-r3-compatible-board-guide/">How to Start with a UNO R3 Board for Arduino Projects</a> (live post #15177) and the live post <a href="https://qualityrcparts.com/first-arduino-project-uno-oled-temperature/">How to Build Your First Arduino Project with UNO and OLED</a> (live post #15203). For sibling pinouts, see <a href="https://qualityrcparts.com/nano-v3-usb-c-arduino-projects-guide/">Nano V3.0 USB-C Guide: ATmega328P Board for Arduino IDE</a> and <a href="https://qualityrcparts.com/raspberry-pi-pico-pinout/">Raspberry Pi Pico Pinout</a>.</p>
<h2>Sources</h2>
<ul>
<li>Arduino UNO R3 documentation, https://docs.arduino.cc/hardware/uno-rev3/</li>
<li>Microchip ATmega328P datasheet DS40002061B, https://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-7810-Automotive-Microcontrollers-ATmega328P_Datasheet.pdf</li>
<li>Arduino UNO R3 schematic, https://docs.arduino.cc/hardware/uno-rev3/</li>
</ul>
<p>Last updated 2026-11-21.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">23364</post-id>	</item>
		<item>
		<title>Seeed XIAO ESP32S3 Pinout: GPIO, Camera, and Power</title>
		<link>https://qualityrcparts.com/xiao-esp32s3-pinout/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 21 Nov 2026 20:50:41 +0000</pubDate>
				<category><![CDATA[Drone Guides]]></category>
		<category><![CDATA[adc]]></category>
		<category><![CDATA[esp32-cam]]></category>
		<category><![CDATA[esp32-s3]]></category>
		<category><![CDATA[i2c]]></category>
		<category><![CDATA[pinout]]></category>
		<category><![CDATA[spi]]></category>
		<category><![CDATA[uart]]></category>
		<category><![CDATA[xiao]]></category>
		<guid isPermaLink="false">https://qualityrcparts.com/xiao-esp32s3-pinout/</guid>

					<description><![CDATA[This XIAO ESP32S3 pinout guide maps all 11 GPIO pins, the native USB pins, the Sense camera and SD card, and the power pins.]]></description>
										<content:encoded><![CDATA[<h1>XIAO ESP32S3 Pinout: GPIO, Camera, and Power Pins</h1>
<p><strong>Answer in brief:</strong> The XIAO ESP32S3 gives you 11 GPIO pins, named D0 through D10. It also gives you native USB, I2C, SPI, UART, and ADC on those same pins. The Sense version adds a camera and a microSD card on a rear connector. This guide maps each pin and its shared uses.</p>
<h2>Quick Facts</h2>
<table>
<tr>
<th>Item</th>
<th>Detail</th>
<th>Source</th>
</tr>
<tr>
<td>Board</td>
<td>XIAO ESP32S3</td>
<td>Seeed Studio XIAO ESP32S3 wiki</td>
</tr>
<tr>
<td>GPIO pins</td>
<td>11 pins, D0 to D10</td>
<td>Seeed Studio XIAO ESP32S3 wiki</td>
</tr>
<tr>
<td>Logic voltage</td>
<td>3.3 volts</td>
<td>Seeed Studio XIAO ESP32S3 wiki</td>
</tr>
<tr>
<td>USB port</td>
<td>USB-C, native USB</td>
<td>Seeed Studio XIAO ESP32S3 wiki</td>
</tr>
<tr>
<td>Native USB pins</td>
<td>GPIO19 D- and GPIO20 D+</td>
<td>Seeed Studio XIAO ESP32S3 wiki</td>
</tr>
<tr>
<td>Boot pin</td>
<td>GPIO0</td>
<td>Seeed Studio XIAO ESP32S3 wiki</td>
</tr>
<tr>
<td>I2C pins</td>
<td>D4 SDA and D5 SCL</td>
<td>Seeed Studio XIAO ESP32S3 wiki</td>
</tr>
<tr>
<td>SPI pins</td>
<td>D8 SCK, D9 MISO, D10 MOSI</td>
<td>Seeed Studio XIAO ESP32S3 wiki</td>
</tr>
<tr>
<td>UART pins</td>
<td>D6 TX and D7 RX</td>
<td>Seeed Studio XIAO ESP32S3 wiki</td>
</tr>
<tr>
<td>Sense SD chip select</td>
<td>GPIO21</td>
<td>Seeed Studio XIAO ESP32S3 wiki</td>
</tr>
</table>
<h2>XIAO ESP32S3 Pinout Table</h2>
<p>This table is an original pinout table built from the Seeed wiki pin multiplexing page. It is not a copied image. The D names are the printed pad names on the board. The GPIO numbers are the chip pin numbers in code.</p>
<table>
<tr>
<th>Pad</th>
<th>GPIO</th>
<th>Main function</th>
<th>Shared functions</th>
</tr>
<tr>
<td>D0</td>
<td>GPIO1</td>
<td>ADC input</td>
<td>Touch input</td>
</tr>
<tr>
<td>D1</td>
<td>GPIO2</td>
<td>ADC input</td>
<td>Touch input</td>
</tr>
<tr>
<td>D2</td>
<td>GPIO3</td>
<td>ADC input</td>
<td>Touch input, strapping pin</td>
</tr>
<tr>
<td>D3</td>
<td>GPIO4</td>
<td>ADC input</td>
<td>Touch input</td>
</tr>
<tr>
<td>D4</td>
<td>GPIO5</td>
<td>I2C SDA</td>
<td>ADC input, touch input</td>
</tr>
<tr>
<td>D5</td>
<td>GPIO6</td>
<td>I2C SCL</td>
<td>ADC input, touch input</td>
</tr>
<tr>
<td>D6</td>
<td>GPIO43</td>
<td>UART TX</td>
<td>UART transmit only</td>
</tr>
<tr>
<td>D7</td>
<td>GPIO44</td>
<td>UART RX</td>
<td>UART receive only</td>
</tr>
<tr>
<td>D8</td>
<td>GPIO7</td>
<td>SPI SCK</td>
<td>ADC input, touch input</td>
</tr>
<tr>
<td>D9</td>
<td>GPIO8</td>
<td>SPI MISO</td>
<td>ADC input, touch input</td>
</tr>
<tr>
<td>D10</td>
<td>GPIO9</td>
<td>SPI MOSI</td>
<td>ADC input, touch input</td>
</tr>
<tr>
<td>BOOT</td>
<td>GPIO0</td>
<td>Boot button</td>
<td>Hold low at reset for download mode</td>
</tr>
<tr>
<td>5V</td>
<td>Power</td>
<td>5 volt input</td>
<td>USB 5 volt rail when USB is connected</td>
</tr>
<tr>
<td>3V3</td>
<td>Power</td>
<td>3.3 volt output</td>
<td>Power for low-current 3.3 volt parts</td>
</tr>
<tr>
<td>GND</td>
<td>Power</td>
<td>Ground</td>
<td>Common ground for all wiring</td>
</tr>
</table>
<h2>Power Pins</h2>
<p>Power the board through the USB-C port or the 5V pad. The USB-C port supplies 5 volts from the host. The 5V pad accepts 5 volts from an external supply. Use one 5 volt source at a time. Do not feed 5 volts into the 3V3 pad.</p>
<p>The 3V3 pad is a 3.3 volt output from the SGM6029 buck converter on the board. The schematic v1.3 marks that converter Imax 600 mA, so keep external 3.3 volt loads under 600 mA in total. The Seeed wiki says 700 mA can be drawn from the 3V3 pad, which is above the schematic Imax, so the 600 mA schematic figure is the safe limit to plan on. The 5V pad is the USB VBUS rail. No separate 5V input current limit is published in schematic v1.3, so the USB source and cable set that limit in practice.</p>
<h2>Strapping and Boot Pins</h2>
<p>GPIO0 is the BOOT pin. The board has a BOOT button tied to GPIO0. Hold BOOT low at reset to enter download mode. The Arduino IDE and esptool handle this step in most cases. Press BOOT only when an upload fails to start.</p>
<p>GPIO3 on pad D2 is also a strapping pin. Keep D2 free of strong pull-downs at boot. A wrong level at boot can change the boot mode. Check the Seeed wiki strapping notes before you wire a sensor to D2.</p>
<h2>ADC and Touch Pins</h2>
<p>ADC input is available on D0, D1, D2, D3, D4, D5, D8, D9, and D10. That is 9 ADC pins in total. Each ADC pin reads a voltage from 0 volts to 3.3 volts. Use a voltage divider for any higher voltage. Never feed 5 volts into an ADC pin.</p>
<p>D11 is GPIO42 and D12 is GPIO41 on Sense and Plus variants. Those two pins serve the PDM microphone on the Sense board. Note that D11 and D12 do not support ADC on the S3 chip. Do not plan an analog read on those two pins. Use them only for their Sense roles unless the wiki for your variant says otherwise.</p>
<h2>PWM Pins</h2>
<p>PWM output works on the GPIO pins through the LEDC peripheral. Use PWM for a dim LED, a small buzzer, or a servo signal. The servo signal is a control signal only. It does not power the servo. Power the servo from a separate supply.</p>
<p>Every D pad can carry a PWM signal in code. The limit is the pin count, not the PWM peripheral. Pick a free D pad for each PWM output. Keep I2C and SPI pins free when those buses are in use. A PWM output on D4 would clash with I2C SDA.</p>
<h2>I2C Pins</h2>
<p>I2C uses D4 for SDA and D5 for SCL. The chip GPIO numbers are GPIO5 and GPIO6. Those two pins are the default I2C pair in most XIAO examples. Use them for an OLED display, a sensor, or a real-time clock.</p>
<p>Both I2C pins also support ADC and touch. That sharing means a choice. A pin on the I2C bus cannot read an analog voltage at the same time. Plan the pin budget before you add a second sensor.</p>
<h2>SPI Pins</h2>
<p>SPI uses D8 for SCK, D9 for MISO, and D10 for MOSI. The chip GPIO numbers are GPIO7, GPIO8, and GPIO9. Pick any free GPIO pin for the SPI chip select. D0 is a common chip select choice when it is free.</p>
<p>All three SPI pins also support ADC and touch. That sharing is the same trade as I2C. A SPI device claims all three pins. Plan for that claim before you add an analog sensor to D8, D9, or D10.</p>
<h2>UART Pins</h2>
<p>UART uses D6 for TX and D7 for RX. The chip GPIO numbers are GPIO43 and GPIO44. Those two pins carry the hardware serial port on the board pads. Use them for a GPS module, a serial sensor, or a second microcontroller.</p>
<p>The USB-C port carries a separate native USB serial link. That link is the programming and debug console. It does not use D6 or D7. You can use D6 and D7 for a device while the USB console stays open. That split is handy for GPS logging.</p>
<h2>USB Pins</h2>
<p>Native USB uses GPIO19 for D- and GPIO20 for D+. Those pins are internal. They do not appear on the D pads. The USB-C connector ties to them on the board. You cannot reassign them to other uses.</p>
<p>Native USB supports serial, HID, and mass storage modes in code. The Arduino core exposes USB serial by default. Use the USB link for uploads and debug output. Use D6 and D7 when you need a separate hardware UART.</p>
<h2>Sense Camera and SD Card</h2>
<p>The Sense version adds an OV2640 camera and a microSD card slot. Both sit on a rear board-to-board connector. The standard XIAO ESP32S3 has no camera and no SD slot. Check which version you hold before you follow the Sense wiring.</p>
<table>
<tr>
<th>Sense feature</th>
<th>Detail</th>
<th>Source</th>
</tr>
<tr>
<td>Camera</td>
<td>OV2640 on rear connector</td>
<td>Seeed Studio XIAO ESP32S3 wiki</td>
</tr>
<tr>
<td>SD card chip select</td>
<td>GPIO21</td>
<td>Seeed Studio XIAO ESP32S3 wiki</td>
</tr>
<tr>
<td>PDM microphone pins</td>
<td>GPIO42 and GPIO41</td>
<td>Seeed Studio XIAO ESP32S3 wiki</td>
</tr>
<tr>
<td>Standard board camera</td>
<td>None fitted</td>
<td>Seeed Studio XIAO ESP32S3 wiki</td>
</tr>
</table>
<p>The Sense camera uses the rear connector, not the D pads. That design keeps D0 through D10 free for your own wiring, except for the SD card sharing below. The SD card chip select is GPIO21. The SD card shares the SPI lines D8, D9, and D10, which are GPIO7, GPIO8, and GPIO9, with chip select on GPIO21. Do not put a second SPI device on D8, D9, and D10 while the SD card is mounted unless it has its own chip select pin. GPIO21 is also the user LED, so the LED flickers with card access.</p>
<p>For the Sense board guide, see the live post <a href="https://qualityrcparts.com/seeed-xiao-esp32s3-sense-boards-guide/">Seeed XIAO ESP32S3 Guide: Standard Board vs Sense Board</a> (live post #18362). That guide compares the standard board and the Sense board in full.</p>
<h2>Pins to Avoid</h2>
<p>Avoid GPIO19 and GPIO20 for general wiring. They are the native USB pins. Avoid GPIO0 as a permanent output. It is the BOOT pin. Avoid D2 as a boot-time output. It is a strapping pin.</p>
<p>Avoid D11 and D12 for ADC reads. Those pins do not support ADC on the S3 chip. Avoid 5 volt logic on any D pad. This board uses 3.3 volt logic. A 5 volt signal needs a level shifter.</p>
<p>Avoid using D4 and D5 for other roles when I2C is active. Avoid D8, D9, and D10 for other roles when SPI is active. A shared pin causes a clash that is hard to trace in code.</p>
<h2>Max Current and Logic Voltage</h2>
<p>Logic voltage is 3.3 volts on every D pad. That value comes from the Seeed Studio XIAO ESP32S3 wiki. Treat 3.3 volts as the high level. Treat 0 volts as the low level. Keep sensor outputs at 3.3 volts or below.</p>
<p>At the strongest drive setting, a GPIO pin sources about 40 mA (IOH) and sinks about 28 mA (IOL), per the Espressif ESP32-S3 Series Datasheet v2.2, Table 5-4. Those are drive-strength values at 3.3 volts, not a recommended continuous load. Cumulative IO output current for the chip is 1500 mA at absolute maximum, per section 5.1 of the same datasheet. Treat a small LED through a resistor as the practical per-pin load, not 40 mA.</p>
<p>Use a driver for any load above a small LED. Keep LED current low with a series resistor. A 220 ohm resistor is a common bench value for a 3.3 volt LED test. Check the LED datasheet for its own forward voltage before you pick a resistor.</p>
<h2>Wiring and Power Warnings</h2>
<p>Power the board at 5 volts through USB-C or the 5V pad. Do not feed 5 volts into the 3V3 pad. Double-check the pad labels before you connect power. The pads are small and close together.</p>
<p>Keep wires short. Use a cable under 3 feet for bench tests when you can. Long wires pick up noise. Noise causes I2C errors and ADC jitter. Twist power and ground wires together when the run is long.</p>
<p>Solder the header pins with care. A solder bridge between two small pads shorts the board. Check each joint with a magnifier. Test for shorts with a meter before first power-up. A short on the 5 volt rail can damage the USB host.</p>
<h2>Pin Test Sketch</h2>
<p>Language: Arduino. Library: Arduino ESP32 core version 2.0.14. No extra library install is needed for this test. Code status: code not compiled. No arduino-cli or PlatformIO is installed in this environment.</p>
<pre><code>// XIAO ESP32S3 pin test sketch
// Board: XIAO ESP32S3
// Arduino ESP32 core version 2.0.14
// Code status: code not compiled

// D pad to GPIO map from the Seeed wiki.
const int pinD0 = 1;  // ADC and touch.
const int pinD1 = 2;  // ADC and touch.
const int pinD4 = 5;  // I2C SDA, ADC, touch.
const int pinD5 = 6;  // I2C SCL, ADC, touch.
const int pinD6 = 43; // UART TX.
const int pinD7 = 44; // UART RX.
const int pinD8 = 7;  // SPI SCK, ADC, touch.

void setup() {
  // Start USB serial at 115200 baud for debug output.
  Serial.begin(115200);
  delay(1000); // Wait 1 second for the monitor to open.

  // Set D0 as an output for the blink test.
  pinMode(pinD0, OUTPUT);

  // Set the ADC pins as inputs.
  pinMode(pinD1, INPUT);
  pinMode(pinD4, INPUT);
  pinMode(pinD5, INPUT);

  Serial.println("XIAO ESP32S3 pin test started");
}

void loop() {
  // Read the ADC value on D1.
  // ADC range is 0 to 4095 counts on the ESP32-S3.
  int adcValue = analogRead(pinD1);
  Serial.print("D1 ADC value: ");
  Serial.println(adcValue);

  // Blink D0 for 500 milliseconds on and 500 milliseconds off.
  digitalWrite(pinD0, HIGH);
  delay(500); // Wait 500 milliseconds.
  digitalWrite(pinD0, LOW);
  delay(500); // Wait 500 milliseconds.
}
</code></pre>
<p>Expected result: the serial monitor shows a D1 ADC value each 1 second. The value changes when you touch a wire on D1 or feed it a voltage below 3.3 volts. The D0 output blinks at a 1 second period. If no serial output appears, check the USB cable and the board selection in the IDE.</p>
<h2>Frequently Asked Questions</h2>
<h3>How many GPIO pins does the XIAO ESP32S3 have?</h3>
<p>It has 11 GPIO pins on the pads, named D0 through D10. The GPIO numbers run from GPIO1 to GPIO9, plus GPIO43 and GPIO44. Native USB uses GPIO19 and GPIO20 internally.</p>
<h3>Which pins are I2C on the XIAO ESP32S3?</h3>
<p>D4 is SDA and D5 is SCL. The chip numbers are GPIO5 and GPIO6. Both pins also support ADC and touch. They cannot serve two roles at once.</p>
<h3>Does the standard XIAO ESP32S3 have a camera?</h3>
<p>No, the standard board has no camera. The Sense version adds an OV2640 camera and a microSD slot on a rear connector. The SD chip select is GPIO21 on the Sense board.</p>
<h3>Can I use 5 volt sensors with this board?</h3>
<p>No, not directly. The board uses 3.3 volt logic. A 5 volt sensor output needs a level shifter. A direct 5 volt input can damage the pin.</p>
<h2>Boards That Match This Pinout</h2>
<p>These boards use the pinout in this guide. Check the product page for current stock before you order. Stock changes over time.</p>
<ul>
<li><a href="https://qualityrcparts.com/product/seeed-studio-xiao-esp32s3-development-board-1-pack/">XIAO ESP32S3 Development Board, 1-Pack</a> (product #17839)</li>
<li><a href="https://qualityrcparts.com/product/seeed-studio-xiao-esp32s3-development-board-3-pack/">XIAO ESP32S3 Development Board, 3-Pack</a> (product #17841)</li>
<li><a href="https://qualityrcparts.com/product/seeed-studio-xiao-esp32s3-sense-development-board-1-pack/">XIAO ESP32S3 Sense Development Board, 1-Pack</a> (product #17842)</li>
</ul>
<p>Related reading: compare this board with the wider ESP32 family in the staged pillar <a href="https://qualityrcparts.com/esp32-vs-esp32-s3-vs-c3/">ESP32 vs ESP32-S3 vs ESP32-C3 vs ESP32-C6</a> (row 22, staged). For sibling pinouts, see <a href="https://qualityrcparts.com/esp32-cam-pinout/">ESP32-CAM Pinout</a> and <a href="https://qualityrcparts.com/esp32-38-pin-boards-compared/">ESP32 38-Pin Boards Compared: Narrow, DevKitC, and 32E</a>.</p>
<h2>Sources</h2>
<ul>
<li>Seeed Studio XIAO ESP32S3 pin multiplexing, https://wiki.seeedstudio.com/xiao_esp32s3_pin_multiplexing/</li>
<li>Seeed Studio XIAO ESP32S3 wiki, https://wiki.seeedstudio.com/xiao_esp32s3_getting_started/</li>
<li>Seeed Studio XIAO ESP32S3 schematic version 1.3, https://wiki.seeedstudio.com/xiao_esp32s3_getting_started/</li>
<li>Espressif ESP32-S3 Datasheet v2.2, https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf</li>
</ul>
<p>Last updated 2026-11-21.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">23363</post-id>	</item>
		<item>
		<title>ESP32-CAM Pinout: Camera, SD Card, and Free GPIO Pins</title>
		<link>https://qualityrcparts.com/esp32-cam-pinout/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 21 Nov 2026 20:50:05 +0000</pubDate>
				<category><![CDATA[Drone Guides]]></category>
		<category><![CDATA[adc]]></category>
		<category><![CDATA[esp32]]></category>
		<category><![CDATA[esp32-cam]]></category>
		<category><![CDATA[i2c]]></category>
		<category><![CDATA[pinout]]></category>
		<category><![CDATA[pwm]]></category>
		<category><![CDATA[spi]]></category>
		<category><![CDATA[uart]]></category>
		<guid isPermaLink="false">https://qualityrcparts.com/esp32-cam-pinout/</guid>

					<description><![CDATA[This ESP32-CAM pinout guide maps every camera pin, microSD pin, and free GPIO pin on the AI-Thinker board, plus power, boot, and wiring rules.]]></description>
										<content:encoded><![CDATA[<h1>ESP32-CAM Pinout: Camera, SD Card, and Free GPIO Pins</h1>
<p><strong>Answer in brief:</strong> The ESP32-CAM uses most of its GPIO pins for the camera and the microSD card. Only a small set of pins stays free for sensors and outputs. This guide maps the camera pins, the SD card pins, and the free pins. It also covers power, boot mode, and safe wiring.</p>
<h2>Quick Facts</h2>
<table>
<tr>
<th>Item</th>
<th>Detail</th>
<th>Source</th>
</tr>
<tr>
<td>Board</td>
<td>AI-Thinker ESP32-CAM</td>
<td>Espressif ESP32 Series Datasheet</td>
</tr>
<tr>
<td>Logic voltage</td>
<td>3.3 volts</td>
<td>Espressif ESP32 Series Datasheet</td>
</tr>
<tr>
<td>USB port</td>
<td>None on board</td>
<td>ESP32-CAM camera driver pin map</td>
</tr>
<tr>
<td>Programming pins</td>
<td>GPIO1 TX and GPIO3 RX</td>
<td>ESP32-CAM camera driver pin map</td>
</tr>
<tr>
<td>Flash mode pin</td>
<td>GPIO0 held low at reset</td>
<td>ESP32-CAM camera driver pin map</td>
</tr>
<tr>
<td>Camera pins used</td>
<td>15 pins</td>
<td>ESP32-CAM camera driver pin map</td>
</tr>
<tr>
<td>SD card pins in 4-bit mode</td>
<td>6 pins</td>
<td>ESP32-CAM camera driver pin map</td>
</tr>
<tr>
<td>SD card pins in 1-bit mode</td>
<td>3 pins</td>
<td>ESP32-CAM camera driver pin map</td>
</tr>
<tr>
<td>Free pins with no SD card</td>
<td>6 pins</td>
<td>ESP32-CAM camera driver pin map</td>
</tr>
</table>
<h2>ESP32-CAM Pinout Table</h2>
<p>This table is an original pinout table built from the source data listed below. It is not a copied image. Check the board print against this table before you wire anything. Some boards print VCC on one header and 5V on the other header.</p>
<table>
<tr>
<th>Header pin label</th>
<th>GPIO</th>
<th>Function</th>
<th>Notes</th>
</tr>
<tr>
<td>5V</td>
<td>Power</td>
<td>5 volt input</td>
<td>Use a stable 5 volt supply</td>
</tr>
<tr>
<td>GND</td>
<td>Power</td>
<td>Ground</td>
<td>Common ground for all wiring</td>
</tr>
<tr>
<td>GPIO12</td>
<td>GPIO12</td>
<td>SD DATA2, ADC, touch</td>
<td>Free only when SD card is not used</td>
</tr>
<tr>
<td>GPIO13</td>
<td>GPIO13</td>
<td>SD DATA3, ADC, touch</td>
<td>Free only when SD card is not used</td>
</tr>
<tr>
<td>GPIO15</td>
<td>GPIO15</td>
<td>SD CMD, ADC, touch, strapping</td>
<td>Free only when SD card is not used</td>
</tr>
<tr>
<td>GPIO14</td>
<td>GPIO14</td>
<td>SD CLK, ADC, touch</td>
<td>Free only when SD card is not used</td>
</tr>
<tr>
<td>GPIO2</td>
<td>GPIO2</td>
<td>SD DATA0, ADC, touch, strapping</td>
<td>Free only when SD card is not used</td>
</tr>
<tr>
<td>GPIO4</td>
<td>GPIO4</td>
<td>SD DATA1, ADC, touch</td>
<td>Free only when SD card is not used</td>
</tr>
<tr>
<td>3V3</td>
<td>Power</td>
<td>3.3 volt output</td>
<td>Do not use as a 5 volt input</td>
</tr>
<tr>
<td>GPIO16</td>
<td>GPIO16</td>
<td>PSRAM chip select</td>
<td>Do not use for other wiring</td>
</tr>
<tr>
<td>GPIO0</td>
<td>GPIO0</td>
<td>Camera XCLK, strapping, boot</td>
<td>Hold low at reset for flash mode</td>
</tr>
<tr>
<td>GND</td>
<td>Power</td>
<td>Ground</td>
<td>Common ground for all wiring</td>
</tr>
<tr>
<td>VCC</td>
<td>Power</td>
<td>5 volt input</td>
<td>Same 5 volt rail as the 5V pin</td>
</tr>
<tr>
<td>U0R</td>
<td>GPIO3</td>
<td>UART receive</td>
<td>Connect to adapter TX for programming</td>
</tr>
<tr>
<td>U0T</td>
<td>GPIO1</td>
<td>UART transmit</td>
<td>Connect to adapter RX for programming</td>
</tr>
<tr>
<td>GND</td>
<td>Power</td>
<td>Ground</td>
<td>Common ground for all wiring</td>
</tr>
</table>
<h2>Power Pins</h2>
<p>The board takes 5 volts through the 5V pin or the VCC pin. Both pins sit on the same 5 volt rail on this board. Use one 5 volt input at a time. Do not feed 5 volts into the 3V3 pin. That mistake can damage the board.</p>
<h2>Strapping and Boot Pins</h2>
<p>GPIO0 controls flash mode. Hold GPIO0 low at reset to enter flash mode. Release it after programming starts. Normal run mode needs GPIO0 high or floating at reset. A jumper wire to ground works for this step. Remove the jumper after the upload.</p>
<p>GPIO0 also carries the camera clock, XCLK. That dual role is normal on this board. Do not add a permanent pull-down to GPIO0. A permanent pull-down would force flash mode at every reset. Use a temporary jumper only during programming.</p>
<p>GPIO2 and GPIO15 are also strapping pins. They share SD card duties on this board. Keep them free of strong pull-downs at boot when the SD card is in use. Check the Espressif ESP32 Series Datasheet for the full strapping table before you add boot-time wiring.</p>
<h2>Camera Pins</h2>
<p>The camera uses 15 pins on this board. Those pins are fixed. Do not reassign them to other parts. The list below is the camera driver pin map for the AI-Thinker board.</p>
<table>
<tr>
<th>Camera signal</th>
<th>GPIO</th>
<th>Notes</th>
</tr>
<tr>
<td>Data D0</td>
<td>GPIO5</td>
<td>Camera data line</td>
</tr>
<tr>
<td>Data D1</td>
<td>GPIO18</td>
<td>Camera data line</td>
</tr>
<tr>
<td>Data D2</td>
<td>GPIO19</td>
<td>Camera data line</td>
</tr>
<tr>
<td>Data D3</td>
<td>GPIO21</td>
<td>Camera data line</td>
</tr>
<tr>
<td>Data D4</td>
<td>GPIO36</td>
<td>Camera data line, input only</td>
</tr>
<tr>
<td>Data D5</td>
<td>GPIO39</td>
<td>Camera data line, input only</td>
</tr>
<tr>
<td>Data D6</td>
<td>GPIO34</td>
<td>Camera data line, input only</td>
</tr>
<tr>
<td>Data D7</td>
<td>GPIO35</td>
<td>Camera data line, input only</td>
</tr>
<tr>
<td>XCLK</td>
<td>GPIO0</td>
<td>Camera clock, also boot pin</td>
</tr>
<tr>
<td>PCLK</td>
<td>GPIO22</td>
<td>Camera pixel clock</td>
</tr>
<tr>
<td>VSYNC</td>
<td>GPIO25</td>
<td>Camera vertical sync</td>
</tr>
<tr>
<td>HREF</td>
<td>GPIO23</td>
<td>Camera horizontal reference</td>
</tr>
<tr>
<td>SDA</td>
<td>GPIO26</td>
<td>Camera control bus data</td>
</tr>
<tr>
<td>SCL</td>
<td>GPIO27</td>
<td>Camera control bus clock</td>
</tr>
<tr>
<td>PWDN</td>
<td>GPIO32</td>
<td>Camera power down control</td>
</tr>
</table>
<h2>SD Card Pins</h2>
<p>The microSD slot uses 6 pins in 4-bit mode. That mode gives the fastest SD writes on this board. The 6 pins are GPIO14, GPIO15, GPIO2, GPIO4, GPIO12, and GPIO13. All 6 pins are then busy. No free GPIO remains from that set while 4-bit mode runs.</p>
<table>
<tr>
<th>SD signal</th>
<th>GPIO</th>
<th>Mode</th>
</tr>
<tr>
<td>CLK</td>
<td>GPIO14</td>
<td>4-bit and 1-bit</td>
</tr>
<tr>
<td>CMD</td>
<td>GPIO15</td>
<td>4-bit and 1-bit</td>
</tr>
<tr>
<td>DATA0</td>
<td>GPIO2</td>
<td>4-bit and 1-bit</td>
</tr>
<tr>
<td>DATA1</td>
<td>GPIO4</td>
<td>4-bit only</td>
</tr>
<tr>
<td>DATA2</td>
<td>GPIO12</td>
<td>4-bit only</td>
</tr>
<tr>
<td>DATA3</td>
<td>GPIO13</td>
<td>4-bit only</td>
</tr>
</table>
<h2>Free GPIO Pins</h2>
<p>Free pins depend on SD card use. With no SD card, 6 pins are free. Those pins are GPIO2, GPIO4, GPIO12, GPIO13, GPIO14, and GPIO15. With 1-bit SD mode, 3 pins are free. Those pins are GPIO4, GPIO12, and GPIO13. With 4-bit SD mode, none of those 6 pins are free.</p>
<p>GPIO33 is the red LED pin. You can blink it in code. It is not a good general output for a load. GPIO16 is the PSRAM chip select. Leave GPIO16 alone. GPIO32 is the camera power-down pin. Leave it under camera driver control.</p>
<h2>ADC, Touch, and PWM</h2>
<p>GPIO2, GPIO4, GPIO12, GPIO13, GPIO14, and GPIO15 all support ADC input. They also support touch input on the ESP32 chip. That overlap is useful. It is also a limit. A pin in SD use cannot serve as an ADC input at the same time.</p>
<h2>I2C, SPI, and UART</h2>
<p>The camera control bus uses GPIO26 for SDA and GPIO27 for SCL. Those pins are busy. Do not add a second I2C device on the same two pins without checking the camera driver first. A shared bus can clash with camera control.</p>
<h2>USB and Programming</h2>
<p>This board has no USB port. Program it with a 3.3 volt USB-to-serial adapter. Set the adapter to 3.3 volts. A 5 volt adapter setting can damage the 3.3 volt logic. Check the adapter jumper before every upload.</p>
<p>Connect adapter TX to board U0R, which is GPIO3. Connect adapter RX to board U0T, which is GPIO1. Connect ground to ground. Connect adapter 3.3 volt output only if the adapter can supply enough current. A separate 5 volt supply on the 5V pin is often more stable.</p>
<p>Hold GPIO0 low. Press reset. Start the upload. Release GPIO0 after the upload starts. Remove the GPIO0 jumper after the upload ends. Press reset once more to run the new code. For a full setup walkthrough, see the live post <a href="https://qualityrcparts.com/esp32-cam-getting-started/">How to Start with ESP32-CAM for WiFi Camera Projects</a> (live post #15173). For the flash steps in detail, see the live post <a href="https://qualityrcparts.com/esp32-cam-flashing-first-camera-stream/">ESP32-CAM Flashing and First Camera Stream: From Unboxing to WiFi Video</a> (live post #22720).</p>
<h2>Pins to Avoid</h2>
<p>Avoid GPIO16 for any new wiring. It is the PSRAM chip select. Avoid GPIO32 for general use. It controls camera power down. Avoid GPIO0 as a permanent output. It is the boot pin and the camera clock.</p>
<p>Avoid GPIO36, GPIO39, GPIO34, and GPIO35 as outputs. They are input-only pins. Avoid GPIO6 through GPIO11. Those pins connect to the on-board flash memory. They do not appear on the headers. Do not try to use them.</p>
<p>Avoid 5 volt logic on any GPIO pin. This board uses 3.3 volt logic. A 5 volt signal needs a level shifter. A direct 5 volt input can damage the pin.</p>
<h2>Max Current and Logic Voltage</h2>
<p>Logic voltage is 3.3 volts on every GPIO pin. That value comes from the Espressif ESP32 Series Datasheet. Treat 3.3 volts as the high level. Treat 0 volts as the low level. Keep sensor outputs at 3.3 volts or below.</p>
<p>At the strongest drive setting, a GPIO pin sources about 40 mA (IOH) and sinks about 28 mA (IOL), per Table 5-4 of the Espressif ESP32 Series Datasheet v5.3. Those are drive-strength values at 3.3 volts, not a recommended continuous load. Cumulative IO output current for the chip is 1200 mA at absolute maximum, per section 5.1 of the same datasheet. Treat a small LED through a resistor as the practical per-pin load, not 40 mA.</p>
<p>Use a transistor or a driver for any load above a small LED. Keep LED current low with a series resistor. A 220 ohm resistor is a common bench value for a 3.3 volt LED test. Check the LED datasheet for its own forward voltage before you pick a resistor.</p>
<h2>Wiring and Power Warnings</h2>
<p>Power the board before you connect a 5 volt sensor. Keep the USB-to-serial adapter at 3.3 volts. Double-check the adapter jumper. A wrong jumper is a fast way to damage the board.</p>
<p>Keep wires short. Use a cable under 3 feet for bench tests when you can. Long wires pick up noise. Noise causes SD errors and camera glitches. Twist power and ground wires together when the run is long.</p>
<h2>Pin Test Sketch</h2>
<p>Language: Arduino. Library: Arduino ESP32 core version 2.0.14, with the built-in esp_camera driver. No extra library install is needed for this test. Code status: code not compiled. No arduino-cli or PlatformIO is installed in this environment.</p>
<pre><code>// ESP32-CAM pin test sketch
// Board: AI-Thinker ESP32-CAM
// Arduino ESP32 core version 2.0.14
// Code status: code not compiled

#include "esp_camera.h"

// Camera pin map for the AI-Thinker board.
#define PWDN_GPIO_NUM 32
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM 0
#define SIOD_GPIO_NUM 26
#define SIOC_GPIO_NUM 27
#define Y9_GPIO_NUM 35
#define Y8_GPIO_NUM 34
#define Y7_GPIO_NUM 39
#define Y6_GPIO_NUM 36
#define Y5_GPIO_NUM 21
#define Y4_GPIO_NUM 19
#define Y3_GPIO_NUM 18
#define Y2_GPIO_NUM 5
#define VSYNC_GPIO_NUM 25
#define HREF_GPIO_NUM 23
#define PCLK_GPIO_NUM 22

// Free pin test uses GPIO4 when no SD card is fitted.
// GPIO4 is SD DATA1 in 4-bit mode, so remove the card first.
const int testPin = 4;

void setup() {
  // Start serial at 115200 baud for debug output.
  Serial.begin(115200);
  delay(1000); // Wait 1 second for the monitor to open.

  // Set the test pin as an output and blink the red LED pin.
  pinMode(testPin, OUTPUT);
  pinMode(33, OUTPUT);

  // Start the camera with a small frame size for the test.
  camera_config_t config;
  config.ledc_channel = LEDC_CHANNEL_0;
  config.ledc_timer = LEDC_TIMER_0;
  config.pin_d0 = Y2_GPIO_NUM;
  config.pin_d1 = Y3_GPIO_NUM;
  config.pin_d2 = Y4_GPIO_NUM;
  config.pin_d3 = Y5_GPIO_NUM;
  config.pin_d4 = Y6_GPIO_NUM;
  config.pin_d5 = Y7_GPIO_NUM;
  config.pin_d6 = Y8_GPIO_NUM;
  config.pin_d7 = Y9_GPIO_NUM;
  config.pin_xclk = XCLK_GPIO_NUM;
  config.pin_pclk = PCLK_GPIO_NUM;
  config.pin_vsync = VSYNC_GPIO_NUM;
  config.pin_href = HREF_GPIO_NUM;
  config.pin_sccb_sda = SIOD_GPIO_NUM;
  config.pin_sccb_scl = SIOC_GPIO_NUM;
  config.pin_pwdn = PWDN_GPIO_NUM;
  config.pin_reset = RESET_GPIO_NUM;
  config.xclk_freq_hz = 20000000; // 20 megahertz camera clock.
  config.pixel_format = PIXFORMAT_JPEG;
  config.frame_size = FRAMESIZE_QVGA; // Small size for a fast test.
  config.jpeg_quality = 12; // Lower number means higher quality.
  config.fb_count = 1;

  // Report the camera start result on serial.
  esp_err_t err = esp_camera_init(&amp;config);
  if (err != ESP_OK) {
    Serial.printf("Camera init failed, error 0x%x\n", err);
    return;
  }
  Serial.println("Camera init OK");
}

void loop() {
  // Blink the test pin and the red LED pin in turn.
  digitalWrite(testPin, HIGH);
  digitalWrite(33, LOW);
  delay(500); // Wait 500 milliseconds.
  digitalWrite(testPin, LOW);
  digitalWrite(33, HIGH);
  delay(500); // Wait 500 milliseconds.
  Serial.println("Pin test tick");
}
</code></pre>
<p>Expected result: the serial monitor shows &#8220;Camera init OK&#8221; and then a tick line each 1 second. The red LED blinks in turn with the test pin. If camera init fails, check the ribbon cable seating first. Then check the 5 volt supply.</p>
<h2>Frequently Asked Questions</h2>
<h3>How many free GPIO pins does the ESP32-CAM have?</h3>
<p>It has 6 free pins with no SD card. The pins are GPIO2, GPIO4, GPIO12, GPIO13, GPIO14, and GPIO15. The count drops to 3 pins in 1-bit SD mode. It drops to 0 pins from that set in 4-bit SD mode.</p>
<h3>Can I use GPIO0 as a normal output?</h3>
<p>No, not as a normal output. GPIO0 is the boot pin and the camera clock. It must be high at reset for normal run mode. Use a free pin from the SD set instead.</p>
<h3>Why does my ESP32-CAM reset when WiFi starts?</h3>
<p>A weak 5 volt supply is the most common cause. WiFi draws a current spike at start. Use a stable 5 volt supply rated at 1 ampere or more. Keep wires short and check the ground.</p>
<h3>Does the ESP32-CAM have a USB port?</h3>
<p>No, it has no USB port. Program it with a 3.3 volt USB-to-serial adapter. Connect adapter TX to U0R and adapter RX to U0T. Hold GPIO0 low at reset for flash mode.</p>
<h2>Boards That Match This Pinout</h2>
<p>These boards use the pinout in this guide. Check the product page for current stock before you order. Stock changes over time.</p>
<ul>
<li><a href="https://qualityrcparts.com/product/esp32-cam-development-board-with-ov2640-camera-module-4mb-psram/">ESP32-CAM Development Board with OV2640</a> (product #13473)</li>
<li><a href="https://qualityrcparts.com/product/esp32-cam-development-board-ov-camera-module-wifi-bluetooth-single/">ESP32-CAM Development Board, Single</a> (product #23161)</li>
<li><a href="https://qualityrcparts.com/product/esp32-cam-camera-module-2-pack/">ESP32-CAM Camera Module, 2-Pack</a> (product #21643)</li>
</ul>
<p>Related reading: compare this board with the wider ESP32 family in the staged pillar <a href="https://qualityrcparts.com/esp32-vs-esp32-s3-vs-c3/">ESP32 vs ESP32-S3 vs ESP32-C3 vs ESP32-C6</a> (row 22, staged). For sibling pinouts, see <a href="https://qualityrcparts.com/esp32-devkit-v1-guide/">How to Use the ESP32 DevKit V1 Board for WiFi Projects</a> and <a href="https://qualityrcparts.com/xiao-esp32s3-pinout/">XIAO ESP32S3 Pinout</a>.</p>
<h2>Sources</h2>
<ul>
<li>Espressif ESP32 Series Datasheet v5.3, https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf</li>
<li>ESP32-CAM camera driver pin map, Espressif Arduino ESP32 core, https://github.com/espressif/arduino-esp32/blob/master/libraries/ESP32/examples/Camera/CameraWebServer/camera_pins.h</li>
</ul>
<p>Last updated 2026-11-21.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">23362</post-id>	</item>
		<item>
		<title>I2C vs SPI vs UART: Which Protocol for Your Sensor or Display</title>
		<link>https://qualityrcparts.com/i2c-vs-spi-vs-uart/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 21 Nov 2026 20:48:26 +0000</pubDate>
				<category><![CDATA[Drone Guides]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[esp32]]></category>
		<category><![CDATA[i2c]]></category>
		<category><![CDATA[spi]]></category>
		<category><![CDATA[uart]]></category>
		<guid isPermaLink="false">https://qualityrcparts.com/i2c-vs-spi-vs-uart/</guid>

					<description><![CDATA[Compare I2C, SPI, and UART on wires, speed, addressing, and distance, with wiring rules, debug steps, and a pick for sensors, displays, and GPS.]]></description>
										<content:encoded><![CDATA[<h1>I2C vs SPI vs UART: Which Protocol for Your Sensor or Display</h1>
<p>Use I2C when several slow sensors share two wires. Use SPI when a display or a fast sensor needs speed. Use UART when two devices need a simple point to point link, such as a GPS module or a debug console. The right pick depends on how many devices you have and how fast they must talk.</p>
<h2>I2C vs SPI vs UART at a glance</h2>
<p>The table below gives the practical numbers. Speeds are typical for Arduino and ESP32 boards, not theoretical maximums, and distances are for breadboard and short cable runs.</p>
<table>
<tr>
<th>Spec (unit)</th>
<th>I2C</th>
<th>SPI</th>
<th>UART</th>
</tr>
<tr>
<td>Signal wires (count)</td>
<td>2, SDA plus SCL</td>
<td>4 minimum, MOSI plus MISO plus SCK plus CS</td>
<td>2, TX plus RX</td>
</tr>
<tr>
<td>Clock</td>
<td>Shared, from controller</td>
<td>Shared, from controller</td>
<td>None, agreed baud rate</td>
</tr>
<tr>
<td>Typical speed</td>
<td>100 kHz standard, 400 kHz fast</td>
<td>1 to 20 MHz on ESP32 and Arduino</td>
<td>9,600 to 115,200 baud common</td>
</tr>
<tr>
<td>Devices on one bus (count)</td>
<td>Up to 127 by 7-bit address, 112 usable</td>
<td>One per chip select pin</td>
<td>1 per UART port</td>
</tr>
<tr>
<td>Duplex</td>
<td>Half duplex</td>
<td>Full duplex</td>
<td>Full duplex</td>
</tr>
<tr>
<td>Addressing</td>
<td>7-bit address per device</td>
<td>Chip select line per device</td>
<td>None</td>
</tr>
<tr>
<td>Pull-up resistors</td>
<td>Required on SDA and SCL</td>
<td>Not needed</td>
<td>Not needed</td>
</tr>
<tr>
<td>Reliable distance</td>
<td>Under 1 m</td>
<td>Under 0.5 m at high speed</td>
<td>Under 1 m (TTL); 15 m is RS-232, not TTL UART</td>
</tr>
<tr>
<td>Best for</td>
<td>Sensors, small displays, RTC, IO expanders</td>
<td>Graphic displays, SD cards, fast sensors</td>
<td>GPS, debug console, board to board links</td>
</tr>
</table>
<h2>What is I2C and when should you use it?</h2>
<p>I2C, or Inter-Integrated Circuit, is a two wire bus created by Philips in 1982. It uses one line for data, called SDA, and one line for the clock, called SCL. Every device on the bus has a unique 7-bit address, so the controller can talk to up to 127 devices on the same two wires. The controller drives the clock, and the devices follow it. Data moves in 8-bit bytes with an acknowledge bit after each byte.</p>
<p>I2C is the right pick when you have several slow sensors and few pins to spare. A BME280 temperature sensor, an SSD1306 OLED display and an MPU6050 motion sensor can all share the same SDA and SCL pins on an ESP32 or an Arduino. Ten sensors still need only two signal pins, plus power and ground. That pin saving is why I2C dominates sensor projects.</p>
<p>I2C has two rules that cause most failures. First, SDA and SCL need pull-up resistors to the logic voltage, typically 4.7 kOhm, and many breakout boards include them already. Without pull-ups, the bus floats and no device answers. Second, two devices with the same address cannot share a bus. The SSD1306 OLED commonly uses address 0x3C, and the BME280 commonly uses 0x76 or 0x77, so check each device address before you wire a second identical sensor. When two identical sensors share an address, use an I2C multiplexer or a second I2C bus.</p>
<p>I2C speed is 100 kHz in standard mode and 400 kHz in fast mode, with faster modes up to 1 MHz and beyond on modern controllers. That is plenty for a sensor that reports a few times per second, and too slow for a large graphic display that needs a full frame many times per second.</p>
<h2>What is SPI and when should you use it?</h2>
<p>SPI, or Serial Peripheral Interface, is a four wire bus developed by Motorola in the 1980s. It uses MOSI for data from the controller to the device, MISO for data from the device to the controller, SCK for the clock, and one chip select line, called CS, per device. The controller pulls one CS line low to talk to that device, clocks data out on MOSI and in on MISO at the same time, then releases CS.</p>
<p>SPI is the right pick when speed matters. It has no addressing overhead and it moves data in both directions at once, so it runs many times faster than I2C. An Arduino Uno runs SPI up to about 8 MHz. An ESP32 or a Raspberry Pi Pico can push SPI to 80 MHz or higher on short traces. That speed is why graphic TFT displays, SD cards, flash memory and fast sensors use SPI.</p>
<p>The cost of SPI is pins. Devices share MOSI, MISO and SCK, but each device needs its own CS line, so three SPI devices need six signal pins against two for three I2C devices. SPI also has no built in error checking and no addressing, so a wiring fault on one CS line silences one device without affecting the others, which is both a strength and a debugging trap.</p>
<h2>What is UART and when should you use it?</h2>
<p>UART, or Universal Asynchronous Receiver-Transmitter, is the simplest of the three protocols. It uses two wires, TX for transmit and RX for receive, and it has no shared clock. The two devices agree in advance on a baud rate, such as 9,600 or 115,200, plus data bits, parity and stop bits. Each side sends when it is ready, and the other side samples the line at the agreed rate.</p>
<p>UART is the right pick for a point to point link between two intelligent devices: a GPS module, a second microcontroller, a Bluetooth module, or the USB serial debug console on your board. Wiring is crossed: one device TX goes to the other device RX, and the other way round. A straight TX to TX connection never works, and it is the most common UART wiring fault.</p>
<p>UART has no addressing and no clock line, so it connects exactly two devices per port. It also has no built in error correction beyond an optional parity bit. Its strength is simplicity and distance: at 9,600 baud, UART runs reliably over several feet of wire, and with an RS-485 transceiver it reaches hundreds of feet. That makes it the pick for a sensor on a long cable or a link between two boards.</p>
<h2>How do you choose between them?</h2>
<p>Ask three questions in order. First, how many devices? Several slow sensors on few pins points to I2C. One fast device points to SPI. Two intelligent devices points to UART. Second, how fast? A display that redraws many times per second needs SPI. A sensor that reports once a second is happy on I2C. A GPS that sends a sentence once a second is happy on UART. Third, how far? A sensor on the same board or a short breadboard run suits I2C or SPI. A sensor at the end of a long cable suits UART.</p>
<p>Many real projects use all three at once. A weather station reads a BME280 over I2C, draws the result on a TFT display over SPI, and logs to a computer over UART USB serial. That is normal, and it is why a board with two I2C buses, two SPI buses and three UARTs, such as the ESP32, is so useful. The ESP32 has two I2C buses, two usable SPI buses and three UARTs, while the Arduino Uno has one of each.</p>
<h2>What wiring mistakes cause most failures?</h2>
<p>The first mistake is missing pull-up resistors on I2C. SDA and SCL are open drain lines, so they float high only through the pull-up resistor. Many breakout boards include 4.7 kOhm or 10 kOhm pull-ups, but a bare sensor chip does not. If the bus is silent, check the pull-ups first, then the address.</p>
<p>The second mistake is crossed or uncrossed UART wires. UART needs TX to RX. I2C and SPI need like to like: SDA to SDA, SCL to SCL, MOSI to MOSI, MISO to MISO, SCK to SCK. A single crossed SPI wire gives garbage data, and a single crossed I2C wire gives silence.</p>
<p>The third mistake is a missing shared ground. All three protocols need a common ground between the devices, even when each device has its own power supply. Without it, the signal voltages have no reference, and the data is noise. The fourth mistake is a voltage mismatch: a 5 V Arduino talking to a 3.3 V sensor needs a level shifter on the signal lines, or the sensor input is overdriven.</p>
<h2>How do you debug a dead bus?</h2>
<p>Start with an I2C scanner sketch, which lists every address that answers on the bus. If the scanner finds nothing, check power, ground and pull-ups, then check the address jumpers on the board. If the scanner finds the device at the wrong address, change the address jumper or the code to match.</p>
<p>For SPI, check the CS line first. A device that never sees its CS line go low never answers, and the bus looks dead. For UART, check the baud rate on both sides first, then the crossed wiring, then the ground. A baud mismatch gives garbage characters in the serial monitor, while a wiring fault gives silence.</p>
<p>For these protocols in a live build, see the <a href="https://qualityrcparts.com/esp32-wifi-sensor-telemetry/">ESP32 WiFi sensor telemetry build</a>.</p>
<h2>FAQ</h2>
<h3>How many devices can I put on one I2C bus?</h3>
<p>Up to 127 devices by 7-bit address, with 112 usable addresses in practice. The limit in a real build is bus capacitance and address conflicts, not the address count, so keep the bus short and check for duplicate addresses.</p>
<h3>Is SPI faster than I2C?</h3>
<p>Yes. SPI typically runs at 1 MHz to 20 MHz on Arduino and ESP32 boards, while I2C typically runs at 100 kHz or 400 kHz. SPI is the pick for displays and fast sensors.</p>
<h3>Can I use I2C and SPI at the same time?</h3>
<p>Yes. They are separate buses with separate pins, and many projects use both: I2C for sensors and SPI for a display. They share only power and ground.</p>
<h3>Why does my I2C device not show up in a scanner?</h3>
<p>Check power and ground first, then the pull-up resistors on SDA and SCL, then the device address jumpers. A device with no pull-ups or with the wrong address will not answer a scan.</p>
<h3>Do I cross TX and RX on UART?</h3>
<p>Yes. One device TX goes to the other device RX, and the other way round. TX to TX never works. Both sides must also agree on the same baud rate.</p>
<h2>Parts used</h2>
<p><a href="https://qualityrcparts.com/product/0-96-inch-oled-display-module-ssd1306-i2c-128x64-for-arduino-esp32-esp8266/">0.96 Inch OLED SSD1306 Display Module</a>: the I2C display used in the examples, commonly at address 0x3C. <a href="https://qualityrcparts.com/product/bme280-temperature-humidity-pressure-sensor-module-5v/">BME280 Sensor Module</a>: the I2C temperature, humidity and pressure sensor, commonly at 0x76 or 0x77. <a href="https://qualityrcparts.com/product/2-0-inch-tft-lcd-display-module-240x320-full-color-ips-st7789-spi-for-arduino-esp32-stm32/">2.0 Inch TFT LCD ST7789 Display</a>: the SPI display for projects that need speed and colour.</p>
<h2>Sources</h2>
<ul>
<li><a href="https://www.smashingrobotics.com/i2c-vs-spi-vs-uart-explained/" target="_blank" rel="noopener">I2C vs SPI vs UART guide, wiring, speed and addressing</a></li>
<li><a href="https://soldered.com/blogs/learn/i2c-vs-spi-vs-uart" target="_blank" rel="noopener">I2C vs SPI vs UART, sensor and display picks</a></li>
<li><a href="https://projectech.in/guides/i2c-vs-spi-vs-uart-protocols-explained/" target="_blank" rel="noopener">I2C vs SPI vs UART protocols explained, with Arduino and ESP32 examples</a></li>
<li><a href="https://documentation.espressif.com/esp32_datasheet_en.html" target="_blank" rel="noopener">Espressif ESP32 Series Datasheet v5.3</a></li>
</ul>
<p>Last updated: 2026-11-21. Search volume: not verified. Product links use the store short link form with the product ID; confirm the product slug at publish time.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">23359</post-id>	</item>
	</channel>
</rss>
