Skip to content

velan1207/AgroSmart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŒพ CropWatch - IoT-Based Crop Stress Monitoring System

A comprehensive 24ร—7 IoT-based crop stress monitoring and smart irrigation system built with Flutter. This application provides real-time visualization of soil moisture, temperature, and humidity data from ESP32 sensors, with intelligent alerts and manual pump control.

Flutter Firebase ESP32 License

โœจ Features

๐Ÿ“Š Real-Time Monitoring

  • Live sensor data updates (temperature, humidity, soil moisture)
  • Automatic data refresh every 3-5 seconds
  • Visual crop stress level indicators
  • Multi-field support with unique device IDs

๐Ÿ“ˆ Historical Analytics

  • Daily/Weekly/Monthly data visualization
  • Line and bar charts for trend analysis
  • Min/Max/Average statistics
  • Exportable reports

๐Ÿ”” Smart Alerts

  • Configurable threshold alerts
  • Critical, warning, and info severity levels
  • Push notifications for urgent issues
  • Alert history and management

๐Ÿ’ง Irrigation Control

  • Manual pump ON/OFF control
  • Real-time pump status monitoring
  • Auto-irrigation option (configurable)
  • Pump action logging

๐ŸŒ Offline Support

  • Data buffering when offline
  • Automatic sync when connection returns
  • Local storage for preferences

๐ŸŽจ Beautiful UI

  • Modern Material Design 3
  • Dark and light themes
  • Smooth animations
  • Farmer-friendly interface

๐Ÿ—๏ธ System Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                        HARDWARE LAYER                           โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  ESP32 + DHT22 + Soil Moisture Sensor + Relay (Pump)           โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                           โ”‚ WiFi
                           โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                         CLOUD LAYER                             โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚               Firebase Realtime Database                         โ”‚
โ”‚  โ”œโ”€โ”€ devices/                                                    โ”‚
โ”‚  โ”‚   โ””โ”€โ”€ field-001/                                             โ”‚
โ”‚  โ”‚       โ”œโ”€โ”€ latest/     (current sensor readings)              โ”‚
โ”‚  โ”‚       โ”œโ”€โ”€ history/    (historical data)                      โ”‚
โ”‚  โ”‚       โ”œโ”€โ”€ pumpStatus  (pump control flag)                    โ”‚
โ”‚  โ”‚       โ””โ”€โ”€ settings/   (configuration)                        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                           โ”‚ HTTPS
                           โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                      APPLICATION LAYER                          โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                    Flutter Mobile App                            โ”‚
โ”‚  โ”œโ”€โ”€ Real-time visualization                                    โ”‚
โ”‚  โ”œโ”€โ”€ Historical charts                                          โ”‚
โ”‚  โ”œโ”€โ”€ Alert management                                           โ”‚
โ”‚  โ””โ”€โ”€ Pump control                                               โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿš€ Getting Started

Prerequisites

  • Flutter SDK 3.8+
  • Android Studio / VS Code
  • Firebase account
  • ESP32 development board (for hardware)

Installation

  1. Clone the repository

    git clone https://github.com/yourusername/crop_monitor.git
    cd crop_monitor
  2. Install dependencies

    flutter pub get
  3. Configure Firebase (for production)

    • Create a Firebase project
    • Enable Realtime Database
    • Download google-services.json (Android)
    • Place in android/app/
    • Update Firebase rules (see below)
  4. Run the app

    flutter run

Firebase Database Rules

{
  "rules": {
    "devices": {
      "$deviceId": {
        ".read": true,
        ".write": true,
        "latest": {
          ".read": true,
          ".write": true
        },
        "history": {
          ".read": true,
          ".write": true,
          ".indexOn": ["timestamp"]
        }
      }
    }
  }
}

๐Ÿ”ง Hardware Setup

Components Required

Component Quantity Purpose
ESP32 DevKit 1 Main controller
DHT22 Sensor 1 Temperature & Humidity
Capacitive Soil Moisture Sensor 1 Soil moisture
5V Relay Module 1 Pump control
Mini Water Pump 1 Irrigation (demo)
Jumper Wires Several Connections
5V Power Supply 1 Power

Wiring Diagram

ESP32 Pin Connections:
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
GPIO4  โ†’ DHT22 Data
GPIO34 โ†’ Soil Moisture Sensor (Analog)
GPIO25 โ†’ Relay IN
3.3V   โ†’ DHT22 VCC, Soil Sensor VCC
GND    โ†’ DHT22 GND, Soil Sensor GND, Relay GND
5V     โ†’ Relay VCC

Uploading Firmware

  1. Open esp32_firmware/crop_monitor.ino in Arduino IDE
  2. Install required libraries:
    • Firebase ESP Client
    • DHT sensor library
  3. Update WiFi and Firebase credentials
  4. Select ESP32 board and upload

๐Ÿ“ Project Structure

lib/
โ”œโ”€โ”€ main.dart                 # App entry point
โ”œโ”€โ”€ models/                   # Data models
โ”‚   โ”œโ”€โ”€ sensor_data.dart     # Sensor reading model
โ”‚   โ”œโ”€โ”€ field.dart           # Farm field model
โ”‚   โ””โ”€โ”€ alert.dart           # Alert model
โ”œโ”€โ”€ providers/                # State management
โ”‚   โ”œโ”€โ”€ field_provider.dart  # Field & sensor state
โ”‚   โ”œโ”€โ”€ alert_provider.dart  # Alert management
โ”‚   โ””โ”€โ”€ settings_provider.dart # App settings
โ”œโ”€โ”€ screens/                  # UI screens
โ”‚   โ”œโ”€โ”€ splash_screen.dart   # Splash with animation
โ”‚   โ”œโ”€โ”€ home_screen.dart     # Main navigation
โ”‚   โ”œโ”€โ”€ dashboard_screen.dart # Live data view
โ”‚   โ”œโ”€โ”€ graph_screen.dart    # Charts & analytics
โ”‚   โ”œโ”€โ”€ alerts_screen.dart   # Alert management
โ”‚   โ”œโ”€โ”€ fields_screen.dart   # Multi-field view
โ”‚   โ””โ”€โ”€ settings_screen.dart # App preferences
โ”œโ”€โ”€ services/                 # Backend services
โ”‚   โ”œโ”€โ”€ firebase_service.dart # Firebase RTDB
โ”‚   โ”œโ”€โ”€ notification_service.dart # Push notifications
โ”‚   โ””โ”€โ”€ storage_service.dart # Local storage
โ”œโ”€โ”€ theme/                    # App theming
โ”‚   โ””โ”€โ”€ app_theme.dart       # Colors, styles
โ””โ”€โ”€ widgets/                  # Reusable widgets
    โ”œโ”€โ”€ sensor_card.dart     # Sensor display card
    โ”œโ”€โ”€ stress_indicator.dart # Crop stress widget
    โ”œโ”€โ”€ field_card.dart      # Field selector
    โ”œโ”€โ”€ alert_card.dart      # Alert item
    โ”œโ”€โ”€ pump_control.dart    # Pump toggle
    โ””โ”€โ”€ charts.dart          # Line & bar charts

๐ŸŒฑ Crop Stress Calculation

The system calculates crop stress based on three parameters:

Parameter Optimal Range Moderate Stress High Stress Critical
Temperature 20-30ยฐC 18-32ยฐC 15-35ยฐC <15 or >35ยฐC
Humidity 40-70% 35-80% 30-85% <30 or >85%
Soil Moisture 40-70% 35-75% 25-85% <25 or >85%

๐ŸŽฏ Supported Crops

  • ๐ŸŒพ Paddy (Rice)
  • ๐ŸŒพ Wheat
  • ๐Ÿฅœ Groundnut
  • ๐ŸŒฟ Cotton
  • ๐ŸŽ‹ Sugarcane
  • ๐ŸŒฝ Maize (Corn)
  • ๐Ÿ… Tomato
  • ๐Ÿฅ” Potato
  • ๐Ÿง… Onion
  • ๐ŸŒถ๏ธ Chili
  • ๐Ÿฅญ Mango
  • ๐ŸŒ Banana
  • ๐Ÿฅฅ Coconut
  • โ˜• Coffee
  • ๐Ÿต Tea

๐Ÿ“‹ Functional Requirements

ID Requirement Status
FR-1 Sensor Data Acquisition โœ…
FR-2 Data Transmission to Cloud โœ…
FR-3 Real-Time Visualization โœ…
FR-4 Historical Data View โœ…
FR-5 Alert System โœ…
FR-6 Multi-Location Support โœ…
FR-7 Manual Irrigation Control โœ…

๐Ÿ”ฎ Future Enhancements

  • AI-based stress prediction
  • SMS alert system
  • Voice alerts in local languages
  • Solar-powered sensor nodes
  • Weather forecast integration
  • Crop disease detection (camera)
  • Multi-user authentication
  • Farm analytics dashboard

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

๐Ÿ“„ License

This project is licensed under the MIT License.

๐Ÿ‘จโ€๐Ÿ’ป Author

Developed as an Academic Project for IoT-Based Smart Agriculture


Made with โค๏ธ for Smart Agriculture

"The proposed system enables 24ร—7 crop monitoring using IoT sensors and a Flutterโ€‘based mobile application with realโ€‘time visualization, alerts, and offline support."

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors