Home (Room) Temprature and Humidity Monitor with Web Based Chart – Raspberry Pi

Simple way to monitor your, Home ,room, garage small factory or any other places Temperature and Humidity from anywhere in the world via internet.

It very fun and very simple.

Step 1: The Concept

  • The Raspberry Pi will get the Home(Room) Temperature and the Humidity from the DHT11 sensor.
  • All the data will be POST to the web server via JSON RAW data method.
  • Data will store in a data base and publish to a chart.
  • We can monitor the Temperature and Humidity with the chart.Home (Room) Temprature and Humidity Monitor with Web Based Chart - Raspberry Pi

Step 2: Required Items And Pre Requests

Step 3: Connecting The Device

  • Make sure the power is switched off.
  • Connect the VCC to the +3 V.
  • Connect the DATA to the GPIO 4.
  • Connect the GND to the GND.
  • Power on the Raspberry Pi

Step 4: Setup the Python File in the Raspberry Pi

Connect to the Raspberry Pi via SSH or connect directly. select a proper folder or location to create the file.

example :Desktop

nano dht11.py

And Download the attached dht11.py file and copy the source to your file in the Raspberry Pi.

All the functions and methods i have explained in the code with comments.

My web server IP address is “” and the web service PHP file is “/rpi/rpi.php”

Step 5: Setup The PHP Web service

Download the rpi.rar file and extract the files.

Open phpMyadmin and create a new database example : “rpi_themo”.

Download the “pi.sql” file and import to your new database. (i have inserted few sample data)

Change the data base credentials in the following files

  1. \rpi\db-con.php
  2. \rpi\temp\assets\php\getTemp.phpHome (Room) Temprature and Humidity Monitor with Web Based Chart - Raspberry Pi schematic

Step 6: Testing the Device

Connect to the Raspberry Pi and go to your dht11.py file location.

run the below comand

sudo python dht11.py

you will get something like this :

New record created successfully

if you get something like this :


don't worry this has a chance to lose data. This is because Raspberry Pi is not running at a real-time system, the delay in the program is not accurate enough, and sometimes that leads to a failure of transmission.we can run the program for several times can pick the correct result.


For more detail: Home (Room) Temprature and Humidity Monitor with Web Based Chart – Raspberry Pi

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top