Metrika
Ivy Knob

ESP8266 SDKs comparison: NodeMCU Part 1

ESP8266 SDKs comparison: NodeMCU Part 1

ESP8266 is low-power Wi-Fi solution with a lot of capabilities. It was released in 2014 and used by a lot of hobbyists. It's cheap, support wifi and much more powerfull, than Arduino. There are also a lot of hardware versions of this chip, each of them differs with flash size, number of pins, form factor etc. But all of them do support same SDK list: NodeMCU, Arduino, Espressif RTOS, Espressif Non-OS, Sming, MicroPython, Mongoose OS and much more.

This post starts series about ESP8266 SDKs. We will start from NodeMCU firmware (same name as Dev board).

ESP8266

ESP8266 is low-power Wi-Fi solution with a lot of capabilities. It was released in 2014 and used by a lot of hobbyists. It's cheap, support wifi and much more powerfull, than Arduino. There are also a lot of hardware versions of this chip, each of them differs with flash size, number of pins, form factor etc. But all of them do support same SDK list: NodeMCU, Arduino, Espressif RTOS, Espressif Non-OS, Sming, MicroPython, Mongoose OS and much more.

Introduction

NodeMCU - is firmware for ESP8266 chips and hardware based on ESP-12 modules. There is also very popular devboard with the same name. Offtopic: We do recommend this devboard, its cheap and needs only micro USB for operation.NodeMCU uses Lua (eLua) language for programs and based on Espressif Non-OS SDK. NodeMCU firmware was abandoned once, but now it is well maintained. There are fresh issues on Github page that were answered and closed. But actually all needed things were OK long time ago and do not require maintenance.

Libraries

Dependency management is done by including modules in the firmware. Its cryptic process, but there is the free site https://nodemcu-build.com/ that helps to build the firmware with needed modules. Unfortunately, you can't include all modules because of limited resources.It does support all popular modules: sensors libs, HTTP, MQTT, wifi setup and much more. Nice thing about NodeMCU is that it does support TLS/SSL v1.2.

Tooling

The most popular tool for NodeMCU is ESPlorer - Java based IDE. It works fine, but any modern code editor, ie Atom, Sublime or Visual Studio Code, is much cleaner and easier to use. Great thing is ESPlorer do support simultaneous files upload with serial monitor.

There are also few tools based on official command line esptool.py. I used Node.js based NodeMCU-tool for my terminal workflow.

Testing

It terms of tests, NodeMCU does not support them. I tried to use common Lua tools for testing, but it does not work with NodeMCU modules. Syntax checker don't work because source code uses modules from firmware, and unix based Lua don't know anything about it.

CI/CD compatibility

Because of no support of unit testing, we tried to add some kind of check of the source code. There is a function to compile lua code for faster execution and lower footprint. There is also ability to cross compile Lua code with luac.cross from firmware. We tried to build it in mac os x, but failed. Then we used official firmware docker container and built this tool, but then found interesting thing.

There is no way to determine if your code is ok or not with luac.cross. After this discovery we stopped trying to use CI/CD with NodeMCU.

Simplicity

Support of tests and CI/CD is needed for professional software development, but if you are a hobbyist, maybe you don't need this? In case of simplicity and time to start NodeMCU beats all other SDKs. Lua is very simple and pleasant language. You don't need to know anything about memory allocation and all that C stuff. You just open documentation, copy code and adapt it for your needs.

When we built our test case with different SDKs, NodeMCU was clear winner in case of time spent. There was no mess with dependency management and different libs. You don't need to choose what implementation of library you want to use.

Conclusion

NodeMCU is great firmware for home projects. It helps you to start fast, but does not support common tools, like tests and CI/CD. I definitely recommend to buy NodeMCU dev board and try NodeMCU firmware. Even kid can write program for it without any problems. However, if you want something complex it will not suit your needs.