📌 Introduction
If you are starting with IoT projects or home automation, then the Wemos D1 Mini V2 is one of the best and cheapest Wi-Fi microcontroller boards you can use.
I’m Asif Khan, and I’ve personally used this module in real-world projects like:
- Face recognition door systems
- Home automation using Flutter + Django + MQTT
- Smart attendance systems
In this blog, I’ll explain how to program Wemos D1 Mini V2 from scratch, in simple language, exactly the way I teach my students.
No confusing theory — only practical steps ✅
🔍 What is Wemos D1 Mini V2?
The Wemos D1 Mini V2 is a compact development board based on the ESP8266 Wi-Fi chip.
It is powerful, small in size, and perfect for production-ready IoT projects.
✅ Key Features
- Built-in Wi-Fi
- ESP8266EX chipset
- Works with Arduino IDE
- Powered by USB
- Very low cost
- Perfect for home automation & IoT
🧰 What You Need Before Programming
Before we start programming, keep these things ready:
🧱 Hardware
- Wemos D1 Mini V2
- Micro USB cable
- Laptop / PC (Windows / Linux / macOS)
💻 Software
- Arduino IDE
- USB driver (usually auto-installed)
🛠 Step 1: Install Arduino IDE
Download and install Arduino IDE from the official Arduino website.
After installation:
- Open Arduino IDE
- Go to File → Preferences
- In Additional Board Manager URLs, paste this:
http://arduino.esp8266.com/stable/package_esp8266com_index.json
Click OK.
⚙️ Step 2: Install ESP8266 Board Package
- Go to Tools → Board → Boards Manager
- Search for ESP8266
- Install “esp8266 by ESP8266 Community”
Now your Arduino IDE is ready to program Wemos D1 Mini.
🔌 Step 3: Select Correct Board & Port
Go to Tools → Board and select:
LOLIN (Wemos) D1 R2 & mini
Then:
- Connect Wemos D1 Mini using USB
- Go to Tools → Port
- Select the correct COM port
💡 Step 4: First Program – LED Blink
This is the hello world of microcontrollers.
🔴 LED Pin
Wemos D1 Mini has a built-in LED connected to GPIO 2 (D4).
✅ Blink Code
Copy and paste this code into Arduino IDE:
#define LED_PIN D4
void setup() {
pinMode(LED_PIN, OUTPUT);
}
void loop() {
digitalWrite(LED_PIN, LOW); // LED ON
delay(1000);
digitalWrite(LED_PIN, HIGH); // LED OFF
delay(1000);
}
Now click Upload 🚀
If the LED starts blinking — congratulations!
Your Wemos D1 Mini is programmed successfully 🎉
📶 Step 5: Connecting Wemos D1 Mini to Wi-Fi
This is where IoT becomes powerful.
#include <ESP8266WiFi.h>
const char* ssid = "YOUR_WIFI_NAME";
const char* password = "YOUR_WIFI_PASSWORD";
void setup() {
Serial.begin(9600);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("\nWiFi Connected");
Serial.println(WiFi.localIP());
}
void loop() {
}
Open Serial Monitor (9600 baud) to see the IP address.
🚀 Real-World Projects You Can Build
From my experience, you can build:
- Smart Home Automation
- Face Recognition Door Lock
- Office Attendance System
- IoT Device Health Monitoring
- MQTT-based Control Systems
- Smart Switch Boards
This same module is used in commercial installations also.
❓ Common Problems & Solutions
❌ Upload Error?
- Change USB cable
- Select correct COM port
- Re-install ESP8266 board
❌ LED Not Blinking?
- Remember: LOW = ON, HIGH = OFF (built-in LED logic)
🧠 Why I Personally Recommend Wemos D1 Mini V2
As someone working in defense-level and production projects, I recommend this board because:
✔ Stable
✔ Cheap
✔ Easy to replace
✔ Huge community support
✔ Works perfectly with Django + MQTT
📌 Final Words
If you are serious about IoT, automation, or smart systems, learning Wemos D1 Mini V2 programming is a must.
I hope this guide helped you understand everything step by step, without confusion.
📞 Need Help or Source Code?
👉 WhatsApp: https://wa.me/919525845873
👉 Email: support@apycoder.com
👉 YouTube: Search ApyCoder
👉 Blog: More tutorials coming soon
