A real-time IoT dashboard for monitoring and automating plant moisture levels using Arduino sensors. Built with React 19, Tailwind CSS 4, and Recharts, featuring a cyberpunk biophilic design aesthetic.
- Moisture Level Tracking โ Animated SVG gauge with status indicators (optimal/warning/critical/overwatered)
- Environmental Sensors โ Air humidity, temperature, light level, soil pH, and raw ADC values
- Multi-Plant Support โ Monitor up to 3+ plants simultaneously with individual thresholds
- Live Waveform Charts โ Recharts AreaChart with 30-minute history and mode switching (moisture/humidity/temperature/all)
- Threshold-Based Alerts โ Critical and warning severity levels with auto-generation when thresholds are breached
- Alert Feed โ Real-time log with acknowledge/dismiss controls and time-ago timestamps
- Auto-Water Controls โ Toggle auto-watering per plant or trigger manual watering with pump simulation
- Connection Status โ Real-time connection indicator with simulated reconnection events
- Arduino Code Panel โ Expandable
.inosketch with syntax highlighting, hardware specs, and copy button - Sensor Specifications โ DHT22 humidity/temperature, capacitive soil moisture sensor, 5V relay pump
- Serial Communication โ 9600 baud rate, 2-second polling interval
- Neon Terrarium Aesthetic โ Cyberpunk biophilic design with electric teal accents, glassmorphic cards, and ambient glow effects
- Responsive Layout โ Fixed sidebar plant roster + main content area with mobile hamburger menu
- Smooth Animations โ Pulse rings, breathing gauges, slide-in alerts, and count-up value transitions
- Dark Theme โ OKLCH color space with custom tokens for consistency
| Layer | Technology |
|---|---|
| Frontend | React 19, TypeScript, Wouter (client-side routing) |
| Styling | Tailwind CSS 4, OKLCH color space, custom animations |
| Components | shadcn/ui, Recharts (charting), Lucide React (icons) |
| State | React Hooks (useState, useEffect, useRef, useMemo) |
| Build | Vite 7, esbuild, pnpm |
| Package Manager | pnpm 10.4.1 |
smart-home-controller/
โโโ client/
โ โโโ public/ # Static assets (favicon, robots.txt)
โ โโโ src/
โ โ โโโ components/
โ โ โ โโโ ui/ # shadcn/ui components
โ โ โ โโโ MoistureRing.tsx # Animated SVG gauge
โ โ โ โโโ SensorCard.tsx # Individual metric display
โ โ โ โโโ SensorChart.tsx # Recharts waveform
โ โ โ โโโ AlertFeed.tsx # Alert log panel
โ โ โ โโโ PlantSidebar.tsx # Plant roster sidebar
โ โ โ โโโ ArduinoPanel.tsx # Hardware info & code
โ โ โโโ hooks/
โ โ โ โโโ useSensorData.ts # Sensor simulation & alert logic
โ โ โโโ pages/
โ โ โ โโโ Home.tsx # Main dashboard
โ โ โ โโโ NotFound.tsx # 404 page
โ โ โโโ contexts/
โ โ โ โโโ ThemeContext.tsx # Dark/light theme
โ โ โโโ App.tsx # Routes & layout
โ โ โโโ main.tsx # React entry point
โ โ โโโ index.css # Global styles & tokens
โ โโโ index.html # HTML template
โโโ server/ # Placeholder (static-only)
โโโ package.json
โโโ tsconfig.json
โโโ vite.config.ts
โโโ README.md
- Node.js 18+ (or use
nvm) - pnpm 10.4.1+ (or
npm,yarn)
-
Clone the repository
git clone https://github.com/MIKECHITI/smart-home-controller.git cd smart-home-controller -
Install dependencies
pnpm install
-
Start the development server
pnpm dev
The app will be available at
http://localhost:3000 -
Build for production
pnpm build
The app includes a realistic sensor simulation (useSensorData.ts) that:
- Generates fluctuating moisture, humidity, temperature, and light readings
- Drifts targets every 30 ticks to simulate natural environmental changes
- Maintains 30-minute history with 2-second polling intervals
- Auto-generates alerts when thresholds are breached
- Simulates occasional connection drops and reconnection
| Plant | Species | Location | Moisture Range | Humidity Range |
|---|---|---|---|---|
| Monstera | Monstera deliciosa | Living Room | 40โ70% | 50โ80% |
| Succulent | Echeveria elegans | Bedroom | 15โ35% | 20โ50% |
| Boston Fern | Nephrolepis exaltata | Bathroom | 55โ80% | 60โ90% |
- Primary Accent โ Electric Teal
#00d4aa(moisture/life) - Warning โ Warm Amber
#f59e0b(caution) - Critical โ Vivid Coral
#ef4444(alerts) - Secondary โ Sky Blue
#60a5fa(humidity) - Background โ Deep Charcoal
oklch(0.13 0.015 240)(dark)
- Display Font โ Syne (bold headers, geometric)
- Body Font โ DM Sans (readable, modern)
- Data Font โ Space Mono (monospaced, technical)
- Glassmorphic Cards โ Frosted glass effect with backdrop blur and subtle borders
- Glow Borders โ Status-aware colored glows (teal/amber/coral)
- Animated Gauges โ SVG circles with breathing pulse rings
- Waveform Charts โ Gradient-filled area charts with interactive tooltips
Manages all sensor state and alert logic:
const {
plants, // Array of plant objects with readings
alerts, // Alert feed
selectedPlant, // Currently selected plant
isConnected, // Connection status
unacknowledgedCount, // Unread alert count
acknowledgeAlert, // Mark alert as read
dismissAlert, // Remove alert
triggerWater, // Simulate watering
toggleAutoWater, // Toggle auto-water mode
} = useSensorData();Animated SVG gauge displaying soil moisture with status-aware coloring:
- Spans 270ยฐ arc (135ยฐ to 405ยฐ)
- Smooth value transitions with easing
- Breathing pulse ring for non-optimal states
- Center text shows percentage, status label, and threshold range
Recharts AreaChart with mode switching:
- Moisture โ Teal gradient
- Humidity โ Blue gradient
- Temperature โ Amber gradient
- All โ Combined view with legend
- Last 20 readings displayed with time labels
Real-time alert log with severity coloring:
- Critical alerts blink and show red glow
- Warning alerts show amber glow
- Acknowledge/dismiss buttons per alert
- "All systems nominal" empty state
- Mobile (< 640px) โ Full-width layout, hamburger sidebar menu
- Tablet (640pxโ1024px) โ 2-column sensor grid, collapsible sidebar
- Desktop (1024px+) โ Fixed sidebar, 3-column hero section, full feature set
Arduino Uno R3
โโโ A0 โโโโโโโโ Capacitive Moisture Sensor (analog)
โโโ Pin 2 โโโโโ DHT22 Humidity/Temp Sensor (digital)
โโโ Pin 8 โโโโโ 5V Relay Module (pump control)
โโโ Pin 13 โโโโ LED Status Indicator
โโโ 5V โโโโโโโโ Power rail
โโโ GND โโโโโโโ Ground rail
The ArduinoPanel component includes the full .ino code with:
- DHT22 library integration
- Capacitive moisture sensor reading (0โ1023 ADC)
- Auto-water pump logic
- Serial output at 9600 baud
- 2-second polling interval
- Select a plant from the left sidebar
- View sensor data in the hero section (moisture ring + sensor cards)
- Check history in the "Sensor History" tab (waveform chart)
- Review alerts in the "Alerts" tab if any thresholds are breached
- Manual Water โ Click "Water Now" button to trigger pump (simulates 3-second watering)
- Auto-Water โ Toggle the switch to enable automatic watering when moisture drops below threshold
- Last Watered โ Displays time elapsed since last watering event
To modify plant thresholds, edit useSensorData.ts:
const INITIAL_PLANTS = [
{
id: "plant-1",
name: "Monstera",
thresholds: {
moistureMin: 40, // Adjust these values
moistureMax: 70,
humidityMin: 50,
humidityMax: 80,
tempMax: 30,
lightMin: 20,
},
// ...
},
];pnpm buildThis generates:
dist/โ Optimized static files ready for hostingdist/index.htmlโ Single-page app entry point
# Example: Vercel
vercel deploy
# Example: GitHub Pages (requires gh-pages package)
pnpm add -D gh-pages
pnpm build
npx gh-pages -d dist- Add entry to
INITIAL_PLANTSinuseSensorData.ts - Add initial readings to
INITIAL_READINGS - Add target values to
TARGETS - Component will auto-render in sidebar and overview
Edit alert generation logic in useSensorData.ts setPlants effect:
if (moisture < t.moistureMin - 15) {
// Critical alert
} else if (moisture < t.moistureMin) {
// Warning alert
}- Global tokens in
client/src/index.css(colors, fonts, animations) - Component-specific styles use inline
styleprops with OKLCH colors - Tailwind utilities for layout and spacing
- Custom animations:
pulse-ring,breathe,float-up,count-up,blink-led,slide-in-right,slide-in-bottom
- Sensor Simulation Only โ No real Arduino hardware connection; all data is simulated
- Static Frontend โ No backend API; all state is client-side
- localStorage Not Implemented โ Plant settings and alerts reset on page reload
- No Real-time Sync โ Designed for single-user local use
- Threshold Customization UI โ Drag sliders to set custom moisture/humidity ranges per plant
- Watering Schedule โ Weekly calendar for automated watering times
- Data Export โ Download sensor history as CSV
- Email Alerts โ Send notifications when thresholds are breached
- Real Arduino Integration โ Connect to actual Arduino board via WebSerial API
- Backend API โ Store sensor data in database for historical analysis
- Multi-User Support โ User accounts and shared plant monitoring
- Mobile App โ React Native version for iOS/Android
MIT License โ See LICENSE file for details
MIKECHITI โ GitHub Profile
- Design Inspiration โ Cyberpunk aesthetic + biophilic design principles
- Libraries โ React, Tailwind CSS, shadcn/ui, Recharts, Lucide React
- Arduino Community โ DHT22 and capacitive sensor documentation
For issues, questions, or suggestions:
- Open an Issue on GitHub
- Include screenshots, error messages, and reproduction steps
- Tag with appropriate labels (
bug,feature,documentation)
Happy gardening! ๐ฟ๐ง
