This page is to Setup and Config NodeMCU

Hardware and Software


    Arduino IDE


  • Good For MAC
  • Manual Install and Flash :
    • Install Python
  • Full DOC :
  • E.g. --port /dev/cu.SLAB_USBtoUART write_flash -fm qio -fs 32m 0x00000 nodemcuflash.bin

  • --------------------------------------------------------------------------------

  • Firmware :
  • Build a Firware :
  • Doc :
  • Flash :
  • Offical Site :

  • Steps : 
    • Create your own Firmware :

    • Use flasher to download to ESP8266 (ESP01 or NODEMCU)


    • After Boot

    • NodeMCU custom build by
    • branch: master
    • commit: c8037568571edb5c568c2f8231e4f8ce0683b883
    • SSL: false
    • modules: bit,coap,crypto,file,gpio,i2c,net,node,ow,pwm,spi,tmr,u8g,uart,wifi,ws2801,ws2812
    •  build built on: 2016-05-30 07:22
    •  powered by Lua 5.1.4 on SDK 1.4.0


          This example is lua file for esp01 or nodemcu lua flasher formated
  1. wifi.setmode(wifi.STATION)
    led1 = 3
    led2 = 4
    gpio.mode(led1, gpio.OUTPUT)
    gpio.mode(led2, gpio.OUTPUT)
        conn:on("receive", function(client,request)
            local buf = "";
            local _, _, method, path, vars = string.find(request, "([A-Z]+) (.+)?(.+) HTTP");
            if(method == nil)then
                _, _, method, path = string.find(request, "([A-Z]+) (.+) HTTP");
            local _GET = {}
            if (vars ~= nil)then
                for k, v in string.gmatch(vars, "(%w+)=(%w+)&*") do
                    _GET[k] = v
            buf = buf.."<h1> ESP8266 Web Server</h1>";
            buf = buf.."<p>GPIO0 <a href=\"?pin=ON1\"><button>ON</button></a>&nbsp;<a href=\"?pin=OFF1\"><button>OFF</button></a></p>";
            buf = buf.."<p>GPIO2 <a href=\"?pin=ON2\"><button>ON</button></a>&nbsp;<a href=\"?pin=OFF2\"><button>OFF</button></a></p>";
            local _on,_off = "",""
            if( == "ON1")then
                  gpio.write(led1, gpio.HIGH);
            elseif( == "OFF1")then
                  gpio.write(led1, gpio.LOW);
            elseif( == "ON2")then
                  gpio.write(led2, gpio.HIGH);
            elseif( == "OFF2")then
                  gpio.write(led2, gpio.LOW);

Module - Description

 ADCAnalog to Digital Converter 
Only One ADC on NodeMCU
No ADC on ESP-01
 am2320 AM2320 humidity and temperature sensor, using the i2c interface
 ADXL345ADXL345 Sensor XYZ  BME280 BME280/BMP280 temperature/air presssure/humidity sensors (Bosch Sensortec).
 APA102  APA102 RGB LEDswhich are similar in function to the common WS2812addressable LEDs. BMP085  BMP085 temperature and pressure sensor. The module also works with BMP180.
 bit Bit manipulation support, on 32bit integers. CoAP The CoAP module provides a simple implementation according to CoAP protocol. The basic endpoint server part is based on microcoap, and many other code reference libcoap.
 CJSON The JSON support module. Allows encoding and decoding to/from JSON. crypto The crypto modules provides various functions for working with cryptographic algorithms (Encrypts  and Decrypts )
 DHT Read all kinds of DHT sensors, including DHT11, 21, 22, 33, 44 humidity temperature combo sensor. enduser This module provides a simple way of configuring ESP8266 chips without using a serial interface or pre-programming WiFi credentials onto the chip.
 encoder The encoder modules provides various functions for encoding and decoding byte data. (encoder.toBase64()) file The file module provides access to the file system and its individual files.

The file system is a flat file system, with no notion of directories/folders.

 gpio This module provides access to the GPIO (General Purpose Input/Output) subsystem.

All access is based on the I/O index number on the NodeMCU dev kits, not the internal GPIO pin. For example, the D0 pin on the dev kit is mapped to the internal GPIO pin 16.

 HMC5883L HMC5883L three axis digital compass.
 HTTP  Basic HTTP client module that provides an interface to do GET/POST/PUT/DELETE over HTTP(S), as well as customized requests. Due to the memory constraints on ESP8266, the supported page/body size is limited by available memory. Attempting to receive pages larger than this will fail. If larger page/body sizes are necessary, consider using net.createConnection() and stream in the data. HX711 This module provides access to an HX711 load cell amplifier/ADC. The HX711 is an inexpensive 24bit ADC with programmable 128x, 64x, and 32x gain. Currently only channel A at 128x gain is supported.
 I2C Setup I²C address and read/write mode for the next transfer. L3G4200D L3G4200D three axis digital gyroscope.
 mDNS Multicast DNS is used as part of Bonjour / Zeroconf. This allows system to identify themselves and the services that they provide on a local area network. Clients are then able to discover these systems and connect to them. mqtt

(A Borker Base, have to installl a Broker on PC Server and listen Publish and SubScript from ESp8266 Sensor)
 The client adheres to version 3.1.1 of the MQTT protocol. Make sure that your broker supports and is correctly configured for version 3.1.1. The client is backwards incompatible with brokers running MQTT 3.1.
 net SSL/TLS support node The node module provides access to system-level features such as sleep, restart and various info and IDs.
 Wire This module provides functions to work with the 1-Wiredevice communications bus system. pcm Play sounds through various back-ends.
 PWM PWM starts, the waveform is applied to the GPIO pin. perf This module provides simple performance measurement for an application. It samples the program counter roughly every 50 microseconds and builds a histogram of the values that it finds. Since there is only a small amount of memory to store the histogram, the user can specify which area of code is of interest. The default is the entire flash which contains code. Once the hotspots are identified, then the run can then be repeated with different areas and at different resolutions to get as much information as required.
 rc  rotary This module can read the state of cheap rotary encoder switches. These are available at all the standard places for a dollar or two. They are five pin devices where three are used for a gray code encoder for rotation, and two are used for the push switch. These switches are commonly used in car audio systems.
 rtcfifo Two Set RTC rtcmem The rtcmem module provides basic access to the RTC(Real Time Clock) memory.
 rtctime The rtctime module provides advanced timekeeping support for NodeMCU, including keeping time across deep sleep cycles (provided rtctime.dsleep() is used instead of node.dsleep()). This can be used to significantly extend battery life on battery powered sensor nodes, as it is no longer necessary to fire up the RF module each wake-up in order to obtain an accurate timestamp. sigma_delta This module provides access to the sigma-deltacomponent. It's a hardware signal generator that can be routed to any of the GPIOs except pin 0.
 sntp The SNTP module implements a Simple Network Time Procotol client. This includes support for the "anycast"NTP mode where, if supported by the NTP server(s) in your network, it is not necessary to even know the IP address of the NTP server. struct This module offers basic facilities to convert Lua values to and from C structs. Its main functions are struct.pack, which packs multiple Lua values into a struct-like string; and struct.unpack, which unpacks multiple Lua values from a given struct-like string.
 spi All transactions for sending and receiving are most-significant-bit first and least-significant last. For technical details of the underlying hardware refer to metalphreak's ESP8266 HSPI articles. switec This module controls a Switec X.27 (or compatible) instrument stepper motor
 tm1829 tm1829 is a library to handle led strips using Titan Micro tm1829 led controller. tmr The tmr module allows access to simple timers, the system counter and uptime.

 tsl2561 Extra I2C init Initializes the device on pins sdapin & sclpin. u8g U8glib is a graphics library developed at olikraus/u8glibwith support for many different displays. The NodeMCU firmware supports a subset of these.
 uart The UART (Universal asynchronous receiver/transmitter) module allows configuration of and communication over the UART serial port. ucg Ucglib is a graphics library developed at olikraus/ucglibwith support for color TFT displays. The NodeMCU firmware supports a subset of these:
 wifi The NodeMCU WiFi control is spread across several  ws2801 
 ws2802 ws2812 is a library to handle ws2812-like led strips. It works at least on WS2812, WS2812b, APA104, SK6812 (RGB or RGBW). l3g4200d This module provides access to the L3G4200D three axis digital gyroscope.

Update Fameware on 2016 08 18