Component guide · Beginner · 3 min read
ESP8266 NodeMCU

Pinout, D-Pin Mapping and Wi-Fi Basics
By Geekobot Learning Team · Updated 24 Oct 2026
On this page
The ESP8266 is a 3.3 V Wi-Fi microcontroller, and NodeMCU is the most common board built around it. Its D0 to D8 labels map to GPIO numbers, so D1 is GPIO 5 and D2 is GPIO 4. It has one analog input (A0, 0 to 3.3 V on NodeMCU) and about nine usable GPIO pins. For new projects the ESP32 is usually the better buy.
Key specs at a glance
- Chip
- ESP8266EX (Tensilica L106, 80 or 160 MHz)
- Wi-Fi
- 2.4 GHz 802.11 b/g/n, station and access point
- Logic level
- 3.3 V, not 5 V tolerant
- Usable GPIO
- About 9 (D1, D2, D5, D6, D7 safest)
- ADC
- One, 10-bit, 0 to 3.3 V on NodeMCU (0 to 1 V on bare module)
- Flash
- 4 MB on NodeMCU and D1 Mini
- Power
- 5 V micro USB or VIN; 3.3 V at 3V3; 170 mA peaks when transmitting
NodeMCU vs Wemos D1 Mini vs ESP-01
| Board | Size | USB | Choose it for |
|---|---|---|---|
| NodeMCU (ESP-12E/F) | 58 x 31 mm, 30 pins | Yes (CP2102 or CH340) | Beginners, breadboard prototypes |
| Wemos / LOLIN D1 Mini | 34 x 26 mm, 16 pins | Yes (CH340) | Compact builds, stackable shields |
| ESP-01 / ESP-01S | 24 x 14 mm, 8 pins | No, needs a USB adapter | Adding Wi-Fi to an Arduino, relay switches |
- NodeMCU (ESP-12E/F)
- Size:
- 58 x 31 mm, 30 pins
- USB:
- Yes (CP2102 or CH340)
- Choose it for:
- Beginners, breadboard prototypes
- Wemos / LOLIN D1 Mini
- Size:
- 34 x 26 mm, 16 pins
- USB:
- Yes (CH340)
- Choose it for:
- Compact builds, stackable shields
- ESP-01 / ESP-01S
- Size:
- 24 x 14 mm, 8 pins
- USB:
- No, needs a USB adapter
- Choose it for:
- Adding Wi-Fi to an Arduino, relay switches
NodeMCU D-pin to GPIO mapping
The silkscreen numbers are not GPIO numbers. In code, use the GPIO number or the D-constant (D1), never the printed number as a plain integer.
| Label | GPIO | Safe to use? | Notes |
|---|---|---|---|
| D0 | 16 | Partly | No PWM/interrupt; wake from deep sleep when wired to RST |
| D1 | 5 | Yes | Default SCL |
| D2 | 4 | Yes | Default SDA |
| D3 | 0 | Careful | Boot pin, must be high at boot (FLASH button) |
| D4 | 2 | Careful | Boot pin, onboard LED (active low) |
| D5 | 14 | Yes | SCK |
| D6 | 12 | Yes | MISO |
| D7 | 13 | Yes | MOSI |
| D8 | 15 | Careful | Boot pin, must be low at boot |
| RX, TX | 3, 1 | Avoid | Serial and uploads |
| A0 | ADC | Yes | Single analog input, 0 to 3.3 V |
- D0
- GPIO:
- 16
- Safe to use?:
- Partly
- Notes:
- No PWM/interrupt; wake from deep sleep when wired to RST
- D1
- GPIO:
- 5
- Safe to use?:
- Yes
- Notes:
- Default SCL
- D2
- GPIO:
- 4
- Safe to use?:
- Yes
- Notes:
- Default SDA
- D3
- GPIO:
- 0
- Safe to use?:
- Careful
- Notes:
- Boot pin, must be high at boot (FLASH button)
- D4
- GPIO:
- 2
- Safe to use?:
- Careful
- Notes:
- Boot pin, onboard LED (active low)
- D5
- GPIO:
- 14
- Safe to use?:
- Yes
- Notes:
- SCK
- D6
- GPIO:
- 12
- Safe to use?:
- Yes
- Notes:
- MISO
- D7
- GPIO:
- 13
- Safe to use?:
- Yes
- Notes:
- MOSI
- D8
- GPIO:
- 15
- Safe to use?:
- Careful
- Notes:
- Boot pin, must be low at boot
- RX, TX
- GPIO:
- 3, 1
- Safe to use?:
- Avoid
- Notes:
- Serial and uploads
- A0
- GPIO:
- ADC
- Safe to use?:
- Yes
- Notes:
- Single analog input, 0 to 3.3 V
Set up the ESP8266 in the Arduino IDE
- 1Add the ESP8266 board manager URL (from the esp8266/Arduino project) in File > Preferences.
- 2Install esp8266 by ESP8266 Community in Boards Manager.
- 3Select NodeMCU 1.0 (ESP-12E Module) or LOLIN(WEMOS) D1 R2 & mini, and your COM port.
#include <ESP8266WiFi.h>
void setup() {
Serial.begin(115200);
pinMode(LED_BUILTIN, OUTPUT);
WiFi.begin("YourNetwork", "YourPassword");
while (WiFi.status() != WL_CONNECTED) { delay(250); Serial.print("."); }
Serial.println(WiFi.localIP());
}
void loop() {
digitalWrite(LED_BUILTIN, LOW); // LED is active low
delay(500);
digitalWrite(LED_BUILTIN, HIGH);
delay(500);
}ESP8266 vs ESP32: should you still buy an ESP8266?
The ESP32 costs only a little more and adds a second core, Bluetooth, 18 ADC channels and far more GPIO. Buy an ESP8266 when you need a very small, cheap Wi-Fi node (D1 Mini), are following an older tutorial, or run the many Tasmota and ESPHome devices built on it. For anything new and ambitious, choose the ESP32.
Power and 5 V modules
Feed 5 V to the USB port or VIN pin; the onboard regulator makes 3.3 V. The pins are not 5 V tolerant, so a 5 V sensor output needs a level shifter or divider. The single ADC accepts 0 to 3.3 V on NodeMCU and D1 Mini thanks to an onboard divider, but only 0 to 1 V on a bare ESP-12 module.
Try it: ADC resolution calculator
Change the values and the diagram and results update as you type.
Common mistakes to avoid
- Using the printed D-number as a GPIO number in code (digitalWrite(1, ...) is TX, not D1).
- Pulling D3, D4 or D8 the wrong way at boot, so the board never starts.
- Expecting more than one analog input.
- Blocking the loop for long periods; the Wi-Fi stack needs the CPU back, or the watchdog resets the board. Use yield() or short delays.
- Feeding 5 V signals into the GPIO pins.
Frequently asked questions
What is the difference between ESP8266 and NodeMCU?
ESP8266 is the Wi-Fi chip. NodeMCU is a development board (and originally a Lua firmware) that puts the chip on a USB board with a regulator and pin headers.
How many GPIO pins does the ESP8266 have?
NodeMCU exposes 11 digital pins, but only about 5 (D1, D2, D5, D6, D7) are free of boot or serial duties. Plan around that.
Can I program an ESP8266 with the Arduino IDE?
Yes. Install the ESP8266 core via Boards Manager; most Arduino libraries and functions work with it.
Is the ESP8266 5 V tolerant?
Officially no. The chip maker rates GPIO at 3.6 V maximum. Use a level shifter for 5 V signals.
Which board is better, ESP8266 or ESP32?
The ESP32 for almost all new projects: more pins, two cores, Bluetooth and better ADC. The ESP8266 is fine for simple Wi-Fi switches and sensors where cost and size matter.
Parts for this guide
Calculators
Terms in this guide
Projects that use it
Put this into practice: 9 step-by-step builds in our project library use parts from this guide.
Keep learning
Sources
- ESP8266EX datasheet (Espressif Systems)
- ESP8266 Arduino core documentation (esp8266/Arduino)
- NodeMCU DevKit schematic
Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.



