This project focuses on building a real-time data visualization dashboard using ESP32 or NodeMCU. It allows you to monitor various sensor data visually using charts and graphs.
The following code demonstrates how to set up the ESP32 to send sensor data to a web page, where it will be visualized:
#include <WiFi.h>
#include <DHT.h>
#define DHTPIN 4 // DHT22 pin
#define DHTTYPE DHT22 // DHT 22
DHT dht(DHTPIN, DHTTYPE);
const char* ssid = "your_SSID";
const char* password = "your_PASSWORD";
void setup() {
Serial.begin(115200);
dht.begin();
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi...");
}
Serial.println("Connected to WiFi");
}
void loop() {
float temperature = dht.readTemperature();
float humidity = dht.readHumidity();
if (isnan(temperature) || isnan(humidity)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
// Here you would send the data to a server or update a database
// For example, you can use HTTP POST to send the data
delay(2000); // Delay between readings
}
Real-Time Data Dashboard
This project demonstrates how to create a real-time data visualization dashboard using ESP32 or NodeMCU. With this setup, you can easily monitor sensor data and visualize it in a user-friendly manner.