Raspberry Pi Temperature & Humidity Monitor

Web-based environmental monitoring system with real-time data visualization

Python Raspberry Pi Flask Electronics Web Development
Raspberry Pi Temperature Monitor

⚡ GPIO Pin Connection

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

Project Overview

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.

Raspberry Pi Compatibility

This project works with any Raspberry Pi model that has GPIO pins:

  • Raspberry Pi 5 (2023)
  • Raspberry Pi 4 Model B (2019)
  • Raspberry Pi 3 Model B+ / 3 Model B / 3 Model A+ (2016-2018)
  • Raspberry Pi 2 Model B (2015)
  • Raspberry Pi 1 Model B+ / Model A+ (2014)
  • Raspberry Pi Zero 2 W / Zero W / Zero (2015-2021)

Recommended: Raspberry Pi 3B+ or newer for optimal performance with the Flask web server.

Components Used

  • Raspberry Pi (see Raspberry Pi Compatibility section below)
  • DHT22 Temperature & Humidity Sensor
  • Breadboard and jumper wires
  • 10kΩ pull-up resistor
  • Power supply (5V 2.5A minimum, 5V 3A recommended for Pi 3/4/5)
  • MicroSD card (8GB minimum, 16GB+ recommended)

Hardware Wiring

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.)

Key Features

  • Real-time temperature and humidity monitoring
  • Web-based dashboard accessible from any device
  • Historical data logging with up to 100 readings
  • RESTful API for data access
  • Responsive design for mobile and desktop
  • Automatic sensor polling every 2 seconds
  • Clean, modern user interface

Technical Implementation

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.

Python Code

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

Skills Demonstrated

Python Programming
Flask Web Framework
GPIO Interfacing
Sensor Integration
RESTful API Design
Data Visualization
Responsive Web Design
Embedded Systems

Applications

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.

← Back to Projects