Inspiration

It breaks your heart when you sit down with a farmer who has just lost their entire tapioca crop overnight. In places like Kerala, India, the wild boar population has exploded by over 40% in recent years. These highly adaptable animals cause severe agricultural devastation, with some farmers facing daily economic losses of Rs 150—often with no functional compensation system to fall back on.

Worse than the economic toll is the physical danger. Wild boars are responsible for sudden, unprovoked attacks on humans outside of forested areas. Traditional solutions are either too blunt, like lethal poison baits that destroy the ecosystem, or dangerous and expensive, like electric fences that can harm innocent people and livestock. We felt immense sympathy for these farming communities fighting a losing battle, and we realized we could use modern TinyML and extreme edge computing to build a humane, targeted, and autonomous shield.

What it does

Varaha AI is a targeted, non-lethal, and human-safe agricultural protection system. It operates completely off the grid without cellular infrastructure or cloud connectivity.

When the field node's camera spots a wild boar, it triggers a custom-built 35 kHz analog ultrasonic sweep. While humans cannot hear above 20 kHz, boars have a much higher auditory range. This silent alarm causes acute auditory discomfort, driving the boars away from the crops without disturbing the farmers or local wildlife. Simultaneously, the system fires off a raw P2P LoRa telemetry packet to a Base Station up to several kilometers away, alerting the farmer via a TFT UI Dashboard.

High Level Architecture

How we built it (Meeting the Arm Optimization Requirements)

Machine Learning Pipeline

From day one, we knew that to deploy this in a field on battery power indefinitely, we had to ruthlessly optimize our machine learning pipeline for the Arm Cortex-M55 and the Arm Ethos-U55 NPU. This project wasn't just about training a model; it was about squeezing every drop of efficiency out of the Arm architecture.

We went through a rigorous, three-tier optimization journey to meet the challenge's strict optimization requirements:

  1. Model 1 (Edge Impulse FOMO): We started with a centroid-detection architecture. It was fast, but the 14.1% recall rate was far too low to rely on for crop protection.
  2. Model 2 (Standard Edge Impulse YOLO): We escalated to a Bounding Box YOLO model. Accuracy shot up, but we faced significant CPU fallbacks. The Ethos-U55 was constantly handing operations back to the Cortex-M55, creating latency bottlenecks and draining power.
  3. Model 3 (Swift-YOLO via SSCMA): This was our breakthrough. We trained a custom Swift-YOLO architecture, quantized it to INT8, and aggressively compiled it using the Arm Vela toolchain.

Comprehensive 3-Model Benchmark Comparison

Metric / Parameter Model 1: Edge Impulse FOMO Model 2: Edge Impulse YOLO Model 3: Swift-YOLO (SSCMA — Production)
Pipeline / Framework Edge Impulse Edge Impulse Google Colab / SSCMA (ModelAssistant)
Detection Task Type Centroid / Point Detection Bounding Box Detection Bounding Box Detection
Input Resolution 96 × 96 160 × 160 192 × 192
Quantization Precision INT8 INT8 INT8
Model Size on Disk/Flash 30.00 KiB 608.00 KiB 1024.70 KiB (1.00 MB)
mAP@50 (IoU=0.50) N/A (Centroid Model) 77.4% 70.2%
mAP@50:95 (Overall mAP) N/A (Centroid Model) 41.9% 37.7%
Precision 45.3% ~51.6% 68.4%
Recall (Overall) 14.1% 49.4% 54.9%
F1-Score 21.5% ~50.5% 60.9%
NPU Offload Rate Unverified (Partial CPU) Unverified (Partial CPU) 100.0% (175 / 175 Operators)
CPU Fallback Rate High Moderate 0.0% (0 Operators)
SRAM Footprint Unknown Unknown 198.00 KiB
Compute Workload ~30 M MACs ~90 M MACs 123.6 M MACs / inference
Target Arm Hardware Arm Ethos-U55 / Cortex-M55 Arm Ethos-U55 / Cortex-M55 Arm Ethos-U55 NPU (500 MHz, 64 MACs/cycle)

The Optimization Victory: We hit the physical limits of the hardware and won. We successfully shrunk our active memory footprint to an incredible 198 KiB of SRAM. The model utilizes 123.6 M MACs per inference while maintaining a highly robust mAP@50 of 70.2% and a recall of 54.9%. More importantly, the Vela compilation resulted in 100% NPU offload (175 out of 175 operators executing natively on the Ethos-U55) with zero CPU fallbacks. We achieved sub-10ms inference times at the far edge.

Swift-YOLO Detection Output

The Hardware Stack

We didn't just build a software model; we closed the loop with physical hardware.

Final Hardware Setup

  • Vision AI: Grove Vision AI V2 (WiseEye2 HX6538) housing the Arm Cortex-M55 and Ethos-U55.
  • Logic Controllers: XIAO ESP32-S3 (Field) and XIAO ESP32-C6 (Base).
  • Telemetry: Grove Wio-E5 transmitting raw P2P LoRa packets (866 MHz, SF12) bypassing LoRaWAN overhead.
  • Custom Analog Deterrent: We engineered a custom 35kHz ultrasonic circuit using a CD4060B binary counter, a TL072 op-amp, an LM13700 OTA, and a power MOSFET to drive a piezoelectric transducer.

Analog Breadboard Prototype

  • Enclosure: A custom 3D-printed weather-resistant case (HogWatch_Case_v2.stl).

Challenges we ran into

The biggest challenge was overcoming the dreaded "CPU fallback" during NPU inference. Standard YOLO operations contain layers that micro-NPUs often don't support, forcing the microcontroller's CPU to wake up and process the math. Diagnosing this required deep-diving into the Vela compiler logs to identify the unsupported operators. We had to specifically swap to the Swift-YOLO architecture to ensure the model graph was 100% compatible with the Ethos-U55 instruction set.

Before we could even begin training that Swift-YOLO model, however, we faced a massive hurdle with the toolchain. The original SSCMA (Seeed Studio ModelAssistant) Google Colab notebook was outdated and riddled with dependency errors, broken links, and package conflicts. We had to spend significant time untangling these python dependency chains, fixing versioning issues, and effectively rebuilding the Colab training environment from scratch just to get the pipeline operational.

Additionally, designing the analog ultrasonic circuit required precise tuning. Generating a stable 35 kHz sweep at 14.8V from a 3.3V logic trigger required balancing a boost inductor with an OTA (Operational Transconductance Amplifier) to prevent the piezoelectric transducer from burning out.

Accomplishments that we're proud of

We are incredibly proud of achieving the 100% Arm Ethos-U55 execution rate. Seeing the Vela logs confirm 0 CPU operators was a massive win for the team. We are also deeply proud that we have engineered a system that doesn't just look good in a Jupyter Notebook, but physically exists in the real world to solve a devastating humanitarian and agricultural crisis ethically.

What we learned

We learned that model size on disk isn't everything—SRAM footprint and operator compatibility dictate the true viability of TinyML at the edge. We gained deep, practical experience working with the Arm Vela compiler and learned how to bridge the gap between cutting-edge digital AI inference and raw analog hardware engineering.

What's next for Varaha AI

The immediate next step is field-testing the 3D-printed nodes across multiple farms in Kerala to gather empirical data on the long-term effectiveness of the 35 kHz deterrence pattern. We also plan to expand the LoRa P2P architecture into a full, self-healing mesh network, allowing dozens of autonomous nodes to cover massive industrial plantations seamlessly.

Built With

  • arduino
  • arm-cortex-m55
  • arm-ethos-u55
  • arm-virtual-hardware
  • c++
  • computer-vision
  • edge-ai
  • edge-impulse
  • esp32-c6
  • esp32-s3
  • grove-vision-ai-v2
  • int8-quantization
  • iot
  • lora
  • machine-learning
  • mesh-network
  • python
  • seeed-studio
  • swift-yolo
  • tensorflow-lite-micro
  • vela-compiler
  • wio-terminal
Share this project:

Updates

Submission history