AI + IoT in Smart Clean Vegetable Farms — sensors, models, and the automation loop
A VietGAP-certified vegetable farm no longer means the farmer stays up monitoring soil moisture or irrigating by feel. We break down the architecture combining multi-sensor IoT, an AI vision model for early pest and disease detection, and a closed-loop control system running at the edge — plus how VietGAP traceability becomes a natural by-product of comprehensive logging.
Most certified vegetable farms today still run largely on experience: the farmer checks soil moisture by hand, reads leaf color to judge nutrition, and irrigates on a fixed schedule regardless of weather. That works — until the farm grows, or an unusual temperature spike ruins an entire bed before anyone notices. A fungal outbreak inside a humid greenhouse doesn't need many days to undo weeks of careful tending.
This post describes the architecture we are building for a specific problem: mid-size clean vegetable farms (0.5–5 ha) producing under VietGAP standards in tropical climates like the Mekong Delta. Not a complex smart-farming platform built for large agribusiness, but a system that a small team can actually operate and that delivers measurable ROI within a single growing season.
Multi-sensor network — truth comes from the soil
The starting point is reliable data from the soil and environment. For clean vegetables, the parameters that most directly drive quality and yield are:
- **Soil moisture**: capacitive sensors are affordable and accurate enough for most light soils. Place them at root depth (10–20 cm) — not at the surface, which dries fast and doesn't represent where water absorption actually happens. At least 2–3 measurement points per bed, because moisture distribution is uneven across terrain
- **EC (Electrical Conductivity)**: measures ion concentration in the soil — a direct proxy for available nutrients. Low EC means nutrient-starved plants; EC above threshold causes salt toxicity and root death. This is the most commonly skipped metric yet has the largest impact on produce quality
- **Soil pH**: determines nutrient uptake efficiency. Most leafy vegetables need pH 6.0–6.8; outside that range, even adequate fertiliser stays locked in insoluble form and the plant absorbs little of it
- **Air temperature and humidity**: critical for ventilation and shading decisions, and for predicting fungal risk. Humidity above 85% combined with 22–28°C is a high-risk zone for many common diseases
- **PAR light (Photosynthetically Active Radiation)**: necessary for greenhouse and controlled-light growing environments. Too little PAR slows growth; excessive PAR combined with high temperature causes leaf scorch
For connectivity: in open fields or dispersed bed layouts, LoRaWAN is the natural choice — solar-charged batteries, LoRa coverage up to several kilometres, data pushed to an MQTT broker every 5–15 minutes. Inside a greenhouse with a single WiFi access point, ESP32 over WiFi is simpler and cheaper. All readings land in a time-series database (TimescaleDB or InfluxDB) for history and analysis.
Camera + AI for early pest and disease detection
Soil sensors can report everything normal while the plants are already infested — that is the fundamental limit of a sensor-only system. A camera paired with a Vision-Language model (or a lighter classification model for a fixed disease set) adds a direct observation layer on leaves and stems.
Common problems detectable early from imagery: yellowing from nitrogen or iron deficiency, brown spots or soft rot from fungal infection, chewing damage signs (holes, frass on leaves), leaf curl from aphids, and water-stress symptoms (wilting, edge curling). Catching these 3–5 days before symptoms spread is the difference between localised treatment and losing an entire bed.
The model runs on an edge device (Raspberry Pi 4 or Jetson Nano with USB/CSI camera), analyses frames every few hours or during stable-light windows (typically 8–10 a.m.), and pushes only inference results to the cloud — not the raw images, reducing bandwidth and keeping farm imagery local.
As with AI Entry, a confidence score is mandatory: if the model is uncertain (confidence below threshold), only send a notification with the photo for the operator to confirm — do not let the model autonomously trigger pesticide application without human review.
Closed-loop automation — irrigation, fertigation, ventilation
Sensor data combined with AI model outputs drives a closed control loop:
- **Drip irrigation**: solenoid valves open and close on a base schedule, but are overridden by actual soil moisture readings. Skip irrigation if soil moisture is already above 70% of target, even if the timer fires. This one logic saves 30–40% water compared to fixed-schedule irrigation, and prevents waterlogging — the most common silent killer of vegetable roots
- **Fertigation (nutrient dosing)**: combines a base fertiliser schedule with live EC readings. EC below the target range → activate nutrient pump at the pre-calculated dilution rate. Target concentration is adjusted by growth stage: seedlings need lower EC (0.8–1.2 mS/cm) than mature plants (1.8–2.5 mS/cm)
- **Ventilation and cooling**: temperature above ceiling threshold → open fans. Abnormally high air humidity combined with warm temperature → raise fungal alert and increase ventilation to bring humidity down
All control logic runs at the edge to be independent of cloud connectivity. If internet drops, the farm still irrigates on the base schedule, still doses nutrients — only the AI analysis layer and remote dashboard go offline. Cloud is for long-term history storage and model updates, not a required dependency for every irrigation command.
Design principle: IoT collects truth from the soil and the plant; AI converts that truth into a decision; actuators execute; humans approve the exceptions. Without trustworthy sensor data, every AI decision is guesswork — invest in sensor quality before investing in model sophistication.
VietGAP traceability — a natural by-product of comprehensive logging
VietGAP requires complete records of seed sources, fertilisers used, any pesticide applications, and cultivation conditions. The IoT system logs all of this automatically: every irrigation event (timestamp, duration, estimated volume), every nutrient dosing run (type, EC before and after), and every sensor reading — all written to the database with timestamps and device identifiers.
The practical output: each harvested batch gets a QR code linking to a complete growing record — from seeding date to harvest, average environmental conditions per week, no days when temperature or EC exceeded abnormal thresholds. This is increasingly required by supermarket chains and export partners who want verifiable provenance, not just paperwork.
Compliance cost drops significantly: instead of filling manual logs daily, the operator only needs to record exception events (special pesticide applications, unusual manual interventions). Everything else the system already has.
Real-world challenges — not a set-and-forget solution
- **Power and connectivity in the field**: rural areas can have unstable LoRa coverage or sudden power cuts. Store-and-forward at the gateway (buffer data locally when offline, push when connectivity returns) is mandatory, not optional
- **Periodic sensor calibration**: EC and pH sensors drift over time due to electrode fouling and wear. Calibration with standard solutions every 2–4 weeks is non-negotiable. Skipping it means drifting data means wrong AI decisions
- **Variable image quality**: morning fog, harsh midday backlight, rain — all degrade images and increase false negatives. Solution: fix the capture window (8–10 a.m.), auto-reject blurry or underexposed frames, and add LED supplemental lighting for greenhouse cameras
- **Building operator trust**: forcing full automation from day one usually fails. Start in advisory mode — display AI recommendations, let the operator confirm before execution. After 2–4 weeks of consistently correct suggestions, operators naturally hand more autonomy to the system
Reference architecture and deployment cost
A system covering a 1 ha farm with full functionality includes: 6–10 soil sensor clusters (ESP32 + capacitive moisture + EC + pH), 2–3 cameras with Raspberry Pi, 1 LoRa gateway, an MQTT broker and time-series DB on a small server or cloud instance, and a mobile dashboard for the operator.
Hardware cost at this scale is manageable when choosing components appropriately rather than buying closed-platform solutions. The higher-cost part is typically field infrastructure (drip piping, solenoid valves, power cabling) — not the IoT electronics. ROI is usually clearest in water savings (30–40%), reduced losses from early disease detection, and the accelerated path to VietGAP certification.
In the IoT & Sensors layer, KonexForge applies the same multi-layer architecture — sensor network to AI edge to dashboard — similar to how we built the water quality monitoring system across 12 districts in Can Tho. Different problem, same principle: reliable data from a real environment, AI decisions at the right layer, closed loop.
Related articles
LoRaWAN, MQTT or NB-IoT: choosing the right connectivity protocol for industrial IoT
Three names that appear together in almost every IoT design discussion — but they are not three alternatives for the same job. LoRaWAN and NB-IoT are wireless radio protocols that determine range and battery life; MQTT is a messaging protocol that runs on top. Understanding which layer each solves helps avoid some expensive architectural mistakes.
Reading part of a massive point cloud file: classification, octrees, and COPC for LAS/LAZ/PTS data
A LiDAR LAS/LAZ scan of a plant or a road corridor can weigh dozens of GB and contain billions of points. Most real tasks — fetching only ground points, only one structure in an area, or a low-resolution preview — don't need the whole file. How LAS/LAZ/PTS organize classification, bounding boxes, and octrees, and how PDAL, Entwine, and COPC exploit them to load only the points you need — cutting system load and speeding up large-scale 3D processing.
KonexForge AI Core: when the AI Orchestrator becomes the central brain of your enterprise ecosystem
Not a chatbot, not an LLM wrapper — AI Core is a unified orchestration layer that connects every AI specialist, enterprise tool, and internal data source into a single automated pipeline. An 8-component architecture, local/cloud routing, and a Critic Engine are the real differentiators.