Learn LOLIN WEMOS D1 R2 & Mini – Step-by-Step Guide

LOLIN (WEMOS) D1 R2 & Mini – A Beginner’s Guide

If you’ve been curious about Wi-Fi-enabled microcontrollers, the LOLIN (WEMOS) D1 R2 and D1 Mini are excellent starting points. These boards are powered by the ESP8266 chip, giving you built-in Wi-Fi, great performance, and full Arduino IDE compatibility — all at a super affordable price.

This guide walks you through getting started, from setup to your first working sketch.


Step 1: Meet the Boards

The D1 R2 resembles an Arduino Uno in shape but runs on 3.3 volts and has Wi-Fi built in.
The D1 Mini, on the other hand, is much smaller — roughly the size of a postage stamp — making it ideal for breadboards and compact IoT projects.

Both boards share the same brain: the ESP8266EX microcontroller.

FeatureD1 R2D1 Mini
MicrocontrollerESP8266EXESP8266EX
Operating Voltage3.3V3.3V
USB ConnectionMicro USBMicro USB
Wi-FiBuilt-inBuilt-in
SizeArduino Uno footprintVery small (breadboard-friendly)

Step 2: Setting Up the Arduino IDE

Before uploading code, you’ll need to add ESP8266 board support:

  1. Open Arduino IDE.
  2. Go to File → Preferences.
  3. In Additional Boards Manager URLs, paste this line: https://arduino.esp8266.com/stable/package_esp8266com_index.json
  4. Open Tools → Board → Boards Manager.
  5. Search for ESP8266 and install the package by “ESP8266 Community.”

That’s it — your IDE can now recognize ESP8266-based boards.


Step 3: Select the LOLIN (WEMOS) Board

  1. Go to Tools → Board and choose
    “LOLIN(WEMOS) D1 R2 & Mini”
  2. Plug your board in with a Micro-USB cable.
  3. Select the correct COM port under Tools → Port.

You’re ready to code!


Step 4: Blink an LED

Try this simple example to confirm your setup:

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  digitalWrite(LED_BUILTIN, LOW);  // LED on
  delay(500);
  digitalWrite(LED_BUILTIN, HIGH); // LED off
  delay(500);
}

Upload the sketch — the onboard LED should start blinking.
That’s your first success with the D1 board!


Step 5: Connect to Wi-Fi

Now let’s get your board online:

#include <ESP8266WiFi.h>

const char* ssid = "YourNetwork";
const char* password = "YourPassword";

void setup() {
  Serial.begin(115200);
  WiFi.begin(ssid, password);
  Serial.print("Connecting to Wi-Fi");
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("\nConnected!");
  Serial.print("IP Address: ");
  Serial.println(WiFi.localIP());
}

void loop() {}

After uploading, open Serial Monitor at 115200 baud.
You’ll see connection progress dots, then your device’s IP address.


Step 6: Add-On Shields and Expansions

The D1 Mini supports stackable shields — like relay modules, OLED displays, motor drivers, and sensors.
This modular approach makes it easy to experiment and build layered IoT systems quickly.

For example, stack a DHT11 shield to read temperature and humidity, or an OLED shield to show live sensor data right on the board.


Tips & Good Habits

  • Always power sensors from 3.3V.
  • Avoid GPIO0, GPIO2, and GPIO15 for general use — they affect boot modes.
  • If uploads fail, hold the RESET button or use the FLASH button while uploading.

Step 7: What’s Next?

Now that your board is online, you can:

  • Send sensor data to a dashboard
  • Control LEDs and motors over Wi-Fi
  • Host a web server from the board itself

With just a few lines of Arduino code, the LOLIN (WEMOS) D1 R2 & Mini opens the door to endless IoT possibilities.