Farmassist is a smart farming app for IoT and AI-powered plant disease detection. It is built with Flutter and uses Firebase as its backend.
![]() |
![]() |
![]() |
---|---|---|
View Agricultural News | Receive IoT Telemetry Data | Detect Plant Disease |
You can download the latest version of the Android APK here.
Architecture Diagram of Farmassist
The above illustration shows a high level overview of the Farmassist project. Farmassist consists of 3 subsystems:
The backend services used are as follows:
The following sections explain more detail about the services and components used by the corresponding subsystems.
The signup and login flow of Farmassist is developed using the Bloc library and Firebase Authentication. After a user signs up successfully, the user data will be stored in the data model of Cloud Firestore as shown below:
{
"users": { // "users" collection
"4lbwvicymz71LfY9POHZ": { // "userId" document
"id": "4lbwvicymz71LfY9POHZ",
"email": "example@farmassist.com",
"displayName": "Jack",
"tokens": [ ... ] // used by Cloud Messaging
},
"4DkFgqNdjZnEh78YmsE3": { ... },
// more "userId" documents
}
}
Cloud Firestore, a NoSQL, document-oriented database, is used to store farm management data using key-value pairs. In Cloud Firestore, each collection consists of a number of documents in which each document can store a number of subcollections.
There are 2 types of farm management data stored: planting data and harvesting data. An example of the data model for harvesting data is shown below:
{
"planting": { // "planting" collection
"4lbwvicymz71LfY9POHZ": { // "userId" document
"months": { // "months" subcollection
"jan": { // "jan" document
"plantName": "tomato",
"noOfPlants": "100",
"plantDate": "25-03-2021",
"estimatedHarvestWeek": "9",
"harvestDate": "25-5-2021",
"harvested": true
},
"feb": { ... } // "feb" document
// more documents for the remaining months
}
},
// more "userId" documents
}
}
Under farm management, 2 extra APIs are used:
Realtime Database acts as a repository of IoT telemetry data that performs data synchronization with the Farmassist app. The overall process of IoT monitoring is described as follows:
5 types of telemetry data are stored as JSON objects in Realtime Database:
Each telemetry data is stored as a key-value pair of timestamp and value. An example of the data model for telemetry data is shown below:
{
"telemetry_data": {
"4lbwvicymz71LfY9POHZ": { // userId
"humidity": {
"1617979596947": "56.64", // timestamp: value
"1617979596949": "55.89",
// more values
},
"moisture": { ... },
"pH": { ... },
"salinity": { ... },
"temperature": { ... }
},
// more telemetry data from other users
}
}
For demonstration purpose, a minimal IoT device simulator is built to send telemetry data to Realtime Database. For more information, you can refer to Farmassist IoT Device Simulator.
The code for Cloud Functions can be found in Farmassist Firebase.
A plant disease detection model was trained using Google Cloud AutoML Vision. The training dataset is a subset of PlantVillage dataset from Mendeley Data. A total of 2,941 diseased plant images that consists of 6 disease categories were used:
After training, the model was exported as a TensorFlow Lite model, which is suitable to be run on a mobile device. You can find the trained model here.
Some of the useful Flutter packages used in the Farmassist app are listed in the table below. Refer to pubspec.yaml for the complete package information.
Package | Functions |
---|---|
Provider | A simple state management tool |
bloc and flutter_bloc | A state management library implemented using BLoC design pattern |
fl_chart | A powerful Flutter chart library with beautiful UI |
getwidget | A Flutter UI library with 1000+ pre-made UI components |
Things to do if you want to fork or contribute to the project.
push
event, I set up a manual trigger with workflow_dispatch
event.