FarmGuard Weather AI
Hyperlocal agricultural intelligence dashboard that turns sensor data and weather forecasts into actionable farming decisions. Real-time irrigation, spray windows, and crop stress insights at your fingertips.
FarmGuard Weather AI
Prototype Agricultural Weather Intelligence Dashboard
1. Project Overview
This prototype is a lightweight, browser-based intelligence dashboard designed for agricultural operations. It ingests hyperlocal environmental telemetry from a distributed sensor network, processes it through a simple normalization pipeline, and correlates it with public meteorological datasets to derive actionable field recommendations.
Primary Purpose:
To transform raw sensor telemetry and third-party weather data into farmer-readable guidance — specifically daily irrigation demand, spray windows, atmospheric stress indicators, and soil health metrics.
Scope:
This is a functional proof-of-concept. It demonstrates end-to-end data flow from physical sensing hardware to rendered visualizations, but does not yet include production-grade authentication, multi-tenant isolation, or long-term historical analytics.
2. Tech Stack
| Layer | Technology |
|---|---|
| Frontend | React 18 (Vite build tool), Chart.js / Recharts for data visualization |
| Styling | CSS modules + component-scoped styles |
| Weather API | Open-Meteo (public NOAA/GFS downstream correlation) |
| Data Transmission | LoRaWAN (Long Range Wide Area Network) |
| Backend Storage | Time-series capable store (SQLite/PostgreSQL for prototype) |
| Geolocation | Static coordinate mapping per monitoring zone |
Prototype - as web access and as well as android app/iOS
3. Data Collection Architecture
3.1 Sensor Hardware (Source X)
Field-deployed environmental stations are equipped with the following telemetry array:
- Soil moisture probe: Capacitance-based volumetric water content (%)
- Soil temperature sensor: Thermistor at 6-inch depth (deg F)
- Soil pore EC sensor: Electrical conductivity (dS/m)
- Ambient air sensors: Temperature, relative humidity, barometric pressure
- Rain gauge: Tipping bucket (inches accumulation)
- Anemometer: Wind speed and direction
- Solar radiation / UV sensor
All sensors are polled by a microcontroller at 15-minute intervals. The readings are packetized into a compact binary payload and transmitted via LoRaWAN to a cellular-enabled gateway.
3.2 LoRaWAN Transmission Flow
Sensor Node → LoRaWAN Gateway → Network Server → HTTP Endpoint
The payload is intentionally small to respect LoRaWAN duty-cycle constraints:
View Source Code
Click to expand interactive code modal
At the network server, the payload is decoded from Base64 and forwarded as a JSON POST to the ingestion endpoint.
3.3 Ingestion Endpoint
The backend exposes a simple REST receiver:
View Source Code
Click to expand interactive code modal
Example payload:
View Source Code
Click to expand interactive code modal
4. Data Storage & Schema
Telemetry is stored in a relational schema optimized for time-series insertions.
Core Table: telemetry_readings
View Source Code
Click to expand interactive code modal
Table: forecast_cache
Public weather forecast responses are cached to reduce API calls and enable offline dashboard rendering.
View Source Code
Click to expand interactive code modal
5. Data Processing Pipeline
5.1 Normalization
Raw readings are normalized to consistent units before any derived computation:
- All temperatures stored as Fahrenheit
- Rainfall as inches (cumulative per 24-hour window)
- Wind speed as mph
- Soil moisture as volumetric percent
5.2 Derived Metrics
The pipeline computes several derived values per zone:
Water Demand (ET deficit)
View Source Code
Click to expand interactive code modal
Where et0 is reference evapotranspiration retrieved from the public weather API.
Vapor Pressure Deficit (VPD) - Atmospheric Stress
View Source Code
Click to expand interactive code modal
High VPD indicates atmospheric stress demanding higher irrigation.
Spray Window Suitability
View Source Code
Click to expand interactive code modal
5.3 Aggregation Scheduler
A lightweight cron task runs every 6 hours to:
- Fetch latest 24h of sensor telemetry per zone.
- Compute rolling averages and daily totals.
- Pull fresh 5-day forecast from the external API.
- Write derived metrics to a
daily_summarytable.
6. Correlation with NOAA / Public Meteorology
The prototype does not ingest NOAA data directly. Instead, it uses Open-Meteo, which is a public aggregation service that normalizes multiple global meteorological inputs including NOAA GFS (Global Forecast System), ECMWF, and regional models.
6.1 Why This Indirection?
- NOAA GFS requires GRIB2 decoding and large bandwidth; Open-Meteo provides a lightweight JSON REST layer.
- It handles spatial interpolation automatically for the provided lat/lon.
- It exposes agriculturally relevant parameters: ET0, soil temperature, humidity, precipitation probability.
6.2 Correlation Logic
The system correlates local sensor data with the regional model by computing deltas:
View Source Code
Click to expand interactive code modal
These deltas are not yet surfaced to the UI in the prototype, but they are stored in daily_summary for future calibration use.
6.3 NOAA GFS Reference
When reporting to agronomists or regulators, the system can reference the upstream model lineage:
- Primary upstream source: NOAA GFS (Global Forecast System) via Open-Meteo pipeline
- Resolution: 0.25 deg x 0.25 deg global grid
- Update frequency: 4 times daily (00Z, 06Z, 12Z, 18Z)
7. Frontend Dashboard
7.1 Component Architecture
View Source Code
Click to expand interactive code modal
7.2 Critical Frontend Code: Forecast Labeling
One critical requirement was making the X-axis labels human-readable for farm operations. The shared formatter is:
View Source Code
Click to expand interactive code modal
Used in both the chart resolvers and the outlook strip.
7.3 Chart Resolvers
The chart system is resolver-based. Each chartKey maps to a function that transforms a zone object into Chart.js-compatible data:
View Source Code
Click to expand interactive code modal
7.4 Date Display Pattern
The header separates two distinct temporal concepts:
View Source Code
Click to expand interactive code modal
8. Forecast Data Format
The raw forecast from the upstream API is simplified into a flat array for frontend consumption:
View Source Code
Click to expand interactive code modal
Critical rule: date is stored as an ISO string; all formatting is deferred to the UI layer.
9. Future Directions
9.1 Near-term (Prototype → Alpha)
- Real-time socket layer: Replace 6-hour cron polling with WebSocket pushes from the LoRaWAN network server.
- Historical trending: Render 30-day soil moisture and ET0 trend lines rather than point-in-time snapshots.
- Alerting: Push SMS/email alerts when VPD crosses crop-specific thresholds or soil moisture drops below refill points.
- NOAA direct ingestion: For operations requiring regulatory-grade audit trails, implement direct GRIB2 ingestion from NOAA NOMADS rather than the simplified API.
9.2 Medium-term (Alpha → Beta)
- Crop modeling integration: Feed water demand and GDD into simple crop growth models (e.g., ASCE standardized ET, CIMIS coefficients).
- Multi-tenant zoning: Support distinct ranches with RBAC and zone-level configuration.
- Mobile PWA: Add service worker, offline forecast caching, and field-friendly touch targets.
- Sensor calibration dashboard: Surface the sensor-vs-forecast delta scores to agronomists for hardware recalibration.
9.3 Long-term (Production)
- Machine learning pipeline: Train regression models on sensor + satellite + weather data to predict irrigation demand 7-14 days ahead with confidence intervals.
- Valley integration: API integration with irrigation valve controllers for semi-automated pivot scheduling.
- Regulatory reporting: Automated export of water usage and ET reports for state water board compliance.
10. Security & Data Integrity Notes
- LoRaWAN payload includes AES-128 encryption at the physical layer.
- The HTTP ingestion endpoint should implement basic API-key validation.
- Sensor battery voltage is included in every payload to flag hardware degradation before data loss.
- All timestamps are stored in UTC; localization happens only at the presentation layer.
11. Glossary
| Term | Meaning |
|---|---|
| ET0 | Reference evapotranspiration - the baseline water loss from soil and plants |
| VPD | Vapor pressure deficit - the atmospheric dryness driving plant water demand |
| GDD | Growing degree days - accumulated heat units for crop phenology |
| LoRaWAN | Low-power, long-range radio protocol for IoT telemetry |
| NOAA GFS | NOAA Global Forecast System - global numerical weather prediction |
| GRIB2 | Standard binary format for meteorological grid data |