

NodeMCU is an open-source IoT platform based on the ESP8266 Wi-Fi module. It features a built-in microcontroller and supports the Lua script interpreter, making it an excellent choice for developing connected devices. With its compact design and integrated Wi-Fi capabilities, NodeMCU simplifies the process of creating IoT applications by combining hardware and software in a single platform.








| Pin | Name | Description | 
|---|---|---|
| 1 | VIN | Input voltage (4.5V–10V) for powering the board. | 
| 2 | GND | Ground connection. | 
| 3 | 3V3 | Regulated 3.3V output. | 
| 4 | D0 (GPIO16) | General-purpose digital I/O pin. | 
| 5 | D1 (GPIO5) | General-purpose digital I/O pin, often used for I2C (SCL). | 
| 6 | D2 (GPIO4) | General-purpose digital I/O pin, often used for I2C (SDA). | 
| 7 | D3 (GPIO0) | General-purpose digital I/O pin, also used for boot mode selection. | 
| 8 | D4 (GPIO2) | General-purpose digital I/O pin, connected to the onboard LED. | 
| 9 | D5 (GPIO14) | General-purpose digital I/O pin, often used for SPI (SCLK). | 
| 10 | D6 (GPIO12) | General-purpose digital I/O pin, often used for SPI (MISO). | 
| 11 | D7 (GPIO13) | General-purpose digital I/O pin, often used for SPI (MOSI). | 
| 12 | D8 (GPIO15) | General-purpose digital I/O pin, often used for SPI (CS). | 
| 13 | A0 | Analog input pin (0–3.3V). | 
| 14 | RST | Reset pin. Pull low to reset the board. | 
The following example demonstrates how to blink the onboard LED (connected to GPIO2):
// Define the onboard LED pin
const int ledPin = 2; // GPIO2 is connected to the onboard LED
void setup() {
  pinMode(ledPin, OUTPUT); // Set the LED pin as an output
}
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
}
Q: Can I power the NodeMCU with a 5V power supply?
A: Yes, you can power the NodeMCU via the VIN pin or micro-USB port with a 5V supply.
Q: How do I reset the NodeMCU?
A: Press the "RST" button on the board or pull the RST pin low.
Q: Can I use the NodeMCU with 5V sensors?
A: Use a voltage divider or level shifter to step down the 5V signal to 3.3V for compatibility.
Q: What is the maximum Wi-Fi range of the NodeMCU?
A: The range depends on environmental factors but is typically around 30–50 meters indoors.