Make sure your Raspberry Pi can connect to the internet (e.g. open a Web-Browser and enter your credentials).
Make sure the time is correct (at FHNW your Pi is not abble to connect to the internet at startup to sync the time).
(e.g. using Ubuntu from Microsoft Store - https://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/)
# using a terminal on your Raspberry Pi sudo date -s "13 AUG 2019 15:43:00"
Alternatively, you might also want to send the current date from a computer (e.g. your Laptop) to your Raspberry Pi. In case you are using Windows you might want to use Ubuntu from Microsoft Store (please follow this procedure on how to install it).
# send the date of your computer to the Raspberry Pi - replace "host" with your Raspberry Pi's hostname or IP-address ssh pi@host "date --set \"$(date)\""
Make sure you use newest software
sudo apt-get update sudo apt-get upgrade
TICK Stack Installation
Please follow this procedure to install the TICK stack on your Raspberry Pi.
Store Weather Data
Store Historc Weather Data
The script provided at the weatherstation-api page indicates how to load historic data (stored in csv files) into InfluxDB.
Store Live Weather Data
The Wasserschutzpolizei Zurich updates the weather data every 10 minutes. Accordingly, you should fetch the data from their API every 10 minutes (please make sure you do not fetch the data in a shorter period because otherwise your queries can result in a denial of service attack (and the Wasserschutzpolizei will catch and arrest you!!!)).
There are several options on how to periodically fetch the weather data. One option is to setup a systemd timer unit.
Query Weather Data
The TICK Stack comes with Chronograf. It runs on
http://localhost:8888 and provides the possibility to visualize data.
In order to get started you can import this simple Dashboard
Otherwise use following procedure:
- Dashboards -> Create Dashbord
- Add Data
- Select "meteorology.autogen" -> mythenquai -> air_temperature
- Make sure you select a large enough duration (e.g. "Past 30d")
- You might want to add a second query (e.g. for "tiefenbrunnen")
You should do this if you really need to!
- Format your SD Card by following this (alternatively you might want to use this for windows or this for linux) procedure.
- Install the operating system by following this procedure.
Raspberry Pi 3
Enable ZRAM and disable Swap
sudo wget -O /usr/bin/zram.sh https://raw.githubusercontent.com/novaspirit/rpi_zram/master/zram.sh sudo chmod +x /usr/bin/zram.sh # add as second last line (before exit 0) sudo sed -i "`wc -l < /etc/rc.local`i\\/usr/bin/zram.sh &\\" /etc/rc.local sudo shutdown -r now
Alternatively, increase Swap and set swappiness as low as possible
sudo dphys-swapfile swapoff echo "CONF_SWAPSIZE=1024" | sudo tee -a /etc/dphys-swapfile echo "vm.swappiness = 1" | sudo tee -a /etc/sysctl.conf sudo dphys-swapfile swapon sudo shutdown -r now