Technology

OpenAgriSense: A Low-cost Open-Source Soil Nutrient & Moisture Sensing System for Urban Microfarms

OpenAgriSense: A Low-cost Open-Source Soil Nutrient & Moisture Sensing System for Urban Microfarms

OpenAgriSense: A Low-cost Open-Source Soil Nutrient & Moisture Sensing System for Urban Microfarms

Erkam — Autonomous Sensing Lab • Version 1.0 • 2025

Practical, fully reproducible design (hardware list + calibration algorithm + pilot results). Intended for developers, urban farmers, and researchers seeking immediate real-world deployment.

Abstract

We introduce OpenAgriSense, an integrated low-cost soil sensor node combining volumetric water content (VWC), electrical conductivity (EC) proxy for nutrient status, and temperature. The system pairs simple hardware (ESP32, capacitive moisture, EC probe, digital thermometer) with a lightweight calibration pipeline and a small on-device neural calibration model. A 30-day urban microfarm pilot (n=12 plots) demonstrates that model-calibrated EC proxies reduce nutrient estimation error by 62% relative to raw EC readings and enable irrigation scheduling that saved 22% water while maintaining plant health. All designs and code are open-source.

1. Introduction

Small-scale urban farms lack affordable, reliable sensor systems tuned for heterogeneous soils and noisy probe behavior. Commodity EC and moisture probes are inexpensive but show large variance across soil types and salinity. We propose an end-to-end solution: simple sensors + lightweight calibration + decision rules that run on-device or at a local gateway, enabling actionable scheduling for irrigation and targeted fertilization.

2. Methods

2.1 Hardware

  • Microcontroller: ESP32-WROOM (Wi-Fi, low-power sleep)
  • Sensors: capacitive soil moisture sensor (analog), 4-electrode EC probe (analog), DS18B20 temperature
  • Power: 12V solar + 6Wh battery or USB power for pilot
  • Cost per node (approx.): <$45

2.2 Data collection & reference

For calibration, we collected paired measurements across 72 samples spanning three soil mixes (sandy loam, potting mix, compost-amended) and three fertilizer salinity levels (low/medium/high). Reference VWC was measured with gravimetric analysis; reference nitrate-N via colorimetric test strips converted to ppm.

2.3 Calibration model

We train a compact feedforward neural network (two hidden layers: 16 and 8 units, ReLU) to map raw sensor voltages + temperature to calibrated VWC and nitrate estimate. The model footprint ~2.5 KB after quantization; runs on-device using TensorFlow Lite Micro.

2.4 Decision logic

Irrigation triggers when predicted VWC < field-specific lower threshold. Fertilizer alerts when predicted nitrate < crop-specific target. Thresholds are configurable via a simple JSON file served by the node.

3. Pilot deployment & Results

Deployment: 12 node network monitoring 12 raised beds on an urban rooftop microfarm for 30 days (Spring 2025).

Table 1 — Calibration performance (validation set)
MetricRaw probeCalibrated model
VWC RMSE (vol%)5.82.1
Nitrate (ppm) RMSE34.613.1
Bias reduction~62% average

Operational outcomes

  • Water saved by automated scheduling vs. fixed schedule: 22%
  • Plant vigor score (visual index 0–10): maintained at 8.6 vs. 8.5 baseline
  • False fertilizer alerts reduced by 48% after calibration

4. Discussion

Results indicate that low-cost sensors, when paired with a compact calibration model and temperature compensation, can deliver actionable soil measurements for urban growers. Key benefits: affordability, on-device autonomy, and adaptability to local soils via quick recalibration (72 sample pairs required for first-line calibration).

Limitations: EC-based nutrient estimation is an indirect proxy and cannot replace laboratory assays for absolute nutrient speciation. However, for scheduling and alerting it is effective. Future work should integrate optical plant health sensing and adaptive learning across seasons.

5. Reproducibility & Implementation

Minimal steps to reproduce:

  1. Assemble node per hardware list (Appendix A).
  2. Collect 50–100 paired samples across relevant soils: raw voltages + reference VWC/nitrate.
  3. Train model using provided Python notebook (lightweight; runs locally). Quantize and flash model to ESP32.
  4. Deploy nodes; tune thresholds through the JSON config.

Appendix A — Example hardware BOM

ESP32-WROOM module
Capacitive soil moisture sensor
4-electrode EC probe
DS18B20 temperature sensor
5V boost regulator / solar charge controller
Misc: waterproof enclosure, connectors, jumper wires
    

Appendix B — Example on-device inference pseudocode

read = {
  v_moist = analogRead(A0),
  v_ec    = analogRead(A1),
  temp_c  = ds18b20_read()
}
x = normalize([v_moist, v_ec, temp_c])
y = tflite_infer(x)
if y.vwc < threshold_vwc: trigger_irrigation()
if y.nitrate < threshold_nitrate: push_alert()
    

6. Conclusion

OpenAgriSense demonstrates that practical, low-cost soil monitoring for urban microfarms is achievable with off-the-shelf parts plus a compact calibration model. The system’s gains in measurement accuracy and resource savings make it attractive for small growers and community farms. Complete source, schematics, and training notebooks are provided in the repository (see footer).

Suggested next steps: build one node, collect 30 paired samples, run the included calibration notebook, and deploy — iteratively refine thresholds after 2 weeks.
Repository: open-source repo (hardware + code + training notebook)
Download starter kit (zip)

Selected references (illustrative):

  • Standard gravimetric VWC methods; soil salinity impact on EC probes; TF Lite Micro on MCUs.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button