Farm Overview
Real-time status across all grow rooms
Active Rooms
3
↑ 1 from last week
Live Batches
4
2 near harvest
Today's Yield
2.3 kg
↑ 8% vs yesterday
Active Alerts
2
1 critical, 1 warning
Outdoor Weather · Sirajganj
—°C
—%
Outdoor RH
— m/s
Wind
—°
Feels Like
7-Day Yield (kg)
Active Alerts
Environment Monitor
Live sensor readings · auto-refresh every 5s
Current Readings · Room A
All OK
Temperature & Humidity · 24h
CO₂ & O₂ Levels · 24h
VPD & Dew Point Trend · 24h
Optimal Range Reference
Production Tracker
Batch lifecycle · harvest logs · biological efficiency
Active Batches
| Batch ID | Species | Room | Stage | Colonisation | Days In | Est. Harvest | Status |
|---|
Yield Per Batch (kg)
Biological Efficiency (%)
Recent Harvest Log
| Batch | Flush | Date | Weight (kg) | BE% | Room | Notes |
|---|
Long-run Analytics
Historical trends · correlations · performance benchmarks
Monthly Yield (kg)
BE% Trend Per Batch
30-Day Harvest Heatmap
Low yield
High yield
Temp vs Yield Correlation
Contamination Breakdown
Energy & Equipment
Power monitoring · equipment control · efficiency
Today (kWh)
18.4
Projected: 24.2 kWh
This Month
412
kWh · ৳ 3,296
Active Load
2,037 W
7 devices active
Cost / kg
৳ 18.4
↓ 6% vs last month
Hourly Power Consumption (W)
Equipment Status & Control
Data Points & Schema Reference
Complete sensor taxonomy · Supabase table schemas · collection frequency
Environmental Sensors Every 60s
| Parameter | Unit | Sensor | Optimal Range | Alert Threshold |
|---|---|---|---|---|
| Temperature | °C | DHT22 / SHT31 | 23 – 27 °C | <20 or >30 |
| Relative Humidity | %RH | DHT22 / SHT31 | 85 – 92 % | <75 or >97 |
| CO₂ Concentration | ppm | MH-Z19B / SCD40 | 600 – 1,000 | >1,500 |
| O₂ Level | % | ME2-O2 / KE-25 | 19.8 – 21 | <19.0 |
| Airflow / FAE Rate | m/s | SFM3000 / Hot-wire | 0.3 – 0.7 | <0.2 |
| VPD (calculated) | kPa | Derived: T + RH | 0.3 – 0.7 | >0.9 |
| Light Intensity | lux | BH1750 / TSL2591 | 100 – 500 | >1,000 |
| Dew Point | °C | Derived: T + RH | 16 – 20 | — |
Substrate & Water Quality Every 5 min
| Parameter | Unit | Sensor | Optimal Range | Alert Threshold |
|---|---|---|---|---|
| Substrate Moisture | % | Capacitive soil probe | 60 – 75 % | <55 or >85 |
| Substrate Temp | °C | DS18B20 probe | 22 – 26 °C | >28 |
| Substrate pH | pH | Atlas EZO-pH | 6.0 – 7.0 | <5.5 or >7.5 |
| Water pH (irrigation) | pH | Atlas EZO-pH | 6.0 – 7.0 | <5.8 or >7.5 |
| Water EC | mS/cm | Atlas EZO-EC | 0.8 – 2.5 | >3.5 |
| Water Temp | °C | DS18B20 | 18 – 24 °C | >28 |
| Daily Water Usage | L/day | YF-S201 flow meter | Target depends on room | — |
| Dissolved O₂ (water) | mg/L | Atlas EZO-DO | 6 – 9 | <4 |
Production & Batch KPIs Per event
| Metric | Unit | Collected At | Notes |
|---|---|---|---|
| Spawn Run Duration | days | Inoculation → 100% colonisation | Benchmark: 14–21 days |
| Pin Initiation Date | date | First visible pins | Days after spawn: 18–25 |
| Flush Harvest Weight | kg | Each harvest event | Track F1, F2, F3 separately |
| Biological Efficiency | % | Post-harvest (each flush) | BE% = (yield/dry substrate)×100 |
| Days to First Harvest | days | Inoculation → F1 | Benchmark: 22–28 days |
| Total Yield / Batch | kg | All flushes summed | 3–4 flushes typical |
| Substrate Dry Weight | kg | Pre-inoculation | Used to calculate BE% |
| Contamination Rate | % | Per batch inspection | Target <5% of bags |
| Contamination Type | enum | Visual inspection | Bacterial / Trichoderma / Mould |
| Spawn Rate Used | % | Inoculation | Typically 10–20% w/w |
Energy & Equipment Every 15 min
| Parameter | Unit | Device | Notes |
|---|---|---|---|
| Power Consumption (total) | kWh | Smart energy meter | Daily + monthly rollup |
| Per-device Power | W | Smart plug / CT clamp | HVAC, humidifier, fans, UV, sensors |
| Equipment Uptime | hrs | Relay state log | On/off log per device |
| HVAC Duty Cycle | % | Derived from on/off log | Target 40–70% |
| Humidifier Cycles/hr | count | Relay log | Indicates humidity stability |
| Fan Speed | RPM | PWM feedback / tachometer | Correlates to CO₂ clearance |
| UV Hours | hrs | Run-time counter | Replace bulb at 8,000 hrs |
| Energy Cost / kg | ৳/kg | Calculated | Total kWh × ৳8 / yield |
Supabase SQL — Paste this into your Supabase SQL Editor to create all sensor tables
-- ══════════════════════════════════════════════════════ -- SaFa Naturals IoT Farm · Supabase Schema -- Run in: Supabase Dashboard → SQL Editor → New Query -- ══════════════════════════════════════════════════════ -- 1. SENSOR READINGS (60-second interval, per room) CREATE TABLE sensor_readings ( id BIGSERIAL PRIMARY KEY, created_at TIMESTAMPTZ DEFAULT NOW(), room_id TEXT NOT NULL, -- 'A', 'B', 'C' temperature NUMERIC(5,2), -- °C humidity NUMERIC(5,2), -- %RH co2_ppm INTEGER, -- ppm o2_pct NUMERIC(4,2), -- % airflow_ms NUMERIC(4,2), -- m/s vpd_kpa NUMERIC(4,3), -- kPa (calculated) light_lux INTEGER, -- lux dew_point NUMERIC(5,2) -- °C (calculated) ); -- 2. SUBSTRATE READINGS (5-minute interval, per room) CREATE TABLE substrate_readings ( id BIGSERIAL PRIMARY KEY, created_at TIMESTAMPTZ DEFAULT NOW(), room_id TEXT NOT NULL, moisture_pct NUMERIC(5,2), substrate_temp NUMERIC(5,2), substrate_ph NUMERIC(4,2), water_ph NUMERIC(4,2), water_ec_ms NUMERIC(5,3), -- mS/cm water_temp NUMERIC(5,2), water_used_l NUMERIC(7,3) ); -- 3. PRODUCTION BATCHES CREATE TABLE farm_batches ( id TEXT PRIMARY KEY, -- e.g. 'BAT-2025-041' created_at TIMESTAMPTZ DEFAULT NOW(), species TEXT NOT NULL, room_id TEXT NOT NULL, inoculation_date DATE NOT NULL, substrate_kg NUMERIC(6,3), -- dry weight spawn_pct NUMERIC(4,1), stage TEXT DEFAULT 'Inoculated', colonisation_pct INTEGER DEFAULT 0, pin_date DATE, expected_harvest DATE, status TEXT DEFAULT 'active', -- active | completed | contaminated notes TEXT ); -- 4. HARVEST EVENTS CREATE TABLE harvest_events ( id BIGSERIAL PRIMARY KEY, created_at TIMESTAMPTZ DEFAULT NOW(), batch_id TEXT REFERENCES farm_batches(id), flush_num SMALLINT NOT NULL, harvest_date DATE NOT NULL, yield_kg NUMERIC(7,3), be_pct NUMERIC(5,2), -- biological efficiency room_id TEXT, notes TEXT ); -- 5. CONTAMINATION LOG CREATE TABLE contamination_log ( id BIGSERIAL PRIMARY KEY, created_at TIMESTAMPTZ DEFAULT NOW(), batch_id TEXT REFERENCES farm_batches(id), room_id TEXT, type TEXT, -- Bacterial | Mould | Trichoderma bags_affected INTEGER, total_bags INTEGER, action_taken TEXT, resolved BOOLEAN DEFAULT FALSE ); -- 6. ENERGY LOG (15-minute interval) CREATE TABLE energy_log ( id BIGSERIAL PRIMARY KEY, created_at TIMESTAMPTZ DEFAULT NOW(), device_id TEXT NOT NULL, -- 'hvac-a', 'humidifier-b', etc. room_id TEXT, watts NUMERIC(8,2), is_on BOOLEAN DEFAULT TRUE, kwh_total NUMERIC(10,4) ); -- 7. ALERT LOG CREATE TABLE alert_log ( id BIGSERIAL PRIMARY KEY, created_at TIMESTAMPTZ DEFAULT NOW(), room_id TEXT, severity TEXT NOT NULL, -- 'ok' | 'warn' | 'crit' parameter TEXT, value NUMERIC, threshold NUMERIC, message TEXT, resolved_at TIMESTAMPTZ ); -- ── INDEXES for time-series queries ── CREATE INDEX idx_sensor_room_time ON sensor_readings (room_id, created_at DESC); CREATE INDEX idx_substrate_room ON substrate_readings (room_id, created_at DESC); CREATE INDEX idx_harvest_batch ON harvest_events (batch_id, flush_num); CREATE INDEX idx_energy_device_time ON energy_log (device_id, created_at DESC); CREATE INDEX idx_alerts_severity ON alert_log (severity, created_at DESC); -- ── ROW LEVEL SECURITY ── ALTER TABLE sensor_readings ENABLE ROW LEVEL SECURITY; ALTER TABLE farm_batches ENABLE ROW LEVEL SECURITY; ALTER TABLE harvest_events ENABLE ROW LEVEL SECURITY; ALTER TABLE energy_log ENABLE ROW LEVEL SECURITY; ALTER TABLE alert_log ENABLE ROW LEVEL SECURITY; -- Allow authenticated users (admin) full access CREATE POLICY "admin_all" ON sensor_readings FOR ALL TO authenticated USING (true); CREATE POLICY "admin_all" ON farm_batches FOR ALL TO authenticated USING (true); CREATE POLICY "admin_all" ON harvest_events FOR ALL TO authenticated USING (true); CREATE POLICY "admin_all" ON energy_log FOR ALL TO authenticated USING (true); CREATE POLICY "admin_all" ON alert_log FOR ALL TO authenticated USING (true);
Recommended Hardware Stack
Controller Node
ESP32 — main MCU per room, Wi-Fi + BT
Raspberry Pi 4 — central gateway + local DB
4G LTE dongle — backup internet for remote farm
UPS module — 12V battery backup for ESP32
Sensor Modules
SHT31 — temperature + humidity (±0.3°C, ±2%)
SCD40 — CO₂ (NDIR, ±50ppm), includes T+H
BH1750 — light intensity
Atlas EZO-pH — substrate & water pH
Atlas EZO-EC — electrical conductivity
Control & Actuation
4-channel relay — HVAC, humidifier, fans, UV
PWM controller — variable fan speed
PZEM-004T — AC power monitoring per circuit
Supabase Realtime — push sensor data every 60s
Threshold alerts — POST to Supabase alert_log