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.
| Feature | D1 R2 | D1 Mini |
|---|---|---|
| Microcontroller | ESP8266EX | ESP8266EX |
| Operating Voltage | 3.3V | 3.3V |
| USB Connection | Micro USB | Micro USB |
| Wi-Fi | Built-in | Built-in |
| Size | Arduino Uno footprint | Very small (breadboard-friendly) |
Step 2: Setting Up the Arduino IDE
Before uploading code, you’ll need to add ESP8266 board support:
- Open Arduino IDE.
- Go to File → Preferences.
- In Additional Boards Manager URLs, paste this line:
https://arduino.esp8266.com/stable/package_esp8266com_index.json - Open Tools → Board → Boards Manager.
- 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
- Go to Tools → Board and choose
“LOLIN(WEMOS) D1 R2 & Mini” - Plug your board in with a Micro-USB cable.
- 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.