Raspberry Pi Weather Station Uses One Sensor, Displays Data via Web Based Dashboard

Raspberry Pi
(Image credit: Donsky, Donskytech)

This Raspberry Pi is truly a device for all makers. The Raspberry Pi can be a fun retro gaming device or it can be a serious scientific project, and many things in between. Maker Donsky, the mastermind behind Donskytech, has used one to create a lovely Raspberry Pi weather station project. It uses just one sensor so you don’t need much hardware to get off the ground and he also provided a very thorough tutorial to follow along with making it an excellent beginner's project.

The project takes data from a DHT22 sensor and displays information pulled from it in real-time. Users can access a web based dashboard that shows information in both text form as well as in the form of graphical charts. To access the data, all a user has to do is open a web browser and check out both the temperature and humidity in one place.

(Image credit: Donsky, Donskytech)

In order to make a web-based dashboard, the project requires a web server. This web server application runs on the Raspberry Pi so a model with wireless support is ideal. A file called "app.py" is used to generate the dashboard, via Python's Flask module which creates the HTML and handles sockets. A little Bootstrap HTML and CSS is used to format the web page, but the charts are created in real-time using Plotly.js.  The Pi is also responsible for reading the DHT22 sensor data, via "dht22_module.py", a single module that handles both temperature and humidity data.

In the demonstration project created by Donsky, a Raspberry Pi 4B 8GB module is used, however, you could get away with a Raspberry Pi Zero 2 W, even a Raspberry Pi Pico could perform this task. The temperature and humidity sensor used is a DHT22 but a DHT11 would work, as well. A breadboard isn’t necessary, you can just use jumper wires to directly connect the DHT22 to the Pi.

If you want to recreate this Raspberry Pi project, check out the official project page over at Donsky’s website where you’ll also find tons of other cool projects. 

You can find all of the code used in this project over at GitHub. Donsky also shared a video of the weather station project over at YouTube if you’d like to see it in action.

Be sure to follow him for more cool creations as well as any future updates on this one.

Ash Hill
Contributing Writer

Ash Hill is a contributing writer for Tom's Hardware with a wealth of experience in the hobby electronics, 3D printing and PCs. She manages the Pi projects of the month and much of our daily Raspberry Pi reporting while also finding the best coupons and deals on all tech.

  • DotNetMaster777
    Well done Donsky ! ! !
    Reply
  • donskytech
    Thank you!
    Thank you also tomshardware for featuring me on your site. I actually did not know that I was featured here until later.

    I made an update to this project by the way, so instead of only displaying one DHT22/DHT11 sensor, it is now displaying multiple sensor readings all at the same time.

    If you would like to know more then please see Raspberry Pi IoT Weather Station - Multiple Sensors
    I hope you would like it also.
    Reply