惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
M
MIT News - Artificial intelligence
MyScale Blog
MyScale Blog
博客园_首页
G
Google Developers Blog
博客园 - 【当耐特】
美团技术团队
博客园 - 聂微东
Stack Overflow Blog
Stack Overflow Blog
Vercel News
Vercel News
小众软件
小众软件
博客园 - 司徒正美
雷峰网
雷峰网
T
Tailwind CSS Blog
V
V2EX
博客园 - 三生石上(FineUI控件)
F
Fortinet All Blogs
罗磊的独立博客
量子位
P
Proofpoint News Feed
Microsoft Azure Blog
Microsoft Azure Blog
月光博客
月光博客
A
About on SuperTechFans
Hugging Face - Blog
Hugging Face - Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Everyone's Talking About Bigger AI Models. I Built a Gemm...
Sreejit Prad · 2026-05-18 · via DEV Community

This is a submission for the Gemma 4 Challenge: Build with Gemma 4

Google's AI story is usually told from the top of the stack.

Bigger models. Better reasoning. More multimodal demos. More cloud endpoints.

That is useful. But there is a different question that kept nagging at me:

What happens when the person who needs the AI is not sitting in a perfect cloud environment? What happens when they are on a farm, the internet is weak, the data is local, and the decision is not abstract at all?

That is why I built SoilSense AI.


What I Built

SoilSense AI is an offline-first farm intelligence app powered by Gemma 4. It runs on a PC, phone, tablet, or Raspberry Pi hub. It connects farm profiles, live soil sensor readings, plant analysis, chat history, and local memory into one app — and it works without a cloud account.

The core problem it solves: most AI agriculture demos skip the boring part. They show a nice chat box, the farmer asks a question, the model gives a confident answer. But real farms are not a single prompt.

A farmer may have one field for vegetables, another for flowers, another for fruit. Each has different crops, soil conditions, irrigation patterns, and disease risks. If those readings get mixed together, the AI advice becomes worse than useless. It becomes confidently wrong.

There is also the connectivity problem. A system that only works when the cloud is reachable is not good enough for many rural environments.

So SoilSense is built on a different assumption: the farm is the source of truth. Gemma 4 is the reasoning layer.

What the app includes:

  • Multi-farm profiles — fruit farms, flower farms, vegetable farms, greenhouses, and field zones
  • Farm-scoped sensor feeds, so each farm only sees its own pH, moisture, temperature, and NPK readings
  • A local bridge that receives sensor packets over HTTP, stores readings locally, and streams live updates over WebSocket
  • Gemma 4 analysis that receives the active farm profile, current sensor snapshot, sensor freshness, node identity, prior verdicts, chat memory, and an optional plant image
  • Persistent local memory — analyses and chats are stored per farm, not lost after one session
  • Three deployment paths: API mode (internet), phone-local Gemma (supported Android devices), or a PC/Pi hub over LAN
  • Judge Mode for reproducible demos when physical hardware is not available

The important part is not just that Gemma answers farm questions. It is that Gemma answers with the farm's context already in front of it.


Demo

Demo video: https://youtu.be/EJ6397EinNw?si=a9Ei3Fxmsh_UHHjV

GitHub: https://github.com/ogMaverick12/soilsense-ai/tree/beta

The demo flow:

  1. First launch and farm profile setup
  2. Gemma setup — API, phone-local, or PC/Pi hub
  3. Sensor pairing via QR payload
  4. Judge Mode replay — 9 sensor packets across 3 farms
  5. Switching between fruit, flower, and vegetable farms while watching sensor readings change
  6. Running Gemma 4 analysis using live farm context
  7. Viewing saved history and local memory
  8. About, Terms & Conditions, and Gemma 4 Hackathon links in the app footer

One honest note: I do not currently have physical sensor hardware connected for the submission demo. The demo uses Judge Mode — it replays sensor packets through the same local bridge endpoints that real ESP32 and Raspberry Pi nodes use. It proves the ingestion and routing pipeline, but it is replayed data, not live hardware.


Code

Repository:

Tech stack:

  • React + Vite for the UI
  • Express local bridge (bridge/server.mjs)
  • WebSocket for live sensor streaming
  • Farm-scoped HTTP sensor API with farmId and sensorNodeId on every reading
  • QR pairing payloads for hardware sensor nodes
  • Electron for Windows desktop packaging
  • Capacitor for Android wrapping
  • Ollama/OpenAI-compatible local bridge for Gemma-family models

The project structure keeps concerns clean: src/ has the React app and app logic, bridge/ has the local hub, desktop/ has the Electron shell, android/ has the Capacitor project, and scripts/ has Pi and Windows launchers. Docs cover setup, mobile deployment, Raspberry Pi use, sensor integration, and packaging.


How I Used Gemma 4

SoilSense is intentionally Gemma-only. The UI and local bridge both reject non-Gemma model tags. That matters because I did not want the submission to quietly become a generic model-switcher wrapper. The point is to show Gemma 4 as the reasoning engine for a local-first farm workflow, not as one option among many.

Model strategy is hardware-aware:

  • gemma4:e2b — preferred for Raspberry Pi and weak edge devices
  • gemma4:e4b — the balanced local desktop path (detected and tested on my machine through Ollama)
  • google/gemma-4-31b-it — the API path for stronger disease reasoning when internet is available
  • Phone-local Android mode — available on devices that support the Google on-device GenAI runtime; unsupported phones are guided toward PC/Pi hub mode

For analysis, Gemma receives structured context:

  • Active farm profile and crop selection
  • Current sensor snapshot (pH, moisture, temperature, N/P/K)
  • Sensor freshness and latency
  • Sensor node identity
  • Previous analysis history
  • Recent chat memory
  • Optional plant image

The output is also structured. SoilSense prompts Gemma for a JSON response covering health status, primary issue, urgency, confidence, disease evidence, soil interpretation, sensor correlation, memory used, spoken alert, and next actions. That lets the UI show a practical verdict instead of dumping raw prose into a chat window.

Gemma also powers a free-form farm chat mode. Even there, the selected farm's local memory is passed as context — so chat answers are grounded in that farm's history, not a blank slate.

Local evidence from my test machine (Windows x64, 8 CPU threads, 15.8 GB RAM, gemma4:e4b via Ollama):

Capability Result Honesty note
TypeScript check Passed (npm run typecheck) Static check only, not a full end-to-end test
Production build Passed (npm run build) dist/ is generated output, not committed
Windows installer Built (SoilSense AI Setup 0.1.0.exe) Attached to GitHub Releases, not the repo
Android debug APK Built via Capacitor + Gradle Debug build unless signed release is created
Setup health endpoint Passed: app, LAN, sensor, node, and model checks Depends on local machine and network
Judge Mode replay Accepted 9 packets across 3 farms Replayed packets, not physical hardware
Farm-scoped sensor route Returned orchard readings for judge-fruit-orchard Proves routing by farmId through the bridge
Local Gemma detection Detected gemma4:e4b through Ollama Recommendation changes by hardware and installed models
Local Gemma smoke test Returned a response in ~70 seconds Latency depends heavily on hardware and model warm state

That last number is not a universal benchmark. Local inference speed depends on hardware, model size, and warm state. But it proves the local path is wired end to end on my machine.


Where I Would Push Back On My Own Project

SoilSense does not prove field-grade sensor calibration. Low-cost pH and NPK sensors can be noisy. A real deployment needs calibration records, placement guidance, and local agronomy validation.

It does not prove every Android phone can run local Gemma. Phone-local support depends on the Android on-device GenAI runtime and device capability — which is exactly why the PC/Pi hub mode exists as the fallback.

It is also not a replacement for local experts, lab tests, pesticide labels, or official agricultural guidance. SoilSense is decision support. It is not a magic agronomist in a box.

I think that honesty makes the project stronger. The architecture is built for the real constraint: use local data, keep the farmer in control, and let Gemma reason over context instead of isolated prompts.


Final Take

The most exciting AI apps are not always the ones with the largest model call.

Sometimes the real product is the boring glue around the model — local data, memory, sensor routing, setup flows, privacy boundaries, and a UI that someone can actually use on a farm with weak internet.

That is what SoilSense AI is trying to be.

Not just "Gemma, answer a farm question."

Gemma 4 with the farm profile, the sensor feed, the history, the crop, and the constraints in front of it.

That is the difference between a chatbot and a tool. And for farmers working with local hardware and unreliable connectivity, that difference matters.

Repo: https://github.com/ogMaverick12/soilsense-ai