Which ESP32 pins are safe to use?
For most projects the safe pins are GPIO 4, 13, 14, 16 to 19, 21 to 23, 25 to 27, 32 and 33, which can be inputs or outputs. GPIO 34, 35, 36 and 39 are safe as inputs only. On a WROVER board, skip 16 and 17.
Which ESP32 pins should I avoid?
Never use GPIO 6 to 11, because they connect to the flash chip. Leave GPIO 1 and 3 free for uploading and the Serial Monitor. Be careful with the strapping pins 0, 2, 5, 12 and 15, and remember that ADC2 pins cannot read analog values while Wi-Fi is on.
How many GPIO pins does the ESP32 have?
The ESP32 chip has 34 physical GPIO pins, according to Espressif's GPIO reference (opens in a new tab). The ESP32-WROOM-32E module brings out up to 26 of them, according to its datasheet (opens in a new tab). A DevKit board may show fewer, depending on its size. Once you remove the serial and strapping pins from those 26, the table in this guide leaves 15 general pins and 4 input-only pins for parts.
What is the difference between a 30-pin and a 38-pin ESP32 board?
Both use the same chip and GPIO numbers. A 38-pin board, such as Espressif's ESP32-DevKitC, brings out more pins, including the flash pins. A 30-pin board leaves some out and orders the rest differently, so follow the labels on your own board.
Can ESP32 GPIO pins handle 5 V?
No. The ESP32 Series Datasheet (opens in a new tab) sets the highest input level at the supply voltage plus 0.3 V, which is 3.6 V on a 3.3 V board. A 5 V signal is above that rating. Use a voltage divider or a level shifter between a 5 V sensor output and an ESP32 pin.
Why do my analog readings stop working when Wi-Fi is on?
Your sensor is on an ADC2 pin. Espressif's GPIO reference (opens in a new tab) states that ADC2 pins cannot be used while Wi-Fi is in use. Move the sensor to an ADC1 pin: GPIO 32, 33, 34, 35, 36 or 39.
Can I use GPIO 0, 2 or 12 in my project?
Yes, with care. They are strapping pins, read once at start-up. GPIO 0 must not be pulled low and GPIO 2 must not be pulled high then, and GPIO 12 must stay low, or the board will not start or upload normally.
Which ESP32 pins can do PWM?
In Arduino-ESP32, the LEDC peripheral produces PWM, and ledcAttach(pin, freq, resolution) connects it to an output-capable pin you choose. The original ESP32 has 16 LEDC channels, according to the Arduino-ESP32 LEDC reference (opens in a new tab). Input-only pins 34 to 39 cannot output PWM.