Show Raspberry Pi Weather Station Data on the Touchscreenīefore we start with the installation, the display must be connected and supplied with power. Now we create a configuration file: sudo nano /etc/openhab2/services/weather.cfg You can get the required WOEID number for your city on this website.
Go to “Add-Ons” -> “Bindings” in the PaperUI and install the “Weather Binding”. Of course, it can also be replaced by another one.įor this, we use the OpenHAB weather binding. Since you need an API key everywhere except for the forecasts from Yahoo, we use this service for the sake of simplicity. Depending on the location, some are more accurate or better suited. We can choose between different providers like Forecast.io, OpenWeatherMap, Yahoo! and much more. This feature is optimal, but it does make a difference. Our Raspberry Pi weather station should get an additional feature: In addition to the currently measured data, we also want to make predictions for the next day. via Karaf console).Īddition: Setting up the Weather forecast via Yahoo! How you can access it is explained in this article (e.g. If contrary to expectations, something does not work as it should, a look at the logs often helps. With the given examples it should be a breeze to expand the files if necessary. He can also measure the height (in meters) and the sea level pressure. In addition, we could of course also measure the temperature with the BMP180. Since the values are quite different (air pressure ~ 1000, temperature 0-30, air humidity ~ 20-70 ), we can also create different graphs/charts or, for example, the unit instead of hPa Use bar. Here all values and the previous values are now displayed in a table.
Then update the BasicUI page and select the sitemap “Waiter station”. So we start with the main script:: sudo nano /etc/openhab2/scripts/weatherstation.py The easiest way to do this is with Python, for which there are many libraries (including those that we have already used and installed). The functions that we will use need tools that deliver the data to us. Setting Up the Raspberry Pi Weather Station If the BMP sensor is already connected, we can test whether it has already been recognized: i2cdetect -y 1 We activate it under “Interface Options” -> “I2C” (this can vary from the Raspbian version, but is always included in the raspi-config). Then we have to activate I2C: sudo raspi-config If you want to use Python2 instead of Python3, you have to adapt the packages and installation calls accordingly. Sudo apt-get install build-essential python-dev python3-dev python3-openssl python3-smbus python3-pip i2c-tools git Now we log in via SSH and install the required packages for the DHT and BMP180 sensors: sudo apt-get update When this is complete, we open and look for the “Exec Binding” package under “Binding”, the “RRD4j Persistence” package under the “Persistence” tabs and under “Transformations” “the” RegEx Transformation “package.
Therefore, we start to install OpenHAB 2 on the Raspberry Pi. Since it offers different graphical interfaces, it is not necessary that we create our own GUI. We use OpenHAB as the interface, which is generally a very good introduction to home automation. Preparation: Installing OpenHAB & packages Raspberry Pi Weather Station Breadboard of the Sensors The BMP180 is only connected to the I2C bus and also gets a connection to 3.3V and GND. Now the data pin goes to GPIO23 and at the same time to 3.3V via a 10k Ω resistor. The DHT11 sensor is connected to 3.3V and GND as shown in the picture. These were also discussed in more detail in previous tutorials, but here is the structure again: A detailed description can be found here. It gets power either via the 5V pin or via USB connection. This can be connected to the DSI port of the Raspberry Pi using the ribbon cable. The easiest way is with the official Raspberry Pi touchscreen. Let’s start with the wiring of all modules.
How to display data on it is explained in more detail in a previous tutorial and can be adjusted if necessary. The display on an LCD is not explicitly dealt with in this tutorial. In addition, other sensors such as gas sensors, brightness sensors or wind strength sensors are also an option which can be integrated.Īnother option is to use an ESP8266 NodeMCU or Raspberry Pi Zero W as an outpost for the weather station.
However, the code must then also be adjusted accordingly.
Individual components can of course also be omitted or added. You will need the following hardware parts for the weather station. Required Hardware Parts For the Raspberry Pi Weather Station