ESP8266 - NodeMCU and Wemos

12/15/18

Categories: Microcontrollers Tags: ESP

~/contents

I ordered a few ESP boards because I am interested in their deep sleep and low power capabilities as well as WiFi. ESP can be modified to sip power during deep sleep and run on batteries for an extended period–possibly years, depending on the indication. The best-known of these boards are the Huzzah, the Node MCU, and the Wemos D1 R1, they are sometimes called “Arudino killers” because of their low price point and WiFi functionality. They can be programmed with the Arduino C or Lua, or you can load MicroPython.

A notable difference between these boards and the other MCU’s I’ve used so far is the ESP pins are only 3.3V tolerant, though it will accept 5V USB power. 5V is a pretty common voltage, and you can use 5V to 3.3V stepdown/buck regulator to lower the voltage. (Inversely, 3.3V to 5V would be a stepup or boost convertor.)

To use the Arduino IDE you must install the ESP8266 Arduino Core package.

Preferences > Additional Board Manager URLS: http://arduino.esp8266.com/stable/package_esp8266com_index.json Tools > Boards > Board Manager > esp8266

Pieter P has written a highly informative guide, A Beginner’s Guide to the ESP8266.

Node MCU V3 ESP8266 ESP-12E (clone)

This development board differs from the Wemos in that it is about twice the size and has one more ground pin. The Node MCU is deceptive, however, in that some of the seemingly available pins are reserved and cannot be used. For this board, I selected NodeMCU 1.0 in the IDE. It takes slightly longer to upload compared to Arduinos. Boards with the CH340G chip will probably need drivers if you don’t have them already, they are found at nodemcu-devkit.

NodeMCU V3 pinout

Resources:

Wemos D1 Mini

The Wemos is popular for its small footprint, about half the size of the Node MCU, and the fact that it has a large variety of shields available. One useful thing about this board is it has a 5V pin. Another is that 9 pins have PWM. I thought it would be powerful enough to run a few LED strips (less than 30 LEDs) but that ended up not being the case, even at reduced brightness. The display was very unreliable, sometimes it worked, sometimes only a few LEDs lit up or they would be random colors.

Wemos pinout

Problems with Wemos Clones

I ordered a Wemos from WorldChips. The listing pictures indicate this MCU has a S2Qx MicroOne 500mA regulator, but this is not true. The board received has a 4A2D, which is 300mA, and the silkscreen doesn’t match. The listing pictures are obviously not for the board they’re actually selling. For more on this problem with Wemos clones, see this Reddit thread. I discovered after the fact Wemos clones have a reputation for having high failure rates. Lesson learned, if I ever try a Wemos again I will order from the official Wemos/LOLIN store.

Turning RX/TX into GPIO

To convert TX/1 or RX/3 to GPIO:

  pinMode(3, FUNCTION_3); // Change RX to GPIO
  pinMode(3, OUTPUT);

ESP Upload Errors

You may find Arduino IDE has difficulty communicating with your ESP board. This is a commonly reported error. As usual, try unplugging the board, restarting the IDE, reinstalling drivers, and checking your cable.

warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed

or

An error occurred while uploading the sketch

digidigital suggests uninstalling and reinstalling the CH340 drivers. There are a number of possible solutions on github. I also tried setting Device Manager port settings to 155200 and ensuring Tools > Upload Speed was the same in the IDE. Also see Using ESP8266 GPIO0/GPIO2/GPIO15 pins.

Resources: