Skip to content

AI-powered smart agricultural IoT monitoring system using Raspberry Pi sensors and Llama 3.2 LLM for offline crop management. Provides real-time environmental data analysis and natural language farming insights without internet dependency.

License

Notifications You must be signed in to change notification settings

AdrianDiepeveen/LLM-Driven-Smart-Agricultural-IoT-Raspberry-Pi-Sensor-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

LLM-Driven Smart Agricultural IoT Raspberry Pi Sensor System

1. Problem Statement and Solution Approach

Problem Statement:

  • Agriculture faces critical challenges in maximizing crop yields while efficiently utilizing limited resources, particularly in developing countries like South Africa
  • Climate change consequences including drastic temperature variations and irregular rainfall patterns create additional agricultural stress
  • Traditional farming methods rely on periodic manual monitoring, leading to inaccurate detection of rapid changes in crop water levels, temperature, humidity, and pest activity
  • Rural agricultural areas suffer from unreliable internet connectivity and limited access to powerful computing hardware, restricting adoption of modern farming technologies
  • Farmers often lack extensive IT knowledge, creating barriers to implementing technology-driven agricultural solutions

Solution Approach:

  • Developed an AI-driven smart agricultural IoT monitoring system utilizing continuous sensor monitoring and real-time data analytics for optimized crop-growing conditions
  • Implemented large language models (LLMs) specifically Llama 3.2 to interpret IoT sensor data and provide intuitive natural language communication for farmers
  • Created a closed peer-to-peer (P2P) network architecture enabling local AI processing on CPU without internet connectivity requirements
  • Designed system with minimal hardware requirements to ensure accessibility for farms without expensive GPU infrastructure
  • Integrated advanced AI techniques for IoT data analysis and intelligent decision recommendations, transforming raw sensor data into actionable agricultural insights

2. Architecture, Technology Stack and Dependencies

Hardware Architecture:

  • Raspberry Pi 5 client node with 40 GPIO pins serving as edge computing device for sensor data collection
  • Ubuntu VM Server (VMware Workstation Pro) providing centralized processing and AI inference capabilities
  • Direct point-to-point Ethernet connection ensuring reliable, secure data transmission without internet dependency
  • Ultrasonic sensor for precision water level detection with 0.3cm tolerance threshold
  • HC-SR501 PIR motion sensor for automated pest detection and counting
  • DHT11 temperature and humidity module for environmental monitoring with delta change tracking

Software Stack and Dependencies:

  • Core Runtime: Python 3 with virtual environment isolation for dependency management
  • AI/ML Framework: Ollama hosting Llama 3.2 (3 billion parameter quantized model) optimized for CPU-only inference
  • Communication Protocol: Custom TCP socket implementation over port 6000 for reliable sensor data transmission
  • GUI Framework: Tkinter for cross-platform user interface with full-screen authentication and dashboard capabilities
  • Data Visualization: Matplotlib integration for real-time sensor data plotting with thread-safe rendering
  • Hardware Interface: gpiozero library for GPIO control and adafruit-circuitpython-dht for sensor interfacing
  • Concurrency Management: Python threading module enabling parallel sensor monitoring and data processing

Network Architecture:

  • Static IP configuration (192.168.50.10/24 client, 192.168.50.20/24 server) ensuring consistent node addressing
  • TCP/IP over Ethernet (OSI Layer 4) providing reliable, connection-oriented data transport
  • VMware bridged network adapter configuration enabling direct hardware network interface access

3. Performance Metrics and Benchmarks

System Performance Specifications:

  • AI Processing Efficiency: CPU-only LLM inference eliminates GPU hardware requirements while maintaining responsive natural language processing
  • Real-time Data Collection: 1-second intervals for water level readings and 2-second intervals for temperature/humidity monitoring ensuring timely agricultural data capture
  • Network Performance: Sub-second TCP communication response times with reliable point-to-point Ethernet connectivity
  • Memory Management: Thread-safe data buffering utilizing Python deque with 300 data points maximum for efficient memory utilization
  • Sensor Accuracy: Water level detection with 0.3cm precision threshold and continuous PIR motion detection for comprehensive pest monitoring

Scalability and Optimization Benchmarks:

  • Horizontal Scalability: Modular architecture supports dynamic addition of multiple Raspberry Pi clients through OS snapshot replication and unique IP assignment
  • Resource Optimization: Memory-efficient rolling buffer system prevents memory overflow while maintaining historical data access
  • Independence Metrics: Local processing architecture eliminates cloud dependency, ensuring 100% operational capability in offline rural environments
  • Cost Efficiency: System operates on consumer-grade hardware without specialized GPU requirements, significantly reducing deployment costs for resource-constrained agricultural operations
  • Performance Optimization: Balanced CPU-only AI processing against response time requirements, optimizing for accessibility over raw computational speed while maintaining practical agricultural decision-making capabilities

About

AI-powered smart agricultural IoT monitoring system using Raspberry Pi sensors and Llama 3.2 LLM for offline crop management. Provides real-time environmental data analysis and natural language farming insights without internet dependency.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages