Skip to content

dderyldowney/afs_fastapi

Repository files navigation

Automated Farming System API

AFS Testing

Automated Farming System API logo

Project Outline

1. Project Purpose

The AFS-FastAPI Project aims to harness Machine Learning (ML) and robotics to automate essential farming processes, including operating farm equipment, maintaining soil health, and managing water quality. By integrating data-driven insights with advanced automation, the project seeks to enhance farming efficiency, sustainability, and productivity.

The system provides a robust set of API interfaces, using FastAPI, to support diverse use cases, ranging from controlling robotic devices and physical farm equipment to monitoring environmental factors such as soil, water, and air quality. The APIs are designed to serve a wide range of consumers, including AI agents managing autonomous operations and humans overseeing the overall system or specific subsystems.


2. Locating Operational Manuals for Farm Equipment

Objective: Identify and utilize online resources that provide operational manuals for farm equipment. These manuals will guide the adaptation of current robotics to operate agricultural machines for automation purposes.

FarmTractor Model: The FarmTractor model is a Pydantic model used in the project to represent a farm tractor. It includes fields such as make, model, year, and manual_url to store the URL of the operational manual for the tractor. This model is used to demonstrate the use of Pydantic models in FastAPI and to provide a structured way to manage tractor data within the system.

Attributes:

  • make (str): The make of the tractor.
  • model (str): The model of the tractor.
  • year (int): The year of manufacture.
  • manual_url (str | None): URL to the manual.

Methods:

The FarmTractor class provides several methods to interact with and control the tractor. Below is a list of the available methods:

  • start_engine() -> str: Starts the engine of the tractor.
  • stop_engine() -> str: Stops the engine of the tractor.
  • change_gear(gear: str) -> str: Changes the gear of the tractor.
  • accelerate(increment: int) -> str: Accelerates the tractor.
  • brake(decrement: int) -> str: Brakes the tractor.
  • engage_power_takeoff() -> str: Engages the power takeoff.
  • disengage_power_takeoff() -> str: Disengages the power takeoff.
  • activate_hydraulics() -> str: Activates the hydraulics.
  • deactivate_hydraulics() -> str: Deactivates the hydraulics.
  • __str__() -> str: Returns the string representation of the tractor.

Example Usage:

from afs_fastapi.equipment.farm_tractors import FarmTractor

# Example usage:
tractor = FarmTractor(make="John Deere", model="9RX", year=2023, manual_url="https://example.com/manual")
print(f"Make: {tractor.make}, Model: {tractor.model}, Year: {tractor.year}, Manual URL: {tractor.manual_url}")

Sources:

  1. AgManuals
  2. Case IH Operator Manuals
  3. Farm Manuals Fast
  4. AGCO Technical Publications
  5. John Deere Manuals and Training
  6. Farming and Construction Manuals
  7. Solano Horizonte
  8. Yesterday's Tractors Forums
  9. Tractor Tools Direct
  10. General Implement Distributors
  11. TractorData
  12. Tractor Manuals Downunder

Build Process:

To build the project, follow these steps:

  1. Clone the repository: git clone https://github.com/dderyldowney/afs_fastapi.git
  2. Change to the project directory: cd afs_fastapi
  3. Create a virtual environment: python -m venv .venv
  4. Activate the virtual environment: source .venv/bin/activate
  5. Install the project dependencies: pip install -r requirements.txt
  6. Install build tools: pip install build
  7. Build the project: python -m build
  8. Install the generated wheel file: pip install dist/afs_fastapi-0.1.0-py3-none-any.whl
  9. Import afs_fastapi into your project: import afs_fastapi

3. Monitoring and Maintaining Soil Conditions

Objective: Research and utilize tools, sensors, and platforms to monitor soil composition, mineral content, and pH balance, ensuring optimal crop health.

Resources:

  1. Soil Scout
  2. Renke 4-in-1 Soil Nutrient Sensor
  3. Murata Soil Sensors
  4. HORIBA LAQUAtwin pH Meters
  5. Sensoterra Soil Moisture Sensors
  6. DFRobot 4-in-1 Soil Sensor
  7. EarthScout Agricultural Field Sensors
  8. University of Minnesota Extension: Soil Moisture Sensors
  9. ATTRA: Soil Moisture Monitoring Tools
  10. ESCATEC Electrochemical Sensors

4. Monitoring and Maintaining Water Conditions

Objective: Identify and deploy tools to assess and maintain water composition, mineral levels, and pH balance, ensuring water quality is optimized for agricultural use.

Resources:

  1. Renke Water Quality Sensors
  2. In-Situ Agriculture Water Monitoring
  3. Xylem Analytics Water Quality Monitoring
  4. KETOS Automated Water Monitoring
  5. YSI Water Quality Systems
  6. SGS Agricultural Water Testing
  7. Boqu Instrument Water Quality Sensors
  8. Digital Matter Remote Sensor Solutions
  9. Intuz IoT Water Monitoring
  10. Rika Sensor Water Quality Sensors

5. Utilizing Publicly Available Water Sampling Datasets

Objective: Access and analyze publicly available water quality datasets to inform ML models for monitoring water conditions suitable for farming.

Sources:

  1. Water Quality Portal (WQP)
  2. USGS National Water Information System (NWIS)
  3. EPA Water Quality Data
  4. Kaggle: Water Quality Dataset for Crop
  5. Ag Data Commons: Soil and Water Hub Modeling
  6. NASA Earthdata: Water Quality

6. Project Integration and Machine Learning Goals

Objective: Synthesize the research and datasets into ML models and robotics systems capable of automating farm operations, improving efficiency, and ensuring sustainability. Models will address:

  • Autonomous machine operation (leveraging operational manuals).
  • Soil condition predictions and adjustments.
  • Water quality monitoring and real-time management.

Tools and Techniques:

  • ML libraries like TensorFlow and PyTorch.
  • IoT-enabled sensors for real-time data collection.
  • Integration with cloud platforms for data storage and analysis.

Conclusion

This project will employ cutting-edge ML and robotics solutions to automate farming processes, ensuring optimized resource utilization and sustainable agricultural practices.