This project is a dashboard for Raspberry Pi to display environmental weather data, rain radar, weather forecast, etc. on a connected LCD written in Python. The data is collected from local MQTT broker and also from Internet services.
I used a 7inch IPS display with 1024x600 hardware resolution and HDMI input, which has a low power consumption of only 1-2 Watt which is predestinated for 24/7 operation. An RCWL-0516 doppler radar microwave motion sensor module is used to switch off the backlight when no motion has been detected for the last 10 minutes. This is for saving energy when nobody is in the room to watch the dashboard. The backlight is switched on automatically when motion is detected.
https://www.waveshare.com/wiki/7inch_HDMI_LCD
I use the Raspberry Pi Zero WH which has enough performance, a low power consumption and an HDMI connector. Also it is possible to connect it directly to the backside of the Waveshare display. Only a mini-HDMI (type C) to normal-HDMI (type A) cable is required. The whole system (RPI + display) can be powered over the USB connector and consumes in total a maximum of 4 Watt.
- Use a 16Gbyte SD card and install Raspberry Pi OS on it
- Configure graphics driver and resolution as described on https://www.waveshare.com/wiki/7inch_HDMI_LCD
- Configure a static IP within your WiFi network
- Activate SSH for remote configuration, SW update and maintainance
- pip install python3-utils
- sudo apt-get install python3-pil python3-pil.imagetk
- sudo apt-get install python3-pip -y
- sudo pip3 install paho-mqtt
Please change following variables according to your location. The value for xmin and ymin can be determined with https://oms.wff.ch/calc.htm for a specific zoom level.
- longitude = "8.900"
- latiude = "48.800"
- timezone = "Europe/Berlin"
- zoom = 12
- xmin = 2148
- ymin = 1409
- mqtt_user = "*********"
- mqtt_password = "***************"
- mqtt_broker_address = "192.168.xxx.xxx"
- mqtt_port = 1883
- mqtt_topic_pressure = "/483fdabaceba/pressure"
- mqtt_topic_outtemperature = "/483fdabaceba/temperature"
- mqtt_topic_outhumidity = "/483fdabaceba/humidity"
- mqtt_topic_intemperature = "/483fdabaceba/temperature"
- mqtt_topic_inhumidity = "/483fdabaceba/humidity"
- mqtt_topic_staticiaq = "/483fdaaaceba/staticiaq"
- mqtt_topic_ppurchase = "/00d0935D9eb9/ppurchase"
- mqtt_topic_pfeed = "/00d0935D9eb9/pfeed"
- mqtt_topic_pconsume = "/00d0935D9eb9/pconsume"
- mqtt_topic_pgenerate = "/00d0935D9eb9/pgenerate"
- mqtt_topic_pdischarge = "/00d0935D9eb9/pdischarge"
- mqtt_topic_pcharge = "/00d0935D9eb9/pcharge"
- mqtt_topic_sbatcharge = "/00d0935D9eb9/sbatcharge"
- mqtt_topic_eyield = "/00d0935D9eb9/eyield"
- mqtt_topic_eabsorb = "/00d0935D9eb9/eabsorb"
- Tiles for the map background from Openstreetmap: e.g. https://tile.openstreetmap.org/12/2148/1409.png
- Rainviewer API: https://api.rainviewer.com/public/weather-maps.json
- Tiles for the rain radar as overlay from Rainviewer: e.g. https://tilecache.rainviewer.com/v2/radar/1636462800/256/12/2148/1409/2/1_1.png
- Actual weather and weather forecast from BrightSky (DWD open weaher data): e.g. https://api.brightsky.dev/weather?lat=48.80&lon=8.90&date=2021-10-18&tz=Europe/Berlin
Execute the program with: python3 ./weatherclock_rpi.py