NodeMcu (ESP8266)

To be upgraded with future knowledge

This module implements an ESP8266MOD that is Wifi hardware + microcontroller with flash memory + USB-uart interface (serial port) + GPIO lines.

Its firmware is 3-layered:

  • Bootloader
  • Base Firmware: interprets user code and interfaces with hardware
  • User code in LUA language

For the moment, we don't know how to install user code in memory and IF and HOW it would be possible to rewrite the whole firmware to user's needs.

Step-by-step guide to get the first example working.

  1. Compile the firmware
  2. Upload the firmware
  3. Connect to the serial terminal
  4. Write and test an example code: connect to an existing WiFi network and start a simple HTTP server

1. compile the firmware

( )

We used the cloud building service at

Once built an email will notify you and you can download the image ready to be uploaded in the nodemcu .

2. upload the firmware

( )

Download and the needed requirements (python and python-serial module) from here .

If your module is cheap it should be 512kB version so run: –port <USB-port-with-ESP8266> write_flash -fm qio -fs 4m 0x00000 <nodemcu-firmware>.bin.

3. Connect to the serial terminal

Open your preferred terminal (i just prefer cutecom) and set the serial port (like /dev/ttyUSB0) to 115200 baud 8n1.

Reset the device and it should write something like:

NodeMCU custom build by
\0x09branch: master
\0x09commit: cdaf6344457ae427d8c06ac28a645047f9e0f588
\0x09SSL: false
\0x09modules: file,gpio,http,net,node,ow,tmr,uart,wifi
 build \0x09built on: 2016-06-07 19:06
 powered by Lua 5.1.4 on SDK 1.5.1(e67da894)
lua: cannot open init.lua

That > means it is ready to accept and interpret LUA code in console mode.

4. Write and test an example code

4.1. connect to an existing WiFi network

To set the wifi module in client mode enter(+return):


To list the wifi networks enter all the following lines and wait a little while after the last:

function listap(t)
    for k,v in pairs(t) do
        print(k.." : "..v)

To join a wifi network enter:

wifi.sta.config("SSID", "password")

To check if it has joined and the IP obtained from the DHCP server:

print (wifi.sta.getip())

4.2. start a simple HTTP server

srv = net.createServer(net.TCP)
srv:listen(80, function(conn)
    conn:on("receive", function(sck, payload)
        sck:send("HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n<h1> Hello folks this is NodeMCU!</h1>")
    conn:on("sent", function(sck) sck:close() end)

Table of contents


For any info you can write to:
Per qualunque info potete scrivere a:


QR Code
QR Code talks:nodemcu-esp8266 (generated for current page)