Weather Clock for Raspberry PI

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.

drawing

Display

I used a 7inch IPS display with 1024×600 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

Raspberry PI

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.

Software on the Raspberry PI

  • 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

Install following packages used by the Python program:

  • 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

Weather Clock configuration

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

Please change following variables according to your MQTT settings:

  • 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”

Internet services used

The program

Execute the program with: python3 ./weatherclock_rpi.py

GitHub

View Github