Home / Reference / NodeMCU Pinout Reference
pcbway
NodeMCU pinout
Reference

NodeMCU Pinout Reference

The NodeMCU is an ESP8266 development board that combines WiFi, GPIO, USB programming, and power regulation on a single board. At its core is the ESP8266, which means you can build WiFi-enabled projects without connecting a separate Arduino board.

This NodeMCU pinout reference covers the commonly used NodeMCU V1.0 and V3 boards, including GPIO numbers, safe pins, boot pins, I2C, SPI, UART, PWM, ADC, interrupts, and power pins. The older NodeMCU V0.9 pinout is also included near the end of the article.

NodeMCU ESP8266 Pinout

NodeMCU pinout

The most important thing to understand about the NodeMCU pinout is that the labels printed on the board, such as D1, D2, and D5, do not match the actual ESP8266 GPIO numbers.

For example:

  • D1 is GPIO5
  • D2 is GPIO4
  • D5 is GPIO14
  • D7 is GPIO13

When programming a NodeMCU using the ESP8266 Arduino core, you can use either the NodeMCU pin name:

digitalWrite(D7, HIGH);

or its actual GPIO number:

digitalWrite(13, HIGH);

Both refer to the same physical pin.

NodeMCU Pin Mapping Quick Reference

NodeMCU Pin ESP8266 GPIO Common Function Notes
D0 GPIO16 GPIO, PWM, Deep Sleep Wake No GPIO interrupt support
D1 GPIO5 GPIO, I2C SCL Good general-purpose pin
D2 GPIO4 GPIO, I2C SDA Good general-purpose pin
D3 GPIO0 GPIO, Flash/Boot Must be HIGH during normal boot
D4 GPIO2 GPIO, onboard LED Must be HIGH during normal boot
D5 GPIO14 GPIO, SPI SCLK Good general-purpose pin
D6 GPIO12 GPIO, SPI MISO Good general-purpose pin
D7 GPIO13 GPIO, SPI MOSI Good general-purpose pin
D8 GPIO15 GPIO, SPI CS Must be LOW during boot
RX GPIO3 UART RX, GPIO Shared with serial communication
TX GPIO1 UART TX, GPIO Outputs serial data during boot
A0 ADC0 Analog Input Only analog input

Which NodeMCU Pins Are Safe to Use?

For most projects, the easiest NodeMCU pins to use are:

  • D1 - GPIO5
  • D2 - GPIO4
  • D5 - GPIO14
  • D6 - GPIO12
  • D7 - GPIO13

These GPIO pins do not determine how the ESP8266 boots, making them good choices for LEDs, relays, sensors, displays, and other peripherals. If you simply need a digital GPIO and have no special requirements, start with D1, D2, D5, D6, or D7. D0 or GPIO16 is also useful as a general digital I/O, although it has some limitations. In particular, GPIO16 cannot be used with the normal ESP8266 GPIO interrupt system. It also has a special role when waking the ESP8266 from deep sleep. The pins that require the most care are D3, D4, and D8 because their logic levels are checked while the ESP8266 starts.

NodeMCU Boot Pins: D3, D4 and D8

Three ESP8266 pins help determine the boot mode:

NodeMCU Pin GPIO Required State During Normal Boot
D3 GPIO0 HIGH
D4 GPIO2 HIGH
D8 GPIO15 LOW

The NodeMCU board already contains pull-up and pull-down resistors that place these pins into their correct states. Problems can occur when an external circuit overrides those levels. For example, if a sensor or relay module pulls D8/GPIO15 HIGH while the board is powering up, the ESP8266 may fail to boot. Similarly, pulling D3/GPIO0 LOW during reset puts the ESP8266 into its UART bootloader mode instead of running the stored program. The NodeMCU FLASH button intentionally uses GPIO0 for this purpose. You can still use D3, D4, and D8 as GPIO pins. Just make sure anything connected to them does not interfere with their required boot states.

NodeMCU Digital GPIO Pins

Most of the NodeMCU D pins can be configured as either inputs or outputs using the normal Arduino functions:

pinMode(D1, OUTPUT);
digitalWrite(D1, HIGH);

or:

pinMode(5, OUTPUT);
digitalWrite(5, HIGH);

Both examples control GPIO5/D1.

The ESP8266 uses 3.3 V logic. Treat its GPIO pins as 3.3 V pins and avoid directly applying a 5 V logic signal to them. If you need to connect a 5 V device that outputs 5 V logic, use an appropriate level shifter or voltage divider.

GPIO6 to GPIO11

You may notice that several ESP8266 GPIO numbers are missing from the NodeMCU D0-D8 sequence. GPIO6 through GPIO11 are normally connected internally to the ESP8266 module's SPI flash memory. The processor continuously accesses this flash to execute your program. Do not use GPIO6 through GPIO11 as normal I/O pins on a typical NodeMCU. Interfering with the flash bus can cause crashes or prevent the ESP8266 from running.

NodeMCU I2C Pins

The default I2C pins used by the ESP8266 Arduino core on the NodeMCU are:

I2C Signal NodeMCU Pin GPIO
SDA D2 GPIO4
SCL D1 GPIO5

These are excellent pins for connecting devices such as OLED displays, BME280 sensors, RTC modules, and I2C LCDs. A typical Arduino sketch starts I2C with:

#include <Wire.h>

void setup() {
  Wire.begin();
}

On the NodeMCU, this normally uses D2 for SDA and D1 for SCL. The ESP8266 Arduino implementation also allows you to specify different pins:

Wire.begin(D2, D1);

The first parameter is SDA and the second is SCL.

NodeMCU SPI Pins

The commonly used ESP8266 hardware SPI interface, or HSPI, uses:

SPI Signal NodeMCU Pin GPIO
SCLK D5 GPIO14
MISO D6 GPIO12
MOSI D7 GPIO13
CS D8 GPIO15

D5, D6, and D7 are particularly good pins for SPI devices such as displays, SD card modules, and radio transceivers. D8/GPIO15 is the hardware chip-select pin, but remember that GPIO15 must remain LOW during boot. Many Arduino libraries also let you choose another GPIO as a software-controlled CS pin. A typical SPI sketch begins with:

#include <SPI.h>

void setup() {
  SPI.begin();
}

NodeMCU UART Pins

The main ESP8266 UART uses:

UART Signal NodeMCU Label GPIO
TX TX GPIO1
RX RX GPIO3

These pins are connected to the board's USB-to-serial converter and are normally used when uploading programs and communicating through the Arduino Serial Monitor.

For example:

void setup() {
  Serial.begin(115200);
}

GPIO1 and GPIO3 can also be used as regular GPIO pins, but doing so can conflict with serial communication. GPIO1/TX also outputs boot information when the ESP8266 starts, so it is not a good choice for devices that could be affected by unexpected pulses during startup.

NodeMCU Analog Pin: A0

Unlike boards such as the Arduino Uno, the ESP8266 has only one analog-to-digital converter channel. On the NodeMCU this is labeled A0. You can read it using:

int adcValue = analogRead(A0);

The ADC inside the bare ESP8266 chip accepts only 0 to 1.0 V. However, NodeMCU development boards typically include a resistor divider between the A0 header and the ESP8266 ADC input, allowing a higher voltage to be measured at the board's A0 pin. Because clone boards do not always use exactly the same design, check the schematic or specifications of your specific board before applying more than 1 V to A0. This distinction is important: the ESP8266 chip's ADC voltage range and the voltage range exposed by a particular development board are not necessarily the same.

NodeMCU PWM Pins

The ESP8266 does not have the same dedicated hardware PWM peripherals found on some other microcontrollers. Instead, the Arduino ESP8266 core provides software PWM using

analogWrite()
.

For example:

analogWrite(D5, 128);

With current ESP8266 Arduino Core 3.x versions, the default Arduino-compatible PWM range is:

0 to 255

Older ESP8266 Arduino core versions used a default range of 0 to 1023. This is why older NodeMCU tutorials may still use values such as:

analogWrite(D5, 512);

If you want to use the older 10-bit-style range with a current core, you can change it:

analogWriteRange(1023);

Software PWM is available on ESP8266 GPIO0 through GPIO16, although the normal restrictions of each pin still apply. For example, D3, D4, and D8 still need the correct logic levels during boot.

NodeMCU Interrupt Pins

GPIO interrupts are useful when the ESP8266 needs to respond immediately to events such as a button press, sensor pulse, or encoder signal. Interrupts can be attached to the normal ESP8266 GPIO pins except GPIO16/D0.

For example:

void IRAM_ATTR buttonPressed() {
  // Keep the interrupt routine short
}

void setup() {
  pinMode(D1, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(D1), buttonPressed, FALLING);
}

With current ESP8266 Arduino core versions, interrupt service routines should use

IRAM_ATTR
and should be kept short. Avoid delays and other long operations inside an interrupt handler. If your project requires interrupts, D1, D2, D5, D6, and D7 are usually convenient choices.

NodeMCU Deep Sleep Pin

D0, or GPIO16, has a special function related to the ESP8266's deep-sleep mode. To automatically wake the ESP8266 after deep sleep, connect:

D0 / GPIO16 → RST

Then your program can use a command such as:

ESP.deepSleep(10e6);

This example puts the ESP8266 into deep sleep for approximately 10 seconds. GPIO16 is different from the other GPIO pins and cannot be used with the standard GPIO interrupt system. This is one reason D0 is sometimes marked as a special-purpose pin in NodeMCU pinout diagrams.

NodeMCU Power Pins

The NodeMCU exposes several power-related pins:

Pin Purpose
3V3 Regulated 3.3 V rail
GND Ground
VIN Input to the board's power-regulation section on common NodeMCU designs
EN ESP8266 chip enable
RST Active-low reset input

The 3V3 pin is a 3.3 V supply rail and is commonly used to power 3.3 V sensors and modules. The ESP8266 itself also uses 3.3 V logic. A peripheral being powered from 5 V does not automatically mean its signals are safe to connect to the ESP8266. Check the device's logic levels before connecting its output directly to a NodeMCU GPIO. When powering a NodeMCU through VIN, check the schematic for the exact board or clone you are using. Most common NodeMCU DevKit designs expect approximately 5 V on this side of the onboard 3.3 V regulator.

NodeMCU V1.0 Pinout

NodeMCU ESP8266 V1.0 pinout

The NodeMCU V1.0 is probably the most recognizable version of the board. Compared with the original V0.9 design, it is narrower and much easier to use on a breadboard. It uses an ESP-12E module containing the ESP8266 and typically provides 4 MB of external flash. The original NodeMCU V1.0 design uses a Silicon Labs CP2102 USB-to-UART converter. If your computer does not detect the board as a serial port, install the current Silicon Labs CP210x VCP driver. For most tutorials and projects, this is the NodeMCU pin layout you should use as your reference.

NodeMCU V3 Pinout

NodeMCU ESP8266 V3 pinout

The commonly sold NodeMCU V3 is a LoLin design. It uses essentially the same important D0-D8 GPIO mapping as the V1.0 board, so code written for the V1.0 usually uses the same pin definitions. One major hardware difference is the USB-to-serial converter. Many V3 boards use the CH340G instead of the CP2102. If your V3 board is not detected by your computer, you may need the CH340/CH341 USB serial driver from WCH. The V3 board is also wider than the NodeMCU V1.0, which can matter when placing it on a breadboard.

NodeMCU V0.9 Pinout

NodeMCU ESP8266 V0.9 pinout

The NodeMCU V0.9 was the original development-board design and uses an ESP-12 module. It is considerably wider than the later V1.0 board. When inserted into a normal breadboard, very little space remains beside the headers for connecting jumper wires. The V0.9 design also contains several pins marked NC, or Not Connected. These disadvantages led to the smaller and more practical V1.0 design. Unless you specifically own an older V0.9 board, the V1.0 pinout is usually the more useful reference.

NodeMCU vs ESP8266

The terms NodeMCU and ESP8266 are often used as though they mean exactly the same thing, but they do not. The ESP8266 is the WiFi microcontroller made by Espressif. The ESP-12 and ESP-12E are modules containing an ESP8266 together with flash memory, RF components, and an antenna. The NodeMCU DevKit places one of these modules on a development board and adds useful hardware such as:

  • USB-to-UART converter
  • Micro USB connector
  • 3.3 V voltage regulator
  • Reset button
  • Flash/program button
  • Automatic programming circuitry
  • Header pins

This is why a NodeMCU can be connected directly to a computer and programmed without needing a separate USB-to-serial adapter. Other development boards also use the ESP8266, including the Adafruit Huzzah and WeMos D1 Mini. Their board layouts are different even though the underlying ESP8266 GPIO functions are similar.

NodeMCU Pinout FAQ

What are the best GPIO pins to use on NodeMCU?

For general-purpose I/O, D1/GPIO5, D2/GPIO4, D5/GPIO14, D6/GPIO12, and D7/GPIO13 are usually the easiest choices because they do not control the ESP8266 boot mode.

Are D1 and GPIO1 the same pin?

No. This is one of the most common NodeMCU pinout mistakes.

D1 is GPIO5.

GPIO1 is the ESP8266's UART TX pin, which is labeled TX on most NodeMCU boards.

Can I use D3, D4, and D8 as normal GPIO pins?

Yes, but they affect booting.

D3/GPIO0 and D4/GPIO2 need to be HIGH during normal boot, while D8/GPIO15 needs to be LOW. External hardware connected to these pins must not force them into the wrong state while the ESP8266 starts.

What are the NodeMCU I2C pins?

The default Arduino ESP8266 I2C pins are:

  • SDA: D2 / GPIO4
  • SCL: D1 / GPIO5

What are the NodeMCU SPI pins?

The normal HSPI pins are:

  • SCLK: D5 / GPIO14
  • MISO: D6 / GPIO12
  • MOSI: D7 / GPIO13
  • CS: D8 / GPIO15

Which NodeMCU pin is analog?

The NodeMCU has one analog input, A0. The ESP8266's internal ADC input range is 0 to 1.0 V, although NodeMCU boards commonly add a voltage divider that increases the usable voltage at the development board's A0 header.

Which pin controls the onboard LED?

On many ESP8266 NodeMCU boards, the onboard LED is connected to D4/GPIO2 and is active LOW.

This means:

digitalWrite(D4, LOW);

turns the LED on, while:

digitalWrite(D4, HIGH);

turns it off.

Because different clones can have slightly different hardware, check your board if this does not work as expected.

Can NodeMCU GPIO pins accept 5 V?

The ESP8266 is a 3.3 V device. Treat the GPIO pins as 3.3 V logic and do not directly connect a 5 V output to them. Use a level shifter or voltage divider when needed.

Can D0 be used as a normal GPIO?

Yes. D0 is GPIO16 and can be used as digital input or output. However, it does not support the normal GPIO interrupt mechanism and is also used to wake the ESP8266 from deep sleep when connected to RST.

More NodeMCU Tutorials

This NodeMCU pinout page is intended as a quick hardware reference. If you are just getting started with the ESP8266 or want to build a project using it, see these tutorials:

For most projects, remember these five pins first: D1, D2, D5, D6, and D7. They are the most convenient general-purpose GPIO pins on the NodeMCU. D3, D4, and D8 are also useful, but require extra care because they affect the ESP8266 boot process.

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted