Skip to content

MIKECHITI/smart-home-controller

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1 Commit
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Smart Home Controller โ€” Arduino IoT Plant Monitoring Dashboard

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.

Smart Home Controller Dashboard


๐ŸŒฑ Features

Real-Time Sensor Monitoring

  • 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)

Alert & Automation Logic

  • 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

Hardware Integration

  • Arduino Code Panel โ€” Expandable .ino sketch 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

Design & UX

  • 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

๐Ÿ› ๏ธ Tech Stack

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

๐Ÿ“ Project Structure

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

๐Ÿš€ Getting Started

Prerequisites

  • Node.js 18+ (or use nvm)
  • pnpm 10.4.1+ (or npm, yarn)

Installation

  1. Clone the repository

    git clone https://github.com/MIKECHITI/smart-home-controller.git
    cd smart-home-controller
  2. Install dependencies

    pnpm install
  3. Start the development server

    pnpm dev

    The app will be available at http://localhost:3000

  4. Build for production

    pnpm build

๐Ÿ“Š Sensor Simulation

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 Nodes (Pre-configured)

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%

๐ŸŽจ Design System

Color Palette (OKLCH)

  • 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)

Typography

  • Display Font โ€” Syne (bold headers, geometric)
  • Body Font โ€” DM Sans (readable, modern)
  • Data Font โ€” Space Mono (monospaced, technical)

Components

  • 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

๐Ÿ”ง Key Components

useSensorData Hook

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();

MoistureRing Component

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

SensorChart Component

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

AlertFeed Component

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

๐Ÿ“ฑ Responsive Design

  • 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 Hardware Reference

Wiring Diagram

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

Arduino Sketch

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

๐ŸŽฏ Usage Guide

Monitoring a Plant

  1. Select a plant from the left sidebar
  2. View sensor data in the hero section (moisture ring + sensor cards)
  3. Check history in the "Sensor History" tab (waveform chart)
  4. Review alerts in the "Alerts" tab if any thresholds are breached

Watering

  • 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

Customization

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,
    },
    // ...
  },
];

๐Ÿšข Deployment

Build for Production

pnpm build

This generates:

  • dist/ โ€” Optimized static files ready for hosting
  • dist/index.html โ€” Single-page app entry point

Deploy to Vercel, Netlify, or GitHub Pages

# Example: Vercel
vercel deploy

# Example: GitHub Pages (requires gh-pages package)
pnpm add -D gh-pages
pnpm build
npx gh-pages -d dist

๐Ÿ“ Development Notes

Adding a New Plant

  1. Add entry to INITIAL_PLANTS in useSensorData.ts
  2. Add initial readings to INITIAL_READINGS
  3. Add target values to TARGETS
  4. Component will auto-render in sidebar and overview

Customizing Alerts

Edit alert generation logic in useSensorData.ts setPlants effect:

if (moisture < t.moistureMin - 15) {
  // Critical alert
} else if (moisture < t.moistureMin) {
  // Warning alert
}

Styling

  • Global tokens in client/src/index.css (colors, fonts, animations)
  • Component-specific styles use inline style props 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

๐Ÿ› Known Limitations

  • 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

๐Ÿ”ฎ Future Enhancements

  • 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

๐Ÿ“„ License

MIT License โ€” See LICENSE file for details


๐Ÿ‘ค Author

MIKECHITI โ€” GitHub Profile


๐Ÿ™ Acknowledgments

  • Design Inspiration โ€” Cyberpunk aesthetic + biophilic design principles
  • Libraries โ€” React, Tailwind CSS, shadcn/ui, Recharts, Lucide React
  • Arduino Community โ€” DHT22 and capacitive sensor documentation

๐Ÿ“ž Support

For issues, questions, or suggestions:

  1. Open an Issue on GitHub
  2. Include screenshots, error messages, and reproduction steps
  3. Tag with appropriate labels (bug, feature, documentation)

Happy gardening! ๐ŸŒฟ๐Ÿ’ง

About

Arduino-based plant moisture monitoring dashboard. Real-time sensor data, humidity/moisture tracking, alert logic, IoT aesthetics

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors