Wemos D1 R2: Your Gateway to ESP8266 Power
A compact and versatile development board featuring the ESP8266 Wi-Fi SoC, ideal for IoT projects.
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 / SoC | ESP8266EX |
| Architecture | 32-bit RISC Tensilica L106 |
| Clock speed | Typically 80 MHz (can be configured up to 160 MHz) |
| Flash / Storage | 4MB (onboard SPI flash) |
| RAM / SRAM | 80KB (internal SRAM) |
| Operating voltage | 3.3V |
| Digital I/O pins | 11 (GPIO0-16, excluding some internal use) |
| Analog / ADC | 1 (ADC0 - GPIO17) |
| PWM | Yes (up to 6 channels) |
| Connectivity | Wi-Fi 802.11 b/g/n |
| USB | Micro USB connector (for power and programming) |
| Power input | 5V via Micro USB or 3.3V pin |
| Dimensions | Approx. 25.6mm x 48.6mm |
Pinout & pin functions
| Pin | Function |
|---|---|
| 3V3 | 3.3V Power Output |
| GND | Ground |
| 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 |
| ADC | Analog-to-Digital Converter input (connects to GPIO17) |
| RST | Reset 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.