

NodeMCU is an open-source IoT platform developed by WCH.cn, based on the ESP8266 Wi-Fi module (manufacturer part ID: esp). It integrates a built-in microcontroller and supports both Lua scripting and the Arduino IDE, making it a versatile and user-friendly choice for developing connected devices. With its compact design and robust features, NodeMCU is widely used in IoT applications, home automation, and wireless sensor networks.








| Parameter | Specification |
|---|---|
| Microcontroller | ESP8266 |
| Operating Voltage | 3.3V |
| Input Voltage (VIN) | 4.5V - 10V |
| Digital I/O Pins | 11 |
| Analog Input Pins | 1 (10-bit ADC) |
| Flash Memory | 4MB |
| Clock Speed | 80 MHz (can be overclocked to 160 MHz) |
| Wi-Fi Standard | 802.11 b/g/n |
| Communication Protocols | UART, SPI, I2C |
| Power Consumption | 170 mA (average during Wi-Fi operation) |
| Dimensions | 49mm x 26mm |
| Pin Name | Pin Number | Description |
|---|---|---|
| VIN | - | Input voltage (4.5V - 10V) |
| GND | - | Ground |
| 3V3 | - | 3.3V output |
| D0 | GPIO16 | General-purpose digital I/O |
| D1 | GPIO5 | General-purpose digital I/O, supports I2C |
| D2 | GPIO4 | General-purpose digital I/O, supports I2C |
| D3 | GPIO0 | General-purpose digital I/O, boot mode |
| D4 | GPIO2 | General-purpose digital I/O, boot mode |
| D5 | GPIO14 | General-purpose digital I/O, supports SPI |
| D6 | GPIO12 | General-purpose digital I/O, supports SPI |
| D7 | GPIO13 | General-purpose digital I/O, supports SPI |
| D8 | GPIO15 | General-purpose digital I/O, boot mode |
| A0 | ADC0 | Analog input (0V - 3.3V) |
| RST | - | Reset pin |
Powering the NodeMCU:
Programming the NodeMCU:
Connecting Peripherals:
Uploading Code:
The following example demonstrates how to connect the NodeMCU to a Wi-Fi network and blink an LED.
#include <ESP8266WiFi.h> // Include the ESP8266 Wi-Fi library
const char* ssid = "Your_SSID"; // Replace with your Wi-Fi SSID
const char* password = "Your_Password"; // Replace with your Wi-Fi password
const int ledPin = D4; // Built-in LED pin (GPIO2)
void setup() {
pinMode(ledPin, OUTPUT); // Set LED pin as output
Serial.begin(115200); // Initialize serial communication
Serial.println("Connecting to Wi-Fi...");
WiFi.begin(ssid, password); // Connect to Wi-Fi
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("\nWi-Fi connected!");
Serial.print("IP Address: ");
Serial.println(WiFi.localIP()); // Print the IP address
}
void loop() {
digitalWrite(ledPin, HIGH); // Turn the LED on
delay(1000); // Wait for 1 second
digitalWrite(ledPin, LOW); // Turn the LED off
delay(1000); // Wait for 1 second
}
NodeMCU Not Detected by Computer:
Code Upload Fails:
Wi-Fi Connection Issues:
Overheating:
Q: Can I power the NodeMCU with a 5V power bank?
A: Yes, you can power the NodeMCU via the micro-USB port or the VIN pin with a 5V source.
Q: What is the maximum current output of the GPIO pins?
A: Each GPIO pin can source or sink up to 12 mA. Avoid exceeding this limit to prevent damage.
Q: Can I use the NodeMCU with a 5V sensor?
A: Use a voltage divider or level shifter to step down the 5V signal to 3.3V before connecting it to the NodeMCU.
Q: How do I reset the NodeMCU?
A: Press the "RST" button on the board to perform a hardware reset.