Web-based environmental monitoring system with real-time data visualization
DHT22 Data Pin → GPIO4 (Physical Pin 7)
Also connect: VCC → 5V (Pin 2/4), GND → Ground (Pin 6/9), 10kΩ resistor between VCC and Data
A comprehensive environmental monitoring system built with Raspberry Pi and DHT22 sensor. The system continuously monitors temperature and humidity levels, displaying real-time data through an intuitive web dashboard accessible from any device on the network.
This project demonstrates practical IoT development skills, combining hardware interfacing with web technologies to create a functional monitoring solution suitable for home automation, greenhouse management, or server room monitoring.
This project works with any Raspberry Pi model that has GPIO pins:
Recommended: Raspberry Pi 3B+ or newer for optimal performance with the Flask web server.
| Component | Pin/Connection | GPIO Pin | Physical Pin Number |
|---|---|---|---|
| DHT22 | VCC (+) | 5V Power | Pin 2 or Pin 4 |
| DHT22 | Data | GPIO4 | Pin 7 |
| DHT22 | GND (-) | Ground | Pin 6, 9, 14, 20, 25, 30, 34, or 39 |
| 10kΩ Resistor | Pull-up | Between VCC and Data pin | |
Important: Connect the DHT22 data pin to GPIO4 (Physical Pin 7). The pull-up resistor connects between the 5V power and the data pin.
Quick Summary: DHT22 Data → GPIO4 (Pin 7), VCC → 5V (Pin 2/4), GND → Ground (Pin 6/9/etc.)
The system uses Python to interface with the DHT22 sensor via GPIO pins, collecting temperature and humidity readings at regular intervals. A Flask web server provides both a user-friendly dashboard and a RESTful API endpoint for programmatic access.
Data is stored in memory with automatic rotation to maintain the most recent 100 readings, allowing for trend visualization without requiring a database. The web interface uses modern HTML5 and CSS3 for responsive layout, ensuring accessibility across desktop and mobile devices.
Complete Python implementation with Flask web server and DHT22 sensor interface. The code includes error handling, data logging, and RESTful API endpoints.
📥 Download Python Code
Requirements: Flask, Adafruit_DHT library
Install with: pip install flask Adafruit_DHT --break-system-packages
This monitoring system can be adapted for various practical applications including home automation systems, greenhouse environment control, server room monitoring, wine cellar management, museum artifact preservation, laboratory conditions monitoring, and industrial process control.