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:
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 Peripherals
The ESP32 peripherals include:
- 18 Analog-to-Digital Converter (ADC) channels
- 3 SPI interfaces
- 3 UART interfaces
- 2 I2C interfaces
- 16 PWM output channels
- 2 Digital-to-Analog Converters (DAC)
- 2 I2S interfaces
- 10 Capacitive sensing GPIOs
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).
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.
GPIO | Input | Output | Notes |
0 | pulled up | OK | outputs PWM signal at boot, must be LOW to enter flashing mode |
1 | TX pin | OK | debug output at boot |
2 | OK | OK | connected to on-board LED, must be left floating or LOW to enter flashing mode |
3 | OK | RX pin | HIGH at boot |
4 | OK | OK | |
5 | OK | OK | outputs PWM signal at boot, strapping pin |
6 | x | x | connected to the integrated SPI flash |
7 | x | x | connected to the integrated SPI flash |
8 | x | x | connected to the integrated SPI flash |
9 | x | x | connected to the integrated SPI flash |
10 | x | x | connected to the integrated SPI flash |
11 | x | x | connected to the integrated SPI flash |
12 | OK | OK | boot fails if pulled high, strapping pin |
13 | OK | OK | |
14 | OK | OK | outputs PWM signal at boot |
15 | OK | OK | outputs PWM signal at boot, strapping pin |
16 | OK | OK | |
17 | OK | OK | |
18 | OK | OK | |
19 | OK | OK | |
21 | OK | OK | |
22 | OK | OK | |
23 | OK | OK | |
25 | OK | OK | |
26 | OK | OK | |
27 | OK | OK | |
32 | OK | OK | |
33 | OK | OK | |
34 | OK | input only | |
35 | OK | input only | |
36 | OK | input only | |
39 | OK | input 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)
RTC GPIOs
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
PWM
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
I2C
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:
- ESP32 I2C Master and Slave (I2C Communication Between Two ESP32) – Arduino IDE
- ESP32: I2C Scanner (Arduino IDE) – Finding the Address of I2C Devices
- Guide for TCA9548A I2C Multiplexer with the ESP32
SPI
By default, the pin mapping for SPI is:
SPI | MOSI | MISO | CLK | CS |
VSPI | GPIO 23 | GPIO 19 | GPIO 18 | GPIO 5 |
HSPI | GPIO 13 | GPIO 12 | GPIO 14 | GPIO 15 |
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)
UART
The ESP32 supports up to three UART interfaces: UART0, UART1, and UART2, depending on the ESP32 board model you’re using.
- UART0 is usually reserved for communication with the serial monitor during upload and debugging. However, you can also use it for communication with other devices after uploading the code if the Serial Monitor is not needed.
- UART1 and UART2: available to communicate with external devices.
Like I2C and SPI, these UART pins can be mapped to any GPIO pin on the ESP32. However, they have a default pin assignment on most board models.
For most ESP32 boards the UART pin assignment is as follows:
UART Port | TX | RX | Remarks |
UART0 | GPIO 1 | GPIO 3 | Used for Serial Monitor and uploading code; Can be assigned to other GPIOs; |
UART1 | GPIO 10 | GPIO 9 | Must be assigned to other GPIOs |
UART2 | GPIO 17 | GPIO 16 | Can be assigned to other GPIOs |
About UART1 (GPIO 9 and GPIO10) – these GPIOs are connected to the ESP32 SPI flash memory, so you can’t use them like that. To use UART1 to communicate with other devices, you must define different pins using the HardwareSerial library.
Learn more about UART with the ESP32: ESP32 UART Communication (Serial): Set Pins, Interfaces, Send and Receive Data (Arduino IDE)
If you’re using an ESP32-S3, the assignment is completely different. Check out the ESP32-S3 pinout here.
Interrupts
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:
- Learn ESP32 with Arduino IDE
- Getting Started with the ESP32 Development Board
- 20+ ESP32 Projects and Tutorials
- ESP32 Web Server Tutorial
- ESP32 vs ESP8266 – Pros and Cons
Thanks for reading.
Thanks, very usefull.
Hi!
Thank you! 🙂
Hi! following these references, if I activated the Bluetooth, which pins could I use for ADC, or is it similar to the wifi-on behavior?
did you know which pins are MDC and MDIO pins
Really, really useful – thank you…
Thanks 🙂
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
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:
learn.adafruit.com/adafruit-huzzah32-esp32-feather/pinouts
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.
Regards,
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 ?
Hi Keith.
I think this is the pinout for that board: https://i0.wp.com/randomnerdtutorials.com/wp-content/uploads/2018/08/esp32-pinout-chip-ESP-WROOM-32.png
Regards,
Sara
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
Regards,
Sara 🙂
Hi Sara,
I think you can only use A1.. while WiFi is used. It’s a design problem of the ESP32 chip.
Greetings
Matthias
Hi.
Thank you for sharing that.
We definitely need to test that situation.
Thanks.
Regards 🙂
Hello,
could you share with us the results of your test about using ADC pins while using WIFI ?
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 );
One more a real Rui-Tutorial !! Very, very useful for my projects.
Many thanks to Sara and Rui
Hi.
Thank you so much for your support!
Regards,
Sara 🙂
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?
Chris
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.
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.
Hi Jerry.
Thank you so much for your kind words!
I’m really glad you find our tutorials helpful.
If you want to learn more about the ESP32 you can take a look at our ESP32 projects repository (it’s free):
– https://randomnerdtutorials.com/projects-esp32/
We also have a course about ESP32, take a look at the contents here:
– https://randomnerdtutorials.com/learn-esp32-with-arduino-ide/
Thank you and good luck with your projects! 🙂
Thanks for the nice overview. I have a question about pin current ratings. You declare 12 and 6 mA in your article which can also be found at other web pages. However if I read the datasheet correctly (https://www.espressif.com/sites/default/files/documentation/esp32-wroom-32_datasheet_en.pdf) it should be 40 and 28 mA. Where are your numbers from?
Hi Dali.
You are right.
We’ve update the post.
Thanks for letting us know.
Regards,
Sara 🙂
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?
Regards,
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
It is like Aliexpress – DOIT ESP32 DEVKIT V1 Board (Wi-Fi and Bluetooth). Thanks for your kindly response
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.
Regards,
Sara 🙂
Thanks!
might be a problem with the power supply:
solution Tantal capacitor 47uF between GND and VCC
see also:
arduino-hannover.de/2018/07/25/die-tuecken-der-esp32-stromversorgung/
Thanks, very usefull.
There is ONE I2C-interface only! Yes, 2 lines are used to provide one I2C-bus only.
Anyway, very useful overview!
Hi.
Thank you for making that clear.
Regards,
Sara 🙂
Very good, congratulations !
Thank you 🙂
i want to use esp wroom32 module in my custom pcb,how to do it.can you please help me
Hi.
At the moment, we don’t have any project/tutorial about that subject.
We have a project in which we build a shield for the ESP32 board. But I don’t think it is what you’re looking for:
https://randomnerdtutorials.com/build-an-all-in-one-esp32-weather-station-shield/
Regards,
Sara 🙂
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: github.com/espressif/esptool/wiki/ESP32-Boot-Mode-Selection
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.
Regards,
Sara 🙂
The Boot Mode Selection page seems to have moved to: docs.espressif.com/projects/esptool/en/latest/esp32/advanced-topics/boot-mode-selection.html
That’s right.
Thanks.
Regards,
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
espressif.com/sites/default/files/documentation/esp32-wrover-b_datasheet_en.pdf
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: github.com/deets/deets-fpv-vtx-scanner
You can use KiCad 5 to see the schematic that I verified works for me.
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.
Thank you! 🙂
@ 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.
Hi,
how can I connect ESP32 WROOM to 18650 (3.7 V) battery ?
Thanks
Hi Rick.
You can use a Low DropOut Regulator (LDO) to convert the 3.7V to 3.3V and power the ESP32 through the 3.3V pin.
You can use the MCP1700-3320E LDO, for example.
I hope this helps.
Regards,
Sara
You can also get an 18650 ‘shield’ which has an LDO fitted and offers a 3v output? Cost me 2 UKP from eBay
I’m not familiar with that “shield”, but with what you’ve described, it seems a good fit.
Here is a link to one?
ebay.co.uk/itm/ESP32-18650-Battery-Shield-V3-ESP-32-Micro-USBWemos-LED-for-Arduino-Raspberry-Pi/292498985534?epid=24006249128&hash=item441a4c523e:rk:1:pf:0&checksum=292498985534af0ace93d18544359998ba8308878450&enc=AQADAAAC8FjVrDbVsZ8oH%2F8PNHtt9VX4%2Fw7FZcmMuqsX8uaFEduVaORNXMCeazS4LEKj6KZlHxIUwmX1v17N9DAobpUqdxVjZ98fBA3dYSriex3x9H0ZPD0NygfPp84ctvIzbJ%2BbzWtZG071XChWAyOm6s0TCSn27%2Bzt2yJn0frZtN3i9mn7V8q94X5tBKS9qorMMDmaAQzM1S18k7Mge13VoQhP88eYTF8y3jWwayxCR8L7f%2BcVGGhJraUHz14JnFDDYJPoCLWAPPH40FjIj3YAX7Z1nLrG%2Fzg6bvPtk8VJBMD2Ozz%2FrHbngt%2FNzoFFL5MYBPHfHk%2F3frz2CqDupRrQYiIoFlHM5ruSLxEGE8TvyqxnBLoAOlkbvIe4FE3Bdbfc%2FgGHcQ4H3jCJAG1yLemonUsnNYCWuS%2FokqKUARurc4djDUabWTHG%2B9mvrbn%2F66S%2BnjIOv8ni%2Ba3Ik%2BwMy8pALql5%2BzKxYnqmyHSe%2BeG5nbeBLzu0jKoNFkiLuRxwsxNUEnrBLug8%2F1ZKZKl%2FPTRpv2QCvFLTGIEHCpECWO5V746H0W6m7%2BvQ5P8sio3qIpVDiOexu54CMg7eyLSQxXbdp3zwbX6wD2%2FpLqjrLC4GEIcyn65O1YhUmWuDeBZUJd3XuvW4jcYXuBwd7IMZkhHGjSHEAN8w8TMF%2FwDj%2BOfDIu0R5I4UqTTpr1kvgVuRi5y5Iv7%2B%2F1aTmlqosMeTQJUrr5jkQcdccwrqlRJwLQMmX2SI5Q%2BrjLh%2FjMM%2B6J7k4yiIt%2ByL7oYtNsns76cjiX90MWO1B1WE98zFiUm3vtTMRZJ4HeGeqen%2FkROx0xzL%2FTQKiTUesXclxEhuKMJWwlal9R6rszHx%2BeaL4sjedyEevb1nro5QdYWA6yqJVIRAI%2FmeLHgylZp0ccPWbLpx%2FUzBw%2BqGb3Cq0sXWcFlQ%2BoQcangeThTD24FyA%2FMgD7UUJJerMpzz6gPq0SihxXSQ%2FhSpOG4hgeOtz12j3hUj%2FeQ5YU4rKAAz
Yes. That should work.
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: youtu.be/GwShqW39jlE?t=182
Thank you for your interest in our tutorials.
Regards,
Sara
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: https://www.espressif.com/sites/default/files/documentation/esp32-wrover_datasheet_en.pdf
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.
Regards,
Sara
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
Hi again.
I thought you were referring to the ESP32-CAM, my mistake.
Regards,
Sara
Merci beaucoup !
Thank you very much
You’re welcome. 🙂
Randomnerdtutorials, you guys are great. Your articles are very very much helpful.
Thank you.
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.
Thanks for the excellent overview.
Small remark: GPIO13 seems to be missing in the list of GPIOS
Hi Tom.
Thanks for noticing.
I’ve added GPIO 13 now.
Regards,
Sara
Hello all ,
RTC GPIOs… What is RTC is it REAL TIME CLOCK..or something else?
Yes, RTC stands for Real Time Clock in this case.
hi
Can you give some explanation RTC in context with GPIO
I am not able to find any information.
Thanks
Basically, these GPIOs are routed to the RTC low-power subsystem can be used when the ESP32 is in deep sleep. You can use the RTC GPIOs to wake up the ESP32 from deep sleep (read ESP32 External Wake Up): https://randomnerdtutorials.com/esp32-external-wake-up-deep-sleep/
thank you, this article is very useful
You’re welcome! Thanks for reading!
Hi
Many thanks. Your article would have saved me hours if available earlier!!! 👍
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.
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.
Regards,
Sara
Hi, This is very good tutorial and it is so helpful.
Thankyou so much 🙂
Regards
From Indonesian
You’re welcome! Thanks for reading
hi Rui and Sara,
Thanks for providing the great website. I wonder if you know how to flash a naked esp32 chip, not the module? I am working on a customer board which doesn’t have USB port.
Cheers,
Scott
Hi.
Unfortunately, we’ve never tried it yet.
However, this can help you figure out what pins need to be high and low in order to enter boot mode: https://github.com/espressif/esptool/wiki/ESP32-Boot-Mode-Selection
Regards,
Sara
Thanks Sara. I am trying a method and will have a look at the reference you directed.
Cheers,
Scott
Super it is very useful. Thanks a lot.
Thank you 🙂
Hi !
It was a great description. Could please tell me which pins can’t be used when using WIFI.
Thanks
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.”
Regards,
Sara
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.
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?
Hi, i was wondring, can i use other GPIO as CS pin for SPI
Hi Umar.
Yes, you can use.
You just need to define that on your code.
Regards,
Sara
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 🙂
Hi.
You can use the Enable pin.
Read the section about the enable pin in the post.
Regards,
Sara
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…
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:
github.com/va3wam/TWIPi/blob/7e3c5c6ea300107d7c091d7392264c02d4c73f93/Eagle/doc/feather-pinout-map.pdf
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
This particular article is for the 36 pin kit… Do you have the same breakdown of the 30 pin kit?
Hi. The pinout is basically the same, but doesn’t include GPIOs 6 to 11.
Regards,
Sara
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
Hi Eva. What is the sensor that you’re using?
Regards,
Sara
i’m using MPX5700AP
Thank You for this excellent resource! Random Nerds is definitely helping to educate and expand this community’s capabilities. ☺
Hi David.
Thank you so much for your feedback.
Regards,
Sara
Very useful resource.
Many thanks from France.
This helped a lot, thank you.
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.
Thank you for your comment.
I think you get a clear answer if you read this guide: https://github.com/espressif/esptool/wiki/ESP32-Boot-Mode-Selection
I hope this helps.
Regards,
Sara
Thanks for your help Sara.
I have read the link you provided, and found it very informative, but could not find a direct answer to my question.
Through trial and error, I found that providing 3.3V and GND did not work, but by using a pullup resistor on pin 3 (EN pin), the ESP started normally and I could flash it over the air without having to press anything or short any pins. Later I found this information already provided in the datasheet on page 15.
Best regards,
Khalil
Hi.
Thanks for sharing it. I wasn’t aware of that.
Regards,
Sara
I need libraries Esp32 devkit v1 36pin in fritzing
hello thank you for the article, you what pins do I have to use to connect the ultrasonic sensor?
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.
Regards,
Sara
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,
Hi.
It depends on the library.
Many libraries are compatible.
Regards,
Sara
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.
Regards,
Sara
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.
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…
Hi.
Yes, the 5V pin can be an output when the board is powered from USB.
Regards,
Sara
Hi Sara
Thanks for the quick reply. Problem turned out to be a mislabeled silkscreen on my board, marking as ground the CMD pin.
Greatly useful.
You guys are the best!
Lots of great info on this page! Thank you.
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.
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 ?
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
Petr
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???
Thanks
Knochi
Very helpful.
1) Any chance for an explanation about the UART pins or include this link to this webpage: [https://circuits4you.com/2018/12/31/esp32-hardware-serial2-example/]
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: [https://www.arduino.cc/en/Reference/softwareSerial] and a URL to as an example [https://randomnerdtutorials.com/sim900-gsm-gprs-shield-arduino/#more-42170]. 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,
Alex
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?
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.
Regards,
Sara
I have found someone who has done it (see end of post -> table with free to use pins): studiopieters.nl/esp32-s2-pinout/
Thanks for sharing.
Regards,
Sara
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
Hi Larry.
Where did you post your question?
Since you are one of our customers, you can post your issues in the RNTLAB forum.
It is easier for me to follow your issues there:https://rntlab.com/forum/
Regards,
Sara
What is the meaning of ADC(PA) for gpio36 and 39.
ADC is clear (Analog-Digital-Converter)
But what stays PA for?
Pin Analog
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.
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 https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf (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.
https://esp32.com/viewtopic.php?p=9557#p9557
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.
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
Really detailed Document for everybody!
Good job.
Thanks 🙂
Hi Great write up. I am using a ESP32 where EN pin is connected to 3.3v.on switch it is pulled down to ground. The problem is the ESP32 does not boot unless I press the EN button.
May you point what am I missing?
Hi.
I think this might help:https://github.com/espressif/esptool/wiki/ESP32-Boot-Mode-Selection
Regards,
Sara
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.
Regards,
Sara
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. 🙂
It is mentioned that GPIO 37 and 38 can be used as ADC pins. Where those pins located in DEVKIT 1 board and ESP32 chip?
Hi.
Those are not available on the development board. Only on the ESP32 chip.
Regards,
Sara
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 😉
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!
Hi.
Thanks for sharing.
I didn’t know about that.
What ESP32 board model did you use?
Regards,
Sara
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
– https://docs.espressif.com/projects/esp-idf/en/release-v3.3/api-reference/peripherals/can.html
– https://upcommons.upc.edu/bitstream/handle/2117/118541/report-tfm-eduard-valentino.pdf
– https://www.iotsharing.com/2017/09/how-to-use-arduino-esp32-can-interface.html
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,
Gilbert
Bonjour,
Je dispose d’une ESP32-CAM et je souhaite modifier l’UART pour gagner en fluidité. Comment faire ?
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.
Hello.
I have a board “NodeMCU-ESP-S3-12K” but the excellent Sara and Rui + internet helped. Thank you and a nice day.
Hi, very usefull.
Thank you very much
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.
Regards,
Sara
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
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?
Thanks for the article. Is it true that pin 5V on esp32 can be given a voltage of 5 to 12 volts?
Esp32 can work with CD74HC4067?
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
https://github.com/espressif/esptool/wiki/ESP32-Boot-Mode-Selection
found on your site under Boot Mode Selection documentation.
According to https://docs.espressif.com/projects/esptool/en/latest/esp32/advanced-topics/boot-mode-selection.html
moved.
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.
Regards,
Sara
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.
Anyone can please help on this specific question? Thank you.
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….
GPIO16, GPIO17 are not available on certain variant
Source
https://esp32.com/viewtopic.php?t=3390
Love this page, use it all the time! Can you please update for ESP32-c3. Many thanks.
Hi.
Thanks.
I’ll order one and take of care of the pinout guide soon.
Regards,
Sara
The pinout is similar to the esp8266mod and the footprint is the same. Many are using it as a esp32 replacement for the 8266mod.
It might be good to cross-reference it on the 8266 page also: https://randomnerdtutorials.com/esp8266-pinout-reference-gpios/
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.
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 !
If a pin is multiplexed. How to I program a pin to disable both TOUCH2 and ADC1 but enable GPIO2?
I love all your articles, its such a use full resource! Thanks a lot for that!
According to the official datasheet on the esp32, there are only 5 strapping pins. On page 21 there are IO12, 15, 0, 2, 5 listed, you added the extra IO4! Is it possible, this is not correct?
Here is the link to the datasheet: https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf
Hi.
I followed this documentation: https://docs.espressif.com/projects/esptool/en/latest/esp32/advanced-topics/boot-mode-selection.html#boot-mode-message
Regards,
Sara
hello I have a question about the GPIO 25 and GPIO 26
what is the EMAC_RXD0 and EMAC_RXDI ?
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?
Hi.
If you use those pins, the code running on the ESP32 will probably crash.
Regards,
Sara
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.
Regards,
Sara
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.
Regards,
Sara
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!
Hi.
Thanks for the suggestion.
I’ll get one of those boards soon and create a GPIO guide.
Regards,
Sara
I second that! Your guide has been my go to for understanding how I should actually use the ESP32, an S3 guide would be a fantastic resource for everyone wanting to use that board!
Thanks.
I really need to work on that.
Regards,
Sara
Nevermind, it seems someone else has created one (inspired by this page!)
For anyone looking for a similar reference for the S3:
github.com/atomic14/esp32-s3-pinouts
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
sorry for my bad english and spelling mistake
Hi.
I’m not experienced in using those chips. But, yes, I think you really need to connect that middle GND pads.
Regards,
Sara
OK , Thank you Sara Santos.
The matter is extensively discussed here: esp32.com/viewtopic.php?t=1864. The center pads provide additional GND connections and enhance the thermal stability of the ESP chip. In most cases you can just ignore the central pads.
In an ideal world you want to connect all ground pins to ground, but in practical terms you only need to connect at least one of them
THX FOR THIS PLATFORM
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
That’s great!
Thank you.
Regards,
Sara
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!
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
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?
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?
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.
Hi.
Take a look at our I2C guide: https://randomnerdtutorials.com/esp32-i2c-communication-arduino-ide/
Regards
Sara
hey
thanks so much for the tutorial. It’s especially helpfull to know what pins to NOT use.
could you please do this same tutorial for the ESP32 DEV Kit C V4 Boared?
thanks!