A weather panel project using Raspberry Pi Zero and Nextion touchscreen.
Features:
- Weather data fetching from Open-Meteo API
- Utilizes GI (PyGObject) for network connection management
- Utilizes Nextion GUI designing commands to draw 5-day weather bar chart
- Automatic location detection via IPInfo.io API
- Geocoder for location name resolution via Nominatim API
Demo:
https://www.youtube.com/watch?v=vR5DYhlheCI
Hardware:
- Raspberry Pi Zero WH
- Nextion NX8048T050 display
- USB to TTL adapter (IZOKEE CP2102 in this project)
- SD card, power supply, HDMI adapter for Pi, etc.
Related project:
- Install Nextion Editor and open
./display/NX8048T050/project.HMIin the editor. You can use "Debug" button to simulate the display and check if any error occurs. - Install the driver for the USB to TTL adapter. Connect the display to your computer using a USB to TTL adapter. Note TX of the display should be connected to RX of the adapter and vice versa.
- Push the "Upload" button in the Nextion Editor to upload the project to the display. If the display is not detected, check the connection and the driver installation.
- Connect the display to the Raspberry Pi Zero W. TX of the display shoud be connexted to uart0 RX (GPIO16) of the Pi Zero W and vice versa.

-
Install Raspberry Pi OS Lite on SD card using Raspberry Pi Imager. Set up OS customization settings like ssh, wifi as needed.
-
Open bootfs directory of SD card. Write these configs in [all] section of
/boot/config.txtto enable uart pins and allow HDMI output:[all] enable_uart=1 hdmi_force_hotplug=1 hdmi_drive=2
-
Insert SD card into Pi Zero W and boot up. Connect to Pi through SSH or HDMI monitor. Enable UART/serial interface in Raspberry Pi OS using
raspi-config:$ sudo raspi-config
- Select
Interfacing Options - Select
Serial Port - Select
Noto disable login shell over serial - Select
Yesto enable serial hardware - Reboot
The final configuration should look like:
The serial login shell is disabled The serial interface is enabled - Select
- Login to Pi Zero and install NetworkManager development package:
$ mkdir -p /etc/NetworkManager/conf.d
$ sudo apt install libgirepository1.0-dev gir1.2-nm-1.0 python3-gi python3-gi-cairo
Restart NetworkManager:To allow user program to control NetworkManager without root privileges. Create `any-user.conf` within conf.d: ```toml [main] auth-polkit=falsesystemctl restart NetworkManager
- Copy the
./pi-zerodirectory of this repo to your home directory of Pi Zero from your personal computer:$ scp -r pi-zero piuser@192.168.x.x:~/ - Create venv and install dependencies (Python 3.11.2):
$ cd pi-zero $ python -m venv ./venv $ source ./venv/bin/activate $ pip install -r requirements.txt
- Run the program:
$ python main.py
- background: Goč, Serbia by Filip Zrnzević on Unsplash
- weather icons: https://openweathermap.org/weather-conditions

