Skip to content

[FEATURE] LCD v9: Weather forecast, AQI index, animated transitions #5

Description

@farcomiot

📺 LCD v9: Weather Forecast, AQI Index & Animated Transitions

Current State (LCD v8)

  • 14-screen rotation: 11 sensor bars + info + logo + health
  • SPI @ 32 MHz, ~6.7 FPS refresh
  • Proximity-based screen switching (LTR559, threshold 800)
  • Static screens with color bars

Proposed Features

Weather Forecast Screen

  • OpenWeatherMap API integration — fetch 3-day forecast via WiFi
  • Weather icons — programmatic sun/cloud/rain/storm drawings (PIL)
  • Min/max temperature for today + tomorrow
  • Humidity forecast comparison with local BME280
  • Cache forecast data — refresh every 30 minutes, display cached between refreshes
  • API key management — store in .env file on Pi (see [SECURITY] Pi hardening: firewall, fail2ban, SSH keys #3)

AQI Index Screen

  • EPA AQI calculation from PM2.5 readings using standard breakpoints
  • Color-coded AQI gauge — Green (Good) → Maroon (Hazardous)
  • AQI category label — "Good", "Moderate", "USG", "Unhealthy", "Very Unhealthy", "Hazardous"
  • 24h average PM2.5 from SQLite for AQI accuracy (instantaneous vs rolling)
  • Health recommendation text — "Enjoy outdoors" / "Sensitive groups limit exposure"

Animated Transitions

  • Slide transitions between screens (left-to-right wipe)
  • Fade effect using alpha blending on screen switch
  • Loading animation for boot splash (spinning ruedita)
  • Smooth bar graph updates — interpolate between old and new values

Technical Approach

Weather API

# OpenWeatherMap free tier: 1000 calls/day
# At 30-min refresh = 48 calls/day (well within limit)
URL: api.openweathermap.org/data/2.5/forecast
Params: lat=25.644&lon=-100.236&units=metric&cnt=8

AQI Breakpoints (EPA Standard)

AQI PM2.5 (µg/m³) Category Color
0-50 0.0-12.0 Good Green
51-100 12.1-35.4 Moderate Yellow
101-150 35.5-55.4 USG Orange
151-200 55.5-150.4 Unhealthy Red
201-300 150.5-250.4 Very Unhealthy Purple
301-500 250.5-500.4 Hazardous Maroon

Animation Performance

  • ST7735 @ 32 MHz SPI can handle ~20 FPS full-screen
  • Transition frames: 5-8 frames over 0.3s
  • Use PIL Image.blend() for alpha transitions
  • Pre-render next screen in background thread

Dependencies

  • requests library for weather API
  • OpenWeatherMap free API key
  • Existing PIL/Pillow for animations
  • SQLite 24h data for rolling AQI average

Screen Count After v9

Current: 14 screens → Proposed: 16 screens (+weather, +AQI)


Ref: #1 Roadmap — LCD Enhancements

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions