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!
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
why don’t you upload your code to github? it much easy to read.
That’s a good idea. I will try to do that in the future.
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?
What program are you using to output the results?
why when I run “sudo python weatherStation.py” there is no result and there is only its background
I made your project, but unfortunately sensor gives me a wrong measure, like a 414º and 659%… And I 100% sure that is correct good!, I using DHT22 (blue NOT white).. Can those make a problem?¿?¿
hi I want to upload an another picture can u help me I tried everything but I didn’t get it.
hello I try to use this video but I have a problem “python-imaging” its not available or its obsolete :( can you help me?
please, i am working with bme280 . but it doesn’t work.could you help
d
Dear sir. thank for your video on dht22 Raspberry pi weather station, i find it so interesten that i want to build mine but when i time the fifth state of the coding, this is what i got “E: Package ‘python-imaging’ has no installation candidatepi@raspberrypi:~/Desktop/Adafruit_Python_DHT-master $ ” please can you help me out? thanks