Language: EN

esp8266-nodemcu

NodeMCU, the popular development board with ESP8266

We continue to advance with the ESP8266 SOC tutorials. In this post, we are going to see our first development board based on the ESP8266, out of the many available. As it couldn’t be otherwise, we are going to start with the well-known NodeMCU.

NodeMCU is a development board based on the ESP12E, which, as we saw in this post, is probably the most popular module that integrates the ESP8266 SoC. However, despite the popularity of the NodeMCU boards, there is also a lot of confusion regarding the terminology (Lua, Lolin, versions), and sometimes they are mixed up or even used as synonyms.

Keep in mind that, unlike Arduino where there is a company that puts a certain order in the designs and available models, the development boards based on the ESP8266 have evolved somewhat in leaps and bounds and alongside different manufacturers.

The situation is further complicated if we read the descriptions of some vendors, who mix concepts and contribute to generating even more confusion.

So we are going to try to deepen and bring a little order around the NodeMCU, one of the most popular development boards based on ESP8266 and one of the fundamental pillars on which the ESP8266 ecosystem has been based during its evolution.

What is NodeMCU?

NodeMCU is a name that encompasses both an Open Source firmware and a development board based on the ESP8266.

Initially, the name NodeMCU referred mainly to the firmware. Currently, this has been reversed, and when we talk about NodeMCU, we usually refer to the development board.

nodemcu

The NodeMCU firmware was created shortly after the appearance of the ESP8266, on December 30, 2013. A few months later, in October 2014, the first version of the NodeMCU firmware was published on Github. Two months later, the first NodeMCU development board was published, called devkit v0.9, also being Open Hardware.

Let’s remember that in those early moments of the ESP8266 there was hardly any information and the little information available was confusing. Most of the community’s interest was limited to the ESP01, which was considered more a cheap Wifi module for processors like Arduino than an independent development board.

The NodeMCU firmware could be flashed onto an ESP8266, after which we could program it with the Lua script language. Lua programming allowed the ESP8266 to be connected and programmed in a much simpler way than the official tools provided by Espressif.

esp8266-lua

Lua is an imperative and structured programming language, created in 1993 by Roberto Ierusalimschy, Luiz Henrique de Figueiredo, and Waldemar Celes. It is based on C and Perl, and is designed to be very lightweight. It has been implemented in a variety of embedded devices, from video game consoles to industrial robots. The official page is https://www.lua.org/.

Over time and with the appearance of other alternatives to program the ESP8266, such as (especially) with C++ using the Arduino environment and others like MicroPython, interest in Lua has decreased considerably.

Despite the interesting aspects of Lua programming, it is not as widespread as C++ and Python. In addition, they never managed to make it totally stable in the ESP8266. On the other hand, being an interpreted language (rather than compiled), the performance and resource utilization are lower.

In 2015, the original development team stopped maintaining the NodeMCU firmware. Although it is still maintained by a community of developers, interest in the firmware has almost completely declined. For this reason, currently we refer to NodeMCU more to the development board than to the firmware.

However, although the firmware is currently somewhat forgotten, we must not forget the contribution that the NodeMCU project, both firmware and development board, have made to the proliferation and implementation of the ESP826.

NodeMCU Development Board

Now that we have seen a little history and the origin of NodeMCU both as firmware and development board, it’s time to get into the details and see what interests us currently, which is NodeMCU as a development board.

Basically, the NodeMCU development board is based on the ESP12E and exposes its functionality and capabilities. But, in addition, it adds the following advantages of development boards:

  • Micro USB port and Serial-USB converter
  • Easy programming through Micro-USB
  • Power through USB
  • Terminals (pins) to facilitate connection
  • Integrated LED and reset button

We are not going to go into the hardware details of the ESP12E because we saw them intensively in its own post, and they are common to all development boards based on the ESP12E (and it doesn’t make sense to repeat it on each development board we see).

If you want, you can consult details of the ESP12E hardware (GPIO pins, analog outputs and inputs, communication), which are directly shared with those of the NodeMCU, you can consult the post about the ESP12E.

In this post, we will focus on the specific aspects of the NodeMCU board beyond those inherited from mounting an ESP12E. As we mentioned in the introduction, everything related to NodeMCU can be confusing because there is more than one manufacturer and each has its own criteria.

To make matters worse, Chinese sellers on AliExpress or eBay write the descriptions of their items as if they were paid by the word, mixing everything and making it unnecessarily complicated.

In summary, we have three main manufacturers of NodeMCU, Amica, Lolin/Wemos, and DOIT/SmartArduino. The boards are very similar (or even identical), although they may have some differences in pin designation.

On the other hand, we have three versions of the NodeMCU board, which we will see below. The designations of the versions do not make it worse or with the intention also contribute to generating confusion. But, although it seems a bit complicated, in reality, it is simple if you follow the evolution from the beginning.

First generation v0.9

The original version of the NodeMCU was called devkit v0.9, and it mounted an ESP12 along with 4MB of flash (let’s remember that the memory in the ESP8266 is external and is connected via SPI). The ESP12 is similar to the ESP12E, but it lacks a row of pins so it has fewer GPIO.

esp8266-esp12-esp12e

The 0.9 version was ugly (well, to each their own), yellow-orange, and very wide. With dimensions of 47x21mm, it occupied 10 rows of pins on a breadboard, completely covering it. This made it very impractical to use because it leaves no free pins on the breadboard for connections.

esp8266-nodemcu-v09

We are not going to spend more time on this board because it is an obsolete version and we are not even going to be able to buy it. But you should know that it was the original NodeMCU and that everything starts here.

Second generation v1.0 / V2

The next version of the NodeMCU is the v1.0 V2. In summary, Amica, a company created by the German Gerwin Janssen, produced its own improved version of the v0.9. The original NodeMCU team liked it and declared it the “official” version of NodeMCU.

esp8266-nodemcu-v2

The main difference in the v1.0 V2 version is that it mounts an ESP12E instead of an ESP12, so it has more available pins than the original model. In addition, it is narrower than the 0.9 version, only covering 8 rows of a breadboard. This leaves an additional row on each side to make connections.

esp8266-nodemcu-dev-kit-v2-pins

The three manufacturers, Amica, Lolin/Wemos, and DOIT/SmartArduino, manufacture, or have manufactured at some point, this v1.0 V2 version.

Since the NodeMCU team designated Amica’s version as “official”, it is sometimes said that Amica is the official distributor of NodeMCU. This is not the case as it is Open Hardware, and any manufacturer is as valid as the others.

Third generation v1.0 / V3

We come to what is sometimes called the “third generation,” the v1.0 V3 version. Basically the manufacturer Lolin/Wemos decided to create its own “improved” design with a few minor changes.

esp8266-nodemcu-v3

The main change is that the V3 mounts a CH340G serial converter instead of the CP2102. The manufacturer ensures that it makes the USB port more robust. On the other hand, they reused the two reserved pins from the V2 to output a GND and a VUSB.

esp8266-nodemcu-pinout-v3

Otherwise, the specifications are the same. On the other hand, the v1.0 V3 model becomes wide again and covers the entire breadboard, which is a real problem when making setups with a breadboard.

However, the 1.0 V3 is surely the most sold model right now. Although many people are looking for the V2 because they are practically the same in features, but being narrow is more comfortable to use on a breadboard.

Since the V3 version is a version created by Lolin/Wemos, it has sometimes been accused of being “unofficial” (by NodeMCU itself). But considering that it is open hardware, the concept of “unofficial” doesn’t make much sense.

Summary of the versions

Summing up what we have seen,

GenerationVersionModuleWidthComment
First0.9ESP1210 pinsThe original, not for sale
Second1.0V2ESP12E8 pins“Official” version
Third1.0V3ESP12E10 pinsWemos/Lolin version. CH340G converter

So far the theory. Now comes the reality, which is a bit more “fun”. eBay and AliExpress sellers (and others) mix everything up! For example, they put “NodeMCU Lua Lolin V2” and “NodeMCU Amica devkit v3”. So, by chance. But the most fun part is that I have seen versions marked as V3 that are actually narrow. Versions sold as V2 that are wide.

The best way to differentiate between V2 and V3 at a glance is to look at the serial converter they mount. The CP2102, which is square, or the CH340G, which is longer.

esp8266-nodemcu-v2-v3

Otherwise, it is not worth spending more time than necessary on the subject of versions. They are practically the same, and any you have will work fine.

Price

Let’s talk about the price of these development boards that are currently really cheap. In both cases, for the v1.0 V2 and v1.0 V3 versions, we can find them for the (incredible) price of 2-2.5€, looking at international sellers on AliExpress or eBay.

The V3 version is generally a little cheaper (about 2€, compared to the 2.5€ of the V2), probably for mounting the CH340G or for higher production. If you want a NodeMCU for a project without a breadboard, the V3 might be more convenient because it is slightly cheaper.

However, for setups that require using a breadboard, the preferred option is usually the V2 despite its slightly higher price, because its narrower width facilitates connections.

In any case, both models of NodeMCU boards are similar and have a truly unbeatable price for a development board with this power and Wifi connectivity, being the main reason for its success and high popularity.

NodeMCU Pinout

We cannot finish the post without seeing our always beloved and consulted pinout diagram.

esp8266-nodemcu-pinout

And here is a summary table with the pins, their functions, and some of their peculiarities.

PinGPIOInputOutputComments
D0GPIO16No interruptionsNo PWM
No I2C
HIGH during boot

Pull-Down Resistor

Connect to RST for Wake-Up
D1GPIO5OKOKSCL (I2C)

(frequently)
D2GPIO4OKOKSDA (I2c)

(frequently)
D3GPIO0Pulled UpOKBoot fails if pulled LOW

Connected to FLASH button
D4GPIO2Pulled UpOKHIGH during boot

Boot fails if pulled LOW

Built-in LED

TX1
D5GPIO14OKOKSLCK (SPI)
D6GPIO12OKOKMISO (SPI)
D7GPIO13OKOKMOSI (SPI)
D8GPIO15Pulled GNDOKCS (SPI)

LOW during boot

Boot fails if pulled HIGH

No Pull-Up
RXGPIO3OKRXHIGH during boot

Not usable if UART is used
TXGPIO1TXOKHIGH during boot

Boot fails if pulled LOW

Debug output in boot

Not usable if UART is used
A0ADC0Analog InputNO

However, as we have seen, there is a wide variety of small variations and manufacturers that label the same (and sometimes mistakenly) to their development boards. So there may be small differences in the development board you have.

This is precisely why, in case of doubts, refer to the post about the ESP12E, because what all these boards have in common is that they mount the same module and therefore have the same functions.

What may change is the name they have labeled on each pin or that the LED is integrated into another pin or, in rarer cases, that they have connected the pins differently with the ESP12E. But by looking at the ESP12E pinout, you will be able to deal with any NodeMCU board even if they have small variations.

So far the post about NodeMCU. In future posts, we will see other very interesting development boards, such as the Wemos D1 and Wemos D1 Mini, and we will see how to program development boards based on ESP8266 with the Arduino environment and with microPython. In the meantime, have fun with your NodeMCU!