AE-SMARTFARM
USER & TECHNICAL GUIDE

SmartFarm Platform Documentation

Master the unified Project → Device → Sensors architecture. Complete guidance on onboarding, telemetry monitoring, safety-interlocked KUA irrigation, power profiles, AI agronomy, and developer APIs.

1. Quick Start & System Architecture

v7.0 Unified Platform

Welcome to Angaza Elimu SmartFarm. SmartFarm enables farmers, cooperatives, and agronomists to monitor microclimates, automate precision irrigation, and receive agronomic insights from anywhere in the world.

3-Tier Hierarchy: Project → Device → Sensors

SmartFarm organizes hardware and agronomic telemetry around three decoupled layers:

TIER 1
Project (Tenant)

Top-level administrative boundary encapsulating farm parameters.

  • County, Sub-County, Ward
  • Point GPS Coordinates
  • Crop & Soil Profiles
  • Cryptographic API Key
TIER 2
Hardware Devices

IoT controllers executing field operations and transmitting telemetry.

  • 1 Master Controller Invariant
  • Multiple Slave / Sensor Nodes
  • Battery & Solar Power Profiles
  • RSSI Radio Signal Link
TIER 3
Sensors & Actuators

Direct environmental sensing & physical water delivery.

  • 8 Live Sensor Streams
  • Soil Moisture, DHT, NPK, pH
  • KUA Solenoid Valves (V1..V4)
  • Water Pumps (P1..P2)
4-Step Onboarding Roadmap
1
Create Account & Enable MFA

Register your account, verify your email, and enable Two-Factor Authentication (App Authenticator TOTP or Email OTP) for bank-grade farm security.

2
Create a Farm Project

Open Projects & Access → Create Project. Enter project name, choose agronomic crop/soil settings, and set location coordinates (County, Sub-County, Ward, and GPS Pin).

3
Register & Link Devices

Go to Devices → Register Device to register your Master Controller and sensor nodes. Then connect them to your project via Connected Devices.

4
Monitor Telemetry & Configure Control

View real-time incoming sensor streams on your Project Control dashboard, set threshold alerts (SMS/Email/WhatsApp), and program irrigation routines.

2. User Roles & Access Control (RBAC)

Access Control Matrix

SmartFarm enforces strict multi-tenant Role-Based Access Control (RBAC) to ensure that operators, managers, and stakeholders have precisely the permissions they need without risking unintended field changes.

Role Capability Matrix
Platform Capability SuperAdmin Project Owner Project Admin Farm Manager Viewer
View Live Dashboards & Sensors
Trigger Actuators & Run Irrigation
Edit Sensor Alert Thresholds
Register & Link Hardware Devices
Invite & Revoke Team Members
Create New Projects & Rotate API Keys
Cross-Tenant System Governance & Audit Logs
Step-Up Re-Authentication Safeguard

To protect high-impact field actions, SmartFarm enforces Step-Up Re-Authentication. When executing destructive or critical operations (such as rotating project API keys, deleting projects, or emergency pump overrides), the system prompts for your account password or MFA token to establish an elevated 15-minute secure session.

3. Project & Location Configuration

3-Step Creation Wizard

A Project is the parent boundary for all farm operations. Setting up a project properly enables automated regional weather forecasting, geo-specific crop suitability, and tailored irrigation schedules.

3-Step Create Project Wizard
1 Step 1: Information, Agronomy & Location
  • Project Name & Description: Distinct title (e.g. Greenhouse Block 2).
  • Project Type: Choose between Crops Project (select Crop Type, Soil Type, Annual Rainfall) or Others (livestock, aquaculture, nursery).
  • Geographic Location & Map Pin: Select your Kenyan County, Sub-County, and Ward. You can also click Detect My Current Location to automatically pinpoint GPS coordinates and place the interactive map marker.
2 Step 2: Alert & Notification Configuration
  • Alerting Status: Active (enables automated threshold notifications) or Inactive (mutes alerts during maintenance).
  • Delivery Channel: Select SMS, Email, or Both (SMS & Email).
  • Contact Routing: Use default account details or toggle Use custom notification details to route emergency alerts to on-site farm managers.
3 Step 3: Review & Instant Deployment

Review the configuration summary card. Submitting the wizard generates your cryptographic project API key, creates a MongoDB Point coordinate geometry index, and redirects you to the My Projects dashboard.

Zero-Downtime API Key Rotation

When rotating your project API key, SmartFarm implements an automatic grace period window (api_key_grace_until). During this window, your field devices can continue transmitting using their existing key while technicians update firmware, preventing packet dropouts.

4. Device Registry, Power Profiles & Signal Quality

Hardware Hierarchy

Learn how hardware devices interact under the SmartFarm network, how power subsystems are monitored, and how to interpret signal strength in the field.

Invariant: Exactly One Master Controller Per Project
Critical Architectural Rule: Each farm project can have at most one Master Controller device. Multiple Slave Controllers and Sensor Nodes may be connected to the same project alongside the single Master.

The Master Controller is the sole hardware authority responsible for hydraulic valve station sequencing and pump relay actuation. Connecting a second Master Controller to a project is automatically blocked by the platform to avoid actuation race conditions.

Power Profile & RSSI Signal Monitoring

On every Device Manage page (/device-control/:deviceId), the platform provides real-time health diagnostics:

Battery Profile
  • Real-time voltage (e.g. 12.6 V) and state of charge (%).
  • Automatic charging state inference: Displays CHARGING when solar generation is detected, and NOT CHARGING during night cycles.
Solar Panel Profile
  • Solar array voltage output (V).
  • Live Weather Sky Status: Fetches live sky conditions (e.g. Sunny, Scattered Clouds, Light Rain) from the connected project's weather API. Unconnected devices display UNASSIGNED / NO PROJECT.
RSSI Signal Strength Benchmark Scale
RSSI Range (dBm) Quality Level Field Action Recommendation
≥ -65 dBm Excellent Optimal link margin; rapid telemetry delivery.
-66 to -75 dBm Good Stable connection for all field operations.
-76 to -85 dBm Fair Occasional packet re-transmission; consider elevating antenna.
< -85 dBm Poor / Critical High packet loss risk; install directional high-gain antenna or repeater.

5. Telemetry Ingestion, Widgets & Alert Rules

Sensors & Alerts

SmartFarm provides high-throughput telemetry ingestion supporting 8 key agronomic parameters, complete with newest-first tabular streams and anti-fatigue alert suppression.

8 Agronomic Sensor Data Streams
Soil Moisture
0 - 100% Volumetric
DHT Temp
-40°C to 80°C
DHT Humidity
0 - 100% Relative
Soil pH
3.0 - 9.5 Acidity
NPK Nutrient
N, P, K in mg/kg
TDS Quality
0 - 2000 ppm
Ambient Light
0 - 65,535 Lux
Power Monitor
Battery & Solar
Threshold Alerts & 5-Hour Anti-Flooding Suppression

Farmers can set custom safe limits (e.g. Soil Moisture must stay between 40% and 80%). When readings cross these boundaries, automated alerts are dispatched via Email, SMS (via Africa's Talking), and WhatsApp.

5-Hour Suppression Algorithm: Once an alert is sent for a specific parameter breach, subsequent duplicate notifications for that parameter are suppressed for 5 hours. This prevents inbox flooding and high SMS costs while continuing to record all raw telemetry in MongoDB.

6. Smart Irrigation & KUA Actuator State Machine

Hydraulic Safety Engine

Irrigating at scale requires hydraulic discipline. Raw toggle switches risk water hammer, burst pipes, and burnt-out pumps. SmartFarm implements the KUA Staged Actuation State Machine.

Deterministic KUA Staged Actuation
valve_open → [5s delay] → pump_start → running → pump_stop → [10s delay] → valve_close → complete
  • Valve Open First: The target solenoid valve opens and confirms state before the pump is energized. This prevents pump cavitation and pressure buildup against a closed valve.
  • Pump Stop First: When stopping or pausing, the pump stops first. The valve remains open for a 10-second dissipation delay to relieve pipeline line pressure before closing.
Run Modes, Cycle-and-Soak & Smart Weather Skip
Quick Run

Instant manual burst (e.g. 5–15 mins) across all stations or selected zones with countdown timers.

Cycle-and-Soak

Divides watering into repeated micro-bursts (e.g. 5 min water / 5 min soak × 2) to eliminate surface runoff and penetrate heavy clay soils.

Smart Rain Delay

Automatically skips scheduled irrigation if OpenWeatherMap forecasts rain or live soil moisture exceeds target threshold.

7. AI Agronomy Advisor & Standalone Weather Station

AI & Meteorology

Leverage local agro-meteorological intelligence and machine-learning models to optimize crop yields and reduce resource waste.

AI Farm Advisor Modules
Crop Suitability Matrix

Evaluates your project's soil pH, historical moisture levels, ambient temperatures, and annual rainfall to recommend optimal commercial crops.

Irrigation Advisory

Calculates precise evapotranspiration (ET) crop water demands based on growth stages (vegetative, flowering, fruiting).

Soil Nutrition Balancing

Interprets NPK readings to advise on targeted organic amendments, urea, or NPK blends, avoiding fertilizer burn.

6-Day Regional Forecast

View localized 6-day weather forecasts on /weather with rainfall probabilities, wind speed, and humidity predictions.

8. Developer REST API & MQTT Protocol

Integration Guide

Integrate external hardware kits, custom gateways, or ERP dashboards using our authenticated REST endpoints and Buni v1 MQTT bridge.

API Authentication Headers

Every REST API request must supply your project API key:

Authorization: Bearer <YOUR_PROJECT_API_KEY> X-Project-ID: <YOUR_NUMERIC_PROJECT_ID> Content-Type: application/json
Primary Telemetry & Actuation Endpoints
1. Telemetry Ingestion (Multi-Sensor Uplink)
POST /api/multisensor-data-save { "v": 1, "api_key": "YOUR_PROJECT_KEY", "device_id": "115057", "source": "SN-Device002", "boot": 14, "seq": 1042, "rssi": -68, "battery_voltage": 12.6, "battery_level": 88, "solar_voltage": 18.2, "temperature": 25.5, "humidity": 70.2, "soil_moisture": 79.4, "soil_ph": 6.5, "npk_n": 42, "npk_p": 28, "npk_k": 55 }
2. Actuation Control (KUA Start / Stop / Quick Run)
POST /api/devices/:deviceId/control { "action": "START", "run_mode": "quick_run", "station_id": "stn_01", "runtime_minutes": 10 }

9. Hardware Setup, Wiring & Field Pinouts

ESP32 Hardware

Official wiring standard for deploying ESP32 DevKit v1 Master Controllers and Sensor Nodes in agricultural environments.

ESP32 GPIO Pinout Table
Peripheral / Sensor ESP32 GPIO Pin Interface Type Operating Voltage
DHT22 (Temp & Humidity) GPIO 4 1-Wire Digital (4.7kΩ Pullup) 3.3V / 5V DC
Capacitive Soil Moisture v1.2 GPIO 34 (ADC1_CH6) Analog Input 3.3V DC
RS485 NPK Sensor (MAX485) TX: GPIO 17, RX: GPIO 16 UART2 Modbus RTU 5V DC (Sensor 9-24V DC)
Relay 1 (Solenoid Valve V1) GPIO 26 Digital Output (Optoisolated) 5V Logic (12V Switched)
Relay 2 (Water Pump P1) GPIO 27 Digital Output (Optoisolated) 5V Logic (12V/240V Switched)
Battery Voltage Divider GPIO 35 (ADC1_CH7) Analog (100kΩ / 20kΩ Divider) 0 - 3.3V Range

10. Troubleshooting, FAQs & Offline USSD

Field Support

Step-by-step diagnostic procedures for field recovery and basic phone offline operations.

Offline USSD Quick Access (*384#)

Farmers in remote areas with poor or zero internet connectivity can operate SmartFarm using any basic GSM feature phone by dialing *384#:

  1. Dial *384# from your registered farm telephone number.
  2. Select 1. Soil Moisture Status to receive live root-zone percentage via flash SMS.
  3. Select 2. Manual Irrigation Run to choose Station 1 or 2 and trigger a 10-minute watering burst.
  4. Select 3. Emergency Stop to sequentially shut down active pumps and valves.

Check that the battery voltage is above 11.5V. Verify that your local Wi-Fi or GSM SIM has active data. If the signal is below -85 dBm, elevate the antenna above the crop canopy.

Inspect the capacitive sensor wiring. Ensure the sensor is inserted firmly into root-zone soil without air pockets. If raw ADC limits shifted due to soil salinity, recalibrate wet/dry limits under project settings.

Under the KUA state machine, the pump will only energize 5 seconds after the solenoid valve successfully opens. Ensure the valve relay triggers first and verify that your user account has manager or higher role permissions.
SmartFarm AI Assistant
Hello! I am your SmartFarm AI Advisory Assistant. 👋

I can help you with:
  • Smart Crop Advisory
  • Sensor Anomaly Detection
  • Farm Queries
  • Disease Detection Logic

How can I assist you today? Just now