Introduction to NodeMCU IoT Development Board

Reading this article will take approximately 10 minutes.

Getting to Know NodeMCU Development Board

NodeMCU is an open-source IoT hardware development board. It has gained increasing popularity among makers worldwide in recent years due to its support for WiFi functionality and its similarity in usage to Arduino development boards. The size of NodeMCU is similar to that of Arduino Nano. It is not developed by the Arduino team, but features a genuine “Chinese chip”—the ESP8266 module, which can be developed using the Arduino IDE. Both in terms of performance and price, it is very suitable for our development and learning.

As the foundation of IoT, the cost of IoT control boards should not be too high. Expensive IoT control components are not conducive to project cost control and are also unfavorable for learning and use by many maker enthusiasts. In this regard, NodeMCU has more advantages compared to Raspberry Pi and other IoT platforms in the Arduino family.

Introduction to NodeMCU IoT Development Board

△ ESP8266-NodeMCU Development Board

ESP8266 and NodeMCU

ESP8266 is a chip, as shown in the figure below.

Introduction to NodeMCU IoT Development Board

△ ESP8266 Chip

NodeMCU, on the other hand, is a development board centered around the ESP8266 chip, as shown in the figure below.

Introduction to NodeMCU IoT Development Board

△ NodeMCU Development Board with Built-in ESP8266 Chip

The ESP8266 chip is very small, making it difficult to connect the tiny chip pins to our computer for uploading programs and other operations. Thus, various development boards equipped with the ESP8266 chip have emerged in the market, such as SparkFun ESP8266 Thing, Adafruit Feather HUZZAH with ESP8266, and NodeMCU. NodeMCU is one of these development boards.

The two rows of pins on the NodeMCU development board are connected to the pins of the ESP8266 chip. With these two rows of pins on the development board, we can easily use Dupont wires to connect the chip’s pins to the experimental circuit. The NodeMCU development board also comes with a USB interface and voltage conversion circuit, providing us with great convenience. With just a USB data cable, we can easily power the ESP8266 and upload programs.The two rows of pins on the NodeMCU development board are connected to the pins of the ESP8266 chip.

Introduction to NodeMCU IoT Development Board

△ NodeMCU Pins

Detailed Explanation of NodeMCU Development Board

1. Digital Input and Output Pins (GPIO)

As shown in the figure below, there are many pins distributed around the ESP8266 chip. Most of these pins can be used for input and output. These pins used for input and output are collectively referred to as GPIO.

Introduction to NodeMCU IoT Development Board

△ ESP8266 Chip Pin Location

The GPIO pins of the ESP8266 chip can be used as digital inputs to read pin levels or as digital outputs to send control signals to external circuits. In this regard, the GPIO pins are very similar to the pins of Arduino development boards. (Please note that they are similar but not the same, as there are many differences between GPIO pins and Arduino pins.)

When the pins are operating in digital output mode, the low level is 0V (sinking current), and the high level is 3.3V (sourcing current).

Please note: The pin level voltage of the ESP8266 chip differs from that of Arduino Uno/Mega/Nano and other development boards. The high level of Arduino development boards is +5V, and the low level is 0V.

2. Difference Between GPIO Numbering and NodeMCU Development Board Pin Names

Please note: In many resources introducing the ESP8266 and NodeMCU, two naming methods for pins will appear. One is GPIO numbering, and the other is the NodeMCU pin name. Please do not confuse the two.

GPIO numbering refers to the pin numbers of the ESP8266 chip, as shown in the figure below. We refer to them in the format “GPIO + number,” such as GPIO2, GPIO16…

Introduction to NodeMCU IoT Development Board

NodeMCU pin names refer to the names printed on the circuit board. As shown in the figure below:

Introduction to NodeMCU IoT Development Board

The pin names of the NodeMCU development board are typically a combination of a character and a number, such as: D0, D1, A0… .

3. Correspondence Between ESP8266 GPIO Numbering and NodeMCU Development Board Pin Names

The correspondence between ESP8266 GPIO numbering and NodeMCU development board pin names is illustrated in the figure below.

Introduction to NodeMCU IoT Development Board ESP8266-NodeMCU Pin Function

The white text on a dark blue background in the image indicates the GPIO pin number, such as “GPIO4.” The printed names on the development board, such as D2, D3, etc., are the NodeMCU development board pin names, as shown in the figure below.

Introduction to NodeMCU IoT Development Board

△ NodeMCU GPIO Names

As shown in the figure below, the D2 pin of NodeMCU is connected to GPIO4. Similarly, the following explanatory diagram can help find the correspondence between the two.

Introduction to NodeMCU IoT Development Board

So, why spend so much time explaining the correspondence between the development board pin names and GPIO numbers?

When writing control programs for the NodeMCU development board, pin operations are often performed. For example, the following program statement.

Introduction to NodeMCU IoT Development Board

The above statement uses the digitalWrite function to set pin 4 to high level. So what does this number 4 refer to, GPIO4 or the development board D4 pin?

The answer is GPIO4.

If you want to set the D2 pin to high level, you can use the following statement.

Introduction to NodeMCU IoT Development Board

4. Usable Pins

The ESP8266 chip has 17 GPIO pins (GPIO0 to GPIO16). GPIO6 to GPIO11 are used to connect the development board’s flash memory. If GPIO6 to GPIO11 are used in the experimental circuit, the NodeMCU development board will not work properly. Therefore, it is recommended to not use GPIO6 to GPIO11.

Introduction to NodeMCU IoT Development Board

5. Voltage and Current Limitations

The input and output voltage limit of the NodeMCU development board pins is 3.3 V. Applying a voltage above 3.6V to the pins may damage the chip circuit. Also, please note that the maximum output current of these pins is 12mA.

Since the voltage and current allowed by the NodeMCU development board pins are lower than those of Arduino development board pins, please be particularly careful about the voltage and current differences between these two development boards when connecting NodeMCU with Arduino pins. Improper handling may damage the NodeMCU development board.

6. Special Pin Situations

The GPIO2 pin cannot be connected to a low level when the NodeMCU development board starts.

The GPIO15 pin remains in a low level state during the operation of the development board. Therefore, please do not use the GPIO15 pin to read switch states or perform I²C communication.

The GPIO0 pin needs to remain in a high level state during the operation of the development board. Otherwise, the ESP8266 will enter programming upload mode and will not work properly. There is no need for additional operations on the GPIO0 pin, as the built-in circuit of NodeMCU can ensure that the GPIO0 pin connects to a high level during operation and a low level during program upload.

7. Pull-up/Pull-down Resistors

GPIO 0-15 pins are equipped with built-in pull-up resistors. This is very similar to Arduino. The GPIO16 pin is equipped with a built-in pull-down resistor.

8. Analog Input

The ESP8266 has only one analog input pin (this pin converts the analog voltage value on the pin into a digital quantity through analog-to-digital conversion). The analog voltage value that this pin can read is 0 – 1.0V. Please note: Connecting the ESP8266 chip’s analog input pin to a voltage above 1.0V may damage the ESP8266 chip.

The NodeMCU development board is equipped with a step-down circuit. The analog input pin of the NodeMCU development board can read analog voltage signals from 0-3.3V.

9. Communication

(1) Serial Port

The ESP8266 has 2 hardware serial ports (UART).

Serial port 0 (UART0) uses GPIO1 and GPIO3 pins. GPIO1 pin is TX0, and GPIO3 is RX0.

Serial port 1 (UART1) uses GPIO2 and GPIO8 pins. GPIO2 pin is TX1, and GPIO8 is RX1. Please note that since GPIO8 is used to connect to the flash memory chip, serial port 1 can only use GPIO2 to send serial data externally.

(2) I²CThe ESP8266 has only a software simulated I²C port, with no hardware I²C port. This means we can use any two GPIO pins to implement I²C communication via software simulation. In the ESP8266 datasheet, GPIO2 is marked as SDA, and GPIO14 is marked as SCL.

(3) SPIThe SPI port situation of the ESP8266 is as follows:

GPIO14 — CLK, GPIO12 — MISO, GPIO13 — MOSI, GPIO15 — CS(SS)

Overview of ESP8266 Pin Functions

GPIO

Function

Status

Limitations

0

Boot Mode Selection

3.3V

No Hi-Z

1

TX0

Cannot be used during serial communication

2

Boot Mode Selection TX1

3.3V

Cannot be grounded during startup; sends debugging information during startup

3

RX0

Cannot be used during serial communication

4

SDA (I²C)

5

SCL (I²C)

6 – 11

Connected to Flash Memory

x

Not usable

12

MISO (SPI)

13

MOSI (SPI)

14

SCK (SPI)

15

SS (SPI)

0V

Pull-up resistor not available

16

Sleep Wake

No pull-up resistor, only a pull-down resistor connected to the RST pin for sleep wake

Content compiled from Taiji Maker’s “Zero Basics to Learn IoT”

Leave a Comment