Accelerated IOT using NodeMCU

ESP8266 Wifi module, made by a privately held company in China called Espressif, is a self contained SOC with integrated TCP/IP protocol stack that can give any microcontroller access to a WiFi network. ESP8266 module comes pre-programmed with an AT command set firmware that delivers quick and powerful programmability out of the box. In addition, ESP8266 is extremely cost effective and has garnered popularity amongst an ever-growing community. There is also a wealth of information available online for ESP8266, that greatly aid users in using it.

Based on the popular ESP8266 module, NodeMCU Development Board further helps accelerate IOT developments as it combines WiFi Features (accesspoint and station), a Microcontroller and programmability using simple LUA based programming language. NodeMCU provides the following features out of the box:

  • Arduino-like hardware IO
  • Event-driven API for network applications
  • 10 GPIOs D0-D10, PWM functionality, IIC and SPI communication, 1-Wire and ADC A0, all in one board
  • Wifi networking (can be used as access point and/or station), connect to internet to fetch or upload data.
  • Highly cost effective board for accelerated IOT developments

What NodeMCU actually is, is an open-source firmware that you can flash to any ESP8266 board and development kit that helps users to prototype IoT products within a few Lua script lines. A file named init.lua is started when the platform boots and can be used to start other script files. Below is an example of a Lua Script that connects to the wifi network and starts another script:


--init.lua
wifi.setmode(wifi.STATION)
wifi.sta.config("ssid","password")
wifi.sta.connect()
tmr.alarm(1, 1000, 1, function()
if wifi.sta.getip() == nil then
print("IP unavaiable, Waiting...")
else
tmr.stop(1)
print("ESP mode is: " .. wifi.getmode())
print("Config done, IP is "..wifi.sta.getip())
dofile ("myscript.lua")
end
end)

Getting started with LUA could not be simpler. There are multiple examples of codes available on the NodeMCU site and other sources on the Internet that will help you get going with LUA scripting fast. LUA is really lightweight and all you need is a few lines of code to achieve complex functionality. With NodeMCU, you can accelerate development on IOT projects like never before.

Share This Post: