User Tools

Site Tools


Sidebar

Modtronix.com
Sitemap

tutorials:wireless:esp:esp8266:nodemcu_v1


This is a quick tutorial how to get started with your new NodeMCU bought from Modtronix or BestBay.

Hardware

For details on the NodeMCU V1.0, see https://github.com/nodemcu/nodemcu-devkit-v1.0

Using with NodeMCU Firmware and Lua Interpreter

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.

Using with Arduino IDE

Since Arduino IDE 1.6.4, it is possible adding the ESP8266 Board Package to the IDE.

For details, see Using with Arduino.

Buttons and LEDs

The board has 2 buttons and 2 LEDs.

  • Rest Button: It is marked “RST” on the board. Pressing it will pull the nRST pin of the ESP8266 low, causing it to reset.
  • User/Flash Button: It is marked “FLASH” on the board. Pressing it will pull the GPIO0 line low.
  • LED on ESP-12 board: LED on ESP-12 module.
  • LED on main board: Connected to signal GPIO0, active low.

Pinouts & GPIO Pins

Many of the GPIO pins of the ESP8266 are multiplexed with other functions. This limits their availability for general purpose usage. For example:

  • GPIO0 is used for the “Flash” button.
  • GPIO1 and GPIO3 are used for the USB virtual com port, and are unavailable for GPIO use.
  • GPIO15 needs to be low when booting from the onboard SPI flash. It has an onboard 12k pull-down resistor. Do not connect it directly to GND!
  • GPIO16 is used for the user LED.

The pinouts of the NodeMCU and ESP8266 are a bit confusing when using with Arduino.

  • The GPIO pins are the ESP8266 pins
  • The Label is the marking on the NodeMCU board
  • The Arduino Pin is the pin to use in the Arduino IDE

esp_nodemcu-v1_pinouts2_w640.jpg

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!

ADC

There is only 1 ADC port. It is pin 1 on the J1 connector, and is marked “A0” on the board.

PWM

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:

  • D3: Also used for the Flash Button(active low), and has a 12K pull-up resistor connected to is. High is run mode, low is flash mode.
  • D4: Is also RXD1. Has a 12K pull-up resistor connected to it.
  • D5 to D8: Is also the user SPI port(HSPI). Not used by the system of NodeMCU. Available to the user.
  • D7 and D8: Is also the user UART2. Not used by the system of NodeMCU. Available to the user.
  • D9 and D10: Are used for the USB Com port, and for programming.

SPI and HSPI

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.

  • GPIO12: MISO (DIN)
  • GPIO13: MOSI (DOUT)
  • GPIO14: CLOCK
  • GPIO15: CS / SS

Schematics and PCB

Documentation, Source Code and Additional Information

Trouble Shooting

Check USB Drivers are installed correctly

Ensure the CP2102 USB driver is installed correctly. The driver should be located here. If not, google it.

tutorials/wireless/esp/esp8266/nodemcu_v1.txt · Last modified: 2017/07/18 21:43 by modtronix