Aziz Bench

Wemos D1 mini pinout (ESP8266)

The D1 mini prints D0 to D8 on the board, but ESP8266 code also uses GPIO numbers. Tap a pin to see both, or list the pins of your project: the planner flags boot pins, the limits of D0 and the fixed SPI pins.

Wemos D1 mini · 16 pins
  • Free to use
  • Use with care
  • Input only
  • Power and control
Add pin

My pin plan

    No pins yet. Pick a pin on the map, or add one with the form.

    Ready to paste at the top of a sketch or in an issue.

    From D-labels to GPIO numbers

    D0 is GPIO16, D1 GPIO5, D2 GPIO4, D3 GPIO0, D4 GPIO2, D5 GPIO14, D6 GPIO12, D7 GPIO13 and D8 GPIO15. In the Arduino core for the ESP8266 you can write either D5 or 14: with the D1 mini board selected, the D constants point to the right GPIO.

    D3, D4 and D8: boot pins

    The ESP8266 reads three pins at reset: GPIO0 (D3) and GPIO2 (D4) must be HIGH and GPIO15 (D8) LOW to run your sketch. The board already sets these levels with resistors, so the pins work as outputs and for buttons as long as nothing forces the wrong level at power-up. D4 also drives the blue LED of the module, lit when the pin is LOW.

    PinOn the D1 miniNeeded at resetIn practice
    D3 · GPIO0Pulled HIGHHIGH runs the sketch, LOW enters flashing modeA button to GND is fine
    D4 · GPIO2Pulled HIGH, LEDHIGHDon’t pull it LOW at power-up
    D8 · GPIO15Pulled LOWLOWNo pull-up, no module that drives it HIGH

    D0, the special pin

    GPIO16 (D0) can’t trigger interrupts and has no internal pull-up, only a pull-down. Its main job is waking the board from deep sleep: wire D0 to RST and ESP.deepSleep() wakes the board with its timer. WEMOS lists it as the only pin without interrupt, PWM, I²C and 1-Wire support.

    Analog input and buses

    A0 is the only analog input. The bare ESP8266 accepts 0 to 1.0 V, and the D1 mini has a divider that raises the range to about 3.2 V. I²C runs in software on almost any pin, by default D2 (SDA) and D1 (SCL). SPI uses the fixed hardware pins D5 (SCK), D6 (MISO) and D7 (MOSI), with CS on D8 by default. TX and RX go to the USB-serial chip.

    Full D1 mini pin table

    PinGPIOStatusAnalogFunctionsNotes
    D3GPIO0Use with careNoPWM (analogWrite)boot: HIGH
    TXGPIO1Use with careNoPWM (analogWrite), U0TXDserial TX, UART TX
    D4GPIO2Use with careNoPWM (analogWrite), U1TXD (Serial1)boot: HIGH, LED
    RXGPIO3Use with careNoPWM (analogWrite), U0RXDserial RX, UART RX
    D2GPIO4Free to useNoPWM (analogWrite)I²C SDA
    D1GPIO5Free to useNoPWM (analogWrite)I²C SCL
    D6GPIO12Free to useNoPWM (analogWrite), HSPI MISOSPI MISO (RX)
    D7GPIO13Free to useNoPWM (analogWrite), HSPI MOSI, RXD2 (Serial.swap)SPI MOSI (TX)
    D5GPIO14Free to useNoPWM (analogWrite), HSPI SCKSPI SCK
    D8GPIO15Use with careNoPWM (analogWrite), HSPI CS, TXD2 (Serial.swap)boot: LOW, SPI CS
    D0GPIO16Use with careNoPWM (analogWrite)no interrupts, deep-sleep wake
    A0NoInput onlyADC (TOUT)Noanalog only, 0 to 3.2 V

    GPIO 6 to 11 are wired to the module’s flash and are not on the header. The pins work at 3.3 V and are not rated for 5 V, so use a level shifter for 5 V signals.

    Frequently asked questions

    Which D1 mini pins are safe to use?

    D1, D2, D5, D6 and D7 (GPIO 5, 4, 14, 12 and 13) have no boot role and support interrupts and PWM. D3, D4 and D8 are boot pins, D0 has limits, and TX and RX belong to the serial port.

    What is the maximum voltage on A0 of the D1 mini?

    About 3.2 V, thanks to the divider on the board. The ESP8266 itself accepts 0 to 1.0 V on its ADC, so bare modules need their own divider.

    How do I wake the D1 mini from deep sleep?

    Connect D0 (GPIO16) to RST and call ESP.deepSleep() with the sleep time in microseconds. When the time is up, GPIO16 pulls RST LOW and the board restarts.

    Why doesn’t my D1 mini start with something connected to D8?

    D8 is GPIO15, which must be LOW at reset. A module or an external pull-up that holds it HIGH makes the ESP8266 choose another boot mode. Move that connection to D1, D2 or D5 to D7.

    Which pins are I2C and SPI on the D1 mini?

    I²C defaults to D2 (SDA) and D1 (SCL), and Wire.begin(SDA, SCL) moves it to most other pins. SPI uses D5 (SCK), D6 (MISO) and D7 (MOSI), with CS usually on D8.