Skip to content

Central management system for FarmInsight: Integrating IoT sensor networks (FPF) with an intuitive dashboard for real-time agricultural monitoring and control.

License

Notifications You must be signed in to change notification settings

ETCE-LAB/FarmInsight

Repository files navigation

FarmInsight Logo

🌱 FarmInsight

Smart Monitoring Platform for Food Production Facilities

Live System

License Python React Django TypeScript

TU Clausthal ETCE Lab


πŸ“‹ Table of Contents


🎯 About

FarmInsight is a comprehensive open-source platform for monitoring and managing Food Production Facilities (FPFs). Developed at TU Clausthal as part of the Digital Technologies program, it provides real-time sensor data visualization, AI-powered forecasting, and automated control systems.

FarmInsight Overview

🌟 Core Vision

"Maximum yield with minimal sustainable resource input"

FarmInsight enables organizations to manage multiple Food Production Facilities (FPFs) – from vertical farms to greenhouses – with precision and ease:

  • Monitor – Real-time sensor data from temperature, humidity, soil moisture, and more
  • Analyze – Interactive visualizations with historical trends and custom date ranges
  • Predict – AI-powered forecasts for water and energy consumption
  • Automate – Smart triggers and controllable actions for lights, pumps, and climate
  • Collaborate – Multi-tenant architecture with role-based access (Admin/Member)

✨ Features

🏒 Organization Management

  • Multi-tenant architecture
  • Role-based access (Admin/Member)
  • Assign FPFs to organizations

πŸ“Š Sensor Integration

  • HTTP & MQTT protocols
  • Configurable polling intervals
  • Real-time data streaming via WebSocket
  • 10+ sensor models supported

πŸ“· Camera Support

  • Scheduled image capture
  • RTSP/HTTP livestreaming
  • Historical image gallery

πŸ€– AI-Powered Forecasting

  • Water level predictions with irrigation optimization
  • Energy consumption forecasts
  • Best/Average/Worst-case scenarios
  • Weather data integration (Open-Meteo)

⚑ Smart Automation

  • Trigger-based actions (interval, time, sensor threshold)
  • Hardware control via network (HTTP)
  • Queue-based execution with hardware protection
  • Manual override capability

πŸ”” Notifications

  • Matrix server integration
  • Configurable alerts per FPF
  • Real-time status updates

πŸ’§ Water Management Dashboard

  • Animated tank fill level visualization
  • Field moisture monitoring
  • AI-driven irrigation scheduling (Best/Average/Worst)
  • Proactive refill recommendations

⚑ Energy Management Dashboard

  • Battery State-of-Charge monitoring
  • Solar production & grid power tracking
  • Multi-scenario forecasts (Expected/Optimistic/Pessimistic)
  • Automated grid connect/disconnect thresholds

πŸ— Architecture

flowchart TB
    subgraph Client["Client"]
        Browser["Web Browser"]
    end

    subgraph Frontend["Dashboard Frontend"]
        React["React + Redux + Mantine UI"]
    end

    subgraph Backend["Dashboard Backend"]
        Django1["Django REST API"]
        SQLite1[(SQLite)]
        InfluxDB[(InfluxDB)]
        Scheduler1["Task Scheduler"]
    end

    subgraph AI["AI Backend"]
        Django2["Django ML Service"]
        Models["Trained Models"]
        Weather["Open-Meteo API"]
    end

    subgraph FPF["FPF Backend"]
        Django3["Django Sensor Service"]
        SQLite2[(SQLite)]
        Scheduler2["Data Collector"]
    end

    subgraph Hardware["Hardware Layer"]
        Sensors["Sensors"]
        Cameras["Cameras"]
        Actuators["Smart Plugs"]
    end

    Browser <-->|HTTP| React
    React <-->|REST + WebSocket| Django1
    Django1 <--> SQLite1
    Django1 <--> InfluxDB
    Django1 <-->|REST| Django2
    Django2 --> Models
    Django2 <-->|REST| Weather
    Django1 <-->|REST| Django3
    Django3 <--> SQLite2
    Django3 --> Scheduler2
    Scheduler2 <-->|HTTP / MQTT| Sensors
    Scheduler2 <-->|HTTP / RTSP| Cameras
    Scheduler2 <-->|HTTP / MQTT| Actuators
Loading

πŸ”„ Data Flow

sequenceDiagram
    participant S as 🌑️ Sensor
    participant FPF as 🌱 FPF Backend
    participant DB as βš™οΈ Dashboard Backend
    participant AI as 🧠 AI Backend
    participant UI as πŸ“± Frontend
    participant U as πŸ‘€ User

    S->>FPF: Measurement (HTTP/MQTT)
    FPF->>DB: Store data (REST)
    DB->>DB: Save to InfluxDB
    
    loop Every Interval
        DB->>AI: Request Forecast
        AI->>AI: Run ML Model
        AI-->>DB: Predictions + Actions
    end
    
    U->>UI: Open Dashboard
    UI->>DB: Request Data (REST)
    DB-->>UI: Sensor Data + Forecasts
    UI-->>U: Visualize
    
    alt Trigger Activated
        DB->>DB: Execute Action
        DB->>S: Control Hardware
    end
Loading

πŸ“ Repository Structure

FarmInsight/
β”œβ”€β”€ πŸ“± dashboard-frontend/     # React Web Application
β”‚   β”œβ”€β”€ smart_farm_frontend/   # Source code
β”‚   └── .documentation/        # UI screenshots & guides
β”‚
β”œβ”€β”€ βš™οΈ dashboard-backend/       # Central Django API
β”‚   β”œβ”€β”€ django_server/         # Django project
β”‚   β”œβ”€β”€ Dockerfile             # Container config
β”‚   └── docker-compose.yml     # InfluxDB setup
β”‚
β”œβ”€β”€ 🌱 fpf-backend/             # Sensor Collection Service
β”‚   β”œβ”€β”€ django_server/         # Django project
β”‚   └── .documentation/        # Arduino/Pi Pico scripts
β”‚
β”œβ”€β”€ 🧠 ai-backend/              # ML Prediction Service
β”‚   β”œβ”€β”€ model_service/         # Django ML project
β”‚   β”œβ”€β”€ Dockerfile             # Container config
β”‚   └── docs/                  # Model documentation
β”‚
β”œβ”€β”€ πŸ“„ LICENSE                  # AGPL-3.0
└── πŸ“– README.md                # This file

πŸš€ Quick Start

Prerequisites

Component Requirement
Node.js v18+ LTS
Python v3.11+
pip v24+
Docker Optional (for InfluxDB)

Development Setup

1️⃣ Clone the Repository

git clone https://github.com/ETCE-LAB/FarmInsight.git
cd FarmInsight
git submodule init && git submodule update

2️⃣ Start the Dashboard Backend

cd dashboard-backend/django_server

# Create virtual environment
python -m venv .venv
.venv\Scripts\activate  # Windows
# source .venv/bin/activate  # Linux/Mac

# Install dependencies
pip install -r requirements.txt

# Generate OIDC key
openssl genrsa -out rsa/oidc.key 4096

# Setup database
python manage.py migrate
python manage.py loaddata application

# Start server
python manage.py runserver 8000

3️⃣ Start the Frontend

cd dashboard-frontend/smart_farm_frontend

# Install dependencies
npm install

# Configure backend URL
echo 'export const BACKEND_URL = "http://127.0.0.1:8000";' > src/env-config.ts

# Start development server
npm start

4️⃣ (Optional) Start FPF Backend

cd fpf-backend/django_server
pip install -r requirements.txt
python manage.py migrate
python manage.py runserver 8001

5️⃣ (Optional) Start AI Backend

cd ai-backend/model_service
pip install -r requirements.txt
python manage.py runserver 8002

πŸ“š For detailed setup instructions, see the README in each component folder.


πŸ›  Technology Stack

Layer Technologies
Frontend React Redux TypeScript Mantine
Backend Python Django DRF
Database InfluxDB SQLite
AI/ML scikit-learn LightGBM
IoT MQTT Arduino Pi Pico

πŸ“Έ Feature Showcase

Explore the FarmInsight platform through our modern, intuitive interface designed for efficient farm management.


🏠 Landing Page & FPF Overview

FarmInsight Landing Page

Dashboard overview showing all Food Production Facilities with live camera previews and maintenance status indicators


The landing page provides instant visibility into all your FPFs:

  • Live Camera Previews – Real-time thumbnails from each facility
  • Status Indicators – Quick identification of facilities under maintenance
  • Organization Labels – Easy filtering by organization (e.g., ETCE)
  • Search & Create – Quickly find or add new facilities

πŸ“Š Real-Time Monitoring Dashboard

FPF Overview Dashboard

Dashboard Features

🌑️ Live Sensor Data

  • Interactive graphs with time range selection
  • Smooth value visualization option
  • Multiple sensor overlay support

πŸ“· Camera Integration

  • Live image/stream toggle
  • Timestamped captures
  • Full-screen preview

🌀️ Weather Forecast

  • Current conditions
  • 3-day forecast preview
  • Location-based data

πŸ”Œ Hardware Controls

  • On/Off/Auto modes
  • Manual override capability

βš™οΈ Sensor Configuration & Management

Sensor Management Interface

Comprehensive sensor management with real-time status, logging capabilities, and threshold configuration


πŸ“ 10+ Sensor Models ⏱️ Configurable Intervals 🚨 Threshold Alerts πŸ“ Data Logging
DHT22, SenseCAP, Shelly & more From seconds to hours Custom warning levels Full measurement history


πŸ’§ Water Management Dashboard

Water Management Dashboard

Real-Time Monitoring

  • Animated Tank Visualization with live fill level
  • Current Volume Display showing capacity used
  • Water Temperature with freeze warning
  • Soil Moisture Tracking for field sensors

AI-Powered Forecasting

  • 7-Day Water Level Prediction graph
  • Optimal Irrigation Schedule generated automatically
  • Consumption Analytics with daily averages
  • Proactive Refill recommendations

⚑ Energy Management Dashboard

Energy Management Dashboard

πŸ”‹ Battery Status

Live SoC monitoring
Configurable capacity
Real-time updates

⚑ Power Balance

Production vs Consumption
Net power calculation
Solar tracking

πŸ”Œ Grid Status

Connection state
Auto-connect thresholds
Manual override

🚨 Smart Actions

Emergency shutdown
Load shedding
AI-triggered responses

AI Forecast Scenarios

Both Water and Energy dashboards provide multi-scenario predictions:

Scenario Description Planning Use
🟒 Best Case Optimal conditions, minimal consumption Capacity planning
πŸ”΅ Expected Average conditions based on historical data Daily operations
🟠 Worst Case Adverse conditions, high consumption Risk preparation

Smart Automation: The system can automatically trigger actions (e.g., grid connect, pump activation) based on forecast thresholds.


🎬 Automation in Action

Smart Trigger System
Demonstration of the trigger system: Manual override β†’ Auto mode β†’ Time-based triggers

πŸ”§ Learn more about Controllable Actions

FarmInsight's automation system supports multiple trigger types:

Trigger Type Description Example
⏰ Interval Repeat at fixed intervals Water pump every 6 hours
πŸ• Time-Based Execute within timeframe Lights on 6:00-18:00
πŸ“Š Sensor React to measurements Fan on if temp > 30Β°C
πŸ‘† Manual One-click execution Emergency stop

🀝 Contributing

We welcome contributions! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'Add amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

πŸ‘₯ Contributors

This project was developed as part of the Digitalisierungsprojekt at Digital Technologies, TU Clausthal.

Development Team

Tom Luca Heering Theo Lesser Mattes Knigge Julian SchΓΆpe
Marius Peter Paul Golke Niklas Schaumann M. Linke

Supervision

  • Johannes Mayer – Project Lead
  • Benjamin Leiding – Academic Supervisor

Special Thanks

  • Anant – Deployment & Infrastructure

πŸ“„ License

This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0).

See the LICENSE file for details.


Made with πŸ’š at TU Clausthal
🌐 Live Demo β€’ πŸ“¦ ETCE-Lab GitHub

About

Central management system for FarmInsight: Integrating IoT sensor networks (FPF) with an intuitive dashboard for real-time agricultural monitoring and control.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •