This is a quick tutorial how to get started with your new NodeMCU bought from Modtronix or BestBay.
For details on the NodeMCU V1.0, see https://github.com/nodemcu/nodemcu-devkit-v1.0
The official NodeMCU firmware contains the Lua Interpreter. Lua is an interactive programming language which allows you to experiment and build simple working programs without a lot of effort. If you are not familiar with Lua, you will find that it is not hard to learn, at least for the simple tasks needed to get started.
For details how to use and flash the NodeMCU, see this page on our Wiki.
Since Arduino IDE 1.6.4, it is possible adding the ESP8266 Board Package to the IDE.
For details, see Using with Arduino.
The board has 2 buttons and 2 LEDs.
Many of the GPIO pins of the ESP8266 are multiplexed with other functions. This limits their availability for general purpose usage. For example:
The pinouts of the NodeMCU and ESP8266 are a bit confusing when using with Arduino.
|ESP8266 Pin||NodeMCU Pin||Label||Arduino Pin||Free||Note|
|GPIO0||J2-4||D3||D3||Button|| Flash Button(active low) - has 12K pull-up resistor. High is run mode, low is flash mode.
Can only be used as gpio read/write. No support for open-drain/interrupt/pwm/i2c/ow.
|GPIO1||J2-13||D10||D10||TX - TXD0. Connected to TX pin of USB Com port. Used for programming. Do not use for general purpose I/O!|
|GPIO2||J2-5||D4||D4||Shared (LED)|| RXD1 - has 12K pull-up resistor. Needs to be high at power up to enter run(GPIO0 high) or flash mode(GPIO0 low).
Is also connected to blue LED(active low) near the antenna.
Can be used as general purpose output. Note that the blue LED(near antenna) will turn on when output is low.
|GPIO3||J2-12||D9||D9||RX - RXD0. Connected to RX pin of USB Com port. Used for programming. Do not use for general purpose I/O!|
|GPIO4||J2-3||D2||D2||Yes||In Arduino default for SDA(I2C Data).|
|GPIO5||J2-2||D1||D1||Yes||In Arduino default for SCL(I2C Clock).|
|GPIO6||N/A||Pin not available on ESP-12 and NodeMCU|
|GPIO7||N/A||Pin not available on ESP-12 and NodeMCU|
|GPIO8||N/A||Pin not available on ESP-12 and NodeMCU|
|GPIO9||J1-5||D11||D11||Connected to Flash on ESP-12. Do not use! It can potentially be used if configuring Flash to use DIO mode(QIO is default).|
|GPIO10||J1-4||D12||D12||Connected to Flash on ESP-12. Do not use! It can potentially be used if configuring Flash to use DIO mode(QIO is default).|
|GPIO11||N/A||Pin not available on ESP-12 and NodeMCU|
|GPIO12||J2-9||D6||D6||Yes||User MISO pin. HSPI MISO.|
|GPIO13||J2-10||D7||D7||Yes||User MOSI pin. HSPI MOSI. Also RXD2.|
|GPIO14||J2-8||D5||D5||Yes||User SPI CLK pin. HSPI CLK.|
|GPIO15||J2-11||D8||D8||Shared|| HSPI CSn pin. Also TXD2. Has 12K pull-down resistor. Must be low at startup to boot from flash - Do NOT connect directly to ground.
Can be used as general purpose output (or input, but ensure it does not clash with pull-down resistor).
|GPIO16||J2-1||D0||D0||Shared (LED)|| User LED(active low) on NodeMCU (no LED with just using ESP-12F).
Can be used as general purpose output. Note that the LED will turn on when output is low.
|J1-1||A0||A0||Yes||User Analog Input, connected to ESP8266 Analog input(0-1V input) via 0.3125 voltage divider(100k and 22k resistors). This allows a 0 to 3.2V input.|
|ADC||J1-2||RSV||Do not use, use A0 for analog input! Connected to ESP8266 Analog input. Gets input from A0 via voltage divider.|
|EN||J1-12||EN||Enable pin - has 12K pull-up resistor. This is connected to the CH_PD pin of the ESP-12, which requires a pull-up resistor (is provided by the NodeMCU)|
|nRST||J1-13||RST||Reset(active low) - has 12K pull-up resistor. Also connected to 100nF capacitor for auto power on reset|
|GPIO8||J1-6||SD1||SPI port of ESP8266. Connected to Flash on ESP-12. Do not use!|
|GPIO11||J1-7||CMD||SPI port of ESP8266. Connected to Flash on ESP-12. Do not use!|
|GPIO7||J1-8||SDO||SPI port of ESP8266. Connected to Flash on ESP-12. Do not use!|
|GPIO6||J1-9||CLK||SPI port of ESP8266. Connected to Flash on ESP-12. Do not use!|
There is only 1 ADC port. It is pin 1 on the J1 connector, and is marked “A0” on the board.
Pins D1 to D10 can be used for PWM output. Note that some of them are used for alternative functions, and might not be available for the user:
The ESP8266 has two hardware SPI modules, called SPI and HSPI.
SPI: Pins 6 to 9 on J1 connector of NodeMCU. This SPI module is connected to the Flash chip on the ESP-12 module. Do NOT use!.
HSPI: This is a second SPI module available on the ESP8266. It can be used by the user.
Ensure the CP2102 USB driver is installed correctly. The driver should be located here. If not, google it.