I’ve tinkered with microcontrollers on-and-off quite a bit throughout my life, mostly sticking with the Arduino boards. My first one was an Arduino Duemilanove circa 2009. As part of a larger project I wanted to dive into something a bit more advanced. By sheer coincidence I came across an advertisement for a NodeMCU. For under $5 you get an Arduino-compatible microcontroller with built-in WiFi. Absolutely perfect for your IoT project. If you hunt around eBay and don’t mind waiting several weeks, you can get them as cheap as even $3 or so.The heart of the NodeMCU is the ESP2866. The NodeMCU devkit includes full pinouts, more flash storage, and a micro-usb connector. The NodeMCU ships with a Lua-based firmware, which I found to be quite a hassle. I made several attempts to learn and write some Lua, but between having frustrating issues getting my firmware to boot up, to issues with getting libraries to load, along with the head-banging of getting stuck in the init loop and not being able to re-flash, I eventually gave up.
Thankfully, you can boot up the Arduino IDE, and with a couple easy configuration changes you can program and flash your NodeMCU just like you would an Arduino.
Now finally in familiar territory, progress starting sailing along quite quickly. I hooked up a TMP36 temperature sensor that came with my original Arduino dev kit, and made an attempt to connect to a local install of Phant to store periodic temperature readings. It only took me a couple tries, and I was in business!
I eventually moved away from Phant and wrote up my own little API to store data in a MySQL table. I then popped up an install of Expedia’s open-source dashboarding tool, Cyclotron to do some quick visualizations.
Pretty snappy, I say! I’ve since swapped over to some different sensors, but overall I’m VERY happy happy with the NodeMCU – to the point that I bought another 4 of them off eBay for some other projects I’m thinking up in my head.
Next attempt is going to be connecting up a relay board so I can remotely control things like lights. Wish me luck! And if you want to see my code, just ask – I intend on cleaning it up and getting it into GitHub at some point soon.