Source: https://mokxi.com/learn/d1-mini-pinout
Updated: 2026-11-08

Learn

# Wemos D1 mini pinout: D0 to D8, GPIO numbers and boot pins

Beginner

Written by the Mokxi team, updated November 8, 2026

Start building free Open the editor

Or see every lesson.

- 505 parts on the bench
- 45 boards running now
- 1.00x real time, on every board

Click to open it in the editor

The blue LED on D4 (GPIO 2) lights on LOW, the wired LED on D1 (GPIO 5) on HIGH, so they take turns.

The Wemos D1 mini, now sold as the LOLIN D1 mini, is an ESP8266 on a board 34.2 by 25.6 mm with two rows of eight holes. Its silkscreen says D0 to D8, and those are not GPIO numbers: D1 is GPIO 5, D4 is GPIO 2. This page gives the GPIO number behind every hole, what each one can do, the three pins that decide whether the board boots, and which pin to use for what.

The circuit above is the board in Mokxi, blinking the module’s blue LED on D4 and an LED wired to D1. The two are always opposite, because the blue LED lights on LOW. The table is held to the same board model the simulator runs, and where the simulator does less than the board, the page says so.

## Every pin, with its GPIO number

With the antenna at the top, the left row reads RST, A0, D0, D5, D6, D7, D8 and 3V3, and the right row reads TX, RX, D1, D2, D3, D4, GND and 5V. The ESP8266 Arduino core defines D0 to D8, so in a sketch digitalWrite(D1, HIGH) and digitalWrite(5, HIGH) are the same pin. Writing digitalWrite(2, HIGH) drives D4, not D2, and that is the mistake this board is best at causing.

The board is the NodeMCU’s chip with only the pins that do something: the six flash wires, the reserved pins, EN and the second LED are not brought out, so there are no holes here that you must never touch.

Wemos D1 mini: the left row top to bottom, then the right, antenna at the top
Pin | GPIO | What it can do | Watch out for

RST | - | Reset: low restarts the chip; the button does that. | Not a GPIO.

A0 | - | The one analog input, 0 to about 3.2 V through the board’s divider. Ten bits. | Not a GPIO: it cannot be written.

D0 | 16 | Digital in and out, software PWM. Wired to RST, it wakes the chip from deep sleep. | No interrupt, and a pull-down rather than a pull-up.

D5 | 14 | PWM. SPI SCK (default). | -

D6 | 12 | PWM. SPI MISO (default). | -

D7 | 13 | PWM. SPI MOSI (default). | -

D8 | 15 | PWM. SPI SS (default). | Strapping pin, pulled down on the board: must be low at boot.

3V3 | - | The regulator’s 3.3 V output. | Not a GPIO.

TX | 1 | UART0 TX: Serial, and the USB-to-serial chip. | Leave free, or uploads and the serial monitor break.

RX | 3 | UART0 RX: Serial, and the USB-to-serial chip. | Leave free, or uploads and the serial monitor break.

D1 | 5 | PWM. I2C SCL (default). | A safe all-rounder.

D2 | 4 | PWM. I2C SDA (default). | A safe all-rounder.

D3 | 0 | PWM. | Strapping pin, pulled up on the board: low at boot waits for an upload.

D4 | 2 | PWM. The blue LED, lit when LOW. UART1 TX on the chip. | Strapping pin, pulled up on the board: must be high at boot.

GND | - | Ground. | -

5V | - | USB 5 V with a cable in; put 5 V here to run the board without one. | Not a GPIO.

## Boot pins: D3, D4 and D8

The ESP8266 reads three pins as it comes out of reset. GPIO 0 (D3) and GPIO 2 (D4) must be high and GPIO 15 (D8) must be low for it to run your program, and GPIO 0 low means "wait for an upload". The board holds them the right way with a pull-up on D3 and D4 and a pull-down on D8, which is why those three are the ones to be careful with.

So: a button to ground on D3 or D4 is fine as long as nobody holds it at power-on. A module that pulls D8 high, or one that pulls D3 or D4 low, will stop the board booting. Mokxi does not model the boot strapping and starts whatever is wired there, so check those three before you build a circuit from here on a desk.

## Power pins and their limits

5V is the USB rail, and the input when there is no cable: put 5 V on it to run the board from a supply. 3V3 is the regulator’s output, which powers the ESP8266 and whatever small sensor you add. GND is ground.

The ESP8266 is a 3.3 V chip and its pins are not 5 V tolerant. Espressif’s datasheet gives a pin a maximum drive of 12 mA, much less than an Uno’s, so an LED wants a larger resistor than you might be used to, and anything bigger than an LED wants a transistor. Mokxi does not model the regulator’s limits.

## The onboard LED, A0 and D0

The blue LED is on the ESP-12F module, on GPIO 2, which is D4. It is wired from 3.3 V to the pin, so it lights when the pin is LOW. LED_BUILTIN is 2. GPIO 2 is also UART1’s TX on the chip, which is why the LED flickers on a board that uses Serial1. Mokxi does not model UART1.

A0 is the only analog input the ESP8266 has. The chip’s own pin reads 0 to 1.0 V, and the D1 mini puts a 220k and 100k divider in front of it, so the hole reads 0 to about 3.2 V and a pot across 3V3 nearly spans the range. Ten bits, 0 to 1023. Mokxi models the divider. A0 is not a GPIO.

D0 is GPIO 16, which belongs to the chip’s RTC rather than its GPIO block. It has a pull-down where every other pin has a pull-up, it cannot raise an interrupt, and on a real board it is the pin you wire to RST to wake from deep sleep. Mokxi does not model deep sleep.

## PWM, I2C and SPI

The ESP8266 has no PWM hardware, so analogWrite is software: the core moves the pin itself from a timer. Any of D0 to D8 can do it, and the range is 0 to 1023 rather than 0 to 255, so analogWrite(D1, 255) is a quarter brightness. analogWriteRange(255) makes an Uno sketch behave.

I2C is software on this chip too, on D2 for SDA and D1 for SCL by default. SPI is SCK on D5, MISO on D6, MOSI on D7 and SS on D8. Because D8 must be low at boot, an SPI device whose chip-select pulls it high can stop the board starting; give that device another chip-select pin.

Open this circuit in the editor. D1 mini: blink, wired as it runs at the top of this page. Change a part or a value and run it again.
Open the circuit

## Questions

Which D1 mini pin should I use for a button?

D1, D2, D5, D6 or D7, with `INPUT_PULLUP` and the button to ground. D0 has no pull-up and no interrupt, and D3, D4 and D8 are the boot pins.

What are the I2C pins on a D1 mini?

SDA is D2 (GPIO 4) and SCL is D1 (GPIO 5), the pins `Wire.begin()` uses. Most D1 mini shields with an I2C sensor use the same two.

Which pin should I use for a WS2812 strip on a D1 mini, as in WLED?

WLED’s default data pin on an ESP8266 is GPIO 2, which is D4, the blue LED’s pin, so the LED flickers with the data. Mokxi does not drive a WS2812 strip from this board.

Is D1 the same as GPIO 1?

No. D1 is GPIO 5. GPIO 1 is TX. Write `D1` in your sketch and the core turns it into the right number.

Is the D1 mini pinout the same as the NodeMCU?

The D numbers mean the same GPIOs on both, so a sketch moves across unchanged. The NodeMCU brings out more holes, including the flash pins, and has a second LED on D0.

Related

## Keep going

NodeMCU Pinout: ESP8266 D0-D8 to GPIO, Pins to Avoid ESP32 DevKit V1 Pinout: Every Pin and Which to Avoid Connect a Board to WiFi and Serve a Page Run the Wemos D1 mini in the simulator Help: the D1 mini model The project page, with the full sketch Beginner

Sources

## Where the facts on this page come from

- LOLIN (Wemos): the D1 mini’s pins and specification
- Espressif: ESP8266EX datasheet (pins, drive current, ADC)
- The ESP8266 Arduino core reference: digital IO, analogWrite and the boot pins

## Build this for real

Open the editor, change a value and watch the number move with it. Nothing to install, and no account needed.

Start building free Open the editor
