It took me way too long to get started with the WeMos D1 R2 board, partly because mine is an eBay knockoff.

Getting Started

  1. Download and install the Arduino IDE (just called Arduino): Note: I use version 1.6.8, newer versions may not work.
  2. Open Arduino
  3. Open File → Preferences
  4. Copy and paste into Additional Boards Manager URLs field. You can add multiple URLs, separating them with commas
  5. Open Tools → Board:xxx → Boards Manager and install esp8266 by ESP8266 Community
  6. Open Tools → Board:xxx and select WeMos D1 R2 & mini.
  7. Open Tools → Upload Speed and select 115200. If you're brave, you can try 230400 to upload code to the board faster, but watch the console for errors.
  8. Download a driver so your Mac recognizes the WeMos D1 board (the site looks sketchy, but I can confirm the driver is legit): Note: This driver is needed for both real and knockoff D1 boards.
  9. Plug your WeMos D1 board into your Mac using a micro USB.
  10. Open Tools → Port:xxx and in the dropdown, select the option with "usb" in its name.
  11. Your Tools dropdown should look like this:


  1. To make sure everything is working properly, let's download WeMos' example files:
  2. Rename the uncompressed directory to D1miniExamples
  3. In Arduino, open File → Preferences
  4. In Finder, navigate to the Sketchbook location show in in Arduino's Preferences
  5. Move the D1miniExamples directory to Sketchbook location
  6. The path will look like Sketchbookdirectory/D1mini_Examples
  7. Restart the Arduino IDE
  8. All examples are under File→Sketchbook→D1miniExamples

Hello World

  1. Open File→Sketchbook→D1miniExamples→01.Basics→HelloWorld
  2. Click Upload
  3. After upload, open Tools→Serial Monitor, set baudrate to 9600 baud

Digital I/O

If you've gotten to this point, good work! Now we're going to learn a bit more about the WeMos D1's I/O ports. They're f***ed.

The fact that I have a knockoff board doesn't help either. Anyways, enough complaining. Basically, the labels on the WeMos D1 are not the same as those used in Arduino programs.

As an example, if I want to use digital port 3 (D3) as an output, this is the code I would use:

void setup() {  
  pinMode(5, OUTPUT);

void loop() {  
  // Turn on for 1 second
  digitalWrite(5, HIGH);

  // Then off for 1 second
  digitalWrite(5, LOW);

I've created a couple of reference tables for your convenience.

Official WeMos D1 Board LabelKnockoff WeMos D1 Board LabelDigital PortArduino Software

Note: I can't guarantee the official WeMos D1 board mappings are correct, but they're based off this:


  1. Restart the Arduino IDE
  2. Try a different micro USB cable
  3. In Finder, navigate to ~/Library (to get to Library, click on Go, then press control, and click on Library). Rename Arduino15 to Arduino15-backup.Download and install the latest version of the Arduino IDE (replace your current version)Open Arduino, re-install esp8266 in the Boards Manager.

If you have any other troubleshooting tips, send them my way.


A good amount of the content here is based on the official WeMos documentation ( ). I've simply filled in many of the gaps preventing my board from functioning properly.

This is what an actual WeMos D1 board looks like:


This is what my knockoff WeMos D1 board looks like:



Final Words

Now you know how to set up your WeMos D1 board and use its ports. I'm going to leave out discussion on its WIFI capabilities because there's plenty of documentation on that already.

In the next article, I will discuss how to connect a stepper motor to the WeMos D1.