SMS-based soil monitoring and AI crop advisory for rural Tanzania. No internet required on the farm — works on 2G GSM.
A Raspberry Pi Zero 2 W reads 5 sensor types: soil moisture, pH, soil temperature (DS18B20), air temp/humidity (DHT22), and NPK nutrients via RS485 Modbus. Powered by a 12V solar panel.
Sensor data is serialized into compact JSON and sent as an SMS using AT commands over a SIM800L GSM module. Works on any Tanzanian carrier (Vodacom, Airtel) over basic 2G.
The server receives the SMS, parses the JSON, fetches a 7-day weather forecast from Open-Meteo, then sends everything to an LLM (local Ollama or OpenRouter cloud) with an agronomist prompt.
The AI generates a concise, actionable advisory (fits in 3-4 SMS messages) covering soil status, nutrients, recommended actions, crop suggestions, and planting timing. Sent back via SMS.
| COMPONENT | MODEL | PURPOSE |
|---|---|---|
| Microcontroller | Raspberry Pi Zero 2 W | Main controller |
| Moisture sensor | Capacitive (3.3V) | Soil moisture % |
| ADC | ADS1115 (I2C) | Reads moisture + pH analog |
| pH sensor | Analog pH probe + module | Soil pH level |
| Air temp/humidity | DHT22 | Air conditions |
| Soil temperature | DS18B20 (1-Wire) | Soil temp |
| NPK sensor | RS485 Modbus RTU (JXBS-3001) | Nitrogen, Phosphorus, Potassium |
| GSM module | SIM800L / SIM7600 | SMS communication |
| Power | 12V solar + step-down to 5V | Off-grid power |
| SIM card | Any Tanzanian carrier | 2G SMS |
{"node_id":"FARM001","timestamp":1718000000,
"moisture_pct":34.2,"ph":6.1,
"soil_temp_c":24.5,"air_temp_c":28.0,
"air_humid_pct":72.0,
"nitrogen_mg_kg":85,
"phosphorus_mg_kg":30,
"potassium_mg_kg":160}
SoilSMS 12/06 08:42 UTC STATUS: Soil is dry (34%) and slightly acidic (pH 6.1). NUTRIENTS: Nitrogen is low (85 mg/kg). Phosphorus and potassium are adequate. ACTION: Add nitrogen fertilizer before next rain. Do not irrigate this week as rain is expected. PLANT: Best suited for maize or beans. TIMING: Plant in 5-7 days after forecasted rain.
Run Mistral or other models locally on the server. No API key needed, fully offline. Set USE_LOCAL_AI=true in .env.
Use any model via OpenRouter API, including free tiers like Arcee Trinity Large. Set USE_LOCAL_AI=false and provide your API key.
Direct serial connection to a SIM800L modem. Polls for incoming SMS every 60 seconds. No external dependencies.
Use the Africa's Talking API as an SMS gateway. Runs a Flask webhook server for incoming messages.