GPIO Pins of ESP32 | ESP32 Pinout
ESP32 and ESP8266 are two of the most popular development boards, especially for IoT projects. Both are cost-effective Wi-Fi modules perfect for DIY electronics. These boards are equipped with GPIOs, support for protocols like SPI, I2C, UART, and more. What makes them stand out from traditional microcontrollers like Arduino is their built-in wireless networking capabilities, enabling remote control and monitoring via Wi-Fi at a minimal cost.
ESP32 Chip Specifications
- The ESP32 is dual-core, meaning it has two processors.
- It features built-in Wi-Fi and Bluetooth capabilities.
- Runs 32-bit programs with a clock frequency up to 240MHz.
- Offers 512 kB RAM and typically comes with 36 GPIO pins.
- Includes a variety of peripherals such as capacitive touch, ADCs, DACs, UART, SPI, I2C, and more.
- Comes with built-in hall effect and temperature sensors.
ESP32 vs ESP8266 Comparison
Feature | ESP8266 | ESP32 |
---|---|---|
MCU | Xtensa Single-core 32-bit L106 | Xtensa Dual-Core 32-bit LX6 (600 DMIPS) |
Wi-Fi | 802.11 b/g/n (HT20) | 802.11 b/g/n (HT40) |
Bluetooth | X | Bluetooth 4.2 and BLE |
Typical Frequency | 80 MHz | 160 MHz |
SRAM | X | ✓ |
Flash | X | ✓ |
GPIO | 17 | 36 |
Hardware/Software PWM | None / 8 channels | None / 16 channels |
SPI/I2C/I2S/UART | 2/1/2/2 | 4/2/2/2 |
ADC | 10-bit | 12-bit |
CAN | X | ✓ |
Ethernet MAC Interface | X | ✓ |
Touch Sensor | X | ✓ |
Temperature Sensor | X | ✓ |
Hall Effect Sensor | X | ✓ |
Working Temperature | -40ºC to 125ºC | -40ºC to 125ºC |
ESP32 GPIO Pinout Overview
ESP32 boards come with 36 GPIO pins that are versatile and configurable for various functionalities such as digital input/output, analog input, touch sensing, and PWM control.
Key Features of ESP32 GPIOs
- Configurable as input or output: Each GPIO can be set as an input or output pin with software control.
- Analog Support: The ESP32 has 18 ADC channels (12-bit resolution) for analog input.
- Capacitive Touch Sensors: 10 dedicated GPIOs are designed for touch sensing.
- PWM (Pulse Width Modulation): All GPIOs can be configured as PWM output.
- Interrupt Support: Most GPIOs support interrupt capabilities, suitable for handling real-time events.
- I2C, SPI, UART Support: GPIOs can be configured for various communication protocols.
- Deep Sleep Wake-Up: Select GPIOs can act as wake-up sources when the ESP32 is in deep sleep mode.
ESP32 GPIO Pinout Diagram
Here’s a general pin mapping of the ESP32’s GPIO pins and their functions:
GPIO Pin | Function | Notes |
---|---|---|
GPIO0 | Boot Mode Select | Must be pulled HIGH during boot |
GPIO1 (TX) | UART0 TX | Serial communication transmit pin |
GPIO2 | Built-in LED | Often connected to an onboard LED |
GPIO3 (RX) | UART0 RX | Serial communication receive pin |
GPIO4 | PWM, ADC, Touch | Multipurpose pin |
GPIO5 | SPI CS | Chip select for SPI interface |
GPIO12 | ADC, Touch | Often used for touch input |
GPIO13 | ADC, Touch | Another touch-capable GPIO |
GPIO14 | PWM, SPI, I2C | Multipurpose pin |
GPIO15 | PWM, Touch | Multipurpose pin |
GPIO32-39 | ADC (Analog Inputs) | Supports analog reading |
Important Notes on GPIO Usage
- GPIO34 to GPIO39 are input-only pins and cannot be used for output functions.
- GPIO6 to GPIO11 are connected to the ESP32’s internal flash memory and should be avoided for general use.
- Use pull-up or pull-down resistors when necessary to stabilize GPIO behavior.
Best Practices for Using ESP32 GPIOs
- Power Considerations: Ensure you follow the voltage limits (3.3V) to avoid damaging the pins.
- Pin Mapping: Different ESP32 boards may assign GPIOs to different functions. Always verify the pin mapping for your specific board.
- Use External Components: For sensitive sensors, use capacitors or resistors to improve stability.
The ESP32 is a powerful and versatile board packed with features suitable for both beginners and experienced developers. Its advanced GPIO capabilities, combined with Wi-Fi and Bluetooth connectivity, make it an excellent choice for IoT, robotics, and home automation projects.
GPIO Pins of ESP-WROOM-32
Version with 30 GPIOsVersion with 36 GPIOs
Thanks for reading. If you like this post probably you might like my next ones, so please support me by subscribing my blog.
You may like also: Arduino Support for ESP8266 with simple test code
Very nice article sir, keep it up.