Personal Weather Station

Monitor and manage local weather data with this IoT-enabled weather station project.

Project Overview

This personal weather station allows users to monitor real-time temperature, humidity, and atmospheric pressure data using sensors like the DHT22 and BMP280. The data is displayed on a web interface, and historical weather data is managed (forvalted) and stored for analysis.

Components Required

Circuit Diagram

The ESP8266 or ESP32 is connected to the DHT22 and BMP280 sensors. Data is collected and uploaded to a web server or cloud service. A local OLED display can also be connected to show real-time readings.

Weather Station Circuit

Sample Code

Below is a sample code snippet for gathering weather data from sensors and uploading it to a web interface or cloud storage:


// ESP8266 Weather Station Code
#include 
#include 
#include 
#include 
#include 

// Define DHT and BMP280
#define DHTPIN D4
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
Adafruit_BMP280 bmp;

// WiFi credentials
const char* ssid = "your_SSID";
const char* password = "your_PASSWORD";

void setup() {
  Serial.begin(115200);
  dht.begin();
  bmp.begin();

  // Connect to WiFi
  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();
  float pressure = bmp.readPressure() / 100.0F;

  if (isnan(temperature) || isnan(humidity)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }

  // Display data in Serial Monitor (or upload to cloud/database)
  Serial.print("Temperature: ");
  Serial.print(temperature);
  Serial.print(" °C, Humidity: ");
  Serial.print(humidity);
  Serial.print(" %, Pressure: ");
  Serial.print(pressure);
  Serial.println(" hPa");

  delay(2000);  // Repeat every 2 seconds
}
            

Web Interface for Monitoring

The weather station data is displayed in real-time on a simple web interface. The interface shows current temperature, humidity, and pressure data, as well as historical data stored in the cloud for long-term analysis. Below is the web interface structure:


// Example HTML for Weather Station Dashboard



  
  
  Weather Station Dashboard
  


  

Weather Station Dashboard

Temperature: -- °C

Humidity: -- %

Pressure: -- hPa

Data Management

The weather data can be stored and managed using a cloud solution, such as Google Sheets or a custom server with a database. This allows users to track historical weather trends, view graphs, and export the data for further analysis.

Features

Future Enhancements