WeMos D1

The WeMos D1 and its clones are single board computers based on the ESP8266. They combine a 32-bit RISC processor with a WiFi transceiver and 4MB of serial flash. These are cheaper and much more powerful than the traditional 8-bit AVR processors used in Arduino Uno and compatible boards, but they can still be programmed using the hobby-friendly Arduino environment. The boards are widely available at very low prices on eBay, amazon, and AliExpress for $3.19. It's hard to get a faster embedded system that you can put online for less money.

It can be programmed in C/C++ using the Arduino environment after installing support for the ESP8266 platform:

  1. Install the URL for the optional ESP8266 board manager: File->Preferences->Additional Board Manager URLs
  2. Install the ESP8266 board manager: Tools->Board->Boards Manager->esp8266 (scroll to bottom of list and click on it)

Test by creating a basic sketch (Arduino-lingo for a program). Sketches consist of two parts: a setup function that runs once when the program starts and a loop that runs forever after setup finishes:

#define LED_BUILTIN 2

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  // initialize serial communications interface

// the loop function runs over and over again forever
void loop() {
  static uint32_t count;
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
  • Configure the Arduino environment's interface to your physical board:
    1. Tools->Board->Generic ESP8266 Module
    2. Tools->Flash Mode->DIO
    3. Tools->Flash Size->4M (1M SPIFFS)
    4. Tools->Reset Method->nodemcu
    5. Tools->CPU Frequency->160MHz
    6. Tools->Upload Speed->921600
    7. Tools->Port-> <COM Port your board is on...see Windows Device Manager>
  • Compile your program (sketch) and upload it to the board by pressing the -> tool When the download finishes, the blue LED on your board should be blinking and if you launch the serial monitor (Magnifying glass tool in the far right of the toolbar), you should see your board sending out an increasing count every 2 seconds.

The WeMos D1 pin mappings are here

Hardware Interfacing

  • ESP8266 is a 3.3v device. The WeMos board has a built-in voltage regulator that generates 3.3v from a higher voltage. You can power the board using the micro-USB connector (which supplies 5V) or you can supply 4.5 to 7.5vdc directly to the VIN pin (the pin nearest the RST button).
  • You can connect the ESP8266 to a wide variety of other 3.3v devices using
    • Digital I/O pins (D0..D8)
    • 3.3v serial I/O pins RX, TX
    • Analog I/O pin A0
    • SPI interface (CLK, CMD, SD0..3)
    • I2C interface (D1=SCL, D2=SDA)
  • Most importantly, you can connect the WeMos D1 to the internet using WiFi with no additional hardware. See here for a basic WiFi connection example and lots of information about WiFi and how to use it.
  • There are many libraries available for interfacing your Arduino platform to other devices such as LCD displays, ultrasonic sensors, motor drivers, etc.


Last modified 3 years ago Last modified on Jun 6, 2018, 12:10:03 PM