Wemos D1 mini
Interactive Wemos D1 mini pinout with D-pin to GPIO mapping, boot pins and the A0 divider, Arduino IDE and PlatformIO setup, and a compile-checked blink.
Community draft — report a mistake
The D1 mini is a tiny ESP8266 board with just 16 pins, a CH340 USB chip and a huge ecosystem of stack-on shields — relays, sensors, displays and battery chargers that plug straight on top.
It uses the same chip and the same boot rules as the NodeMCU, so code moves between them freely. Use the D-names in Arduino code (D1, D2 …) and the pinout below to find the GPIO number behind each one.
Its single analog input A0 has a divider on the board, so it reads roughly 0–3.2 V directly. Anything above 3.3 V on any pin can damage the chip.
Interactive pinout
Hover or tap a pin for its functions and traps. Filter to light up every I2C, ADC or boot pin.
- Safe for most uses
- Works, with a caveat
- Avoid unless you know why
- Power / control
D3, D4 high and D8 low at boot. Same ESP8266 boot rules as the NodeMCU. The built-in LED sits on D4, which is why it lights when D4 is LOW.
Made for stacking shields. Relay, DHT, OLED and battery shields plug straight on top. Check which pins each shield uses so two shields don't share one.
3.3 V logic. Power it with 5 V on the 5V pin or USB; keep every signal on the GPIOs at 3.3 V.
Set up your computer
- Install Arduino IDE 2.x from arduino.cc.
- File → Preferences → Additional boards manager URLs:
https://arduino.esp8266.com/stable/package_esp8266com_index.json - Boards Manager → install esp8266 by ESP8266 Community (we compile against esp8266 3.1.2).
- Tools → Board → LOLIN(WEMOS) D1 R2 & mini, then pick the port that appears when you plug the board in.
Your platformio.ini:
[env:d1_mini]
platform = espressif8266
board = d1_mini
framework = arduino
monitor_speed = 115200[env:d1_mini] platform = espressif8266 board = d1_mini framework = arduino monitor_speed = 115200
- Download the firmware from micropython.org.
- Flash it with
esptool(erase first), then open Thonny → Interpreter → MicroPython (ESP8266).
First program
// First program for the Wemos D1 mini (ESP8266): blink the built-in LED on D4 (GPIO2).
// The LED is INVERTED (LOW = on), and D4 must be high at boot.
void setup() {
Serial.begin(115200);
pinMode(LED_BUILTIN, OUTPUT);
Serial.println();
Serial.println(F("FlashReady: D1 mini blink"));
}
void loop() {
digitalWrite(LED_BUILTIN, LOW); // on
delay(500);
digitalWrite(LED_BUILTIN, HIGH); // off
delay(500);
}// First program for the Wemos D1 mini (ESP8266): blink the built-in LED on D4 (GPIO2).
// The LED is INVERTED (LOW = on), and D4 must be high at boot.
void setup() {
Serial.begin(115200);
pinMode(LED_BUILTIN, OUTPUT);
Serial.println();
Serial.println(F("FlashReady: D1 mini blink"));
}
void loop() {
digitalWrite(LED_BUILTIN, LOW); // on
delay(500);
digitalWrite(LED_BUILTIN, HIGH); // off
delay(500);
}Components with Wemos D1 mini
- BH1750 lux sensor (GY-302) Arduino C++
- BME280 breakout Arduino C++
- Capacitive soil moisture sensor v1.2 Arduino C++
- DHT11 Arduino C++
- DHT22 (AM2302) Arduino C++
- DS18B20 (1-Wire) Arduino C++
- HC-SR04 ultrasonic sensor Arduino C++
- 16×2 LCD + I2C backpack Arduino C++
- HC-SR501 PIR motion sensor Arduino C++
- RC522 RFID reader (MFRC522, 13.56 MHz) Arduino C++
- 1-channel relay module (5 V coil) Arduino C++
- SG90 micro servo (9 g) Arduino C++
- SSD1306 OLED 0.96″ (128×64, I2C) Arduino C++
- TP4056 Li-ion charger module (with DW01A protection) Arduino C++
- WS2812B addressable RGB LED strip (NeoPixel) Arduino C++
Common errors
Upload fails on a new PC
Install the CH340 driver from wch-ic.com and use a data micro-USB cable.
Relay shield clicks but the board stops booting
The relay shield uses D1 by default; if yours was re-jumpered to D3, D4 or D8 it can upset the boot pins. Move it back to D1.
Deep sleep never wakes up
Wire D0 to RST — the ESP8266 wakes by resetting itself through GPIO16.