The NodeMCU is an open-source firmware and development kit that helps you to prototype your IoT (Internet of Things) projects with few Lua script lines, or through the Arduino IDE. It includes firmware that runs on the ESP8266 Wi-Fi SoC from Espressif Systems, and hardware which is based on the ESP-12 module. The term "NodeMCU" by default refers to the firmware rather than the development kits. The firmware uses the Lua scripting language.
Common applications of the NodeMCU include smart home devices, IoT sensors, wireless control systems, and various other applications that require communication over Wi-Fi.
Pin Number | Function | Description |
---|---|---|
D0 | GPIO16 | Digital I/O, PWM, Deep-sleep wake |
D1 | GPIO5 | Digital I/O, PWM, I2C SCL |
D2 | GPIO4 | Digital I/O, PWM, I2C SDA |
D3 | GPIO0 | Digital I/O, PWM, pulled up, boot/flash mode |
D4 | GPIO2 | Digital I/O, PWM, pulled up, TXD1 |
D5 | GPIO14 | Digital I/O, PWM, SPI SCK |
D6 | GPIO12 | Digital I/O, PWM, SPI MISO |
D7 | GPIO13 | Digital I/O, PWM, SPI MOSI, RXD2 |
D8 | GPIO15 | Digital I/O, PWM, SPI SS, boot from SD card |
A0 | ADC0 | Analog Input |
VIN | - | Input voltage to NodeMCU |
GND | - | Ground |
3V3 | - | 3.3V output |
RST | - | Reset button |
http://arduino.esp8266.com/stable/package_esp8266com_index.json
.Here is a simple example of blinking an LED connected to the NodeMCU:
// Define the LED pin
const int LED_PIN = D4; // NodeMCU pin where the LED is connected
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_PIN as an output.
pinMode(LED_PIN, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_PIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_PIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
Q: Can I use 5V sensors with NodeMCU? A: NodeMCU operates at 3.3V logic levels. For 5V sensors, use a level shifter to prevent damage to the board.
Q: How do I reset the NodeMCU? A: You can reset the NodeMCU by pressing the RST button on the board or by momentarily connecting the RST pin to GND.
Q: How many digital pins can be used for PWM? A: All digital pins on the NodeMCU can be used for PWM except for D0.
Q: What is the maximum current that can be drawn from a single GPIO pin? A: The maximum current from a single GPIO pin should not exceed 12mA.
Q: Can I power NodeMCU using the 3V3 pin? A: Yes, you can power the NodeMCU using the 3V3 pin, but ensure that the power supply is regulated and stable.
For further assistance, consult the NodeMCU community forums or the extensive documentation available online.