Tuesday, February 18, 2025
ElectronicsESPExplainerInternet of ThingsIoT HardwaresIoT Software&Tools

ESP8266 NodeMCU Pinout Reference

What is ESP8266?

The ESP8266 is a low-cost, highly integrated Wi-Fi microcontroller module widely used in IoT applications. Developed by Espressif Systems, it features a powerful 32-bit Tensilica L106 processor, integrated TCP/IP stack, and Wi-Fi capabilities, enabling seamless internet connectivity. The module includes GPIO pins for interfacing with sensors, actuators, and other peripherals, making it versatile for various embedded projects. With support for programming languages like Arduino IDE, MicroPython, and Lua, it is beginner-friendly yet powerful enough for advanced projects. Its small size, low power consumption, and affordability have made it a popular choice for smart home devices, automation systems, and wireless communication projects.

ESP8266 Pinout Reference

A great feature of the ESP8266 is its ample number of GPIO pins, allowing you to work with multiple peripherals without needing to juggle or multiplex them. However, it’s important to review the pinout diagram carefully, as there are a few details to keep in mind.

Keep in mind that the pinout reference below applies to the widely used 30-pin ESP8266 NodeMCU development board. While not all ESP8266 development boards expose every pin, the functionality of each pin remains consistent across different boards.

ESP8266 Peripherals and I/O

The ESP8266 NodeMCU features a total of 17 GPIO pins, which are accessible through the pin headers on either side of the development board. These pins can be configured to perform a range of peripheral functions, including:

1 ADC channel 1 channel of 10-bit precision SAR ADC
2 UART interfaces 2 UART interfaces with with support for flow control
4 PWM outputs 4 PWM pins to control things like motor speed or LED brightness
2 SPI and 1 I2C interfaces Two SPI and one I2C interfaces for connecting various sensors and peripherals
I2S interface One I2S interface for adding sound to your project

The ESP8266’s pin multiplexing feature enables multiple peripherals to share a single GPIO pin, allowing it to handle functions like I2C, I2S, UART, PWM, and more.

For detailed information about the ESP8266, consult the datasheet.

ESP8266 NodeMCU Pinout

The ESP8266 NodeMCU has 30 pins. For convenience, pins with similar functionality are grouped together.

ESP8266 NodeMCU Pinout

Let’s explore a detailed explanation of GPIO pins of ESP8266 NodeMCU and their functions.

GPIO Pins of ESP8266 NodeMCU

The ESP8266 NodeMCU includes 17 GPIO pins that can be programmed for various functions by configuring the relevant registers. Each GPIO can be set with an

internal pull-up, pull-down, or high-impedance state.

GPIO Pins of ESP8266 NodeMCU

Which ESP8266 GPIOs are safe to use?

While the ESP8266 offers many pins with different functions, not all of them may be ideal for your projects. The table below outlines which pins are safe to use and which ones require caution.

  Label    GPIO    Safe to use?  Reason
D0GPIO16AHIGH at boot, used to wake up from deep sleep
D1GPIO5S
D2GPIO4S
D3GPIO0Aconnected to FLASH button, boot fails if pulled LOW
D4GPIO2AHIGH at boot, boot fails if pulled LOW
D5GPIO14S
D6GPIO12S
D7GPIO13S
D8GPIO15ARequired for boot, boot fails if pulled HIGH
RXGPIO3DRx pin, used for flashing and debugging
TXGPIO1DTx pin, used for flashing and debugging
CLKGPIO6DConnected to Flash memory
SDOGPIO7DConnected to Flash memory
CMDGPIO11DConnected to Flash memory
SD1GPIO8DConnected to Flash memory
SD2GPIO9DConnected to Flash memory
SD3GPIO10DConnected to Flash memory
A0ADC0AAnalog input pin, cannot be configured as output

The image below shows which GPIO pins can be used safely.

Which ESP8266 GPIOs are safe to use?

ADC Pins

The ESP8266 features a 10-bit SAR ADC, enabling it to identify 1024 distinct analog levels. This allows it to convert input voltages between 0 and 3.3V (its operating voltage) into integer values from 0 to 1024. This provides a resolution of 0.0032 volts (3.2 mV) per unit, calculated by dividing 3.3 volts by 1024.

ADC Pins

The two measurements below can be performed using the ADC, but they cannot be done simultaneously:

  1. Measure the VDD3P3 power supply voltage (Pin 3 and Pin 4).
  2. Measure the input voltage on A0.

SPI Pins

The ESP8266 includes two SPIs (SPI and HSPI) that can operate in both slave and master modes. These SPIs also support the following general-purpose features:

  • 4 timing modes for SPI data transfer
  • Clock speeds up to 80 MHz, along with clock divisions of 80 MHz
  • A FIFO buffer of up to 64 bytes
SPI Pins

It is possible to use SPI on any pins by ‘bitbanging’.

I2C Pins

The ESP8266 doesn’t have dedicated hardware I2C pins, but I2C communication can be achieved through ‘bitbanging.’ This method works efficiently, and the ESP8266 is fast enough to deliver speeds comparable to ‘Arduino level.’

By default, GPIO4 (SDA) and GPIO5 (SCL) are assigned as I2C pins to simplify integration with existing Arduino code, libraries, and sketches.

However, you can choose any other two GPIO pins for I2C by using the wire.begin(SDA, SCL) command in the Arduino IDE.

I2C Pins

UART Pins

The ESP8266 offers two UART interfaces, UART0 and UART2, which support asynchronous communication (RS232 and RS485) with speeds of up to 4.5 Mbps.

  • UART0 (TXD0, RXD0, RST0, and CTS0 pins) is used for general communication.
  • UART1 (TXD1 pin) provides only a data transmit signal and is typically used for log output.
UART Pins

RXD0 and TXD0 are the serial control and bootloading pins, mainly used for communication with the ESP module.

As these pins are connected to the USB-to-serial converter, they will also receive USB traffic, so caution should be exercised when using them.

PWM Pins

All of the ESP8266’s GPIO pins, from GPIO0 to GPIO15, can be programmed to generate pulse width modulated (PWM) outputs. The ESP8266 provides a PWM signal with a 10-bit resolution, and the PWM frequency can be adjusted within a range of 1000 μs to 10000 μs, corresponding to frequencies between 100 Hz and 1 kHz.

PWM Pins

SDIO Pins

The ESP8266 features a single slave SDIO (Secure Digital Input/Output Interface) for connecting SD cards. It supports both SDIO v1.1 (4-bit, 25 MHz) and SDIO v2.0 (4-bit, 50 MHz).

SDIO Pins

Power Pins

The VIN pin can be used to supply power directly to the ESP8266 and its peripherals, provided you have a regulated 5V power source. The 3V3 pin provides output from the onboard voltage regulator, capable of supplying up to 600mA. GND is the ground pin.

Power Pins

Interrupt Pins

All GPIOs pins of ESP8266 NodeMCU can be configured as interrupts, except GPIO16.

Control Pins

The EN (also known as CH_PD or Chip Power Down) pin is the enable pin for the ESP8266, which is normally pulled high. When pulled HIGH, the chip is powered on; when pulled LOW, the chip is powered off.

The RST pin serves as the reset pin for the ESP8266 and is also pulled high by default. Momentarily pulling it LOW to ground will reset the ESP8266, similar to pressing the onboard RST button.

The FLASH pin is used by the ESP8266 to decide when to enter the bootloader. If the pin is held low during power-up, it will trigger the bootloading process, much like pressing the onboard FLASH button.

The WAKE pin is used to wake the ESP8266 from deep sleep mode.

Control Pins

You can Explore ESP8266/ESP32 Articles and Tutorials

Harshvardhan Mishra

Hi, I'm Harshvardhan Mishra. Tech enthusiast and IT professional with a B.Tech in IT, PG Diploma in IoT from CDAC, and 6 years of industry experience. Founder of HVM Smart Solutions, blending technology for real-world solutions. As a passionate technical author, I simplify complex concepts for diverse audiences. Let's connect and explore the tech world together! If you want to help support me on my journey, consider sharing my articles, or Buy me a Coffee! Thank you for reading my blog! Happy learning! Linkedin

Harshvardhan Mishra has 760 posts and counting. See all posts by Harshvardhan Mishra

Leave a Reply

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