Production

Mushroom Ki Mandi

Mushroom Ki Mandi is a smart IoT platform for mushroom farmers. ESP32 sensors monitor temperature, humidity, and air quality inside grow rooms in real time. When conditions drift, relays kick in automatically - fans, humidifiers, heaters - keeping the environment dialed in for each growth stage. The platform tracks the full cycle from inoculation to harvest, and connects growers directly to buyers through a built-in marketplace. Real sensors, real farms, real mushrooms.

FastAPIPostgreSQLESP32ReactDockerAlembicPlatformIOMQTT
Production - Real HardwareLive → mushroomkimandi.com

# What It Does

Climate Monitoring

ESP32 microcontrollers with DHT22/BME680 sensors continuously monitor temperature, humidity, and air quality in grow rooms. Data published via MQTT.

Growth Stage Tracking

Track mushroom growth cycles from inoculation through fruiting to harvest. Each stage has optimal environmental parameters that trigger alerts if breached.

Relay Automation

Automated relay control for fans, humidifiers, and heaters based on sensor readings. Rules engine maintains optimal growing conditions per stage.

Dashboard & Alerts

React frontend shows live sensor data, growth stage status, relay states, and historical charts. Real-time alerts when conditions drift from optimal ranges.

# Architecture

mushroom-arch.md
┌────────────────────────────────────────┐
│  MUSHROOM FARM                         │
│                                        │
│  [ESP32 + DHT22/BME680]               │
│       │  MQTT publish                  │
│       ▼                                │
│  [MQTT Broker]                         │
│       │                                │
│       ▼                                │
│  [FastAPI Backend]──[PostgreSQL]       │
│       │  WebSocket                     │
│       ▼                                │
│  [React Dashboard]                     │
│   Climate · Stages · Relays · Alerts  │
└────────────────────────────────────────┘

Relay Control Loop:
  Sensor → Backend → Rules Engine
    → MQTT command → ESP32 → Relay ON/OFF

# Stack

BackendFastAPI · SQLAlchemy (async) · PostgreSQL · Alembic migrations
FrontendReact · TypeScript · Tailwind CSS · Historical charts
FirmwareESP32 · PlatformIO · Arduino framework · DHT22/BME680 drivers
ProtocolMQTT (paho-mqtt backend, PubSubClient ESP32)
InfraDocker Compose · Mosquitto broker
Testingpytest (auth, climate, dashboard, devices, firmware, readings, relay, security)
CI/CDDocker-based deployment pipeline

# How It Works

Each grow room has an ESP32 microcontroller wired to DHT22 or BME680 sensors. Every few seconds, temperature, humidity, and air quality readings are published over MQTT to the backend. The rules engine compares readings against optimal ranges for the current growth stage - if humidity drops below threshold during fruiting, it fires a relay command back to the ESP32 to turn on the humidifier.

Farm owners see everything on a React dashboard - live sensor tiles, historical charts, growth stage timelines, relay states, and alerts. The marketplace side connects growers with buyers, letting them list harvests and manage orders.

The system runs in production on real mushroom farms with real hardware. Currently live and under rigorous testing at mushroomkimandi.com.