Home Temperature & Humidity Monitor with Raspberry Pi & Web Dashboard – Real‑Time Remote Tracking
Track the temperature and humidity of your home, garage, or small factory from anywhere with this straightforward Raspberry Pi solution. The system streams real‑time data to a web‑based chart, giving you instant insight into your environment.
Step 1: The Concept
- The Raspberry Pi reads temperature and humidity using a DHT11 sensor.
- Data is sent to a web server via a raw JSON POST request.
- Information is stored in a MySQL database and visualized on a live chart.
- Users can monitor trends and receive alerts through the web interface.
Step 2: Required Items & Pre‑Requests
- 1× DHT11 sensor
- 1× Raspberry Pi B (any recent model) with Raspbian OS
- Jumper wires
- Internet connectivity (Wi‑Fi or Ethernet)
- Python 3 and the RPi.GPIO library installed
- Web server stack (Apache + MySQL + PHP) on Ubuntu or CentOS
Step 3: Connecting the Device
- Power off the Pi before wiring.
- Connect VCC to 3.3 V, GND to ground, and DATA to GPIO 4.
- Power on the Raspberry Pi.
Step 4: Configure the Python Script on the Raspberry Pi
Access the Pi via SSH or directly. Create a working directory (e.g., ~/Desktop) and add the script:
nano dht11.py
Copy the contents of the provided dht11.py file into the editor. The script includes inline comments explaining each function.
Set the web server IP (example: 104.236.91.122) and PHP endpoint (/rpi/rpi.php) within the script.
Step 5: Set Up the PHP Web Service
Extract the rpi.rar package and upload the files to your web server.
Use phpMyAdmin to create a new database, e.g., rpi_themo. Import the pi.sql file to populate the necessary tables.
Update database credentials in the following files:
rpi/db-con.phprpi/temp/assets/php/getTemp.php
Step 6: Test the System
Navigate to the script’s directory and run:
sudo python3 dht11.py
A successful run will output:
New record created successfully
If you see no_data, it indicates a temporary transmission issue. Re‑run the script; subsequent attempts usually resolve the error.
Once data is recorded, open your web dashboard to view live temperature and humidity charts.
For deeper insights, consult the original guide: Home Temperature & Humidity Monitor with Web-Based Chart – Raspberry Pi.
Manufacturing process
- Efficiently Monitor Room Temperatures with Raspberry Pi and Nagios
- Raspberry Pi Temperature & Humidity Network Monitor – DIY Setup Guide
- Home Energy Centre: Monitoring Solar PV, Thermal Panels, and Room Temperatures with Raspberry Pi and Moteino
- Seamless Temperature & Humidity Monitoring on Raspberry Pi with EzTemp
- Build a 433 MHz Smart Home Controller with Sensorflare and Raspberry Pi
- Build a ThingSpeak Temperature Monitor with Raspberry Pi & BrickPi
- Monitor Your Home Temperature with a Raspberry Pi Dashboard
- Build an Automated Aeroponics System with Raspberry Pi and Humidity Sensor
- Raspberry Pi Home Security System: PIR Motion Detection + Camera Email Alerts
- Build a Robot with Raspberry Pi and Python: A Complete Guide