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: https://educ8s.tv/part/Raspberry3

Display : https://educ8s.tv/part/5InchDisplay

DHT22: https://educ8s.tv/part/DHT22

Female Wires: https://educ8s.tv/part/Wires

Power Bank: https://educ8s.tv/part/Powerbank

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!

[adsense]

 

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
——————–

 

 

 

SUBSCRIBE ON YOUTUBE

——————–

Never miss a video: Subscribe to educ8s.tv