Maker Portal

View Original

WeMos D1 Mini ESP8266 Arduino WiFi Board

“As an Amazon Associates Program member, clicking on links may result in Maker Portal receiving a small commission that helps support future projects.”

See this content in the original post

The WeMos D1 Mini is an inexpensive ESP8266-based WiFi board that is low-profile but just as powerful as any NodeMCU or ESP8266-based microcontroller. The D1 Mini is incredibly versatile because it is inexpensive, WiFi-enabled, and fully compatible with the Arduino platform. In this tutorial, the ESP8266 library and board manager will be introduced in order to get the D1 Mini acting as an Arduino board. Then, a simple web page will be introduced with the intention of harnessing the WiFi capabilities of the module. The D1 Mini will act as a web server, allowing any WiFi-connected device to interact with the board and control its pins wirelessly.

See this content in the original post

Parts used in this tutorial:

  1. D1 Mini ESP8266 Board - $8.00 [Our Shop]

  2. LED - $9.99 (600 pcs) [Amazon]

  3. Resistor - $10.99 (1280 pcs) [Amazon]

  4. Breadboard - $3.00 [Our Shop]

  5. Smartphone (iPhone) - $789.99 (iPhone XR 256GB) [Amazon]

See this content in the original post

See this content in the original post

The first step toward interfacing the D1 Mini with the Arduino platform begins with downloading the ESP8266 board platform onto the Arduino IDE. This process is shown below:

In the Arduino IDE:

  1. File -> Preferences

3. Go to: Tools -> Board -> Boards Manager

4. Type in “esp8266” into the search

Ensure that the correct board specifications are selected similar to the reference above (Upload Speed, CPU Frequency, Flash Size). Once the steps above are completed, the D1 Mini board is ready to work with many of the Arduino examples.

As verification, upload the Blink sketch and observe that the D1 Mini onboard LED is blinking.

See this content in the original post

See this content in the original post

The D1 Mini has an ESP8266 at its core, which means that it can do many of the things an Arduino board can do (analog input, digital input, I2C, etc.), but it can also handle WiFi communication. The WiFi communication enables the D1 Mini to act as a local server and so much more. In this example, I will demonstrate the simplest implementation of the D1 Mini as a WiFi server by communicating between a device (smartphone, tablet, desktop) and the D1 Mini by communicating on a local host webpage.

The full code for controlling an LED using the D1 Mini is shown below:

See this content in the original post

The basic usage of the code above goes as follows:

  1. Open the serial port in the Arduino IDE to discover the IP address of the server (something like: 171.20.0.5)

  2. Type in the IP address on a smartphone, tablet, or desktop browser

    • An LED should be connected to pin D1 and should blink 5 times and stay on

  3. Navigate in the browser to: 171.20.0.5/off

    • The LED should be off now

  4. Navigate in the browser to: 171.20.0.5/on

    • The LED should be on again

Obviously, this is a very rudimentary example of the capabilities of the D1 Mini and ESP8266 WiFi module, however, it is the basis for many smart home systems that rely on low-power devices to control peripherals such as: lights, fans, automatic blinds, and much more! Ideally, an app would handle this webpage navigation through button clicks, however, that application will be saved for the user.


See this content in the original post

In this tutorial, the D1 Mini ESP8266-based microcontroller and WiFi module was introduced. The D1 Mini is a sized-down NodeMCU board that boasts the ESP8266 again at its center. The D1 Mini is powerful because of its small profile and Arduino integration. As with the NodeMCU, the D1 Mini has a massive community of codes that makes developing WiFi-based projects easier than ever - all through the lens of the Arduino platform. This means that with a little Arduino background and some knowledge of web programming, users can create their own networks of web-based microcontrollers and devices.

See More in Arduino and WiFi:

See this content in the original post