NodeMCU, manufactured by AZDelivery with part ID ESP8266, is an open-source IoT platform that integrates a Wi-Fi module and a microcontroller into a single compact board. It is based on the ESP8266 chip and features built-in support for Lua scripting and Arduino programming, making it a versatile choice for developing connected devices and IoT applications.
The NodeMCU board features a total of 30 pins. Below is the pinout and description:
Pin Name | Type | Description |
---|---|---|
VIN | Power Input | Input voltage (4.5V–10V) for powering the board via an external power source. |
3V3 | Power Output | Regulated 3.3V output from the onboard voltage regulator. |
GND | Ground | Ground connection. |
D0–D8 | Digital I/O | General-purpose digital pins (can be used for PWM, I2C, SPI, etc.). |
A0 | Analog Input | 10-bit ADC input (0–3.3V range). |
RX | UART Input | UART receive pin for serial communication. |
TX | UART Output | UART transmit pin for serial communication. |
EN | Enable | Active-high enable pin for the ESP8266 module. |
RST | Reset | Active-low reset pin to restart the board. |
SD3, SD2, SD1, CMD, CLK | Flash Memory Pins | Used internally for SPI flash memory communication. Not typically user-accessible. |
Powering the Board:
Programming the Board:
Connecting Peripherals:
Here is an example of how to blink an LED connected to pin D1:
// Define the LED pin
const int ledPin = D1;
void setup() {
// Set the LED pin as an output
pinMode(ledPin, OUTPUT);
}
void loop() {
// Turn the LED on
digitalWrite(ledPin, HIGH);
delay(1000); // Wait for 1 second
// Turn the LED off
digitalWrite(ledPin, LOW);
delay(1000); // Wait for 1 second
}
The board is not detected by the computer:
Upload errors in the Arduino IDE:
Wi-Fi connection issues:
The board resets unexpectedly:
Q: Can I use the NodeMCU with 5V sensors?
A: The NodeMCU operates at 3.3V logic levels. Use a level shifter to safely interface with 5V sensors.
Q: How do I restore the factory firmware?
A: Use the ESP8266 Flasher tool to reflash the original firmware. Ensure you download the correct firmware version for your board.
Q: Can I use the NodeMCU for battery-powered projects?
A: Yes, but ensure the battery provides a stable voltage within the acceptable range (4.5V–10V). Consider using a low-power mode to conserve energy.
Q: What is the maximum Wi-Fi range of the NodeMCU?
A: The range depends on environmental factors but typically extends up to 50 meters indoors and 100 meters outdoors.
By following this documentation, you can effectively utilize the NodeMCU for a wide range of IoT and embedded applications.