Public
Smart Plant Health Monitoring System - IoT Dashboard
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.

🌿 PlantCare β€” Smart Plant Health Monitoring System

A full-stack IoT-inspired smart plant health dashboard with real-time sensor monitoring, AI-based health analysis, automation controls, and trend visualization.

✨ Features

FeatureDetails
πŸ“Š Live DashboardSoil moisture, temperature, humidity with progress bars
🚨 Smart AlertsColor-coded warnings (🟒 Healthy / 🟑 Moderate / πŸ”΄ Critical)
🧠 AI DecisionsStress level analysis with actionable suggestions
βš™οΈ AutomationAuto watering & cooling fan toggle controls
πŸ“ˆ Trend ChartLine graph of last 20 readings (Chart.js)
πŸ—οΈ ArchitectureSystem diagram showing full IoT data flow
πŸ“‘ REST APIPOST sensor data from real Arduino/ESP32

πŸ—οΈ System Architecture

Rendering mermaid diagram...

πŸ“ Project Structure

plant-health-monitor/
β”œβ”€β”€ main.ts              # HTTP entrypoint
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ index.ts         # Hono routes
β”‚   └── database.ts      # SQLite queries
β”œβ”€β”€ shared/
β”‚   └── types.ts         # Types + AI health analysis
└── frontend/
    β”œβ”€β”€ index.html       # HTML shell
    β”œβ”€β”€ style.css        # Green eco theme
    └── app.tsx          # React dashboard

πŸ”Œ API Endpoints

GET /api/status

Returns latest sensor reading + AI health analysis + automation state.

GET /api/history?limit=20

Returns last N readings for chart rendering.

POST /api/reading

Ingest real sensor data from Arduino/ESP32:

{ "soilMoisture": 45, "temperature": 28, "humidity": 60 }

POST /api/simulate

Generate a simulated sensor reading (for demo/testing).

GET|POST /api/automation

Read or update watering/fan automation state.

πŸ€– AI Health Logic

ConditionScoreAlert
Moisture < 20%+3🚨 Critical dry
Moisture < 40%+1⚠️ Low moisture
Temp > 38Β°C+3πŸ”₯ Critical heat
Temp > 32°C+1🌑️ Too warm
Temp < 10Β°C+2πŸ₯Ά Too cold
Humidity < 30%+1πŸ’¨ Dry air
Humidity > 85%+1🌧️ Fungal risk
  • Score 0 β†’ Healthy 🟒
  • Score 1–2 β†’ Moderate 🟑
  • Score 3+ β†’ Critical πŸ”΄

🌱 Connecting a Real Sensor (Arduino/ESP32)

// Arduino / ESP32 snippet #include <WiFi.h> #include <HTTPClient.h> HTTPClient http; http.begin("https://your-val-endpoint.web.val.run/api/reading"); http.addHeader("Content-Type", "application/json"); String body = "{\"soilMoisture\":" + String(moistureVal) + ",\"temperature\":" + String(tempVal) + ",\"humidity\":" + String(humidityVal) + "}"; int code = http.POST(body);