Zbotic Logo Zbotic Logo
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

  • Shop
  • About Us
  • Contact Us
  • Reseller
  • Blogs
020 69134444
1800 209 0998
[email protected]
Help Desk
Facebook Twitter Instagram Linkedin YouTube
Zbotic Logo Zbotic Logo
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

All departments
  • 3D Print Service
  • 3D Printer
  • Batteries & Chargers
  • Development Boards
  • Drone Parts
  • EBike parts
  • Sensor Modules
  • Electronic Components
  • Electronic Modules
  • IoT and Wireless
  • Mechanical Parts and Workbench Tools
  • Motors & Drivers & Pumps & Actuators
  • DIY and Robot Kits
  • Show more
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
Return to previous page
Home IoT & Smart Home

NodeMCU ESP32 Pinout: GPIO, PWM, ADC Reference Guide

NodeMCU ESP32 Pinout: GPIO, PWM, ADC Reference Guide

March 11, 2026 /Posted byJayesh Jain / 0

Understanding the ESP32 NodeMCU pinout GPIO PWM ADC reference is the first and most important step before building any ESP32 project. Unlike simple Arduino boards where almost every pin can be used interchangeably, the ESP32 has specific pins reserved for boot strapping, internal use, and peripheral functions. Using the wrong pin can cause your ESP32 to fail to boot, behave erratically, or produce incorrect readings. This comprehensive pinout guide covers every aspect of ESP32 GPIO functionality — from basic digital I/O to ADC channels, PWM, I2C, SPI, and UART — everything you need as a reference for your IoT projects.

Table of Contents

  1. ESP32 Hardware Overview
  2. GPIO Pin Reference Table
  3. ADC (Analog-to-Digital Converter) Pins
  4. PWM: LED Control on Any GPIO
  5. I2C Pins: Default and Custom Assignments
  6. SPI Pins: VSPI and HSPI
  7. UART Serial Communication Pins
  8. Special-Purpose and Input-Only Pins
  9. Frequently Asked Questions

ESP32 Hardware Overview

The ESP32 is a dual-core Xtensa LX6 32-bit microcontroller from Espressif Systems, running at up to 240MHz. It integrates WiFi (802.11 b/g/n), Bluetooth Classic, and BLE into a single chip, making it one of the most capable and cost-effective microcontrollers available to Indian makers today.

Key hardware specs relevant to pinout:

  • Total GPIO pins: 34 physical GPIO pins on the ESP32 chip (GPIO0–GPIO39)
  • Output-capable pins: GPIO0–GPIO33 (GPIO34–GPIO39 are input-only)
  • ADC channels: 18 channels across two ADC units (ADC1: 8 channels, ADC2: 10 channels)
  • DAC outputs: 2 channels (GPIO25 and GPIO26)
  • Touch sensors: 10 capacitive touch pins
  • PWM channels: 16 channels via LEDC peripheral (any output-capable GPIO)
  • I2C: 2 hardware I2C controllers (any GPIO)
  • SPI: 4 SPI controllers (2 for internal flash, VSPI and HSPI available)
  • UART: 3 UART interfaces

The NodeMCU-32S is the most common ESP32 development board form factor in India. It exposes 36 GPIO pins on two rows of 19 pins each, with a CP2102 or CH340 USB-to-Serial chip for programming. The pinout discussion in this guide applies to the standard 38-pin ESP32-WROOM-32 module used in most NodeMCU-32S boards.

Ai Thinker NodeMCU-32S ESP32 Development Board

Ai Thinker NodeMCU-32S ESP32 Development Board – IPEX Version

The NodeMCU-32S is the reference board for this pinout guide. It exposes 36 GPIO pins with clear silk-screen labeling, includes an IPEX antenna connector for external antenna, and has a built-in CP2102 USB-to-serial converter.

View on Zbotic

GPIO Pin Reference Table

This table covers all accessible GPIO pins on the NodeMCU-32S (ESP32-WROOM-32) board, with their key functions and limitations:

GPIO Input Output Notes
GPIO0 Pulled Up OK Boot fail if LOW. Boot button on most boards. Avoid for input.
GPIO1 TX pin OK UART0 TX. Debug output during boot. Avoid for project I/O.
GPIO2 OK OK Onboard LED on many boards. Must be LOW or float at boot.
GPIO3 RX pin OK UART0 RX. Avoid for project I/O.
GPIO4 OK OK General purpose. Touch0. Reliable, recommended for most uses.
GPIO5 OK OK VSPI CS. Outputs PWM at boot. Pull-up during boot.
GPIO6-11 NO NO Connected to internal SPI flash. DO NOT USE.
GPIO12 OK OK Boot fail if pulled HIGH. JTAG TDI. HSPI MISO. Use with care.
GPIO13 OK OK JTAG TCK. HSPI MOSI. Safe to use.
GPIO14 OK OK JTAG TMS. HSPI CLK. Outputs PWM at boot.
GPIO15 OK OK JTAG TDO. HSPI CS. Must be HIGH at boot. Outputs PWM at boot.
GPIO16 OK OK UART2 RX. Often used for PSRAM on some modules.
GPIO17 OK OK UART2 TX. Safe general-purpose GPIO.
GPIO18 OK OK VSPI CLK. Recommended for SPI clock.
GPIO19 OK OK VSPI MISO. Recommended for SPI MISO.
GPIO21 OK OK Default I2C SDA. Highly recommended for I2C projects.
GPIO22 OK OK Default I2C SCL. Highly recommended for I2C projects.
GPIO23 OK OK VSPI MOSI. Recommended for SPI MOSI.
GPIO25 OK OK DAC1 output. ADC2 channel 8. General purpose safe.
GPIO26 OK OK DAC2 output. ADC2 channel 9. General purpose safe.
GPIO27 OK OK Touch7. ADC2 channel 7. General purpose safe.
GPIO32 OK OK ADC1 channel 4. Touch9. Reliable for ADC use.
GPIO33 OK OK ADC1 channel 5. Touch8. Reliable for ADC use.
GPIO34 OK INPUT ONLY ADC1 channel 6. No internal pull-up/down. Input only.
GPIO35 OK INPUT ONLY ADC1 channel 7. No internal pull-up/down. Input only.
GPIO36 (VP) OK INPUT ONLY ADC1 channel 0. No pull-up/down. Input only.
GPIO39 (VN) OK INPUT ONLY ADC1 channel 3. No pull-up/down. Input only.

ADC (Analog-to-Digital Converter) Pins

The ESP32 has two ADC units with a total of 18 channels, providing 12-bit resolution (0–4095 values for 0–3.3V). This is significantly more analog capability than the Arduino Uno’s single 10-bit ADC.

ADC1 (GPIO32–GPIO36, GPIO39) — SAFE to use with WiFi:

  • GPIO32 → ADC1_CH4
  • GPIO33 → ADC1_CH5
  • GPIO34 → ADC1_CH6 (input only)
  • GPIO35 → ADC1_CH7 (input only)
  • GPIO36 (VP) → ADC1_CH0 (input only)
  • GPIO39 (VN) → ADC1_CH3 (input only)

ADC2 (GPIO0, GPIO2, GPIO4, GPIO12–GPIO15, GPIO25–GPIO27) — CONFLICTS with WiFi:

This is the most important ESP32 ADC gotcha: ADC2 is used by the WiFi driver. When WiFi is active, you CANNOT use ADC2 channels. Attempting to read ADC2 while WiFi is active returns an error. Always use ADC1 channels for analog readings in WiFi-connected projects.

// Reading ADC on ESP32
int rawValue = analogRead(34);  // ADC1_CH6, input-only pin
float voltage = rawValue * (3.3 / 4095.0);
Serial.println(voltage);

// ADC attenuation for different voltage ranges
// Default: 0-1.1V (no attenuation)
analogSetAttenuation(ADC_11db);  // 0-3.3V full range (most common)
// Or per-pin:
analogSetPinAttenuation(34, ADC_11db);

ADC Accuracy Note: The ESP32’s ADC is known to be non-linear, especially at the extremes (near 0V and near 3.3V). For high-accuracy measurements, use an external ADC like the ADS1115 via I2C. For general sensor readings (temperature, light level, potentiometer), the built-in ADC is adequate.

LM35 Temperature Sensor

LM35 Temperature Sensors

The LM35 is a classic analog temperature sensor perfect for testing ESP32 ADC. Connect its output to GPIO32 (ADC1_CH4) for accurate temperature readings even while WiFi is active. Output is 10mV/°C.

View on Zbotic

PWM: LED Control on Any GPIO

The ESP32 has a dedicated LEDC (LED Control) peripheral with 16 independent channels, each capable of generating PWM signals. Any output-capable GPIO can be assigned to any LEDC channel. This is much more flexible than Arduino Uno, which has only 6 fixed PWM pins.

// ESP32 LEDC PWM - works on any output GPIO
const int ledPin = 21;     // GPIO21
const int pwmChannel = 0;  // LEDC channel 0 (0-15)
const int pwmFreq = 5000;  // 5 kHz frequency
const int pwmResolution = 8; // 8-bit resolution (0-255)

void setup() {
  // Configure LEDC channel
  ledcSetup(pwmChannel, pwmFreq, pwmResolution);
  // Attach GPIO to LEDC channel
  ledcAttachPin(ledPin, pwmChannel);
}

void loop() {
  // Fade LED in
  for (int dc = 0; dc = 0; dc--) {
    ledcWrite(pwmChannel, dc);
    delay(10);
  }
}

PWM for Servo Motors: Use LEDC with 50Hz frequency and 16-bit resolution for servo control. Map servo angles (0-180°) to pulse widths of 1ms-2ms (1000-2000 microseconds) within the 20ms period:

ledcSetup(0, 50, 16);  // 50Hz, 16-bit
ledcAttachPin(servoPin, 0);

// Angle to duty cycle conversion for 50Hz/16-bit
int angle = 90; // degrees
int duty = map(angle, 0, 180, 1638, 8192); // 1ms to 2ms in 16-bit
ledcWrite(0, duty);

I2C Pins: Default and Custom Assignments

The ESP32 has two I2C controllers (I2C0 and I2C1) and — unlike most microcontrollers — allows you to assign any GPIO pins as SDA/SCL. The Arduino Wire library defaults to:

  • Default SDA: GPIO21
  • Default SCL: GPIO22

These defaults work with Wire.begin() and no additional arguments. For custom pins or to use the second I2C controller:

#include <Wire.h>

// Default I2C (GPIO21=SDA, GPIO22=SCL)
Wire.begin(); 

// Custom I2C pins
Wire.begin(SDA_PIN, SCL_PIN);
// Example: Wire.begin(16, 17);

// Second I2C bus on ESP32
TwoWire I2C_two = TwoWire(1); // Use I2C controller 1
I2C_two.begin(13, 14, 400000); // SDA=13, SCL=14, 400kHz

The ability to use custom I2C pins is invaluable when the default pins are occupied (e.g., by a display using SPI on GPIO21 for its reset line). Common I2C sensors and their typical addresses: BME280 (0x76/0x77), BMP280 (0x76/0x77), SSD1306 OLED (0x3C/0x3D), MPU6050 (0x68/0x69).

GY-BME280 Precision Altimeter Atmospheric Pressure Sensor

GY-BME280-3.3 Precision Altimeter Atmospheric Pressure Sensor Module

A classic I2C sensor to test with ESP32’s default I2C pins (GPIO21=SDA, GPIO22=SCL). Provides temperature, humidity, and barometric pressure over I2C at address 0x76 or 0x77 depending on the SDO pin state.

View on Zbotic

SPI Pins: VSPI and HSPI

The ESP32 has four SPI controllers: SPI0 and SPI1 are used internally for the flash memory and cache (do not touch these). VSPI (SPI2) and HSPI (SPI3) are available for external peripherals.

Signal VSPI (SPI2) Default HSPI (SPI3) Default
MOSI GPIO23 GPIO13
MISO GPIO19 GPIO12
SCK GPIO18 GPIO14
CS GPIO5 GPIO15

Like I2C, the SPI pins are also configurable. You can run multiple SPI devices on the same bus using different CS pins, or use custom pins entirely. Use VSPI (GPIO18/19/23) as your primary SPI bus for most projects — these pins have no boot-time restrictions.

Avoid GPIO12 (HSPI MISO) as a CS or MOSI line — if pulled HIGH at boot, the ESP32 changes the flash voltage and will fail to boot. Keep GPIO12 low during power-on.

UART Serial Communication Pins

The ESP32 has three hardware UART interfaces, all configurable to any GPIO:

  • UART0: GPIO1 (TX), GPIO3 (RX) — Used by USB-Serial (Arduino Serial). Avoid for project use.
  • UART1: GPIO10 (TX), GPIO9 (RX) — Default pins are on the internal flash! Remap to safe pins.
  • UART2: GPIO17 (TX), GPIO16 (RX) — Safe to use for external serial devices.
#include <HardwareSerial.h>

// UART2 on default pins
HardwareSerial SerialPort(2);

void setup() {
  Serial.begin(115200);     // UART0 via USB
  SerialPort.begin(9600);   // UART2 at GPIO16/17
}

// Custom UART1 pins (remap away from internal flash)
HardwareSerial GPS_Serial(1);
GPS_Serial.begin(9600, SERIAL_8N1, 25, 26); // RX=GPIO25, TX=GPIO26

Special-Purpose and Input-Only Pins

Boot Strapping Pins

These pins are sampled during boot to determine the boot mode. Incorrect states prevent normal operation:

  • GPIO0: Must be HIGH for normal boot. LOW = download/flash mode. This is the BOOT button on most boards.
  • GPIO2: Must be LOW or floating during flashing. HIGH = uploads are blocked.
  • GPIO5: Must be HIGH during boot (internal pull-up).
  • GPIO12: Must be LOW at boot (sets flash voltage). Pulling HIGH = flash voltage changes = boot failure.
  • GPIO15: Must be HIGH at boot (prevents debug log output on UART0).

Input-Only Pins (GPIO34, GPIO35, GPIO36, GPIO39)

These four pins are connected to the ESP32’s ADC and RTC circuitry but have no output drivers. Key limitations:

  • Cannot be set as OUTPUT — will generate an error or be silently ignored
  • No internal pull-up or pull-down resistors — must provide external pull resistors
  • Excellent for ADC readings and low-noise analog inputs
  • GPIO36 (labeled VP) and GPIO39 (labeled VN) on most NodeMCU boards
30Pin ESP32 Expansion Board

30Pin ESP32 Expansion Board with Type-C USB and Micro USB Dual Interface

This expansion board makes working with ESP32 GPIO much easier — it breaks out all 30 pins with labeled headers and supports both Type-C and Micro USB. Perfect for prototyping with multiple sensors and peripherals simultaneously.

View on Zbotic

Frequently Asked Questions

Which ESP32 GPIO pins are completely safe to use without any restrictions?

The safest general-purpose GPIO pins for both input and output are: GPIO4, GPIO13, GPIO16, GPIO17, GPIO18, GPIO19, GPIO21, GPIO22, GPIO23, GPIO25, GPIO26, GPIO27, GPIO32, GPIO33. These have no boot-time restrictions, no conflicts with internal peripherals, and support both input and output with pull-up/down resistors. For input-only use, GPIO34, GPIO35, GPIO36, and GPIO39 are also excellent for analog inputs.

Why does analogRead() give wrong values when WiFi is on?

This happens when you are trying to read an ADC2 pin while WiFi is active. ADC2 is shared with the WiFi driver. Switch to ADC1 pins (GPIO32, GPIO33, GPIO34, GPIO35, GPIO36, GPIO39) for analog readings in WiFi projects. ADC1 is entirely independent and unaffected by WiFi activity.

Can ESP32 GPIO pins handle 5V logic levels?

No. The ESP32 is a 3.3V device and its GPIO pins are NOT 5V tolerant. Applying 5V to a GPIO pin will damage the chip over time and can cause immediate failure. Use a voltage divider or a level shifter when interfacing with 5V devices like Arduino or older sensors. For outputs driving 5V peripherals, a MOSFET or level shifter is required.

How many PWM channels can run simultaneously on ESP32?

The ESP32 LEDC peripheral supports 16 independent PWM channels running simultaneously. Channels 0-7 use a high-speed timer and channels 8-15 use a low-speed timer. All 16 can run at different frequencies and duty cycles at the same time, allowing you to independently control 16 LEDs, servos, or other PWM devices simultaneously.

What is the difference between NodeMCU-32S, ESP32 DevKit v1, and ESP32-WROOM-32?

The ESP32-WROOM-32 is the core module (the metal-shielded component with the antenna). The DevKit v1 and NodeMCU-32S are development boards built around this module. Both have the same ESP32 chip and pinout. The main differences are the USB-to-serial chip (DevKit v1 uses CP2102, some NodeMCU variants use CH340), pin labeling, and physical dimensions. For this pinout guide, all three are functionally identical in terms of GPIO assignments.

Get Your ESP32 Modules and Accessories from Zbotic

Now that you have a complete ESP32 pinout reference, it is time to build! Shop for ESP32 development boards, sensors, expansion boards, and all the components you need at Zbotic. Fast shipping across India, genuine components from trusted brands like Ai Thinker and Waveshare.

Shop ESP32 Components on Zbotic

Tags: ADC, ESP32, GPIO, I2C, nodemcu, pinout, PWM, reference guide, SPI, UART
Share Post
  • Facebook
  • Linkedin
  • Whatsapp
ESP32 Touch Screen: 2.8 Inch T...
blog esp32 touch screen 2 8 inch tft ili9341 project guide 595633
blog home automation with esp32 and alexa full setup guide for indian homes 595640
Home Automation with ESP32 and...

Related posts

Svg%3E
Read more

IoT Home Insurance Sensor Kit: Leak, Smoke, and Motion

April 1, 2026 0
Table of Contents IoT and Home Insurance Water Leak Detection Smoke and Fire Detection Motion and Intrusion Sensing Building the... Continue reading
Svg%3E
Read more

IoT Pet Tracker: GPS Collar with Geofencing Alerts

April 1, 2026 0
Table of Contents Introduction and Overview Hardware Components Required GPS Module Integration with ESP32 Cloud Platform Setup Real-Time Tracking Dashboard... Continue reading
Svg%3E
Read more

IoT Aquaponics Controller: Fish and Plant Automation

April 1, 2026 0
Table of Contents The Water Monitoring Challenge in India Sensor Technologies for Water Building the Sensor Node Data Transmission and... Continue reading
Svg%3E
Read more

IoT Composting Monitor: Temperature and Moisture Tracking

April 1, 2026 0
Table of Contents Why Temperature Monitoring Matters Sensor Selection Guide Hardware Assembly and Wiring Firmware Development Cloud Data Logging Alert... Continue reading
Svg%3E
Read more

IoT Beehive Monitor: Weight, Temperature, and Humidity

April 1, 2026 0
Table of Contents Why Monitor Beehives Weight Measurement System Temperature and Humidity Sensing Building the Monitor Data Analysis for Bee... Continue reading

Add comment Cancel reply

Your email address will not be published. Required fields are marked

Facebook Twitter Instagram Pinterest Linkedin Youtube

Get the latest deals and more.

Download on Google Play Download on the App Store

Call us: 020 69134444 / 1800 209 0998

Monday - Saturday 09:30 AM - 06:00 PM
For Technical Supports Email: [email protected]
For Sales / Enquiries Email: [email protected]

  • My Account

    • Cart

    • Wishlist

    • Checkout

    • My Orders

    • Track Order

    • My Account

  • Information

    • FAQs

    • Blogs

    • Career

    • About Us

    • Contact Us

    • Payment Options

  • Policies

    • Privacy Policy

    • Terms & Conditions

    • GST Input Tax Credit

    • Shipping Return Policy

    • E-Waste Collection Points

    • Our Sitemap

© Zbotic.in is registered trademark of Moxie Supply Pvt Ltd – All Rights Reserved
Login
Use Phone Number
Use Email Address
Not a member yet? Register Now
Reset Password
Use Phone Number
Use Email Address
Register
Already a member? Login Now