The ESP32 has plenty of pins, but not all are free to use. A wrong connection can stop the chip booting, break flashing, or corrupt ADC readings.
1. GPIO 6–11: connected to flash
On standard ESP32 modules, GPIO6, 7, 8, 9, 10 and 11 drive the SPI flash. Do not use them for anything else.
2. Input-only pins
GPIO34, 35, 36 (VP) and 39 (VN) are input-only and have no internal pull-up/pull-down. Don't use them as outputs, or as button inputs without an external resistor.
3. Strapping pins (they select the boot mode)
| GPIO | Note |
|---|---|
| 0 | Pulled LOW at reset = download mode. The BOOT button is usually here. |
| 2 | Must be floating or LOW during flashing. Often wired to the onboard LED. |
| 5 | Affects SDIO timing; outputs a signal at boot. |
| 12 (MTDI) | Sets the flash voltage (VDD_SDIO). If pulled HIGH at boot, some modules won't start. |
| 15 (MTDO) | Pulled LOW at boot silences the boot log on UART. |
You can still use these pins, but whatever is attached must not pull them to the wrong level at startup. For example, an active-high relay module on GPIO12 can keep the ESP32 from booting.
4. ADC2 doesn't work while WiFi is on
ADC2 (GPIO0, 2, 4, 12–15, 25–27) conflicts with WiFi: while WiFi is active, analogRead() on these pins is unreliable. Read analog values with ADC1 (GPIO32–39) instead.
5. GPIO1 and GPIO3
These are TX0/RX0 of the UART used for flashing and logging. Using them as plain GPIO kills your Serial output.
6. Reasonably safe pins
GPIO4, 13, 14, 16, 17, 18, 19, 21, 22, 23, 25, 26, 27, 32, 33 are the common choices. Default I2C: SDA = 21, SCL = 22. SPI (VSPI): MOSI = 23, MISO = 19, SCK = 18, CS = 5.