ESP32 Pinout Reference: Which GPIO pins should you use?

The ESP32 chip comes with 48 pins with multiple functions. Not all pins are exposed in all ESP32 development boards, and some pins cannot be used.

There are many questions on how to use the ESP32 GPIOs. What pins should you use? What pins should you avoid using in your projects? This post aims to be a simple and easy-to-follow reference guide for the ESP32 GPIOs.

The figure below illustrates the ESP-WROOM-32 pinout. You can use it as a reference if you’re using an ESP32 bare chip to build a custom board:

ESP32 Pinout chip ESP-WROOM-32

Note: not all GPIOs are accessible in all development boards, but each specific GPIO works in the same way regardless of the development board you’re using. If you’re just getting started with the ESP32, we recommend reading our guide: Getting Started with the ESP32 Development Board.

ESP32 Pinout Reference: Which GPIO pins should you use?

ESP32 Peripherals

The ESP32 peripherals include:

The ADC (analog to digital converter) and DAC (digital to analog converter) features are assigned to specific static pins. However, you can decide which pins are UART, I2C, SPI, PWM, etc – you just need to assign them in the code. This is possible due to the ESP32 chip’s multiplexing feature.

Although you can define the pins properties on the software, there are pins assigned by default as shown in the following figure (this is an example for the ESP32 DEVKIT V1 DOIT board with 36 pins – the pin location can change depending on the manufacturer).

ESP32 DEVKIT V1 DOIT board with 36 pins Pinout

Additionally, there are pins with specific features that make them suitable or not for a particular project. The following table shows what pins are best to use as inputs, outputs and which ones you need to be cautious.

The pins highlighted in green are OK to use. The ones highlighted in yellow are OK to use, but you need to pay attention because they may have an unexpected behavior mainly at boot. The pins highlighted in red are not recommended to use as inputs or outputs.

0pulled upOKoutputs PWM signal at boot, must be LOW to enter flashing mode
1TX pinOKdebug output at boot
2OKOKconnected to on-board LED, must be left floating or LOW to enter flashing mode
3OKRX pin HIGH at boot
5OKOKoutputs PWM signal at boot, strapping pin
6xxconnected to the integrated SPI flash
7xxconnected to the integrated SPI flash
8xxconnected to the integrated SPI flash
9xxconnected to the integrated SPI flash
10xxconnected to the integrated SPI flash
11xxconnected to the integrated SPI flash
12OKOKboot fails if pulled high, strapping pin
14OKOKoutputs PWM signal at boot
15OKOKoutputs PWM signal at boot, strapping pin
34OKinput only
35OKinput only
36OKinput only
39OKinput only

Continue reading for a more detail and in-depth analysis of the ESP32 GPIOs and its functions.

Input only pins

GPIOs 34 to 39 are GPIs – input only pins. These pins don’t have internal pull-up or pull-down resistors. They can’t be used as outputs, so use these pins only as inputs:

  • GPIO 34
  • GPIO 35
  • GPIO 36
  • GPIO 39

SPI flash integrated on the ESP-WROOM-32

GPIO 6 to GPIO 11 are exposed in some ESP32 development boards. However, these pins are connected to the integrated SPI flash on the ESP-WROOM-32 chip and are not recommended for other uses. So, don’t use these pins in your projects:

  • GPIO 6 (SCK/CLK)
  • GPIO 7 (SDO/SD0)
  • GPIO 8 (SDI/SD1)
  • GPIO 9 (SHD/SD2)
  • GPIO 10 (SWP/SD3)
  • GPIO 11 (CSC/CMD)

Capacitive touch GPIOs

The ESP32 has 10 internal capacitive touch sensors. These can sense variations in anything that holds an electrical charge, like the human skin. So they can detect variations induced when touching the GPIOs with a finger. These pins can be easily integrated into capacitive pads and replace mechanical buttons. The capacitive touch pins can also be used to wake up the ESP32 from deep sleep.

Those internal touch sensors are connected to these GPIOs:

  • T0 (GPIO 4)
  • T1 (GPIO 0)
  • T2 (GPIO 2)
  • T3 (GPIO 15)
  • T4 (GPIO 13)
  • T5 (GPIO 12)
  • T6 (GPIO 14)
  • T7 (GPIO 27)
  • T8 (GPIO 33)
  • T9 (GPIO 32)

Learn how to use the touch pins with Arduino IDE: ESP32 Touch Pins with Arduino IDE

Analog to Digital Converter (ADC)

The ESP32 has 18 x 12 bits ADC input channels (while the ESP8266 only has 1x 10 bits ADC). These are the GPIOs that can be used as ADC and respective channels:

  • ADC1_CH0 (GPIO 36)
  • ADC1_CH1 (GPIO 37)
  • ADC1_CH2 (GPIO 38)
  • ADC1_CH3 (GPIO 39)
  • ADC1_CH4 (GPIO 32)
  • ADC1_CH5 (GPIO 33)
  • ADC1_CH6 (GPIO 34)
  • ADC1_CH7 (GPIO 35)
  • ADC2_CH0 (GPIO 4)
  • ADC2_CH1 (GPIO 0)
  • ADC2_CH2 (GPIO 2)
  • ADC2_CH3 (GPIO 15)
  • ADC2_CH4 (GPIO 13)
  • ADC2_CH5 (GPIO 12)
  • ADC2_CH6 (GPIO 14)
  • ADC2_CH7 (GPIO 27)
  • ADC2_CH8 (GPIO 25)
  • ADC2_CH9 (GPIO 26)

Learn how to use the ESP32 ADC pins:

Note: ADC2 pins cannot be used when Wi-Fi is used. So, if you’re using Wi-Fi and you’re having trouble getting the value from an ADC2 GPIO, you may consider using an ADC1 GPIO instead. That should solve your problem.

The ADC input channels have a 12-bit resolution. This means that you can get analog readings ranging from 0 to 4095, in which 0 corresponds to 0V and 4095 to 3.3V. You can also set the resolution of your channels on the code and the ADC range.

The ESP32 ADC pins don’t have a linear behavior. You’ll probably won’t be able to distinguish between 0 and 0.1V, or between 3.2 and 3.3V. You need to keep that in mind when using the ADC pins. You’ll get a behavior similar to the one shown in the following figure.

Digital to Analog Converter (DAC)

There are 2 x 8 bits DAC channels on the ESP32 to convert digital signals into analog voltage signal outputs. These are the DAC channels:

  • DAC1 (GPIO25)
  • DAC2 (GPIO26)


There is RTC GPIO support on the ESP32. The GPIOs routed to the RTC low-power subsystem can be used when the ESP32 is in deep sleep. These RTC GPIOs can be used to wake up the ESP32 from deep sleep when the Ultra Low Power (ULP) co-processor is running. The following GPIOs can be used as an external wake up source.

  • RTC_GPIO0 (GPIO36)
  • RTC_GPIO3 (GPIO39)
  • RTC_GPIO4 (GPIO34)
  • RTC_GPIO5 (GPIO35)
  • RTC_GPIO6 (GPIO25)
  • RTC_GPIO7 (GPIO26)
  • RTC_GPIO8 (GPIO33)
  • RTC_GPIO9 (GPIO32)
  • RTC_GPIO10 (GPIO4)
  • RTC_GPIO11 (GPIO0)
  • RTC_GPIO12 (GPIO2)
  • RTC_GPIO13 (GPIO15)
  • RTC_GPIO14 (GPIO13)
  • RTC_GPIO15 (GPIO12)
  • RTC_GPIO16 (GPIO14)
  • RTC_GPIO17 (GPIO27)

Learn how to use the RTC GPIOs to wake up the ESP32 from deep sleep: ESP32 Deep Sleep with Arduino IDE and Wake Up Sources


The ESP32 LED PWM controller has 16 independent channels that can be configured to generate PWM signals with different properties. All pins that can act as outputs can be used as PWM pins (GPIOs 34 to 39 can’t generate PWM).

To set a PWM signal, you need to define these parameters in the code:

  • Signal’s frequency;
  • Duty cycle;
  • PWM channel;
  • GPIO where you want to output the signal.

Learn how to use ESP32 PWM with Arduino IDE: ESP32 PWM with Arduino IDE


The ESP32 has two I2C channels and any pin can be set as SDA or SCL. When using the ESP32 with the Arduino IDE, the default I2C pins are:

  • GPIO 21 (SDA)
  • GPIO 22 (SCL)

If you want to use other pins when using the wire library, you just need to call:

Wire.begin(SDA, SCL);

Learn more about I2C communication protocol with the ESP32 using Arduino IDE: ESP32 I2C Communication (Set Pins, Multiple Bus Interfaces and Peripherals)

More I2C Tutorials with the ESP32:


By default, the pin mapping for SPI is:


Learn more about SPI communication protocol with the ESP32 using Arduino IDE: ESP32 SPI Communication: Set Pins, Multiple SPI Bus Interfaces, and Peripherals (Arduino IDE)


All GPIOs can be configured as interrupts.

Learn how to use interrupts with the ESP32:

Strapping Pins

The ESP32 chip has the following strapping pins:

  • GPIO 0 (must be LOW to enter boot mode)
  • GPIO 2 (must be floating or LOW during boot)
  • GPIO 4
  • GPIO 5 (must be HIGH during boot)
  • GPIO 12 (must be LOW during boot)
  • GPIO 15 (must be HIGH during boot)

These are used to put the ESP32 into bootloader or flashing mode. On most development boards with built-in USB/Serial, you don’t need to worry about the state of these pins. The board puts the pins in the right state for flashing or boot mode. More information on the ESP32 Boot Mode Selection can be found here.

However, if you have peripherals connected to those pins, you may have trouble trying to upload new code, flashing the ESP32 with new firmware, or resetting the board. If you have some peripherals connected to the strapping pins and you are getting trouble uploading code or flashing the ESP32, it may be because those peripherals are preventing the ESP32 from entering the right mode. Read the Boot Mode Selection documentation to guide you in the right direction. After resetting, flashing, or booting, those pins work as expected.

Pins HIGH at Boot

Some GPIOs change their state to HIGH or output PWM signals at boot or reset. This means that if you have outputs connected to these GPIOs you may get unexpected results when the ESP32 resets or boots.

  • GPIO 1
  • GPIO 3
  • GPIO 5
  • GPIO 6 to GPIO 11 (connected to the ESP32 integrated SPI flash memory – not recommended to use).
  • GPIO 14
  • GPIO 15

Enable (EN)

Enable (EN) is the 3.3V regulator’s enable pin. It’s pulled up, so connect to ground to disable the 3.3V regulator. This means that you can use this pin connected to a pushbutton to restart your ESP32, for example.

GPIO current drawn

The absolute maximum current drawn per GPIO is 40mA according to the “Recommended Operating Conditions” section in the ESP32 datasheet.

ESP32 Built-In Hall Effect Sensor

The ESP32 also features a built-in hall effect sensor that detects changes in the magnetic field in its surroundings.

Wrapping Up

We hope you’ve found this reference guide for the ESP32 GPIOs useful. If you have more tips about the ESP32 GPIOs, please share by writing a comment down below.

If you’re just getting started with the ESP32, we have some great content to get started:

Thanks for reading.

Learn how to build a home automation system and we’ll cover the following main subjects: Node-RED, Node-RED Dashboard, Raspberry Pi, ESP32, ESP8266, MQTT, and InfluxDB database DOWNLOAD »
Learn how to build a home automation system and we’ll cover the following main subjects: Node-RED, Node-RED Dashboard, Raspberry Pi, ESP32, ESP8266, MQTT, and InfluxDB database DOWNLOAD »

Enjoyed this project? Stay updated by subscribing our newsletter!

204 thoughts on “ESP32 Pinout Reference: Which GPIO pins should you use?”

  1. Excellent , thanks i have been confused with this issue since there are so m any pins and most have diffrenee possibilities. too many variations to remember them withoutu consulting

  2. Very useful and well presented info. It might be useful to point out that the Adafruit Feather pinouts are not compatible with the similar looking DEVKIT V1 DOIT board. Reference:

    • Hi Doug.
      Yes, the Huzza 32 from Adafruit has a slightly different pinout.
      But the guide you refer does a great job explaining each individual pin.
      Thanks for sharing.
      Sara 🙂

    • Hi Doug,
      I am absolutely brand new to this whole “trade” I guess I would call it, but I’m trying to get up to speed as quickly as I can to complete a 16 x 16 Led matrix graduation cap for my daughter, but everywhere I’ve looked there is very little or no information on this other than lots of videos that crank out music while showing someone’s finished project in operation. In summary, I have an ESP32 -WHOOM – 32D which is a 5v or 3.5v board with different pinouts than what I’ve seen here, so I was wondering if anyone has the same board ?

  3. Hi,

    This is a fine guide, but my experience shows that not all ADC pins can be used when Wifi is started, for me only ADC0 worked ?

    thanks Peter

    • Hi Peter.
      Thanks for sharing that info.
      As I can remember we only had trouble in one specific project in using GPIO4 for analog reading with WiFi.
      We should try each individual ADC pin with WiFi and see if we have any trouble.
      Thank you
      Sara 🙂

          • I ran a crude test with wifi in use and the commented out lines did not work.
            analogRead( 36 );
            analogRead( 39 );
            analogRead( 34 );
            analogRead( 35 );
            analogRead( 32 );
            analogRead( 33 );
            //analogRead( 25 );
            //analogRead( 26 );
            //analogRead( 27 );
            //analogRead( 14 );
            //analogRead( 12 );
            //analogRead( 4 );
            //analogRead( 0 );
            //analogRead( 2 );
            //analogRead( 15 );

  4. Bit confused! I have a NodeMCU-32S board, which pins are Analog and which are digital?? You say GPIO34-39 are input only – so I could use all the other pins (if setMode is set to OUTPUT) to turn on LED’s etc?

    What about the GPIO’s you say to not use? GPIO6 – 11?


    • yes you can use any pin from 0-33 as outputs. you could also use gpio 6-11 but it would interfere with the spi communications between the esp’s processor and it’s flash memory and it is thus a bad idea.

  5. Thanks a billion. I purchased my first ESP32 the day I first read about it. I thought my knowledge of the 8266 should get me started. BIG MISTAKE. I ordered 4 of them to begin with, and up until a few weeks ago, they have laid capture in a plastic parts box. At long last I found one project that might work with them, and learned how to get the Arduino IDE to write to them. Well my Frogger try ended up pretty bad, never could get it working right, however I did get it to display, so I guess that is something. That said, I have learned more in the last few minutes reading this page then I knew about this little sports car of devices. Again, thanks billions I shall go on reading the rest of your pages. I knew I had come on something good when I first found your pages a few years ago, and you keep the education going and going.

  6. Great work!.. Is it possible to powering esp32 by external supply? I mean, 5v to Vin Pin and Ground to ground. I’ve tried many ways but it is impossible to me. It just work with USB powering. Thanks in advance.

    • Hi Pablo.
      Yes, it is possible to power the ESP32 using external power supply.
      What exactly are you using to power the ESP32?
      Sara 🙂

      • Hi Sara. I’m using 5v power supply direct to V5 pin but doesnt work. It looks such reboot and never run normal, but if I connnect to usb 1a it works fine. I’ve tried 3 boards and it doesnt work. It is chinese, wrover, most common, v4

          • Hi Pablo.
            That’s the same ESP32 board that we usually work with.
            That very weird.
            It should power up by supplying 5V to the VIN pin. Make sure you’re supplying enough current.
            Otherwise, I have no idea why that is happening.
            Sara 🙂

        • might be a problem with the power supply:

          solution Tantal capacitor 47uF between GND and VCC

          see also:

  7. Hey, I need some kind of help…

    I have a custom design with ESP32. My GPIO0 is held LOW, my EN pin is connected to 3.3v. When I boot, I get the “waiting for download” prompt. However, I always get the famous “Timed out waiting for packet header” error.

    Any help is appreciated 🙂

    • Hi Alex.
      When uploading code to the ESP32, you should press the BOOT button, which is the same of held GPIO 0 to LOW. There are other pins that influence uploading code to the ESP32, such as GPIO2, GPIO12, and GPIO15.
      Take a look at the following article:
      It is very informative when it comes to boot mode selection.
      I’ve never experimented with a custom design with only the ESP32 chip (I’ve just experimented with development boards with the chip), so I’m not aware of other stuff that you may need to pay attention to.
      Anyway, I hope you found the article useful and you can solve your problem.
      Sara 🙂

    • Not sure if this is still relevant, but I encountered a similar issue in my custom PCB project with the ESP32-WROVER-B. Datasheet is

      I hit two snags:

      – using a strapping pin for my SPI display. Pay special attention to all pins mentioned in section 2.3 “Strapping Pins”. They all are trouble. So other than IO0 (for boot mode) I did not connect any of them
      – missing pullups on #EN and IO0 and missing capacitor on #EN. The datasheet is a bit sneaky about these. The example schematic doesn’t mention the pullup for IO0 and the capacitance for #EN is 0.2uF (as there are two circuits mentioning that). I experimented and even use 0.3uF for my capacitor on #EN.

      With this setup, I got the board to reliably flash using esptool.

      My project can be found here:

      You can use KiCad 5 to see the schematic that I verified works for me.

  8. After days of confusion between many articles and distinguishing the
    PINs name and functions, this article made my day. 🙂
    Many thanks for your well written article.

  9. @ bestware – I think you are mistaken.
    There are indeed two separate I2C interfaces. These are referred to as I2C0 and I2C1.
    See e.g. section 11.4 in the ESP32 Technical Reference Manual – where all the registers for control of the two interfaces are listed.
    You can route the SDA and SCL pins of each I2C interface to any GPIO (which can be output and which is in the correct power domain). Please check the technical reference manual if you are interested in details.
    But as Sara Santos correctly explains in the tutorial, the Arduino Wire Library allows one of the I2C’s to be operated – and only on GPIO 21 and 22.

          • Here is a link to one?


  10. You didnt mention about the UARTS apart from saying there are 3. I read somewhere that UART2 on GPIO 16/17 cant be used, or at least those pins cant be used, and I see no other mention of GPIO16/17 above. Do you know what the story is there ?

    Thanks for a great write-up by the way, I come back to it often !

    • Hi Bob.
      As far as I know, you can use GPIO 17 and 16 as UARTs, as well as GPIO 1 and GPIO 3.
      UART0: (GPIO 1 and GPIO3)
      UART2: (GPIO 17 and GPIO 16)

      UART1: (GPIO 9 and GPIO10) – these are connected to the ESP32 SPI flash memory, so you can’t use them. But, you can use UART1 by defining other pins on the HardwareSerial. Andreas Spies has a great video explaining this:

      Thank you for your interest in our tutorials.

      • Interestingly I was just doing a small ESP32 Arduino project and I couldn’t toggle GPIO 16 or 17 in my code. It took a while to realize what was going on, but I eventually moved to different pins. After that I did some digging I discovered that pins 16 and 17 are used by PSRAM on the WROVER modules.

        Pin 16 is used as the chip select for PSRAM, and 17 is used for the clock signal. It would probably be good to note this above.

        You can see it on the schematics on the WROVER datasheet:

        • Hi.
          Thanks for sharing that.
          Can you share what your project does?
          I’ve used GPIO 16 successfully with projects that involve taking a photo (I guess this doesn’t use PSRAM). However, if trying to video stream in high-resolution settings, it might crash because it needs to use PRAM.

          • I can give you the broad strokes. I was prototyping a industrial controller using a ESP32 using a ESP32 DevKitC — which uses a WROVER module and not a WROOM). I needed multiple serial ports, I2C, SPI, and assorted GPIO. Hence the conflict with 16&17

  11. GPIO 5, 12 (MTDI) and 15 (MTDO) are strapping pins, i.e. not OK to use during boot.

    GPIO 12 must be low (0) and GPIO 5 and 15 high (1) during boot.

  12. 101/5000
    I am having problems with analogRead (). It does not work.
    I need to read the value of the sensor. Thank you

    • Can you use a different GPIO? Any of the following GPIOs should be safe to use with Wi-Fi + AnalogRead():
      ADC1_CH0 (GPIO 36)
      ADC1_CH1 (GPIO 37)
      ADC1_CH2 (GPIO 38)
      ADC1_CH3 (GPIO 39)
      ADC1_CH4 (GPIO 32)
      ADC1_CH5 (GPIO 33)
      ADC1_CH6 (GPIO 34)
      ADC1_CH7 (GPIO 35)
      GPIO 15 (the one you’re using belongs to ADC2 and any ADC2 pin causes some issues when used with Wi-Fi).

      Try with GPIO 33 for example and let me know your results.

  13. I have a ESPWROOM-32 module, but it has 38 pins. What pin layout do I use? Top 3.3V on left, GND on right and 5V bottom left and CLK on right. Putting the USB connect at the bottom. Help?

    • Hi Logan.
      To use the pinout, please check the labels on the board and then compare with the pinout that we have.
      Usually, in different boards, the same labels refer to the same GPIO.
      For example, the pin marked as RX2 on the silkscreen of the board is GPIO16. D2 is GPIO2 and so on.
      I hope this helps.

    • Hi.
      As mentioned in the article:
      “ADC2 pins cannot be used when Wi-Fi is used. So, if you’re using Wi-Fi and you’re having trouble getting the value from an ADC2 GPIO, you may consider using an ADC1 GPIO instead, that should solve your problem.”

  14. I have exactly the board of this tutorial with 36 pins.
    I connected GPIO16 and GPIO17 to a standard optocoupled relay board and when the asyncwebserver sends a web page to the client the relays drive crazy.
    Avoid those pins.

  15. hi, i have a DOIT ESP32 devkitV1(clone) –
    pinout seems to match the real doit devkitv1 🙂

    in some of the info i have read on the internet it has a onboard Temperature sensor,
    yet i dont seem to be able to find examples that use it? or what specific sensor it is? – i have used the Hall sensor onboard fine.

    is this temp sensor accessible, and worth the effort (will it just show me how much my board has warmed up, or will it give me usable environment data?)

    ps — is there a way (software) to use the RED power led?? i can use the BLUE one, LED_BUILTIN (its gpio2) but can i use the power led?

  16. A really good guide, thanks
    I have only one question, with the devkit (30 gpio), how can I take a manual RESET button outside? Thanks again 🙂

  17. I wanted to take the time to thank you for these series of articles. I have a number of these generic AliExpress/Aokin ESP-WROOM-32 boards and while I was able to use them without much trouble, it always bothered me that I didn’t have any “solid” documentation for them. Now I know exactly what I am dealing with.

    Again, Thank You…

  18. I went through a similar process figuring out the Adafruit Esp32 Huzzah Feather board, and created my own reference chart. If it’s useful to anyone, help yourself:

  19. Very useful, before creating any new project i always keep this page in front of me. Thanks
    Update GPIO15 function for Enabling/Disabling Debugging Log Print over U0TXD During Booting very useful for final deliverable product

  20. Hello can u help me?
    i’m using esp32 for my project and i using pressure sensor .
    the output of the sensor, i using GPIO36 but it doesn’t work..
    Thank You

  21. Thank You for this excellent resource! Random Nerds is definitely helping to educate and expand this community’s capabilities. ☺

  22. Very informative article indeed, thank you.

    I am planning to do my own home automation project using ESP32-WROOM-32U module.
    I simply don’t need all the IO pins, and am planning to breakout only the pins I need to minimize the PCB footprint (IC2 and IO 16-27).
    I used a ‘Test board Burn Fixture Programmer’ to upload the sketch, and all future updates should be OTA updates. Hence, I don’t need to mess about with the boot mode once the module is soldered to the PCB.

    The question is, do I have to connect any of the Strapping Pins to anything if I want a normal boot and occasional OTA updates?

    • Hi.
      With the ESP32, you can use any GPIO that can be input for the TRIG pin and any GPIO that can be output for the ECO pin.
      For example, you can use GPIO 26 and 27.

  23. Thank you very much for this informative article …but what about the librarys that works with arduino, are all compatible with the ESP32.

    Best regards,

  24. Hi
    In DOIT dev kit GPIO21 and GPIO22 are used by I2C bus. Why those pins are not mentioned as I2C interface in the bare module, in the case if I decide to develop my own custom board.

    • Hi.
      In fact, with the ESP32 you can choose almost any pin to act as I2C.
      However, when using Arduino IDE libraries, it chooses GPIO 21 and GPIO22 as default I2C pins.

  25. Hello,
    I have a project developed on TTGO T7 Ver 1.0
    It is a simple keypad 3X4 reader, plus and RFID decoder (get RFID data from TX of RDM6300 and extract the ID of the card) Match the keyboard input with the one store on EEprom, match the RFID with the stored on EEprom and if the match send an encrypted signal (like Go) through Bluetooth to a slave identical TTGO chip.
    I wonder if the project can work if i try to use a regular ESP32 NodeMCU.
    TTGO chips are only in China and very hard to get through Ali. ESP32 is easier to buy , even from Amazon. This is my problem.

  26. Hi,
    Does the VIN pin also work as a 5V output when ESP board is powered from USB? Mine doesn’t but I’ve seen you do it on your tutorials…

  27. Thank you, very useful!
    I migrated my latest project (self balancing gyrosopic two wheeler) from Arduino Uno to ESP32 because the processor is just too slow. Loop() runs in less than a millisecond. Wow.

  28. ESP32 PICO kit V4 require manual RESET after powering off.
    After powering ON the device, the software doesn’t boot up automaticully. I have to press the reset button. This means that the PICO device is completely unusable as Alarm Device, due to a failure in automatic restart after power break down! Googling for solutions bring me up to install a 4.7 k resistance between +3.3V and IO0 pin. This works only if the powerOFF take place for severals seonds!
    Is there an other solution to activate the automaticully StartUp after a power faillure ?

  29. Hello Sara,
    thank you very much for this realy useful reference guide for the ESP32 GPIOs .
    I have one DS18B20 connceted to the ESP32 GPIO 14 and sometime, the ESP32 has a problem to conect to the WiFi.
    Could the problem be in the badly selected GPIO, as mentioned above?

    Best regards

  30. Hi,

    I’m a bit confused about the “Input only” pins as well. I did a board and used one of them (IO34) as an output, didn’t work of course.

    The original ESP32 WROOM Pinout picture (also on top of this article), doesn’t mark them as “input only”.
    they have a PWM “snake line”, doesn’t make sense for an input only.
    GPIO stands for General Purpose Input OUTPUT… how can this be Input only???


  31. Very helpful.
    1) Any chance for an explanation about the UART pins or include this link to this webpage: []
    2) It would also be super helpful to have an example of UART being used, maybe using it to show two ESP32s communicating via UART0 and UART2.
    3) Some explanation on SoftwareSerial or a link to this page: [] and a URL to as an example []. I think SoftwareSerial is no longer being included in IDE because I just installed latest clean version of Arduino IDE 1.8.13 Windows and I get an error ‘include SoftwareSerial.h not found’ (or I am doing something wrong as something isn’t making sense to me!) when I use code like yours above.

    Sorry if any of these things have already been done, I tried your website search for “UART2” and get no results.
    Many thanks,

  32. Any idea why float batteryLevel = map(analogRead(12), 0.0f, 4095.0f, 0, 100); seems to give back 100 no matter how bad the battery is?

  33. Hi Sara and Rui,
    I’m new to ESP32, and found your posts extremely helpful. Thanks.
    I’m preparing a project to be used with Home Assistant, but I have three questions regarding the pinout:
    1- You mention that if my project uses WiFi (which is the case) I should not use ADC2. So, is Wifi killing 10 of my GPIO? I’m a little confused, since many ADC2 are green on your table. If I exclude all ADC2 and all non-recommended pins, I would end up with just two “touch” pins – 32 and 33. Is that so?
    2- If I load the ESP32 with 2 touch pads, 4 sensors (thermistor, LDR, humidity, PIR) on GPIO 33, 32, 35, 34, 39, 36 and 10 pulse keys on GPIO 23, 22, 1, 21, 19, 18, 5, 17 and 16 do you think it would work?
    3- Do you have similar pinout recommendations of the ESP32-S2?
    Thanks in advance.

    • Hi.
      1- What we mean is that you can’t use ADC in the ADC2 pins when using wi-fi. You can use those pins as standard input or output or touch pins, and they will work fine. They won’t work properly as ADC pins.
      2- I think those pins will work, but it is always better to test everything before making any permanent connections.
      3- At the moment, we don’t have any articles for the ESP32-S2.
      I hope this helps.

  34. So I tried the tutorial and sent you a message about things that didn’t work but never got an answer. Basically one issue was in the code const char had to be changed to char, also no matching function for call to HttpClient http

  35. Are there any of the GPIO pins that can be read as a nibble or a byte for the purpose of reading jumpers or a switch? Thanks.

  36. Hey Sara,
    Great write up and very helpful reference page, I have it bookmarked. One thing I want to mention is that you list the absolute maximum per GPIO current draw as 40mA and I’m not so sure this is exactly correct. I see where you are getting this value from, the “output drive strength” on page 43 of (and page 53 lists the configurable values), but after doing a lot of searching for this value I came across the following thread which claims the maximum current draw is 12mA per GPIO and goes on to explain what “output drive strength” means. I found it enlightening.

    I don’t know where he gets the number 12mA per GPIO from as I myself don’t see any reference in any data sheet as to the maximum current draw per GPIO. The only thing I see is a cumulative current draw of 1200mA on page 42 of the above referenced datasheet. So at this point I’m left taking his word for it and erroring on the side of caution. And if this is a maximum value, I would guess that running at 60% of this value would be about where you would want to be for stability and longevity.

  37. Good info.
    I am also developing projects and industrial applications on 8051, AVR, ARDUINO and Raspberry PI.

    This info is better for me to develop the projects in feature on ESP32.

    Once again thank you.

    Tushar Gandh

  38. Hi, I see that there are 2 I2S interfaces available, but no specific pins showed on the pinout. Does it mean that any 3 pins can be used for I2S?
    Thank you.

    • Hi Steven.
      That’s missing in our tutorial.
      For I2S, you can use GPIOs 25 and 26, marked as DAC1 and DAC2 on the image pinout.

      • For I2S we need MCLK, LRCLK, BCLK, Data IN, and Data OUT. I’m curious if you had specific recommendations for these. Of course, I can verify myself. 🙂

  39. Hi and thanks a lot for this work, just a quick point I came up with on a recent project. GPIO16 and GPIO17 could be used for internal flash memory purpose (cf. ESP32-PICO-D4, ESP32 datasheets) so they can’t be used normally.

    Pratically I get stuck on reboot behavior when pluging a TM1637 DIO and CLK to thos pins on TTGO-Micro32 based boards.

    May be nice to mention this somewhere 😉

  40. Hi, really useful information. I’ve found an edge case! Would be great for you to add a caveat to your article if possible.

    GPIOs 13 and 14 CANNOT be used without any issues. If there’s an SD card present using the standard GPIOS 18,19,23,26 and something is connected to GPIOs 13 and 14, the ESP32 will refuse to boot until the SD card is removed.

    If anyone is aware of a solution to this, I’d be happy to hear about it!

  41. Very useful. I use the page constantly to keep an eye on the ports I’m using in a design. Might be useful to add info about the presence of the embedded CAN controller. It is said to be compatible with the SJA1000 CAN controller. The default pins are GPIO5 (CAN TX) and GPIO4 (CAN RX). Of course you’ll still need a CAN transceiver to connect to a CAN bus. The transceiver must be 3.3V technology like MAX3051 or SN65HVD23x unless you’re willing to mess with level shifters.

    For details see

    Earlier versions of the ESP32 have the limitation that the minimum CAN bit rate is 25 kb/s. As of ESP chip version 2, the bit rate can be as low as 12 kb/s (Espressif made changes to the clock which drives the CAN controller).

    Greetings from Belgium,

  42. Hi,

    First of all, thank you for the detailed information you have given about the esp32 pinout.
    I have question about strapping pins. I have to connect GPIO15(MTDO) to GND with my pull down resistor(30kOhm) to disable a few elements initially passive.

    Will this be a problem for booting? I read section of strapping pins of dataheet. But I did not understand. In my opinon it is not enough information.

    At finally Is silencing the boot message an obstacle to boot? Boot message is not important for me. Can I connect this pin with pull down resistor?

    I’m asking the same question for GPIO 5.

  43. Hello.
    I have a board “NodeMCU-ESP-S3-12K” but the excellent Sara and Rui + internet helped. Thank you and a nice day.

  44. thanks for the write up. If I want to power the esp32 with external power (so no usb connection), my chip has two 5v pins, two 3.3v pins and two grounds. Its the wemos chip with the oled display. Where would I apply the voltage to and what voltage to apply? I assume applying 3.3 to one of the 3.3 would work, but which one? and I assume could use any ground pin for negative. I think applying 5v to one of the 5v pins would also work, but again, which pin? Is there one that is input power and one for output? Thanks for your input in this question

    • Hi.
      You can power it with 3.3V on the 3.3V pins (any of those pins) or with 5V on the 5V pins (any of the 5V pins).
      You can also choose the GND pin.

      After powering it with 3.3V on one pin, the other 3.3V pins will output 3.3V.

      I hope this is clear.


  45. Great reference ! But I have a problem using the HSPI bus on the TTGO T-Display Board(ESP32).
    I am trying to interface a VS1053 mp3 decoder using the HSPI on the TTGO (the VSPI is used for the display). Apparently nobody has ever done this before, or I can’t find where, after an exhaustive search.
    Here is my code snippit:

    // initialize SPI bus;
    SPIClass mySPI(HSPI);
    // Wiring of VS1053 board
    //VS1053 player(VS1053_CS, VS1053_DCS, VS1053_DREQ);
    VS1053 player(33, 32, 15);

    void setup () //=========== Settup ======================
    // initialize SPI HSPI bus
    mySPI.begin(25, 27, 26, 33); // clock,MISO,MOSI,CS

    After many tries … nothing works! Any suggestions greatly appreciated

  46. Thanks for making this page. I refer to it all the time when planning which pins to use in a design.

    I’ve been trying to understand what goes on with the pins that are indicated as emitting PWM on start-up. What’s the nature of that PWM? Is it some fixed frequency and duty cycle, is it configurable, or something else? Do you have any info about that?

  47. Hi, thanks for such a useful article. I always have this open when I work with the ESP.
    However, I stumbled over some points.
    First of all the link
    found on your site under Boot Mode Selection documentation.
    According to

    Next you have the section Strapping Pins but this has at least some information no use in the overview of all GPIOs found there is listed that the GPIO2 can be used without restriction as input and output in the Strapping section is then but that it could lead to problems with the wiring of this GPIO because over it the boot mode is set.
    With me this error has led to a layout error and a longer troubleshooting.
    But maybe this is only a problem if you use the ESP32 stand alone without a develepmont board. Would be great if you would check this and adjust the article if necessary.

    • Hi Roger.
      I’m sorry for the issue it might have caused you.
      I added a few extra pieces of information to the article about that.
      Thanks for the updated link.

  48. I have a ESP32 devkit 30 pin version board. I uploaded some code on it which works fine. But after that something went wrong and the USB onboard chip seems to have got destroyed/damaged so the board is no more detected on Arduino IDE as a com port. The code previously loaded still works however. Can you please suggest a way to upload a newer version of my code (may be by using a USB to TTL board and TX-RX pins on the ESP32)? I searched on internet but could not find any clearly mentioned instruction set to upload code using Arduino IDE into the ESP32 devkit 30 pin version with damaged USB port. Any suggestion/guidance will help me make this board usable with the required code uploaded into it. Thank you very much.

    • Whilst I cannot give you exactly what you are looking for, I can share a similar experience and indicate how far I got with it.
      I was using an Arduino Mega 2560 R3 and regularly updating the code during an ongoing development ( still ongoing ! ). I suspect there was too much ‘Touch Current’ thru either my PC Power Supply or separate Arduino PSU. This indicates a common but annoying lack of insulation resistance thru the 240V mains power supply. This would sometimes result in more than just a ‘Bing Bong’ when plugging the Arduino in ( blanking of monitor, loud clicks in speakers etc ). I often have several projects running concurrently and need to swap things over frequently.
      Anyway, the Arduino had a 16U2 USB interface and it stopped working similar to how you describe. To be precise, it is still recognised by the PC when plugged in and more importantly by ‘Device Manager’ under Windows, but will not upload newly compiled sketches ( times out without any Arduino LED activity – TX & RX on a Mega ). I still had another Mega 2560 R3 board and that was still fine.
      So I put out a question on Facebook ‘Arduino for Beginners’ group on 4th January 2023 beginning ‘I seem to have a dead….’ etc. I ultimately received a reply form another, more experienced user. It told me that the user had experienced something similar and had successfully used Atmel’s ‘Flip’ software to reprogram his board. He could not provide the original link he had used, but provided another similar internet article.
      I followed this and was beset by problems, some links to required firmware downloads etc., were dead and I spent a long time ( a day ? ) trying to solve this.
      I did ultimately succeed in getting all the required items together, but if you get a missing dll error, look first within the files you have, it is NOT necessary to trawl the internet for .dll files as suggested. Ultimately, I got the correct firmware and Flip running, but it could not see my board. However, I eventually explored the Flip software, which even has an ‘Emulate Mode’ built in and risked tried known working Arduino UNOs and other Mega 2560 R3s, but they were not seen by the Flip software either.
      Since Device Manager on that ( Win 7 ) PC could see all the boards, including the faulty one, I concluded that something ‘new’ about either Windows 7 or a subsequently loaded ( Microsoft Update ? ) version of the USB drivers, was preventing communication. Looking at the good quality of Flip and its documentation, I noticed an Atmel supplied USB driver update in the installation or installed software file structure. I’m not sure it loaded properly although it appeared to, even though I tried to purge newer copies off the PC. I did not succeed in reflashing my Mega. However, Windows 2000 and XP were the Atmel recommended operating environment for running Flip, so I may yet dig out an old laptop I have somewhere and try that ! I have since bought 2 x Mega 2560 and 2 x Mega Pro for £70 total to continue my projects, BUT, I bought them with CH340 USB interfaces as I get the impression the 16U2 versions are prone to this problem. I have archived all files I downloaded, but you should not have difficulty finding them yourself.
      Please note, there is a program called ‘Deauther’ that requires the use of some of the software described for this repair, to similarly upload an image of a portable WiFi network attack device that can run on a ‘watch’ based ESP32 to disrupt networks. Perhaps some of the broken links to the required software have been taken down to prevent this spreading so easily ?
      I wish you every success with this one – Noel

      • oh wow – that is indeed a big effort you took and many thanks for the detailed response.

        I have had problems with a few Arduino Nanos where CH340 USB would not load sketeches from computer but could upload using another arduino and menu option “Upload using Programmer” folloing a certain connection diagram available on www.

        However for the ESP32 which is having a burnt USB pin /chip I seem to not find any way around 🙁

        Getting a new ESP32 board is ok but removing the old one from the circuit (while I missed to use berge strips for socket like mounting) is a big trouble for now, hence looking for a work around.

        • Thanks for the reply. When I get desperate to change multipin SMT devices, I try the following. Wait until my wife goes out ( very important ). Place PCB on a ceramic hob on the cooker in kitchen. Slowly increase heat ( not too slowly or also will damage by length of time ) until solder melts. Hold board down with something, cotton bud, bamboo skewer etc., due to adhesive behind item. Using tweezers, lift off the component. Remove from heat immediately, blow a lot. Then clean away any ‘dry’ ( non shiny ) solder or shorts. Apply a solder paste and or small amount of liquid flux. Apply ‘Haynes’ 1st Law. If you are not familiar with this, it is derived from DIY Car care manuals – ‘Reassembly is the reverse of the dismantling procedure’ found everywhere in their books ! May need fresh solder and patience. Don’t take too long, solder bath takes less than a minute. But then its dead anyway ? Don’t forget to clean cooker or you are dead too. Good luck….

  49. Hello.

    I want to control the Built in led from an AI Thinker ESP32-CAM i have. I want to use it when i take a photo and send by email

    To control the led i use the GPIO 4 as a digital Output.

    I can turn the led ON (an intense light). And i can turn the led OFF.

    Still when it is off. It is not all off. There is still a very small light coming out of the builtin led.
    I want the led totally off, so it does not consume more current from the battery.

    I also use my project in deep sleep, so this issue is important so that it does not consume more battery.
    May i use a pull down resistor on the GPIO 4???

    Does ESP32 have internal Pull downs resitors?

    Thanks in advance.

  50. Thanks for the article. However, I have about 10 of these ESP32 units and they all have either 30 pins, like your photgraph above, or 38 pins. I would add that there are some newer boards with different USB chips on: CH340, 2102 & 9102. The 2102 chip boards need you to press the BOOT button to get them to upload a sketch. The others seem to manage by themselves. Also, some of them have different USB sockets too. I don’t like the USB ‘C’ format, the engagement of the plug is much less precise with the Micro USB. Sometimes, the USB C type will disconnect and reconnect at random when moved. I would also avoid those without two onboard LEDs. Some only have a Power LED and not a programmable LED_BUILTIN. I load ‘Blink’ to test my new boards and of course that won’t work !

  51. I am working in a project and I am using 9, 10 & 11 GPIOs as outputs connected with a tranisistor, LED indicator and relay. In above information your recommendation is not use this pins as output or input because they are connected to the integrated SPI flash, If I decide to use them, what would be the consequences or why I couldn’t use them?

  52. Hello,
    I’m working on setting up an automated plant watering system using an ESP32, capacitive soil moisture sensors, a DHT22 temperature and humidity sensor, and a relay circuit powered by its own source.
    I would like to inquire about the recommended pin assignments for connecting these components. Specifically, I would like to know:

    Which GPIO pins should I use to connect the soil moisture sensors?
    Which GPIO pin should I use to connect the DHT22 sensor?
    Which GPIO pins should I use to connect the relay circuit for controlling the pumps?
    Do you have any recommendations or guidelines for the power supply connections?
    Any assistance or guidance regarding the pin assignments for these components would be greatly appreciated.
    Thank you!

    • Hi.
      The moisture sensor should be an analog pin. If you’re using Wi-Fi in your project, you must use an ADC1 GPIO. There are several to choose from.
      For the DHT sensor, you can use for example, GPIO4.
      For a relay it is better to use a pin that doesn’t fluctuate with resets or when uploading code. Any pins highlighted in green on the table should be fine.

  53. Dear Sara,

    Thank you so much for this precise and useful guide about all GPIOs of the ESP32, there is any advice that you could give about the new ESP32-S3, do you think that is the same configuration? where I can find more information about this newer model?

    Thank you so much!

    • Hi.
      It’s not the same configuration.
      I’ll create a pinout for the ESP32-S3, but I still didn’t have the time to test the ESP32-S3.

      • Hello, thank you for this article, it’s been very helpful and I’ve referred to it often, but I am now upgrading to the ESP32-S3. If you write a similar article to this one for the ESP32-S3, I’ll use it as my reference. Thank you!

  54. hello sara , grate information on randomnerdtutorials, I have some questions about ESP32-WROOM-32E-N4 1 cheep , ESP32 have a in center ground point in group around 9 ground point, it is compulsory ground connect ?
    if yes, so if not conect then what is problem face?
    thank you

  55. You know when everything is going wrong and you are about to throw your breadboard at the wall and then, suddenly, a random tute inexplicably provides you with that nugget of info that saves the day? Mhm… me too. Thanks, Sara 🙂 bro fist

  56. Hi,
    thank you very much for all the information. I’m still confused about the I2S usage with ESP32 though… I’m using ESP32-MINI-1-N4 module for my project and I need I2S data output for a speaker. Right now I’m using GPIO32/33 for crystal oscillator, GPIO12-15 for JTAG and 35/36 pins for UART0 connection with the microprocessor.
    Could you tell me which of the pins I could use for BCK, DOUT and WS lines?
    From what I’ve read it can be problematic to use GPIO0/2/4 as they’re strapping pins, GPIO35-39 won’t work either as they’re input only and I’m not sure if GPIO25-27 will work properly (I’m going to use both Bluetooth and WiFi and these pins are listed as not recommended with WiFi). That pretty much leaves me with GPIO18-23 available, but can any of them be configured as I2S pins?
    Thank you very much!

  57. I problem with some ESP32 GPIO pin ( not for all project)
    I ( randomly) problem find with some GPIO pin as a use binary switch sensor
    GPIO 16 GPIO 17 UART2
    GPIO 19 GPIO 18 VSPI
    SDA (GPIO 21)
    SCL (GPIO 22)
    Just share my experience, maybe help this information

  58. Hello.
    Please, answer:
    1. In what docs you have found about ESP32 GPIO14 PWM output on boot? It is correct, but I can’t find about it in Technical datasheet. All other pins behavour described in Strapping Pin section. As I understand GPIO14 is a part of JTAG and it is the reason of behavour, but Im not shure.
    2. Have you information about ESP32 C6 pins with PWM output on boot?

  59. Could you please give me an example using the input-only pins? I’m running out of available pins and would like to know, for instance, if I can use them for the DIO0, DIO1 of LoRa Ra-02, and for the TX of my GPS module.
    Any idea about that?

  60. Hello Sara, many thanks for all your excellent informations.
    I use an AZ-Delivery ESP32-WROOM-32 for a automation, I2C(0) for a LCD_I2c.
    I now want to control others sensors with the second I2C by following exactly your recommandations (GPIO32 for SDA2, GPIO33 for SCL2)
    The compile is OK, but the program no longer run.
    Where could I look for a solution.


Leave a Reply to Khalil Cancel reply

Download Our Free eBooks and Resources

Get instant access to our FREE eBooks, Resources, and Exclusive Electronics Projects by entering your email address below.