Node MCU ESP8266 V3 (LOLIN CH340 chip) Documentation
The Node MCU ESP8266 V3 is a popular microcontroller board based on the ESP8266 system-on-chip (SoC) and LOlin CH340 chip. It is a versatile and affordable IoT development board that supports Wi-Fi connectivity, making it suitable for a wide range of IoT projects.
Microcontroller: ESP8266
Wi-Fi: 802.11 b/g/n
GPIO: 13 (including 1x UART, 1x I2C, 1x I2S)
Flash Memory: 4MB
SRAM: 96KB
Operating Voltage: 3.3V
Input Voltage: 5-12V
Dimensions: 49 x 24.5 mm
The Node MCU ESP8266 V3 is compatible with a variety of programming languages, including C, C++, Lua, and MicroPython.
### Example 1: Wi-Fi Connect and HTTP Client
This example demonstrates how to connect the Node MCU ESP8266 V3 to a Wi-Fi network and make an HTTP request to a web server.
```c
#include <WiFi.h>
#include <HTTPClient.h>
const char ssid = "your_wifi_ssid";
const char password = "your_wifi_password";
const char serverUrl = "http://example.com";
WiFiClient wifiClient;
HTTPClient http;
void setup() {
Serial.begin(115200);
// Connect to Wi-Fi
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi...");
}
Serial.println("Connected to WiFi");
Serial.println("Initializing HTTP client...");
}
void loop() {
http.begin(wifiClient, serverUrl);
int httpCode = http.GET();
if (httpCode > 0) {
String response = http.getString();
Serial.println(response);
} else {
Serial.println("Error sending request");
}
http.end();
delay(5000);
}
```
### Example 2: Blinking LED using MicroPython
This example demonstrates how to use MicroPython to blink an LED connected to GPIO 2 on the Node MCU ESP8266 V3.
```python
import machine
import time
# Set up GPIO 2 as an output
led = machine.Pin(2, machine.Pin.OUT)
while True:
# Turn on the LED
led.value(1)
time.sleep(0.5)
# Turn off the LED
led.value(0)
time.sleep(0.5)
```
### Example 3: Reading Temperature and Humidity using DHT11 Sensor
This example demonstrates how to use the Node MCU ESP8266 V3 to read temperature and humidity data from a DHT11 sensor.
```c
#include <DHT.h>
#define DHT_PIN 2
#define DHT_TYPE DHT11
DHT dht(DHT_PIN, DHT_TYPE);
void setup() {
Serial.begin(115200);
dht.begin();
}
void loop() {
float temperature = dht.readTemperature();
float humidity = dht.readHumidity();
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.println(" C");
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.println(" %");
delay(2000);
}
```
These examples demonstrate the versatility of the Node MCU ESP8266 V3 and its potential for IoT development. With its Wi-Fi capabilities, GPIO pins, and support for various programming languages, this board is an ideal choice for a wide range of projects.