Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use WEMOS D1 R1: Examples, Pinouts, and Specs

Image of WEMOS D1 R1Design with WEMOS D1 R1 in Cirkit Designer

Introduction

The WEMOS D1 R1 is a microcontroller board based on the ESP8266 Wi-Fi module, designed specifically for Internet of Things (IoT) applications. It combines the power of the ESP8266 with the ease of use of an Arduino-like form factor, making it an excellent choice for both beginners and experienced developers. The board features a USB interface for programming, multiple GPIO pins for connecting sensors and actuators, and built-in Wi-Fi capabilities for seamless wireless communication.

Explore Projects Built with WEMOS D1 R1

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of Wi-Fi Controlled RGB LED Strip with Battery Management System: A project utilizing WEMOS D1 R1 in a practical application
Wi-Fi Controlled RGB LED Strip with Battery Management System

This circuit features a Wemos D1 Mini microcontroller powered by a 18650 Li-ion battery through a TP4056 charging module, with power control managed by a rocker switch. The Wemos D1 Mini controls a WS2812 RGB LED strip, with the data line connected to the D4 pin and power lines controlled by the switch. Multiple pushbuttons are connected to the D0 pin through a resistor, likely for user input to control the LED strip or other functions in the microcontroller's code.

Open Project in Cirkit Designer
Image of Wemos D1 Mini Based Environmental Monitoring System with Solar Charging: A project utilizing WEMOS D1 R1 in a practical application
Wemos D1 Mini Based Environmental Monitoring System with Solar Charging

This circuit features a Wemos D1 Mini microcontroller interfaced with a pushbutton, a voltage sensor, an AHT21 temperature and humidity sensor, and an L298N motor driver controlling a linear actuator. The Wemos D1 Mini is powered by a 5V supply from an XL4015 DC-DC buck converter, which steps down the voltage from a 12V AGM battery charged by a solar panel through an MPPT charge controller. The microcontroller reads the voltage sensor data and controls the actuator based on programmed logic, while the pushbutton provides user input and the AHT21 sensor monitors environmental conditions.

Open Project in Cirkit Designer
Image of Battery-Powered Wi-Fi Temperature and Humidity Monitor with Wemos D1 Mini and DHT22: A project utilizing WEMOS D1 R1 in a practical application
Battery-Powered Wi-Fi Temperature and Humidity Monitor with Wemos D1 Mini and DHT22

This circuit appears to be a sensor node with a DHT22 temperature and humidity sensor interfaced with a Wemos D1 Mini microcontroller. The Wemos D1 Mini is powered by a 18650 Li-ion battery, which is charged and protected by a TP4056 charging module. The sensor's data output is connected to the D4 pin of the Wemos D1 Mini for digital signal processing, and voltage dividers made of resistors are likely used for level shifting or pull-up/pull-down purposes.

Open Project in Cirkit Designer

Common Applications and Use Cases

Technical Specifications

Key Technical Details

Pin Configuration and Descriptions

The WEMOS D1 R1 has a pinout similar to the Arduino UNO, but with some differences due to the ESP8266 architecture. Below is the pin configuration:

Pin Label Description
1 D0 GPIO16, can be used as a digital I/O pin
2 D1 GPIO5, supports I2C (SCL)
3 D2 GPIO4, supports I2C (SDA)
4 D3 GPIO0, can be used as a digital I/O pin
5 D4 GPIO2, can be used as a digital I/O pin
6 D5 GPIO14, supports SPI (SCLK)
7 D6 GPIO12, supports SPI (MISO)
8 D7 GPIO13, supports SPI (MOSI)
9 D8 GPIO15, supports SPI (SS)
10 A0 Analog input, 0-3.3V, 10-bit resolution
11 G Ground pin
12 3V3 3.3V output for powering external components
13 5V 5V output (only available when powered via USB or barrel jack)
14 RST Reset pin, used to restart the microcontroller

Usage Instructions

How to Use the WEMOS D1 R1 in a Circuit

  1. Powering the Board:

    • Use a Micro-USB cable to power the board and upload code.
    • Alternatively, supply 7-12V via the barrel jack or 5V directly to the 5V pin.
  2. Programming the Board:

    • Install the Arduino IDE and add the ESP8266 board package via the Board Manager.
    • Select "WEMOS D1 R1" as the board type in the Tools menu.
    • Connect the board to your computer via USB and upload your code.
  3. Connecting Sensors and Actuators:

    • Use the GPIO pins (D0-D8) for digital input/output.
    • Use the A0 pin for analog input (ensure the input voltage does not exceed 3.3V).
    • For I2C devices, connect to D1 (SCL) and D2 (SDA).
    • For SPI devices, use D5 (SCLK), D6 (MISO), D7 (MOSI), and D8 (SS).
  4. Wi-Fi Configuration:

    • Use the ESP8266WiFi library to connect the board to a Wi-Fi network.
    • The board can act as a client or an access point (AP).

Example Code: Connecting to Wi-Fi

Below is an example sketch to connect the WEMOS D1 R1 to a Wi-Fi network:

#include <ESP8266WiFi.h> // Include the Wi-Fi library

const char* ssid = "Your_SSID";       // Replace with your Wi-Fi network name
const char* password = "Your_Password"; // Replace with your Wi-Fi password

void setup() {
  Serial.begin(115200); // Start the serial communication at 115200 baud
  delay(10);

  Serial.println("Connecting to Wi-Fi...");
  WiFi.begin(ssid, password); // Start connecting to the Wi-Fi network

  while (WiFi.status() != WL_CONNECTED) {
    delay(500); // Wait for the connection to establish
    Serial.print(".");
  }

  Serial.println("\nWi-Fi connected!");
  Serial.print("IP Address: ");
  Serial.println(WiFi.localIP()); // Print the assigned IP address
}

void loop() {
  // Add your main code here
}

Important Considerations and Best Practices

Troubleshooting and FAQs

Common Issues and Solutions

  1. Problem: The board is not detected by the Arduino IDE.
    Solution:

    • Ensure the correct USB driver is installed (e.g., CH340 driver for some versions of the WEMOS D1 R1).
    • Check that the correct board and port are selected in the Tools menu.
  2. Problem: The board fails to connect to Wi-Fi.
    Solution:

    • Double-check the SSID and password in your code.
    • Ensure the Wi-Fi network is within range and not using unsupported security protocols.
  3. Problem: GPIO pins are not functioning as expected.
    Solution:

    • Verify that the pins are not being used for multiple purposes (e.g., GPIO15 is also used for SPI SS).
    • Check for proper wiring and connections.
  4. Problem: The board resets unexpectedly.
    Solution:

    • Ensure the power supply is stable and capable of providing sufficient current (at least 500mA).
    • Avoid using long or thin wires for power connections.

FAQs