IoT Weather Reporting System using Raspberry Pi

Project by: Praphul Kant • NIELIT Internship • Last updated: 02-Aug-2024

Introduction

Weather monitoring is essential for numerous sectors including agriculture, transportation, disaster management, and urban planning. Accurate and timely weather data can significantly improve decision-making processes in these fields. However, traditional weather monitoring systems often fall short due to high costs, limited coverage, and inability to provide real-time data.

The "IoT Weather Reporting System using Raspberry Pi 5" harnesses IoT technology to develop a cost-effective, efficient weather reporting system. It monitors environmental parameters such as temperature, humidity, and atmospheric pressure — collecting data from sensors, processing it via Raspberry Pi, and transmitting it to a cloud server for real-time access through a web interface or mobile application.

Key Features

  • Real-time collection of temperature, humidity, atmospheric pressure, wind speed, and rainfall data.
  • Raspberry Pi 5 as the central processing unit interfaced with multiple environmental sensors.
  • Data transmission to cloud via MQTT protocol for lightweight, reliable IoT communication.
  • InfluxDB time-series database for efficient data storage and retrieval.
  • Grafana dashboard for interactive real-time data visualization and alerts.
  • Web interface (Flask/Django) and mobile app (React Native) for remote monitoring from anywhere.

Tools & Technologies

  • Hardware: Raspberry Pi 5, DHT22 (Temp/Humidity), BMP280 (Pressure), Anemometer, Rain Gauge
  • OS: Raspberry Pi OS (Debian-based)
  • Programming: Python (RPi.GPIO, Adafruit_DHT, smbus2, paho-mqtt)
  • Protocol: MQTT (Message Queuing Telemetry Transport)
  • Database: InfluxDB (time-series), Grafana (visualization)
  • Backend: Flask / Django (Web Framework)
  • Frontend: HTML, CSS, JavaScript
  • Mobile: React Native / Flutter
  • Cloud: AWS / Azure / Google Cloud
  • Version Control: Git / GitHub

System Design

The system is designed with a modular architecture ensuring flexibility and scalability. Data flows from physical sensors → Raspberry Pi → MQTT Broker → Cloud Server → InfluxDB → Grafana / Web Interface / Mobile App.

Block Diagram of IoT Weather Reporting System

Block Diagram: Sensors → Microcontroller (Raspberry Pi) → GSM Modem → Display / Cloud

Implementations

  1. Hardware Setup — DHT22, BMP280, Anemometer, Rain Gauge connected to Raspberry Pi 5 GPIO pins. Assembled inside weatherproof enclosure.
  2. Sensor Scripts (Python) — Individual Python scripts for each sensor using Adafruit_DHT, smbus2/bme280, and RPi.GPIO libraries for data acquisition.
  3. Data Transmission (MQTT) — Processed sensor data published to Mosquitto MQTT broker every 60 seconds and forwarded to cloud server.
  4. Cloud Infrastructure — InfluxDB for time-series storage; Grafana for real-time dashboard and alerting; hosted on AWS/Azure/GCloud.
  5. Web Interface (Flask) — REST API endpoints exposing weather data; HTML/CSS/JS frontend for real-time data display.
  6. Mobile Application (React Native) — Cross-platform app fetching data from Flask API; displays live temperature, humidity, pressure readings.

Results & Discussion

The system was deployed and tested over a continuous 24-hour monitoring period. All sensors performed reliably with data successfully transmitted, stored, and visualized in real time. The system maintained high uptime with minimal data anomalies.

Sensor Readings — 24-Hour Sample Data

ParameterSensor UsedMin ValueMax ValueAccuracy
TemperatureDHT2220°C35°C±0.5°C
HumidityDHT2230%80%±2–5%
Atm. PressureBMP2801000 hPa1020 hPa±1 hPa
Wind SpeedAnemometer0 m/s10 m/s±0.33 m/s
Wind DirectionWind Vane16 directionsAnalog
RainfallRain Gauge0 mmModerateTipping bucket

Graph: Temperature & Humidity over 24 Hours (Sample)

Graph: Atmospheric Pressure Variation (Sample)

Hardware Components List

ComponentSpecificationRole
Raspberry Pi 5Quad-core ARM Cortex-A76 @ 1.8GHz, 4GB/8GB RAMCentral Processing Unit
DHT22Temp: −40 to +80°C; Humidity: 0–100%Temperature & Humidity Sensing
BMP280Pressure: 300–1100 hPa; I2C/SPI interfaceAtmospheric Pressure Sensing
AnemometerReed switch output, 0.33 m/s sensitivityWind Speed Measurement
Wind VaneAnalog output, 16 directionsWind Direction Measurement
Rain GaugeTipping bucket, digital pulse outputRainfall Measurement
Power Supply100–240V AC input; 5V DC 3A outputSystem Power
SD Card16GB+ microSDHC/SDXCOS & Data Storage
EnclosureWeatherproof, UV resistant, dustproofHardware Protection

Software Tools Summary

Tool / LanguageRole in Project
Raspberry Pi OSPrimary OS; manages hardware and system resources
PythonSensor data acquisition, processing, and MQTT publishing
MQTT (Mosquitto)Lightweight data transmission from Pi to cloud broker
InfluxDBTime-series database for high-volume sensor data storage
GrafanaReal-time dashboards, data visualization, and alerts
Flask / DjangoBackend web framework and REST API for weather data
HTML / CSS / JavaScriptFront-end web interface design and interactivity
React NativeCross-platform mobile application (Android & iOS)
AWS / Azure / GCloudCloud hosting for server, database, and visualization
Git / GitHubVersion control and collaborative development

Graph: Wind Speed over 24 Hours (Sample)

Screenshots & Images

Place your hardware setup and Grafana dashboard screenshots in images/ folder.

Grafana Dashboard Screenshot Web Interface Screenshot

Future Scope

  • Integrate machine learning algorithms for weather pattern prediction and early warning systems.
  • Add air quality sensors (CO2, PM2.5) and UV sensors for comprehensive environmental monitoring.
  • Implement solar-powered operation for remote or off-grid deployment locations.
  • Expand to a distributed sensor network for wider geographic coverage.
  • Enhance mobile app with offline access, push notifications, and custom weather alerts.
  • Collaborate with meteorological agencies for external data validation and improved forecasting.

Conclusion & Next Steps

The "IoT Weather Reporting System using Raspberry Pi 5" successfully achieved its objectives of creating a comprehensive, real-time, and cost-effective environmental monitoring system. The Raspberry Pi 5 coupled with DHT22, BMP280, anemometer, and rain gauge sensors demonstrated reliable performance with minimal downtime throughout the monitoring period.

With future enhancements including ML-based forecasting, expanded sensor arrays, and cloud-based distributed architecture, this system can evolve into a scalable smart environmental monitoring platform applicable to agriculture, smart cities, and disaster management.