ESP32 Valid GPIO Pins and Bootstrapping Pins Explained

Introduction

When working with the ESP32, understanding which GPIO pins are safe to use is extremely important. Unlike simpler microcontrollers, the ESP32 contains special-purpose pins, bootstrapping pins, and restricted pins that behave differently during startup.

Using the wrong pin can cause problems such as:

  • The board failing to boot
  • Upload errors
  • Unstable hardware behavior

In this guide, you will learn which ESP32 pins are safe to use, which pins require caution, and which pins should be avoided. You will also learn how bootstrapping pins work and how they affect the startup process of the ESP32.


Understanding ESP32 GPIO Pins

The ESP32 has more than 30 GPIO pins, but not all of them are available for general use. Some pins are reserved internally for flash memory, while others are used during the boot process.

GPIO stands for General Purpose Input/Output, meaning these pins can function as either inputs (reading sensors or buttons) or outputs (controlling LEDs, motors, or relays).

However, certain GPIO pins have special restrictions that developers must understand before using them in their circuits.


ESP32 Valid GPIO Pins

The following GPIO pins are considered safe and commonly used for most ESP32 projects.

GPIONotes
GPIO2Often used for onboard LED
GPIO4Safe general-purpose pin
GPIO5Commonly used for SPI
GPIO12Bootstrapping pin (use with caution)
GPIO13Safe general-purpose pin
GPIO14Safe general-purpose pin
GPIO15Bootstrapping pin
GPIO16Safe general-purpose pin
GPIO17Safe general-purpose pin
GPIO18SPI clock pin
GPIO19SPI MISO
GPIO21Default I2C SDA
GPIO22Default I2C SCL
GPIO23SPI MOSI
GPIO25DAC capable
GPIO26DAC capable
GPIO27Safe general-purpose pin
GPIO32Analog capable
GPIO33Analog capable

These pins are typically safe for connecting:

  • LEDs
  • Sensors
  • Relays
  • Displays
  • Communication modules

Input Only Pins

Some ESP32 pins can only be used as input pins and cannot drive output signals.

GPIODescription
GPIO34Input only
GPIO35Input only
GPIO36Input only
GPIO39Input only

These pins are commonly used for:

  • Analog sensors
  • Buttons
  • Interrupt signals

Because they lack internal pull-up or pull-down resistors, external resistors may be required in some circuits.


Pins to Avoid

Certain ESP32 pins should generally not be used in normal applications.

GPIOReason
GPIO6 – GPIO11Connected internally to SPI flash memory

These pins are reserved for the ESP32’s internal flash storage and interfering with them can cause the board to crash or fail to boot.


Bootstrapping Pins

Bootstrapping pins determine how the ESP32 starts up when power is applied or when the reset button is pressed.

These pins must be in the correct logic state during startup. If external hardware changes their voltage level, the ESP32 may enter an incorrect boot mode.

Common Bootstrapping Pins

GPIOFunction
GPIO0Determines boot mode
GPIO2Must be HIGH during boot
GPIO4Bootstrapping pin
GPIO5Bootstrapping pin
GPIO12Flash voltage selection
GPIO15Boot configuration

Because of their role during startup, these pins should be used carefully in circuits.


GPIO0 and Flash Mode

GPIO0 is particularly important because it determines whether the ESP32 boots normally or enters firmware flashing mode.

GPIO0 StateBoot Mode
HIGHNormal program execution
LOWFirmware upload mode

This is why many ESP32 boards include a BOOT button that temporarily pulls GPIO0 LOW during firmware uploads.


Best Practices When Choosing ESP32 Pins

To avoid hardware issues in your projects, follow these guidelines:

  1. Prefer using GPIO4, GPIO16, GPIO17, GPIO18, GPIO19, GPIO21, GPIO22, GPIO23, GPIO25, GPIO26, GPIO27, GPIO32, and GPIO33.
  2. Use bootstrapping pins only when necessary.
  3. Avoid GPIO6–GPIO11 entirely.
  4. Remember that GPIO34–GPIO39 are input-only pins.
  5. Always check the ESP32 pinout diagram before wiring your circuit.

Following these practices will ensure your ESP32 projects run reliably without unexpected boot issues.


Example: Safe LED Connection

For example, connecting an LED to GPIO4 is considered safe and does not interfere with the boot process.

Basic wiring:

GPIO4 → Resistor → LED → GND

This configuration allows the ESP32 to control the LED without affecting startup behavior.


Conclusion

Understanding ESP32 GPIO pins is essential for building stable and reliable projects. While the ESP32 offers many GPIO options, some pins have special functions related to flash memory and boot configuration.

By learning which pins are safe to use and how bootstrapping pins behave, you can avoid common beginner mistakes such as boot failures or unexpected hardware behavior.

In the next step of your ESP32 learning journey, you can explore more advanced topics such as interrupts, PWM control, I2C communication, and SPI devices to build more complex embedded systems.

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
8
0
Would love your thoughts, please comment.x
()
x
Update cookies preferences