Empowering farmers with IoT-driven precision agriculture for optimized greenhouse management
- Overview
- Key Features
- Architecture
- Technical Stack
- AWS Services Integration
- Project Structure
- IoT Device Integration
- Usage
- Screenshots
- License
Farmers is a comprehensive IoT-enabled mobile application designed to revolutionize greenhouse management for modern agriculture. Built with Flutter and powered by AWS services, this application enables farmers to:
- Monitor multiple greenhouses in real-time
- Manage IoT sensor devices for environmental tracking
- Control automated systems (irrigation, ventilation, lighting)
- Receive AI-powered insights and recommendations
- Track crop growth stages and optimize farming practices
The app connects to IoT devices through AWS IoT Core using secure MQTT protocol, providing real-time data synchronization and remote device control capabilities.
- Create and manage multiple greenhouses
- Track greenhouse location, crop type, and planting dates
- View comprehensive greenhouse analytics and insights
- Configure automation settings per greenhouse
- Connect multiple IoT devices to each greenhouse
- Real-time sensor data monitoring:
- Temperature (Β°C)
- Humidity (%)
- Soil Moisture (%)
- pH Levels
- Nitrogen (N) levels
- Device status tracking (online/offline, battery level, last seen)
- Secure device authentication using AWS IoT certificates
- Remote device control via MQTT
- Automated irrigation based on soil moisture
- Climate control (ventilation, temperature regulation)
- Configurable target parameters for each greenhouse
- Real-time command execution and status updates
- AWS Lex Integration: Conversational AI chatbot for farming queries
- Perplexity AI Integration: Advanced fertilizer recommendations based on:
- Current crop stage
- Sensor readings (temperature, humidity, soil conditions)
- Days since planting
- VPD (Vapor Pressure Deficit) calculations
- Evapotranspiration (ETβ) metrics
- Real-time sensor data visualization with charts
- Historical data analysis and trends
- Crop stage tracking with growth insights
- Environmental condition monitoring
- Fertilizer recommendations tailored to crop needs
- Real-time weather data using WeatherAPI
- 7-day weather forecasts
- Air quality index (AQI) monitoring
- Weather alerts and notifications
- Secure authentication with AWS Cognito
- User profile management with cloud storage
- Multi-device synchronization
- Custom notification preferences
The application follows Clean Architecture principles with clear separation of concerns:
βββ Domain Layer (Business Logic)
β βββ Entities (Core business models)
β βββ Repositories (Abstract interfaces)
β βββ Use Cases (Business rules)
β
βββ Data Layer (Data Management)
β βββ Data Sources (Remote/Local data sources)
β βββ Models (Data transfer objects)
β βββ Repositories (Implementation)
β βββ Services (Business services)
β
βββ Presentation Layer (UI)
β βββ BLoC (State management)
β βββ Pages (Screen widgets)
β βββ Widgets (Reusable UI components)
β
βββ Config Layer
βββ Dependency Injection (GetIt)
βββ Routing (GoRouter)
βββ Theme
State Management: BLoC (Business Logic Component) pattern Dependency Injection: GetIt for service locator pattern
- Framework: Flutter 3.24.4 (Stable)
- Language: Dart 3.5.4
- UI Components: Material Design 3
- State Management: flutter_bloc 9.1.1
- Navigation: go_router 16.2.5
- Local Storage: Isar 3.1.0
- Authentication: AWS Amplify Auth (Cognito)
- Database: AWS Amplify DataStore (DynamoDB)
- API: AWS Amplify API (AppSync GraphQL)
- IoT: AWS IoT Core with MQTT
- Storage: AWS S3 (via Amplify Storage)
- AI Services:
- AWS Lex (Conversational AI)
- Perplexity AI (Agricultural recommendations)
- MQTT: Secure IoT device communication (mqtt_client 10.11.1)
- REST API: HTTP requests (dio 5.9.0)
- GraphQL: AWS AppSync for data synchronization
- WebSocket: Real-time data streaming
- Android: Gradle 8.x with Kotlin DSL
- iOS: CocoaPods (native dependencies)
- Amplify: AWS Amplify Gen 2 with TypeScript
- Secure MQTT broker for device-to-cloud communication
- Device certificate management and authentication
- Topic-based pub/sub messaging
- Real-time sensor data streaming
Implementation Details:
- Endpoint: AWS IoT Core endpoint (region: ap-southeast-1)
- Protocol: MQTT over TLS (port 8883)
- Authentication: X.509 certificates per device
- Topics: Custom topics based on device keywords
- User authentication and authorization
- Email-based sign-up and sign-in
- Password reset and account recovery
- JWT token management for API access
- Real-time data synchronization
- Offline-first capabilities
- Automatic conflict resolution
- Fine-grained authorization rules
Data Models:
UserProfile: User account and preferencesGreenhouse: Greenhouse configurationsDevice: IoT device metadata and certificatesSensorReading: Time-series sensor data
- NoSQL database for structured data
- Global Secondary Indexes (GSI) for efficient queries
- Time-series data storage for sensor readings
- Automatic scaling and high availability
- Conversational AI for farming assistance
- Natural language understanding (NLU)
- Context-aware responses
- Integration with greenhouse data for personalized advice
- Profile image storage
- Document uploads
- Backup and archival storage
lib/
βββ config/ # App configuration, DI, routing, theme
βββ core/ # Core utilities, error handling, base classes
βββ data/ # Data layer implementation
β βββ datasources/ # API, AWS services, IoT communication
β βββ models/ # Data models
β βββ repositories/ # Repository implementations
β βββ services/ # Business services
βββ domain/ # Business logic layer
β βββ entities/ # Core business entities
β βββ repositories/ # Repository interfaces
β βββ usecases/ # Business use cases
βββ presentation/ # UI layer
β βββ blocs/ # State management (BLoC)
β βββ pages/ # Screen widgets
β βββ widgets/ # Reusable UI components
βββ amplify_outputs.dart # Auto-generated Amplify config
βββ main.dart # App entry point
amplify/ # AWS Amplify backend configuration
βββ auth/ # Cognito auth setup
βββ data/ # AppSync GraphQL schema
βββ backend.ts # Backend definition
IoT devices must support:
- MQTT protocol over TLS
- X.509 certificate authentication
- JSON payload format
- Sensor data publishing
-
Add Device in App
- Navigate to greenhouse detail page
- Tap "Add Device" button
- Enter device name and pub/sub keyword
- Device certificates are automatically generated
-
Configure Device Certificates
- Device receives CA certificate, device certificate, and private key
- Store certificates securely on the device
- Use certificates for AWS IoT Core connection
-
MQTT Topics
Publish (Device β Cloud): <pubsubKeyword>/sensor_data Subscribe (Cloud β Device): <pubsubKeyword>/commands
Devices should publish JSON payloads:
{
"deviceId": "device-uuid",
"greenhouseId": "greenhouse-uuid",
"temperature": 25.5,
"humidity": 65.0,
"soilMoisture": 45.0,
"phLevel": 6.8,
"nitrogen": 120.0,
"timestamp": "2025-12-06T10:30:00Z"
}App sends control commands:
{
"command": "irrigate",
"duration": 120,
"timestamp": "2025-12-06T10:30:00Z"
}- Sign up with email and password
- Verify email with OTP
- Sign in to access dashboard
- Tap "Add Greenhouse" from dashboard
- Fill in greenhouse details (name, location, crop type)
- Set automation preferences
- Configure target environmental parameters
- Open greenhouse detail page
- Add device with unique pub/sub keyword
- Device certificates are generated automatically
- Configure device with certificates
- View live sensor readings on greenhouse page
- Switch between Overview, Analytics, and Insights tabs
- Monitor device status (online/offline)
- View historical data with charts
- Send manual commands to devices
- Enable/disable automation rules
- Configure irrigation schedules
- Adjust climate control settings
- Open chat page for AI farming advisor
- Ask questions about crop management
- Get personalized recommendations
- View fertilizer suggestions based on current data
- Check current weather conditions
- View 7-day forecast
- Monitor air quality
- Plan farming activities accordingly
| Package | Version | Purpose |
|---|---|---|
flutter_bloc |
^9.1.1 | State management |
get_it |
^8.2.0 | Dependency injection |
go_router |
^16.2.5 | Navigation |
amplify_flutter |
^2.7.0 | AWS Amplify SDK |
mqtt_client |
^10.11.1 | MQTT communication |
dio |
^5.9.0 | HTTP client |
isar |
^3.1.0 | Local database |
fl_chart |
^1.1.1 | Data visualization |
perplexity_flutter |
^2.0.4 | Perplexity AI integration |
equatable |
^2.0.7 | Value equality |
dartz |
^0.10.1 | Functional programming |
This project is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License.
- β You can use, copy, and modify the code for non-commercial purposes
- β You must give appropriate credit
- β You cannot use this project for commercial purposes without permission
For full license details, see LICENSE.md or visit: https://creativecommons.org/licenses/by-nc/4.0/
Made with β€οΈ for farmers worldwide
Version 1.0.0 | December 2025














