FarmAssist: Free AI Crop Doctor for Smallholder Farmers
by Anuraaag in Circuits > Computers
94 Views, 1 Favorites, 0 Comments
FarmAssist: Free AI Crop Doctor for Smallholder Farmers
The Problem
800 million people go hungry every year. One major reason: crop diseases that farmers can't identify in time.
This project grew out of conversations about why crop disease diagnosis is so inaccessible for the people who need it most. In India alone, over 100 million smallholder farmers lose up to 40% of their harvest annually to preventable crop diseases. The solution — an agronomist — costs money most of them simply don't have. A single farm visit can cost more than a week's income.
The Solution
FarmAssist puts a free crop doctor in every farmer's pocket. Take a photo of a diseased crop leaf. In seconds, get a diagnosis: what disease it is, how severe, and exactly how to treat it — with both organic and chemical options.
Free. Forever. No app store. Works on any smartphone.
This is AI being used the way it should be — not for entertainment, but to protect livelihoods and feed people.
How It Contributes to a Better World
- Reduces crop loss → more food, less hunger
- Protects farmer income → less rural poverty
- Democratizes expert knowledge → accessible to anyone with a smartphone
- Reduces unnecessary pesticide use → healthier soil and environment
Live app: FarmAssist Live
Watch it in action: Project Video
Source code: Github Repo
Future hardware design: Tinkercad Design
Supplies
- Computer with Node.js 18+
- Groq account (free AI API) — https://console.groq.com
- GitHub account — https://github.com
- Vercel account (free frontend hosting) — https://vercel.com
- Railway account (free backend hosting) — https://railway.app
- Any smartphone (Android gets full install experience; iPhone works via Safari)
- Autodesk Tinkercad (free, browser-based) — https://tinkercad.com
Total Monthly Cost: $0
Get Your Free AI Key
The app uses Groq's free AI API to analyze crop photos. No credit card required.
- Go to console.groq.com and sign up with your Google account
- Click API Keys in the left sidebar
- Click Create API Key, give it a name like "FarmAssist"
- Copy the key — it starts with gsk_...
- Keep it safe, you'll need it in Step 3
Groq gives you 1,500 free image analyses per day — enough for an entire farming village.
Get the Code
The full source code is on GitHub. Open a terminal and run:
The project has two folders:
- backend/ — Node.js + Express API server
- frontend/ — Angular PWA (Progressive Web App)
Set Up the Backend
Set Up the Backend
Navigate into the backend folder and create your environment file:
Open the .env file and paste your Groq API key:
Then install dependencies and start the server:
You should see: FarmAssist backend running on http://localhost:3000
Set Up the Frontend
Open a new terminal window and run:
Open http://localhost:4200 in your browser. You should see the FarmAssist app running locally.
Test It Locally
- Click the camera/upload box
- Select a photo of a crop leaf — or search Google Images for "tomato leaf blight" and save one
- Click Diagnose
Within a few seconds you'll see:
- Disease name — red if diseased, green if healthy
- Confidence badge — High / Medium / Low
- Severity badge — None / Early / Moderate / Severe
- Organic treatment — uses locally available material
- Chemical treatment — generic compound names any agri shop will stock
- Isolate plant warning when the disease can spread
Result: Here are two real diagnoses (refer attached screenshots) FarmAssist performed during testing, one diseased leaf, and one healthy. The AI correctly identified iron deficiency Chlorosis with high confidence and provided specific organic and chemical treatment options.
Deploy the Backend (Railway)
- Go to railway.app and sign up with GitHub
- Click New Project → Deploy from GitHub
- Select your forked repo
- Set Root Directory to backend
- Set Build command: npm install && npm run build
- Set Start command: npm start
- Go to Variables and add:
- GROQ_API_KEY = your Groq key
- PORT = 8080
- Go to Settings → Networking → Generate Domain
- Copy the URL — you'll need it in Step 7
Deploy the Frontend (Vercel)
- Open frontend/src/environments/environment.prod.ts and replace the apiUrl with your Railway URL:
- Commit and push to GitHub
- Go to vercel.com → Add New Project → import your repo
- Set Root Directory to frontend
- Click Deploy — copy your Vercel URL
- Go back to Railway → Variables and add:
- FRONTEND_URL = your Vercel URL
Your app is now live at a public URL, free forever.
Install on Your Phone
FarmAssist is a Progressive Web App (PWA) — it installs directly from the browser, no app store needed.
On Android:
- Open your Vercel URL in Chrome
- Tap the banner that says "Add to Home Screen"
- The app installs like a native app
- Open it and photograph a crop leaf with your camera
On iPhone:
- Open your Vercel URL in Safari
- Tap the Share button → Add to Home Screen
Future Hardware Version — Autodesk Tinkercad Enclosure Design
FarmAssist currently runs entirely on any smartphone with zero hardware needed. But the same AI diagnosis engine could power a standalone field device -- a weatherproof sensor unit that sits between crop rows, photographs leaves on a schedule, and sends diagnosis alerts to the farmer's phone via SMS even without the farmer being present.
I designed a concept enclosure for this future version using Autodesk Tinkercad.
The design features:
- Main weatherproof housing: 120 × 80 × 50mm
- 25mm front-facing camera aperture for Raspberry Pi Camera Module v2
- Snap-fit lid for tool-free field servicing
- Four pointed soil stakes at corners for stable ground mounting
- Five rear ventilation slots to prevent heat buildup
- Four M3 screw bosses for secure lid assembly
- 3mm wall thickness throughout for outdoor durability
- Solar panel mounting channel (90 × 55mm) on the lid top
Intended internals:
- Raspberry Pi Zero 2W
- Pi Camera Module v2
- DHT22 temperature and humidity sensor
- 3.7V LiPo battery + 5V solar panel
The design is freely available on Tinkercad. Open it, remix it, and print it on any FDM printer in PLA at 0.2mm layer height, 20% gyroid infill.
Estimated filament: 180g.
Estimated cost: under Rs. 200.
Any farmer cooperative or agricultural NGO with access to a basic 3D printer could manufacture and deploy these at scale.