MakerLab
ESP32Wemos D1 R2

Wemos D1 R2: Your Gateway to ESP8266 Power

A compact and versatile development board featuring the ESP8266 Wi-Fi SoC, ideal for IoT projects.

Wemos D1 R2

The Wemos D1 R2 is a popular and affordable microcontroller development board built around the ESP8266EX System-on-Chip (SoC). Released around 2016, it quickly gained traction among makers and hobbyists for its integrated Wi-Fi capabilities and accessible price point. This board is essentially a simplified, cost-effective platform designed to make it easier to get started with the ESP8266, offering a familiar Arduino-like form factor and pinout.

At its heart, the ESP8266EX is a highly integrated Wi-Fi microcontroller developed by Espressif Systems. It boasts a Tensilica L106 32-bit RISC microprocessor core, capable of running at speeds up to 160 MHz. The SoC includes a full TCP/IP stack and a comprehensive Wi-Fi networking subsystem, allowing devices to connect to a Wi-Fi router and establish direct or mediated connections with other devices on the internet or local network. This makes it a powerful choice for Internet of Things (IoT) applications without requiring a separate Wi-Fi module.

The Wemos D1 R2 occupies a significant niche by bridging the gap between basic microcontrollers like the Arduino Uno and more complex embedded systems. Its compact size, breadboard-friendly layout (using standard 0.1" headers), and the availability of libraries for the Arduino IDE make it an excellent choice for beginners looking to experiment with Wi-Fi connectivity. However, its capabilities also extend to more advanced users who can leverage its processing power and networking features for more sophisticated projects.

Historically, the Wemos D1 R2 represented a significant step forward in making Wi-Fi accessible for low-cost embedded projects. Before the widespread adoption of ESP8266-based boards, adding Wi-Fi to a microcontroller project typically involved more expensive and complex modules. The Wemos D1 R2 democratized this capability, enabling a surge in DIY IoT projects, smart home devices, and wireless sensor networks. It's particularly suited for makers who need to send data to the cloud, control devices remotely, or build simple web servers on a budget.

Watch

Related video, embedded from YouTube.

Specifications

Microcontroller / SoCESP8266EX
Architecture32-bit RISC Tensilica L106
Clock speedTypically 80 MHz (can be configured up to 160 MHz)
Flash / Storage4MB (onboard SPI flash)
RAM / SRAM80KB (internal SRAM)
Operating voltage3.3V
Digital I/O pins11 (GPIO0-16, excluding some internal use)
Analog / ADC1 (ADC0 - GPIO17)
PWMYes (up to 6 channels)
ConnectivityWi-Fi 802.11 b/g/n
USBMicro USB connector (for power and programming)
Power input5V via Micro USB or 3.3V pin
DimensionsApprox. 25.6mm x 48.6mm

Pinout & pin functions

PinFunction
3V33.3V Power Output
GNDGround
D0 (GPIO16)General Purpose Input/Output, Deep Sleep Wakeup
D1 (GPIO5)General Purpose Input/Output, I2C SCL
D2 (GPIO4)General Purpose Input/Output, I2C SDA
D3 (GPIO0)General Purpose Input/Output, Boot mode selection
D4 (GPIO2)General Purpose Input/Output, Boot mode selection
D5 (GPIO14)General Purpose Input/Output, SPI SCK
D6 (GPIO12)General Purpose Input/Output, SPI MISO, HSPI Clock
D7 (GPIO13)General Purpose Input/Output, SPI MOSI, HSPI MOSI
D8 (GPIO15)General Purpose Input/Output, SPI CS, HSPI MISO
RX (GPIO3)UART Receive, Programming
TX (GPIO1)UART Transmit, Programming
ADCAnalog-to-Digital Converter input (connects to GPIO17)
RSTReset Pin (Active Low)

Wiring & circuit basics

The Wemos D1 R2 operates at a logic level of 3.3V. This is crucial when interfacing with external components. Connecting 5V devices directly to its GPIO pins can damage the microcontroller. If you need to interface with 5V sensors or actuators, use a logic level shifter. Powering the board is typically done via the Micro USB port, which accepts a standard 5V supply. Ensure your power supply can provide at least 500mA, especially if the Wi-Fi module is actively transmitting. Alternatively, you can power the board through the 3.3V pin, but this bypasses the onboard voltage regulator and requires a stable 3.3V source.

When connecting an LED, always use a current-limiting resistor to protect both the LED and the Wemos D1 R2. A common value for a standard LED is around 220-330 ohms. Connect the anode of the LED to a digital GPIO pin (e.g., D1) and the cathode to the resistor, with the other end of the resistor connected to GND. This setup allows you to control the LED by setting the GPIO pin HIGH or LOW.

For I2C communication, the Wemos D1 R2 uses pins D1 (GPIO5) for SCL (Serial Clock) and D2 (GPIO4) for SDA (Serial Data). Most I2C sensors and devices require pull-up resistors on both the SCL and SDA lines. While some modules have these built-in, it's good practice to include external pull-up resistors (typically 4.7k ohm) connected to the 3.3V supply if your sensor does not provide them. Connect the sensor's VCC to 3.3V, GND to GND, SCL to D1, and SDA to D2.

Programming & getting started

The Wemos D1 R2 is most commonly programmed using the Arduino IDE. To get started, you'll need to add the ESP8266 board support to your Arduino IDE. Go to File > Preferences, and in the 'Additional Boards Manager URLs' field, add: http://arduino.esp8266.com/stable/package_esp8266com_index.json. Then, go to Tools > Board > Boards Manager, search for 'esp8266', and install the package. Select your Wemos D1 R2 board (usually found under 'NodeMCU 1.0 (ESP-12E Module)' or similar) and the correct COM port.

To upload your first sketch, connect the Wemos D1 R2 to your computer via the Micro USB port. Ensure the board is in programming mode (usually by holding down the BOOT button if present, though the D1 R2 typically enters flash mode automatically when reset via USB). Open a simple sketch, like the 'Blink' example, modify the pin number if necessary to match one of the D pins, and click the Upload button. The IDE will compile the code and flash it to the ESP8266. Once uploaded, the board will typically reset and begin executing the new program.

Project ideas

Wi-Fi Connected LEDControl an LED remotely via a web interface hosted on the Wemos D1 R2. This project uses the ESP8266's Wi-Fi capabilities and a GPIO pin to toggle the LED state, teaching basic web server concepts and GPIO control.
Home Temperature and Humidity MonitorRead data from a DHT11 or DHT22 sensor and send it to a cloud service like ThingSpeak or display it on a simple web page. This project utilizes the ADC, digital I/O, and Wi-Fi connectivity, demonstrating sensor integration and data logging.
Smart Plug with Energy MonitoringControl a relay connected to a mains appliance and measure its power consumption. This involves using a relay module, potentially an AC-AC voltage sensor, and the ESP8266's Wi-Fi for remote control and monitoring, teaching about power electronics and IoT device control.
I2C Sensor NetworkConnect multiple I2C sensors (e.g., BME280 for environmental data, MPU6050 for motion) to the board and send their readings over Wi-Fi. This project deepens understanding of the I2C protocol and multi-sensor data aggregation.
Over-the-Air (OTA) UpdatesImplement OTA updates for your Wemos D1 R2 projects, allowing you to update firmware wirelessly without physically connecting a USB cable. This is an advanced topic crucial for deployed IoT devices, teaching about network programming and firmware management.
Simple Web Server for Device ControlBuild a basic web server on the Wemos D1 R2 to control other devices like servos or buzzers, or to display sensor data. This project reinforces web server fundamentals and user interface design for embedded systems.

Buying tips & gotchas

When purchasing a Wemos D1 R2, be aware of numerous clones and variants. While most function similarly, quality can vary. Look for boards with reliable voltage regulators and flash chips. Common pitfalls include misinterpreting the 3.3V logic level, leading to damaged components, or exceeding the current capabilities of the onboard 3.3V regulator when powering multiple external devices. Ensure your Wi-Fi connection is stable, as weak signals can cause unexpected behavior. Accessories like stackable shields (e.g., OLED display, relay, sensor shields) can greatly expand the board's functionality without complex wiring.