Skip to content

blueskyson/pi-zero-weather

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pi Zero Weather

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:

ESP32 Weather

Setup Steps

Setup Nextion Display

  1. Install Nextion Editor and open ./display/NX8048T050/project.HMI in the editor. You can use "Debug" button to simulate the display and check if any error occurs.
  2. 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.
  3. 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.
  4. 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.

Setup Raspberry Pi Zero W

  1. Install Raspberry Pi OS Lite on SD card using Raspberry Pi Imager. Set up OS customization settings like ssh, wifi as needed.

  2. Open bootfs directory of SD card. Write these configs in [all] section of /boot/config.txt to enable uart pins and allow HDMI output:

    [all]
    enable_uart=1
    hdmi_force_hotplug=1
    hdmi_drive=2
  3. 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 No to disable login shell over serial
    • Select Yes to enable serial hardware
    • Reboot

    The final configuration should look like:

    The serial login shell is disabled
    The serial interface is enabled
    

Setup Python Dependencies

  1. Login to Pi Zero and install NetworkManager development package:
    $ sudo apt install libgirepository1.0-dev gir1.2-nm-1.0 python3-gi python3-gi-cairo
    $ mkdir -p /etc/NetworkManager/conf.d
    To allow user program to control NetworkManager without root privileges. Create `any-user.conf` within conf.d:
    ```toml
    [main]
    auth-polkit=false
    
    Restart NetworkManager:
    systemctl restart NetworkManager
  2. Copy the ./pi-zero directory of this repo to your home directory of Pi Zero from your personal computer:
    $ scp -r pi-zero piuser@192.168.x.x:~/
  3. 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
  4. Run the program:
    $ python main.py

Image sources

About

A weather dashboard using Raspberry Pi Zero and Nextion touchscreen.

Topics

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages