prefixkit Ask an engineerAsk Support RU

Smart home

ESP8266 (Wemos D1 mini, NodeMCU) pinout

ESP8266 (Wemos D1 mini, NodeMCU) pin table: which GPIOs are free for sensors and relays, which affect booting (strapping), are taken by flash, USB or are input only, and where the ADC and I²C are. With an ESPHome example.

6 safe 5 with care 7 avoid

GPIOBoard labelUse?FunctionsNotes
GPIO16D0with careWake from deep sleepNo interrupts, PWM or I²C. Connect to RST for deep sleep. Has a pull-down, not a pull-up.
GPIO5D1safeI²C SCLFree; default I²C clock.
GPIO4D2safeI²C SDAFree; default I²C data.
GPIO0D3with careFLASH buttonStrapping pin: LOW at boot = flash mode. Has a pull-up. OK for a button or DS18B20.
GPIO2D4with careBuilt-in LED, TX1Strapping pin: must be HIGH at boot. Built-in LED (on when LOW).
GPIO14D5safeSPI CLKFree.
GPIO12D6safeSPI MISOFree.
GPIO13D7safeSPI MOSIFree.
GPIO15D8with careSPI CSStrapping pin: must be LOW at boot (has a pull-down). Fine for outputs such as a relay.
GPIO3RXwith careUART RXSerial RX; usable as an input if you do not need serial logs.
GPIO1TXavoidUART TXSerial TX: logs and flashing.
GPIO6avoidSPI flashConnected to the flash (not on the D1 mini header).
GPIO7avoidSPI flashConnected to the flash (not on the D1 mini header).
GPIO8avoidSPI flashConnected to the flash (not on the D1 mini header).
GPIO9avoidSPI flashConnected to the flash (not on the D1 mini header).
GPIO10avoidSPI flashConnected to the flash (not on the D1 mini header).
GPIO11avoidSPI flashConnected to the flash (not on the D1 mini header).
A0A0safeADCThe only analog input: 0–1 V on the chip, 0–3.2 V on the D1 mini (divider on the board).

Boards route pins differently: check your board’s schematic. Strapping pins are read at power-on; if a sensor or button pulls one the wrong way, the board will not boot or will enter flash mode.

ESPHome example

esp8266:
  board: d1_mini

i2c:
  sda: GPIO4
  scl: GPIO5

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO13
      mode: INPUT_PULLUP
      inverted: true
    name: "Button"

A full config with sensors, keys and a pin clash check: ESPHome generator. Other boards: ESP32, ESP32-C3, ESP32-S3.

Where to buy

AliExpress

Links open a search in the shop; some are affiliate links: buying through them costs you nothing extra and supports this site. We do not sell devices or get them from manufacturers.

Idea?