Raspberry Pi Weather Station Project

Home/Arduino Projects/Raspberry Pi Weather Station Project

Raspberry Pi Weather Station Project

Today we are going to test the new Raspberry Pi 3 board, by building a simple but useful project. We are going to build a Raspberry Pi Weather Station.

A few months back, the Raspberry Pi 3 board was released. It is a great new board because it now offers WiFi and Bluetooth connectivity out of the box! It uses a quad core processor which operates at 1.2Ghz and it has 1GB of RAM available. From the benchmarks I have seen, this board is at least 3 times faster than the original Raspberry Pi. It can run Linux and offers 40 GPIO pins for our projects. The impressive thing is its price. It costs around 40$ and Gearbest.com was kind enough to send me a sample unit in order to test it and build projects with it.

The parts needed in order to build the Raspberry Pi Weather Station are these:

——————–
WHERE TO BUY
——————–

Raspberry Pi 3: http://bit.ly/RaspberryPI3

Display : http://bit.ly/5TouchDisplay

DHT22: http://bit.ly/DHT22GE

Female Wires: http://bit.ly/FemaleWiresG

Power Bank: http://bit.ly/POWERBANKXiaomi

Full disclosure: All of the links above are affiliate links. I get a small percentage of each sale they generate. Thank you for your support!

 

In order to test it, I built this Raspberry Pi Weather Station with it. As you can see, I have connected a 5’ inch touch display and a DHT22 sensor and in the screen we can see live update of the temperature and humidity. The temperature and the humidity values are updated every two seconds. If I click anywhere on the screen, the applications quits so we can use the Raspberry Pi for other purposes. This project is a nice first project to build with a Raspberry Pi, because you will learn how write and run code on it, and you will learn how to use the GPIO pins of it. But let’s now see how to build this project.

 

——————–
LIBRARIES
——————–

https://github.com/adafruit/Adafruit_Python_DHT

The code uses the TKinter Graphical User Interface package. We have used it in the past as well and I have prepared a video on that, you can check it out by clicking on the card here. Watching that video will help you better understand what’s going on here.
At first we declare all the libraries that we are going to use. Next we define the GPIO pin 40 as an output and we set it to HIGH in order to provide power to the DHT22 sensor. Next we create a full screen image background by loading the image file from the WeatherStation folder. After this, we create two text labels for the temperature and the humidity. With this command we bind the click on the screen or the mouse click with the exit function which exits the application. With this command we call the function readSensor after two seconds. Note that the command is executed in a separate thread in order not to lock the User Interface. The read sensor function calls itself every two seconds. It reads temperature and humidity from the sensor and updates the labels on the display.

 

——————–

CODE OF THE PROJECT
——————–

Download

 

 

 

SUBSCRIBE ON YOUTUBE

——————–

Never miss a video: Subscribe to educ8s.tv

2017-05-11T13:40:42+00:00

3 Comments

  1. Bijo September 4, 2016 at 6:05 pm - Reply

    why don’t you upload your code to github? it much easy to read.

    • Nick September 7, 2016 at 11:04 am - Reply

      That’s a good idea. I will try to do that in the future.

  2. uni May 18, 2017 at 5:09 pm - Reply

    I have a Sense Hat instead, which should be the modifications to this program in order to be able to get the sensor values from the Sense Hat?

Leave A Comment

Close