The ESP8266 NodeMCU is a versatile Wi-Fi microcontroller board based on the ESP8266 chip, designed specifically for Internet of Things (IoT) applications. It combines a powerful microcontroller with built-in Wi-Fi capabilities, making it ideal for projects requiring wireless connectivity. The custom size variant allows for tailored dimensions to fit specific project requirements, offering flexibility for compact or space-constrained designs.
The ESP8266 NodeMCU custom size variant typically includes the following pinout:
Pin | Name | Description |
---|---|---|
1 | VIN | Input voltage (4.5V–10V). Powers the board when USB is not connected. |
2 | GND | Ground pin. Connect to the ground of the circuit. |
3 | 3V3 | 3.3V output. Can power external components (max 50 mA). |
4 | D0 (GPIO16) | General-purpose I/O pin. Can also be used for deep sleep wake-up. |
5 | D1 (GPIO5) | General-purpose I/O pin. Commonly used for I2C SCL. |
6 | D2 (GPIO4) | General-purpose I/O pin. Commonly used for I2C SDA. |
7 | D3 (GPIO0) | General-purpose I/O pin. Must be HIGH during boot to avoid boot mode issues. |
8 | D4 (GPIO2) | General-purpose I/O pin. Built-in LED is connected to this pin. |
9 | RX (GPIO3) | UART receive pin. Used for serial communication. |
10 | TX (GPIO1) | UART transmit pin. Used for serial communication. |
11 | A0 | Analog input pin. Reads voltages from 0–1V (use a voltage divider for higher). |
Note: The number of GPIO pins available may vary depending on the custom size configuration.
Powering the Board:
Connecting to Wi-Fi:
Programming:
GPIO Usage:
The following example demonstrates how to connect the ESP8266 NodeMCU to a Wi-Fi network and control the built-in LED:
#include <ESP8266WiFi.h>
// Replace with your network credentials
const char* ssid = "Your_SSID";
const char* password = "Your_PASSWORD";
void setup() {
Serial.begin(115200); // Initialize serial communication
pinMode(LED_BUILTIN, OUTPUT); // Set built-in LED pin as output
// Connect to Wi-Fi
Serial.print("Connecting to Wi-Fi");
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("\nWi-Fi connected!");
}
void loop() {
// Blink the built-in LED
digitalWrite(LED_BUILTIN, LOW); // Turn LED on
delay(1000); // Wait for 1 second
digitalWrite(LED_BUILTIN, HIGH); // Turn LED off
delay(1000); // Wait for 1 second
}
Board Not Detected by Computer:
Wi-Fi Connection Fails:
Code Upload Fails:
GPIO Pin Issues:
Can I use the ESP8266 NodeMCU with 5V sensors?
What is the maximum range of the Wi-Fi module?
How do I enable deep sleep mode?
ESP.deepSleep()
function in your code.Can I customize the board size and pinout?