Skip to content

This project transforms a Raspberry Pi Zero into a weather clock, displaying real-time weather conditions and time on an RGB LED Matrix. It fetches weather data from a free online weather API and uses NTP (Network Time Protocol) for accurate timekeeping.

License

Notifications You must be signed in to change notification settings

jkeychan/RPI-Zero-Weather-Clock-RGB-LED-Matrix

Repository files navigation

photo of the RPI Zero Weather Clock RGB LED Matrix in action

RPI Zero Weather Clock RGB LED Matrix

This project transforms a Raspberry Pi Zero into a weather clock, displaying real-time weather conditions and time on an RGB LED Matrix. It fetches weather data from a free online weather API and uses NTP (Network Time Protocol) for accurate timekeeping.

Features

  • Accurate Time Display: Utilizes NTP to ensure the clock displays the correct time, automatically adjusting for time zone differences and daylight saving time.
  • Live Weather Updates: Shows current weather conditions with intuitive icons and colors, updated in real-time from OpenWeatherMap's API.
  • Adaptive Brightness: Features automatic brightness adjustment based on the time of day, enhancing visibility and comfort.
  • Customizable Display: Allows for extensive customization, including temperature units, text colors, and enabling/disabling the Langton's Ant animation for dynamic background activity.

Getting Started

Prerequisites

Hardware Setup

  • Matrix Connection: Attach the RGB LED Matrix to the Raspberry Pi Zero using a compatible HAT or bonnet. For a step-by-step guide, see Adafruit's LED Matrix tutorial.

  • Power Requirements: Ensure both the Raspberry Pi Zero and the LED Matrix have an adequate power supply. It's crucial for stable operation and to prevent damage.

  • LED Display: Connect Raspberry Pi with attached bonnet to the back of the LED Matrix panel using the ribbon cable and power cables.

Software Setup

  1. Clone the Repository:

    git clone https://github.com/yourusername/RPI-Zero-Weather-Clock-RGB-LED-Matrix.git
    cd RPI-Zero-Weather-Clock-RGB-LED-Matrix
  2. Install Dependencies:

    sudo apt-get update ; sudo apt-get install -y git python3-pip
    pip3 install -r requirements.txt
    
    cd matrix
    sudo make build-python
    sudo make install-python
    
  3. Configuration:

    Rename sample-config.ini to config.ini and edit it to configure your weather clock.

    mv sample-config.ini config.ini
    vi config.ini

    Update config.ini:

    # sample-config.ini file
    # Make any relevant adjustments and then save as config.ini
    
    [Weather]
    api_key = YOUR_OPENWEATHERMAP_API_KEY # https://openweathermap.org/api
    zip_code = YOUR_ZIP_CODE # https://openweathermap.org/current#zip
    
    [Display]
    time_format = 24
    temp_unit = F
    text_cycle_interval = 10
    FONT_PATH=fonts/5x7.bdf
    FONT_SIZE=10
    AUTO_BRIGHTNESS_ADJUST = True # Set as False to manually set the value (percentage) in BRIGHTNESS
    BRIGHTNESS = 20 # Percentage
    LANGTONS_ANT_ENABLED = True
    
    [NTP]
    preferred_server = pool.ntp.org
    # preferred_server = 127.0.0.1 # If you are running NTP locally
    

The most important and common configuration settings should be adjusted to your preferences:

  • [Weather]
  • [Display]
    • Adjust display settings like time_format, temp_unit (Fahrenheit or Celsius), TEXT_COLOR, and brightness levels.
    • LANGTONS_ANT_ENABLED: Set to True to enable the Langton's Ant animation or False to disable it.
  • [NTP]
    • preferred_server: The NTP server used for time synchronization. pool.ntp.org is a reliable choice (NTP Pool Project)
  1. Run the Application: (sudo required for display stability)

    sudo python3 main.py

Connectivity

  • Weather Updates: Fetches the latest weather data from OpenWeatherMap every 10 minutes to display current conditions accurately.
  • NTP Synchronization: Ensures the time displayed is precise by syncing with global NTP servers. This is vital for maintaining accurate time without manual adjustments, especially important for applications like clocks where precision is key.

Usage

After setup, the device will display the current time and weather information. You can customize the display and update intervals by modifying the config.ini file, tailoring the weather clock to your preferences. You can also find the logs from the program at /var/log/rgb/app.log for troubleshooting purposes.

For running permanently as a display you will want the program to run every time it is power cycled. It is strongly recommended to create a systemd service for the program to ensure it stays running.

# /etc/systemd/system/rgb_display.service

[Unit]
Description=RGB Display Service
After=network.target

[Service]
ExecStart=/usr/bin/python /opt/RGB-Display/main.py --led-cols=64 --led-rows=32
WorkingDirectory=/home/$USER/RPI-Zero-Weather-Clock-RGB-LED-Matrix
StandardOutput=append:/var/log/rgb-matrix.log
StandardError=append:/var/log/rgb-matrix.log
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target

License

This project is licensed under the GPL 3.0 License - see the LICENSE file for details.

Acknowledgments

About

This project transforms a Raspberry Pi Zero into a weather clock, displaying real-time weather conditions and time on an RGB LED Matrix. It fetches weather data from a free online weather API and uses NTP (Network Time Protocol) for accurate timekeeping.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages