Arduino UNO R3 Pinout: Digital, Analog, PWM, and Power

Push button wired to an Arduino input pin with a 10k pull-up resistor

Arduino UNO R3 Pinout: Digital, Analog, PWM, and Power

Answer in brief: 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.

Quick Facts

Item Detail Source
Chip ATmega328P Arduino UNO R3 documentation
Clock speed 16 megahertz Arduino UNO R3 documentation
Logic voltage 5 volts Arduino UNO R3 documentation
Digital pins 14 pins, D0 to D13 Arduino UNO R3 documentation
PWM pins 6 pins: D3, D5, D6, D9, D10, D11 Arduino UNO R3 documentation
Analog inputs 6 inputs, A0 to A5, 10-bit Microchip ATmega328P datasheet DS40002061B
Analog range 0 counts to 1023 counts Microchip ATmega328P datasheet DS40002061B
Per-pin current, recommended 20 milliamperes Microchip ATmega328P datasheet DS40002061B
Per-pin current, absolute max 40 milliamperes Microchip ATmega328P datasheet DS40002061B
Chip total current 200 milliamperes Microchip ATmega328P datasheet DS40002061B
3V3 output, max About 50 milliamperes Arduino UNO R3 documentation
VIN range, recommended 7 volts to 12 volts Arduino UNO R3 documentation

Arduino UNO R3 Pinout Table

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.

Pin Function Shared functions
D0 Digital I/O UART RX
D1 Digital I/O UART TX
D2 Digital I/O Interrupt INT0
D3 Digital I/O, PWM Interrupt INT1, PWM at 490 hertz
D4 Digital I/O None
D5 Digital I/O, PWM PWM at 980 hertz
D6 Digital I/O, PWM PWM at 980 hertz
D7 Digital I/O None
D8 Digital I/O None
D9 Digital I/O, PWM PWM at 490 hertz
D10 Digital I/O, PWM SPI SS, PWM at 490 hertz
D11 Digital I/O, PWM SPI MOSI, PWM at 490 hertz
D12 Digital I/O SPI MISO
D13 Digital I/O SPI SCK, onboard LED
A0 Analog input Digital pin D14
A1 Analog input Digital pin D15
A2 Analog input Digital pin D16
A3 Analog input Digital pin D17
A4 Analog input Digital pin D18, I2C SDA
A5 Analog input Digital pin D19, I2C SCL
VIN Power input 7 volts to 12 volts recommended
5V Power output 5 volt rail from USB or regulator
3V3 Power output 3.3 volt output, about 50 milliamperes max
GND Ground Common ground for all wiring
IOREF Reference Board logic voltage, 5 volts
AREF Reference Analog reference input
RESET Reset Pull low to restart the chip

Power Pins

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.

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.

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.

Boot and Reset Pins

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.

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.

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.

ADC Pins

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.

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.

PWM Pins

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.

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.

I2C Pins

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.

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.

SPI Pins

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.

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.

UART Pins

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.

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.

USB Pins

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.

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.

Pins to Avoid

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.

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.

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.

Max Current and Logic Voltage

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.

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.

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.

Wiring and Power Warnings

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.

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.

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.

Pin Test Sketch

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.

// 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 <= 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.
}

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.

Frequently Asked Questions

How many digital pins does the UNO R3 have?

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.

Which pins are PWM on the UNO R3?

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.

What is the current limit per pin?

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.

Can I power the UNO R3 from the VIN pin?

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.

Boards That Match This Pinout

These boards use the pinout in this guide. Check the product page for current stock before you order. Stock changes over time.

Related reading: compare this board with other microcontroller families in the staged pillar RP2040 vs ESP32 (row 24, staged). For a first project, see the live post How to Start with a UNO R3 Board for Arduino Projects (live post #15177) and the live post How to Build Your First Arduino Project with UNO and OLED (live post #15203). For sibling pinouts, see Nano V3.0 USB-C Guide: ATmega328P Board for Arduino IDE and Raspberry Pi Pico Pinout.

Sources

  • Arduino UNO R3 documentation, https://docs.arduino.cc/hardware/uno-rev3/
  • Microchip ATmega328P datasheet DS40002061B, https://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-7810-Automotive-Microcontrollers-ATmega328P_Datasheet.pdf
  • Arduino UNO R3 schematic, https://docs.arduino.cc/hardware/uno-rev3/

Last updated 2026-11-21.

ESP32-S2 Mini Pinout: GPIO, USB OTG, and ADC

ESP32-S2 Mini development board with USB-C port and pin headers. Caption: ESP32-S2 Mini board, front view with USB-C port. Description: Top view of the ESP32-S2 Mini board used in this pinout guide.

ESP32-S2 Mini Pinout Guide: GPIO, USB OTG, and ADC

The ESP32-S2 Mini pinout starts with one clear limit: this chip has WiFi only, and it has no Bluetooth. The ESP32-S2 chip has 43 GPIO pins. It runs a single-core Xtensa LX7 core at 240 MHz. Native USB OTG uses GPIO19 and GPIO20. DAC uses GPIO17 and GPIO18.

Quick facts

Item Value Source
Chip GPIO count 43 GPIO pins ESP32-S2 Series Datasheet
Core Single-core Xtensa LX7 at 240 MHz ESP32-S2 Series Datasheet
Radios WiFi only, no Bluetooth ESP32-S2 Series Datasheet
Logic voltage 3.3 volts ESP32-S2 Series Datasheet
USB OTG pins GPIO19 D- and GPIO20 D+ ESP32-S2 Series Datasheet
ADC1 pins GPIO1 to GPIO10 ESP32-S2 Series Datasheet
ADC2 pins GPIO11 to GPIO20 ESP32-S2 Series Datasheet
DAC pins GPIO17 and GPIO18 ESP32-S2 Series Datasheet
UART0 pins GPIO43 TX and GPIO44 RX ESP32-S2 Series Datasheet
Strapping pins GPIO0, GPIO45, GPIO46 ESP32-S2 Series Datasheet
Module GPIO count 37 GPIO pins on ESP32-S2-MINI-2 ESP32-S2-MINI-2 Datasheet v1.4
Module flash 4 MB flash, optional 2 MB PSRAM ESP32-S2-MINI-2 Datasheet v1.4

ESP32-S2 Mini pinout table

Use this table as the chip reference. Match each GPIO number to the silkscreen on your board before you wire it.

GPIO Main role Notes
GPIO0 Strapping and boot Hold low at reset for download mode
GPIO1 to GPIO10 ADC1 channels 0 to 9 Analog input, 3.3 volt max
GPIO11 to GPIO16 ADC2 channels 0 to 5 ADC2 shares use with WiFi
GPIO17 ADC2 channel 6, DAC channel 1 True analog output pin
GPIO18 ADC2 channel 7, DAC channel 2 True analog output pin
GPIO19 ADC2 channel 8, USB OTG D- Native USB, not an ADC pin in use
GPIO20 ADC2 channel 9, USB OTG D+ Native USB, not an ADC pin in use
GPIO21 to GPIO32 General GPIO Check board silkscreen for exposure
GPIO33 to GPIO42 General GPIO Check board silkscreen for exposure
GPIO43 UART0 TX Serial transmit pin
GPIO44 UART0 RX Serial receive pin
GPIO45 Strapping Check level at boot
GPIO46 Strapping Check level at boot

The header order on the LOLIN S2 Mini board follows the WEMOS S2 Mini schematic V1.0.0. Each side has two rows of 8 pins. J2 is the right outer row, J5 the right inner row, J4 the left inner row, and J3 the left outer row, with pin 1 at the top of each row in the schematic.

Header Pin order, top to bottom
J2, right outer EN, GPIO3, GPIO5, GPIO7, GPIO9, GPIO11, GPIO12, 3V3
J5, right inner GPIO1, GPIO2, GPIO4, GPIO6, GPIO8, GPIO10, GPIO13, GPIO14
J4, left inner GPIO40, GPIO38, GPIO36, GPIO34, GPIO21, GPIO17, GND, GPIO15
J3, left outer GPIO39, GPIO37, GPIO35, GPIO33, GPIO18, GPIO16, GND, VBUS

That is 27 GPIO pins on the headers in total. GPIO0 is not on the headers; it is the BOOT button only. GPIO15 carries the blue onboard LED. Check the silkscreen on your board against this table before you wire it.

Power pins

Power the board through the USB-C port at 5 volts. The board steps that input down to 3.3 volts for the chip through an ME6211C33 regulator, per the WEMOS S2 Mini schematic V1.0.0. The ME6211 is a 500 milliampere class LDO, so treat 500 milliamperes as the ceiling for the whole 3.3 volt rail, chip included, and keep external 3.3 volt loads well below it. Do not feed 5 volts into any GPIO pin. Use a short USB cable under 3 feet long for stable uploads. Power motors and servos from a separate supply, not from the board. Share a common ground between the board and that supply. Check the silkscreen for the 5 volt, 3.3 volt, and ground labels on your board.

Strapping and boot pins

Strapping pins set the boot mode at reset. The ESP32-S2 strapping pins are GPIO0, GPIO45, and GPIO46, per the ESP32-S2 Series Datasheet. GPIO0 low at reset enters download mode for flashing. GPIO0 high at reset starts the normal sketch. Do not tie a strapping pin hard to 3.3 volts or ground. Keep boot pins free during the first test. If the board will not boot, remove wires from GPIO0, GPIO45, and GPIO46 first. Then test the board with no wires attached.

ADC pins

ADC1 uses GPIO1 to GPIO10, per the ESP32-S2 Series Datasheet. Use ADC1 for analog sensors when WiFi is on. ADC2 uses GPIO11 to GPIO20, per the same datasheet. ADC2 does not work well while WiFi runs. Keep analog input at or below 3.3 volts. Use a voltage divider for a sensor that outputs more than 3.3 volts. Do not use GPIO19 and GPIO20 as ADC inputs, since they carry USB OTG.

DAC and touch pins

DAC uses GPIO17 and GPIO18, per the ESP32-S2 Series Datasheet v1.9. Those two pins give a true analog voltage output. Use them for a simple analog test or a low-speed analog signal. Touch uses GPIO1 to GPIO14, which are TOUCH1 to TOUCH14, per the ESP32-S2 Series Datasheet v1.9, section 2.3.4. All 14 touch pins double as ADC pins: GPIO1 to GPIO10 are ADC1, and GPIO11 to GPIO14 are ADC2 channels 0 to 3.

PWM pins

Most GPIO pins can output PWM through the LEDC driver in the Arduino core. Pick a free GPIO pin that is not a strapping pin, a USB pin, or a DAC pin. Use a 5,000 Hz frequency for an LED test. Use a 50 Hz frequency for a servo signal. Drive a motor through a driver board, never direct from a GPIO pin. See the ESP32 family comparison for how the S2 differs from the S3 on Bluetooth and USB.

I2C pins

I2C can use most GPIO pins on the ESP32-S2, per the ESP32-IDF GPIO reference. No fixed SDA and SCL pins are stated in the verified source data for this post. Pick two free GPIO pins and set them in code. Add pull-up resistors of 4.7 kilo-ohms to 3.3 volts on SDA and SCL if your sensor board lacks them. Keep I2C wires under 1 foot long where you can. Use 3.3 volt I2C sensors only. For the I2C protocol behind the wiring, see I2C vs SPI vs UART: Which Protocol for Your Sensor or Display.

SPI pins

SPI can also use most GPIO pins on the ESP32-S2, per the ESP32-IDF GPIO reference. No fixed MOSI, MISO, SCK, and CS pins are stated in the verified source data for this post. Pick free GPIO pins and set them in code. Use one CS pin per SPI device. Start at a low clock speed, such as 1,000,000 Hz. Use 3.3 volt SPI devices only.

UART pins

UART0 uses GPIO43 for TX and GPIO44 for RX, per the ESP32-S2 Series Datasheet. UART0 is the main serial port for debug output. A second UART can use other free GPIO pins in code. Keep UART wires crossed: TX on one board goes to RX on the other board. Use 3.3 volt UART signals only. Set both ends to the same baud rate, such as 115,200 baud.

USB pins

Native USB OTG uses GPIO19 for D- and GPIO20 for D+, per the ESP32-S2 Series Datasheet. The S2 Mini board brings these pins to a USB-C port. Use that port for flashing and for serial output. Do not use GPIO19 or GPIO20 for sensors. Use a data-capable USB cable, not a charge-only cable. Use a cable under 3 feet long for uploads. USB OTG lets the board act as a USB host for some devices, but that needs host code. The pin test sketch below uses the port for serial only.

Pins to avoid

Avoid GPIO0, GPIO45, and GPIO46 for sensors that pull the pin low at boot. Avoid GPIO19 and GPIO20 for sensors, since they carry USB OTG. Avoid ADC2 pins GPIO11 to GPIO20 for analog reads while WiFi is on. Avoid GPIO17 and GPIO18 for digital loads if you need DAC output. Avoid 5 volt signals on every GPIO pin. The chip uses 3.3 volt logic only. If a pin is not on the board silkscreen, leave it alone and pick an exposed GPIO pin instead.

Max current and logic voltage

Logic voltage is 3.3 volts on all GPIO pins, per the ESP32-S2 Series Datasheet v1.9. 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 same datasheet. Those are drive-strength values at 3.3 volts, not a recommended continuous load, and the default drive strength is 20 mA. Treat a small LED through a resistor as the practical per-pin load, not 40 mA. Drive a relay, a motor, or a servo through a driver or a transistor. The 3.3 volt rail ceiling is 500 milliamperes from the ME6211C33 regulator, per the WEMOS S2 Mini schematic V1.0.0.

Wiring and power warnings

Check the voltage of every sensor before you wire it. A 5 volt sensor output can harm a 3.3 volt GPIO pin. Remove power before you move wires. Do not short the 3.3 volt pin to ground. If the board smells hot, unplug it at once. Use a separate supply for motors and servos. Share only the ground wire between supplies. Keep the board on a non-metal surface while you test it.

Pin test sketch

This sketch blinks an external LED on GPIO4 and reads ADC1 on GPIO1. It uses only the Arduino core for ESP32, version 3.3.13. No extra library is needed. Wire the LED anode to GPIO4 through a 220 ohm resistor. Wire the LED cathode to ground. Wire a potentiometer wiper to GPIO1. Code status: code not compiled. No Arduino CLI or PlatformIO is installed here, so compilation was not run.

// ESP32-S2 Mini pin test sketch
// Board: ESP32-S2 Mini, Arduino core for ESP32 version 3.3.13
// Code status: code not compiled
// LED on GPIO4, ADC input on GPIO1, serial at 115200 baud
const int ledPin = 4; // GPIO4, plain digital pin
const int adcPin = 1; // GPIO1, ADC1 channel 0
void setup() {
  Serial.begin(115200); // Start serial for test output
  pinMode(ledPin, OUTPUT); // Set LED pin as output
  delay(500); // Wait 500 ms for serial to settle
}
void loop() {
  digitalWrite(ledPin, HIGH); // Turn LED on
  int adcValue = analogRead(adcPin); // Read ADC1 on GPIO1
  Serial.print("ADC1 GPIO1 value: "); // Label the reading
  Serial.println(adcValue); // Print raw ADC count
  delay(500); // Wait 500 ms with LED on
  digitalWrite(ledPin, LOW); // Turn LED off
  delay(500); // Wait 500 ms with LED off
}

If the LED blinks and the serial monitor shows ADC values that change with the potentiometer, GPIO4 and GPIO1 both work. If the LED stays dark, check the resistor value and the LED polarity. If the ADC value stays at 0, check the potentiometer wiring to GPIO1.

Frequently asked questions

Does the ESP32-S2 Mini have Bluetooth?

No, the ESP32-S2 chip has WiFi only and no Bluetooth, per the ESP32-S2 Series Datasheet. Do not use Bluetooth code on this board. Use WiFi or USB for a wireless link instead.

Which pins are safe for a first sensor on the ESP32-S2 Mini?

Use ADC1 pins GPIO1 to GPIO10 for analog sensors, per the ESP32-S2 Series Datasheet. Use GPIO4 for a plain digital test. Keep strapping pins, USB pins, and DAC pins free unless you need them.

Can the ESP32-S2 Mini use 5 volt sensors?

No, the GPIO pins use 3.3 volt logic only, per the ESP32-S2 Series Datasheet. A 5 volt signal can harm a GPIO pin. Use a level shifter or a voltage divider for a 5 volt sensor.

Why does my board fail to boot after I add wiring?

A strapping pin may be held low at reset. The strapping pins are GPIO0, GPIO45, and GPIO46, per the ESP32-S2 Series Datasheet. Remove wires from those pins and test the board with no wires attached.

Why does ADC2 read poorly when WiFi is on?

ADC2 shares hardware with WiFi on the ESP32-S2, per the ESP32-S2 Series Datasheet. ADC2 uses GPIO11 to GPIO20. Use ADC1 pins GPIO1 to GPIO10 for reads while WiFi runs.

Can I use GPIO19 and GPIO20 for a sensor?

No, GPIO19 and GPIO20 carry native USB OTG on this board, per the ESP32-S2 Series Datasheet. Use them only for USB. Pick a different free GPIO pin for the sensor.

Product callout

Start with the ESP32-S2 Mini Development Board for a first board at the bench. For a single spare, see the ESP32-S2 Mini Development Board Single. For a bench stock of boards, see the ESP32-S2 Mini Development Board 10-Pack. Check stock on the product page at order time.

Sources

Last updated: 2026-11-21. Status: STAGED ONLY, zero live writes, zero publishes.

For the classic 30-pin board, see the ESP32 DevKit V1 pinout guide.

I2C vs SPI vs UART: Which Protocol for Your Sensor or Display

ESP32 data logger with BME280 sensor and a downloaded CSV log

I2C vs SPI vs UART: Which Protocol for Your Sensor or Display

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.

I2C vs SPI vs UART at a glance

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.

Spec (unit) I2C SPI UART
Signal wires (count) 2, SDA plus SCL 4 minimum, MOSI plus MISO plus SCK plus CS 2, TX plus RX
Clock Shared, from controller Shared, from controller None, agreed baud rate
Typical speed 100 kHz standard, 400 kHz fast 1 to 20 MHz on ESP32 and Arduino 9,600 to 115,200 baud common
Devices on one bus (count) Up to 127 by 7-bit address, 112 usable One per chip select pin 1 per UART port
Duplex Half duplex Full duplex Full duplex
Addressing 7-bit address per device Chip select line per device None
Pull-up resistors Required on SDA and SCL Not needed Not needed
Reliable distance Under 1 m Under 0.5 m at high speed Under 1 m (TTL); 15 m is RS-232, not TTL UART
Best for Sensors, small displays, RTC, IO expanders Graphic displays, SD cards, fast sensors GPS, debug console, board to board links

What is I2C and when should you use it?

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.

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.

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.

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.

What is SPI and when should you use it?

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.

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.

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.

What is UART and when should you use it?

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.

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.

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.

How do you choose between them?

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.

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.

What wiring mistakes cause most failures?

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.

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.

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.

How do you debug a dead bus?

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.

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.

For these protocols in a live build, see the ESP32 WiFi sensor telemetry build.

FAQ

How many devices can I put on one I2C bus?

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.

Is SPI faster than I2C?

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.

Can I use I2C and SPI at the same time?

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.

Why does my I2C device not show up in a scanner?

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.

Do I cross TX and RX on UART?

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.

Parts used

0.96 Inch OLED SSD1306 Display Module: the I2C display used in the examples, commonly at address 0x3C. BME280 Sensor Module: the I2C temperature, humidity and pressure sensor, commonly at 0x76 or 0x77. 2.0 Inch TFT LCD ST7789 Display: the SPI display for projects that need speed and colour.

Sources

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