There's virtually endless choice when you're deciding on a microcontroller. We've taken a good look at the NodeMCU, and we're in love.
The number of microcontrollers that are now on the market leaves the maker with so much choice when starting a project; so which one do you choose? Probably the one you’re most familiar with, or happen to have on the workbench. Here at the DIYODE office, we’re lucky to be exposed to so many options and probably more than what we can assign projects too. However, building a working IoT project still takes some work especially when using the revolutionary ESP8266.
This module was introduced quietly in 2013, as a solution for Chinese tablet manufacturers, but it has been very quickly adopted by the maker community. While the unit is very low cost, it can be difficult to program, especially for new users, which is where the NodeMCU makes its mark.
It's powerful enough, with plenty of GPIO for a dedicated project.
We took a substantial look at the NodeMCU.
WHAT IS IT?
At its core, the NodeMCU is a firmware solution that is based upon an open source developer’s kit (DevKit) for the ESP8266. The hardware itself is based on the ESP-12 module, and it allows the developer to breakout the pins and easily interface with the real world. It contains an Xtensa Single-Core 32-bit L106 processor, and it runs a full 802.11 b/g/n WiFi stack, but does not include Bluetooth. The typical CPU frequency is 80MHz. It supports SPI, I2C, I2S and UART and, most importantly, it contains 10 general-purpose inputs and outputs, and 1 analogue-to-digital converter.
However, what’s really standout is that the ESP8266 is ideal for those of us who come from a background using Arduino as our preferred microcontroller. The ESPXX modules require a programming circuit and a USB-TTL circuit to allow you to program the board. There is some confusion with Arduino shields that look as though they can be programmed like a standard UNO but, in fact, are standalone units. The NodeMCU negates all of that, so once you have installed the ESP8266 libraries and board information in Arduino, you can program and use it just like any another board. The Application Programming Interface for the ESP8266 will operate just like any other Arduino, but now you have access to the world of IoT.
The NodeMCU has been in development since late 2013, not long after the introduction of the ESP8266. Being open source, there are a number of variants available, with many being in the $10 to $15 range; in fact, there are approximately 40 known variants of the board currently being manufactured with the ESP8266.
Primarily the firmware is based upon the MicroPython environment and the Lua scripting language, but for the average maker, this revolution came with the porting of the ESP8266 and NodeMCU support to Arduino.
WHAT CAN IT DO?
Since its inception, several major libraries have been ported for use with the NodeMCU. This includes MQTT IoT protocol (See Issue 3). The u8glib library has also been implemented, allowing you to drive LCDs, screens, OLEDs and even VGA. The unit has 10 usable GPIO, a single 10-bit analogue-to-digital converter (ADC), PWM on most digital pins, and all with low power consumption figures. The unit includes 4MB of internal memory that can be accessed in a file type structure with the right libraries.
If you do embark on using the NodeMCU in your next project there are some things to note: the pins do not line up to the traditional Arduino pins. For example, GPIO2 is D4. Please refer to the full documentation in the Arduino ESP8266/NodeMCU library. Also, note the NodeMCU is 3.3V! It can't take 5V in, or be powered by the USB port. If your program does not appear to load correctly, you can override the system by holding down the flash button, whilst pressing the reset button then releasing.
WHY WOULD I USE IT?
Programming the ESP8266 can be painful at first, as you need to have a specific circuit in place to put it into programming mode; but using the NodeMCU it’s all done for you – although you can do an onboard reset if required, which will reduce the barrier to entry if you are new to the world of microcontrollers and your electronics is still in its infancy.
With the world of IoT there can be some big hurdles to jump, especially when it comes to creating your user interface. The NodeMCU is well supported by software services such as Blynk. Using Blynk, you can develop high-end functioning IoT apps for both iOS and Android. Not only does this allow you to read the data from your NodeMCU IoT project, but also it enables bi-directional communication to be able to send commands to the microcontroller on the other end of your app.
The NodeMCU presents a low-knowledge barrier to entry to the world of WiFi and IoT. If you have experience with Arduino but not IoT, then you’ll appreciate this development board and what it will enable you to create.
We have put the NodeMCU through its paces in our Distributed RFID project in this issue. It fit our requirements perfectly with WiFi functionality and some basic GPIO functionality. It's a great unit, and we'll be doing more with it in the future.