ESP32 DevKit: complete pinout
The ESP32 has Wi-Fi, Bluetooth and dozens of GPIOs, but not all of them suit every job. See the DevKit pinout, which pins to avoid, the ADC, touch, I2C and SPI functions, and filter the map by function.
Specifications
- Microcontroller
- ESP32 dual-core Xtensa LX6, up to 240 MHz
- Logic voltage
- 3.3 V (pins are not 5 V tolerant)
- Supply
- 5 V via USB or VIN; 3.3 V on the 3V3 pin
- Wireless
- Wi-Fi 802.11 b/g/n and Bluetooth 4.2 / BLE
- Usable GPIOs
- ≈ 25 (excluding those tied to flash)
- ADC
- 12-bit, 18 channels (ADC1 and ADC2)
- Current per pin
- ≈ 12 mA recommended (max 40 mA)
- Memory
- 520 KB SRAM; 4 MB flash (typical)
Pinout
Numbering is by GPIO, not by position on the board. GPIOs 6 to 11 are tied to the flash and must not be used. GPIOs 34 to 39 are input only.
Power and control
| 3V3 | 3V3 | Regulated 3.3 V output |
| VIN | VIN | 5 V from USB or external input |
| GND | GND | Ground (several pins) |
| EN | EN | Chip enable; LOW resets |
Default functions
| 21 | SDA | I2C: data |
| 22 | SCL | I2C: clock |
| 23 | MOSI | SPI (VSPI): master data out |
| 19 | MISO | SPI (VSPI): slave data out |
| 18 | SCK | SPI (VSPI): clock |
| 5 | CS | SPI (VSPI): slave select |
| 1 | TX0 | USB serial; avoid |
| 3 | RX0 | USB serial; avoid |
| 17 | TX2 | Serial 2 |
| 16 | RX2 | Serial 2 |
| 25 | DAC1 | 8-bit analog output |
| 26 | DAC2 | 8-bit analog output |
| 2 | LED | Blue board LED (on many models) |
ESP32 pin map
Pick a function to see which GPIOs provide it.
GPIOs 6 to 11 are tied to the flash and are not shown. Boot pins need care: the level at boot decides how the chip starts.
How to wire it
All pins run at 3.3 V. Applying 5 V directly to a GPIO damages the chip: use a voltage divider or level shifter when connecting 5 V outputs.
ADC2 (GPIOs 0, 2, 4, 12 to 15, 25 to 27) does not work while Wi-Fi is on. To read analog sensors together with Wi-Fi, use ADC1 pins (32 to 39).
GPIOs 34, 35, 36 and 39 are input only: no output and no internal pull-up. They suit sensors and buttons with an external resistor.
Boot (strapping) pins: 0, 2, 5, 12 and 15 set the start-up mode. Connect only things that do not force a level at power-up, or the ESP32 will not start. GPIO 12 HIGH at boot changes the flash voltage.
Any GPIO can be PWM (LEDC), I2C or SPI through peripheral mapping, but the default pins (SDA 21, SCL 22, MOSI 23, MISO 19, SCK 18) are the most used in examples.
Example code (Arduino)
Sketch that blinks the board LED (GPIO 2) and reads an analog sensor on GPIO 34.
#define LED_PIN 2
#define ADC_PIN 34 // ADC1, input only
void setup() {
Serial.begin(115200);
pinMode(LED_PIN, OUTPUT);
}
void loop() {
digitalWrite(LED_PIN, !digitalRead(LED_PIN));
int reading = analogRead(ADC_PIN); // 0 to 4095
Serial.println(reading);
delay(500);
}
Common mistakes
- Using GPIOs 6 to 11: they are tied to the flash and freeze the ESP32.
- Reading ADC2 with Wi-Fi on: the reading returns zero or wrong values. Move to an ADC1 pin.
- Applying 5 V to a GPIO: the pin is not tolerant, use a divider or level shifter.
- Connecting a button or sensor that forces LOW on GPIO 0, 2, 12 or 15 during start-up: the ESP32 enters flash mode or does not boot.
- Expecting an internal pull-up on GPIOs 34 to 39: they have none, add an external resistor.
Always check the manufacturer's datasheet for your exact model: pin order can vary between modules.
Frequently asked questions
Which ESP32 pins are safe to use?
GPIOs 4, 13, 14, 16, 17, 18, 19, 21, 22, 23, 25, 26, 27, 32 and 33 have no serious restrictions. Avoid 6 to 11, and use 34 to 39 as inputs only.
What are the ESP32 I2C pins?
By default SDA is GPIO 21 and SCL is GPIO 22, but I2C can be mapped to other pins.
Can I connect 5 V to the ESP32?
Not to the GPIOs: they accept 3.3 V at most. The 5 V supply goes in through USB or the VIN pin.
How many analog inputs does the ESP32 have?
Up to 18, with a 12-bit ADC (0 to 4095). ADC2 channels do not work while Wi-Fi is active.