A collection of fullscreen weather display applications for Raspberry Pi Zero (or other Raspberry Pi models). Includes applications for displaying weather information from OpenWeatherMap API and Air Quality Index (AQI) data from custom API endpoints.
Displays current time, date, and weather information using OpenWeatherMap API.
Features:
- Fullscreen Display: Runs in fullscreen mode optimized for touchscreen displays
- Real-time Clock: Displays current time and date
- Weather Information: Shows current temperature, weather description, and weather icons
- Auto-update: Weather updates every 10 minutes automatically
- Touchscreen Optimized: Configured for Raspberry Pi touchscreen displays
Displays weather and Air Quality Index (AQI) information from a custom API endpoint.
Features:
- Fullscreen Display: Runs in fullscreen mode optimized for touchscreen displays
- Real-time Clock: Displays current time and date
- Location Information: Shows city and station name
- Weather Display: Shows current weather temperature, description, and weather icons
- AQI Display: Shows overall Air Quality Index with color-coded levels
- PM Values: Displays PM2.5, PM10, and PM1 particulate matter readings
- Auto-update: Data updates every 5 minutes automatically
- Color-coded AQI: Uses API-provided colors for AQI levels (Good, Moderate, Unhealthy, etc.)
- Auto-resizing: Dynamically adjusts font sizes and layout to fit any screen size
- Raspberry Pi (tested on Pi Zero)
- Raspberry Pi OS installed
- Touchscreen display connected
- Internet connection for weather API
- Python 3 installed
sudo apt update
sudo apt install xserver-xorg-video-fbdev python3-tk python3-requestsCreate the X11 configuration file for the framebuffer device:
sudo nano /usr/share/X11/xorg.conf.d/99-fbdev.confAdd the following content:
Section "Device"
Identifier "touchscreen"
Driver "fbdev"
Option "fbdev" "/dev/fb1"
EndSection
Section "Screen"
Identifier "Screen0"
Device "touchscreen"
EndSection
Section "ServerLayout"
Identifier "Layout0"
Screen "Screen0"
EndSection
Save and exit (Ctrl+X, then Y, then Enter).
Edit the boot configuration file:
sudo nano /boot/firmware/config.txtMake the following changes:
- Change
gpu_mem=256togpu_mem=64orgpu_mem=128 - Ensure
dtoverlay=vc4-kms-v3dremains commented out (with#at the start)
Save and exit, then reboot:
sudo rebootClone or copy the application files to your Raspberry Pi:
# If using git
git clone <repository-url>
cd RPI-Weather-GUI
# Or copy the Python files to your desired location, e.g.:
# /home/username/weather.py
# /home/username/weather_aqi.pyEdit weather.py and update the following variables:
API_KEY = "your_openweathermap_api_key" # Get from https://openweathermap.org/api
CITY = "YourCity" # Change to your city name
UNITS = "metric" # Use "imperial" for FahrenheitTo get an API key:
- Sign up at OpenWeatherMap
- Navigate to API keys section
- Copy your API key and paste it in
weather.py
Edit weather_aqi.py and update the following variables:
AQI_API_URL = "https://cometer.kakha13.link/api/get/location/7" # Change location ID if needed
WEATHER_API_KEY = "your_openweathermap_api_key" # Get from https://openweathermap.org/api
CITY = "Tbilisi" # Change to your city name
UNITS = "metric" # Use "imperial" for FahrenheitThe AQI application uses:
- Custom AQI API endpoint that provides:
- Location information (city, station name)
- AQI data (overall index, PM2.5, PM10, PM1)
- OpenWeatherMap API for weather data (temperature, description, icons)
After configuring everything, start either application with:
For OpenWeatherMap Weather Display:
startx /usr/bin/python3 /home/username/weather.pyFor Weather & AQI Display:
startx /usr/bin/python3 /home/username/weather_aqi.pyNote: Replace /home/username/weather.py or /home/username/weather_aqi.py with the actual path to your Python file.
Press Esc key to exit the application.
There are several methods to automatically start the GUI application when the Raspberry Pi boots. Choose the method that best fits your setup.
This is the most reliable method and works with all Raspberry Pi OS versions.
- Create a systemd service file:
sudo nano /etc/systemd/system/weather-gui.service- Add the following content (replace
/home/username/weather_aqi.pywith your actual file path):
[Unit]
Description=Weather AQI GUI Application
After=network.target graphical.target
[Service]
Type=simple
User=pi
Environment=DISPLAY=:0
ExecStart=/usr/bin/python3 /home/username/weather_aqi.py
Restart=always
RestartSec=10
[Install]
WantedBy=graphical.target- Enable and start the service:
sudo systemctl daemon-reload
sudo systemctl enable weather-gui.service
sudo systemctl start weather-gui.service- Check the status:
sudo systemctl status weather-gui.serviceTo stop the service:
sudo systemctl stop weather-gui.serviceTo disable auto-start:
sudo systemctl disable weather-gui.service- Create or edit the
.xinitrcfile:
nano ~/.xinitrc- Add the following line (replace with your actual file path):
/usr/bin/python3 /home/username/weather_aqi.py- Configure X to start automatically on boot. Edit the autologin configuration:
sudo nano /etc/systemd/system/getty@tty1.service.d/autologin.confEnsure it contains:
[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin pi --noclear %I $TERM- Add to
.bashrcto start X on login:
nano ~/.bashrcAdd at the end:
if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then
startx
fiIf you're using a desktop environment like LXDE:
- Create the autostart directory if it doesn't exist:
mkdir -p ~/.config/autostart- Create a desktop entry file:
nano ~/.config/autostart/weather-gui.desktop- Add the following content:
[Desktop Entry]
Type=Application
Name=Weather GUI
Exec=/usr/bin/python3 /home/username/weather_aqi.py
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true- Edit the rc.local file:
sudo nano /etc/rc.local- Add before
exit 0:
# Wait for X server to be ready
sleep 10
su - pi -c "export DISPLAY=:0 && startx /usr/bin/python3 /home/username/weather_aqi.py &"Note: Replace /home/username/weather_aqi.py with the actual path to your Python file in all methods above. Also replace pi with your actual username if different.
For weather.py instead of weather_aqi.py: Simply replace the file path in any of the methods above.
You can customize the OpenWeatherMap application by editing the configuration section:
API_KEY: Your OpenWeatherMap API keyCITY: City name for weather dataUNITS: Temperature units ("metric"for Celsius,"imperial"for Fahrenheit)UPDATE_INTERVAL: Weather update interval in milliseconds (default: 600000 = 10 minutes)
You can customize the AQI application by editing the configuration section:
AQI_API_URL: AQI API endpoint URL (default:https://cometer.kakha13.link/api/get/location/7)WEATHER_API_KEY: Your OpenWeatherMap API key (get from https://openweathermap.org/api)CITY: City name for weather dataUNITS: Temperature units ("metric"for Celsius,"imperial"for Fahrenheit)UPDATE_INTERVAL: Data update interval in milliseconds (default: 300000 = 5 minutes)
- Black screen: Check that
/dev/fb1exists and is accessible - Wrong resolution: Verify GPU memory settings in
/boot/firmware/config.txt - Touchscreen not working: Ensure the framebuffer device is correctly configured
For weather.py:
- "Offline / Error" message:
- Check internet connection
- Verify API key is correct
- Ensure city name is spelled correctly
- Check OpenWeatherMap API status
For weather_aqi.py:
- Connection Error or Data Error messages:
- Check internet connection
- Verify API URL is correct and accessible
- Ensure the API endpoint is responding (test with
curl https://cometer.kakha13.link/api/get/location/7) - Check that the location ID in the URL is valid
- Ensure Python 3 and tkinter are installed:
sudo apt install python3-tk - Check that requests library is installed:
pip3 install requests - Verify file permissions:
chmod +x weather.py
- Reduce
UPDATE_INTERVALif updates are too frequent - Lower GPU memory allocation if experiencing memory issues
- Ensure stable internet connection for API calls
RPI-Weather-GUI/
├── weather.py # OpenWeatherMap weather display application
├── weather_aqi.py # Weather & AQI display application
└── README.md # This file
This project is open source and available for personal use.
- Weather data provided by OpenWeatherMap
- AQI data provided by custom API endpoint (https://cometer.kakha13.link/api/get/location/7)
- Built with Python and tkinter