SoilSMS

SMS-based soil monitoring and AI crop advisory for rural Tanzania. No internet required on the farm — works on 2G GSM.

RPi Sensors
SMS (2G)
AI Server
Farmer's Phone
LAUNCH 3D DEMO GET A QUOTE

How It Works

1.

Sense

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.

2.

Send via SMS

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.

3.

AI Analysis

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.

4.

Advise the Farmer

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.

Architecture

[Farm / RPi Node] [Server] Sensors → sensor_node.py analysis_server.py └ Reads soil data └ Parses SMS JSON └ JSON via SMS →→→→→→→ └ Fetches weather (Open-Meteo) └ Analyses with LLM └ Replies to farmer via SMS │ [Farmer's phone] Receives plain-text crop advisory

Hardware

COMPONENTMODELPURPOSE
MicrocontrollerRaspberry Pi Zero 2 WMain controller
Moisture sensorCapacitive (3.3V)Soil moisture %
ADCADS1115 (I2C)Reads moisture + pH analog
pH sensorAnalog pH probe + moduleSoil pH level
Air temp/humidityDHT22Air conditions
Soil temperatureDS18B20 (1-Wire)Soil temp
NPK sensorRS485 Modbus RTU (JXBS-3001)Nitrogen, Phosphorus, Potassium
GSM moduleSIM800L / SIM7600SMS communication
Power12V solar + step-down to 5VOff-grid power
SIM cardAny Tanzanian carrier2G SMS

Example SMS

NODE → SERVER (RAW JSON)
{"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}
SERVER → FARMER (ADVISORY)
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.

Server Modes

Local AI (Ollama)

Run Mistral or other models locally on the server. No API key needed, fully offline. Set USE_LOCAL_AI=true in .env.

Cloud AI (OpenRouter)

Use any model via OpenRouter API, including free tiers like Arcee Trinity Large. Set USE_LOCAL_AI=false and provide your API key.

SMS: GSM Modem

Direct serial connection to a SIM800L modem. Polls for incoming SMS every 60 seconds. No external dependencies.

SMS: Africa's Talking

Use the Africa's Talking API as an SMS gateway. Runs a Flask webhook server for incoming messages.