Rewiring the Thai Smart Farm: From Basic Relays to Edge AI Inference
Upgrade your farm's IoT from simple IF/THEN automation to Edge AI processing that runs locally — reducing cloud costs and adding intelligence to your Smart Farm.

Thai agriculture in 2026 is entering an era where IoT doesn’t just send data to the cloud and wait for commands — it must be able to think, analyze, and decide on the device installed right in the farm. This article explains why “Edge AI Inference” is the key to next-generation Smart Farms and how to upgrade your existing system.
The Limitation of Rule-Based IoT (IF/THEN)
Traditional Smart Farm systems operate on a reactive basis — wait for a condition, then respond. Common examples:
- IF soil moisture < 30% → THEN turn on Relay 1 (water pump)
- IF temperature > 35°C → THEN turn on Relay 2 (fan)
- IF air humidity < 60% → THEN turn on Relay 3 (mist)
What’s wrong with this approach?
- Resource waste — watering when rain is expected in 2 hours
- No context understanding — the system doesn’t know what this crop needs at this growth stage
- Cloud lag — data goes to the cloud, gets computed, then sent back; slow internet means slow response
- High cloud costs — the bigger the farm and the more sensors, the more expensive API calls and storage become
“Rule-based automation is telling a machine to follow human-set rules. Edge AI is letting the machine learn what to do in complex environmental conditions.” — KoMoMi Engineering Team
What is Edge AI and Why It Fits Thai Farms
Edge AI means doing AI inference (the “thinking” part after training) on the device near the data source — without sending data to the cloud.
Recommended Hardware Setup for Thai Farms
For farms upgrading from ESP32 sensor networks, we recommend adding an Edge AI Gateway:
| Device | Role | Approx. Price |
|---|---|---|
| Raspberry Pi 5 (8GB RAM) | Main processor, runs OS and FastAPI backend | ~฿4,500 |
| AI HAT+ (Hailo-8L NPU) | Accelerates AI inference (13 TOPS) | ~฿3,500 |
| ESP32-S3 (6–8 units) | Sensor nodes for soil, temperature, humidity, light | ~฿1,500 |
| Raspberry Pi Camera Module 3 | Computer vision for crop and pest monitoring | ~฿1,800 |
Starter kit total: ~฿11,300 (excluding sensor modules) — cheaper than several months of cloud costs.
Why Hailo-8L NPU?
- Energy efficient: Only 2.5W during inference — works with solar panel + LiFePO4 battery
- Fast: YOLO11 runs at ~30 FPS on Hailo-8L vs. ~1-2 FPS on Pi CPU alone
- Quantized model support: INT8 quantization reduces model size 4× with minimal accuracy loss
Computer Vision for Real-Time Crop Monitoring
This is where Edge AI changes the game: it’s not just soil sensors anymore, but cameras that see and understand what the crop looks like.
Use Case 1: Pest Detection
Using YOLO11 (Quantized, INT8) on Hailo-8L, the system can detect:
- Whiteflies — tiny white spots on leaves
- Caterpillars — shape and leaf damage patterns
- Mealybugs — white clusters on stems and undersides of leaves
Result: Instant alerts via Line Notify or MQTT → ThingsBoard dashboard with location coordinates.
Use Case 2: Crop Readiness Assessment
By training models on image datasets of mangoes, durian, or mangosteen, the system can:
- Identify skin color maturity index
- Estimate fruit size from images (Object Detection + Size Estimation)
- Count fruits per tree for yield prediction
Use Case 3: Leaf Health Classification
Using MobileNetV3 (classification) instead of YOLO (detection) to distinguish:
- Healthy leaves
- Yellow leaves (nitrogen deficiency)
- Brown-spotted leaves (fungal infection)
- Curled/wilted leaves (water stress)
Self-Hosted System Architecture
Here’s the architecture KoMoMi recommends for a complete Edge AI farm:
Why Process at the Edge?
| Scenario | Rule-Based IoT | Edge AI |
|---|---|---|
| Many sensors | Cloud costs skyrocket | Process on-farm, send only summaries |
| Internet down/slow | System breaks entirely | Continues working (offline-first) |
| Latency | 2-5 seconds | <100ms |
| Sensitive data | Everything sent to cloud | Data stays on-farm |
| AI inference | Not possible | Runs right on the farm |
Open-Source Stack
| Layer | Technology | License |
|---|---|---|
| Sensor MCU | ESP-IDF / Arduino | Free |
| MQTT Broker | Mosquitto | EPL/EDL |
| Backend API | FastAPI + Uvicorn | MIT |
| AI Runtime | Hailo TAPPAS / HailoRT | Hailo (Free for dev) |
| Vision Model | YOLO11 (Ultralytics) | AGPL/Commercial |
| Classification | MobileNetV3 (PyTorch) | BSD |
| Dashboard | ThingsBoard CE / Blynk | Apache 2.0 / Proprietary |
| Visualization | Apache Superset (self-hosted) | Apache 2.0 |
Quick-Start: POC in 3 Days
Day 1 — Hardware Setup
- Flash Raspberry Pi OS (64-bit) to Pi 5
- Install Hailo driver and TAPPAS SDK
- Flash ESP32 with MQTT publisher firmware (ArduinoJson + PubSubClient)
Day 2 — Build AI Pipeline
- Train YOLO11n on your crop leaf image dataset (use Roboflow)
- Export to ONNX → Hailo Model Zoo
- Compile to HEF file for Hailo-8L
Day 3 — Web Dashboard
- Set up FastAPI + Mosquitto on Pi 5
- Create WebSocket endpoint for real-time frontend data
- Or use ThingsBoard CE with direct MQTT subscription
What KoMoMi provides:
- Hardware bundle ready to install: Pi 5 + Hailo HAT+ + Camera + ESP32 sensors
- Pre-trained models for major Thai crops (durian, mango, mangosteen, longan)
- FastAPI backend + ThingsBoard integration pre-configured
- Training pipeline for farms that want custom models
Edge AI is no longer out of reach — with declining hardware costs and a mature ecosystem, medium-sized Thai farms can now have AI running on-site. If you’re interested in upgrading your existing system or building a new Edge AI farm, contact KoMoMi today.
