{"id":32019080,"url":"https://github.com/byteninjasmit/smart-irrigation-system","last_synced_at":"2026-04-13T08:31:18.919Z","repository":{"id":318425327,"uuid":"971637143","full_name":"ByteNinjaSmit/smart-irrigation-system","owner":"ByteNinjaSmit","description":"A Smart Irrigation System based on ESP8266, designed to monitor environmental conditions like soil moisture, temperature, humidity, rain detection, and light intensity (via LDR), and control a water pump automatically or manually via WebSocket communication.","archived":false,"fork":false,"pushed_at":"2025-10-08T19:08:41.000Z","size":1344,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-17T02:22:55.632Z","etag":null,"topics":["esp8266","esp8266-webserver","iot-application","iot-device","irrigation-controller","irrigation-system","smart","smart-irrigation-system"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ByteNinjaSmit.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-04-23T20:33:46.000Z","updated_at":"2025-10-08T19:08:45.000Z","dependencies_parsed_at":"2025-10-07T06:22:10.768Z","dependency_job_id":"54f628cc-0464-4037-a181-132ea1facfc3","html_url":"https://github.com/ByteNinjaSmit/smart-irrigation-system","commit_stats":null,"previous_names":["byteninjasmit/smart-irrigation-system"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ByteNinjaSmit/smart-irrigation-system","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ByteNinjaSmit%2Fsmart-irrigation-system","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ByteNinjaSmit%2Fsmart-irrigation-system/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ByteNinjaSmit%2Fsmart-irrigation-system/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ByteNinjaSmit%2Fsmart-irrigation-system/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ByteNinjaSmit","download_url":"https://codeload.github.com/ByteNinjaSmit/smart-irrigation-system/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ByteNinjaSmit%2Fsmart-irrigation-system/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31746101,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T06:26:45.479Z","status":"ssl_error","status_checked_at":"2026-04-13T06:26:44.645Z","response_time":93,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["esp8266","esp8266-webserver","iot-application","iot-device","irrigation-controller","irrigation-system","smart","smart-irrigation-system"],"created_at":"2025-10-16T02:37:52.231Z","updated_at":"2026-04-13T08:31:18.910Z","avatar_url":"https://github.com/ByteNinjaSmit.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# 📁 Smart Irrigation System - Project Folder Structure and Full Roadmap\n\n---\n\n# 🌾 Smart Irrigation System with ESP8266\n\nA **Smart Irrigation System** based on **ESP8266**, designed to monitor environmental conditions like **soil moisture**, **temperature**, **humidity**, **rain detection**, and **light intensity** (via LDR), and control a **water pump** automatically or manually via **WebSocket** communication.\n\nThis project ensures **efficient water usage**, **real-time monitoring**, and **automation** to support **smart farming** and **urban gardens**.\n\n\n\n---\n\n## 📋 Features\n- **WiFi-Enabled Monitoring**: Connects to WiFi for live sensor data streaming.\n- **WebSocket Communication**: Fast, real-time data transmission to a server/frontend.\n- **NTP Time Synchronization**: Timestamps all sensor readings using India's Standard Time (IST, UTC+5:30).\n- **Auto-Mode Pump Control**: Water pump is turned ON/OFF based on real-time soil, rain, temperature, and humidity conditions.\n- **Light Detection (LDR)**: Measures surrounding light intensity.\n- **Rain Sensor**: Detects rainfall.\n- **DHT11 Sensor**: Monitors environmental **temperature** and **humidity**.\n- **Error Handling**: Ensures data is sent only when values change or when first connecting.\n- **Low Power**: Smart updates avoid unnecessary transmissions.\n- **Reconnect Automatically**: Auto-reconnect to WebSocket server if disconnected.\n- **Manual Override**: Auto-mode can be toggled via server commands.\n\n\n---\n\n# 🎯 Roadmap\n\n| Phase | Description |\n|------|-------------|\n| Phase 1 | Setup ESP8266 firmware to send data over WebSocket |\n| Phase 2 | Setup simple Node.js server to receive and display data |\n| Phase 3 | Add Smart Decision Logic (control LED or Pump) |\n| Phase 4 | (Optional) Build React Dashboard to visualize data |\n| Phase 5 | (Optional) Save data to database (MongoDB) |\n| Phase 6 | (Optional) Notifications and AI-based improvements |\n\n---\n## 1. Folder Structure\n\n```bash\nSmart-Irrigation-System/\n├── client/                  # Frontend (Optional: Web Dashboard for Monitoring)\n│   ├── public/              # Static assets\n│   └── src/                 \n│       ├── components/\n│       │   └── sections/    # Reusable UI components\n│       │       ├── dashboard-content.jsx\n│       │       ├── dashboard-layout.jsx\n│       │       ├── gauge.jsx\n│       │       ├── history-chart.jsx\n│       │       └── theme-toggle.jsx\n│       ├── pages/           # Application pages (Dashboard, History, etc.)\n│       ├── services/        # API calls and service logic\n│       ├── App.jsx          # Main application component\n│       └── main.jsx         # Application entry point\n│\n├── esp8266-firmware/         # ESP8266 Arduino firmware (sensors + irrigation logic)\n│   ├── SmartIrrigation.ino   # Main microcontroller code\n│   └── README.md             # Firmware-specific documentation\n│\n├── server/                   # Backend Server (Node.js + Express + WebSocket)\n│   ├── controllers/          # Functions for handling sensor data logic\n│   │   └── history-controller.js\n│   ├── database/             # Database connection files\n│   │   └── models/           # Database models (schemas for sensor readings, logs, etc.)\n│   │       └── (models go here)\n│   │   └── db.js             # Database connection script\n│   ├── logs/                 # Server and WebSocket logs\n│   ├── middlewares/          # Authentication, error handling, validations\n│   │   └── save-history-data.js\n│   ├── routes/               # API route definitions\n│   │   └── history-route.js\n│   ├── utils/                # Utility helper functions\n│   │   └── logger.js\n│   └── server.js             # Server entry point\n│\n├── README.md                 # Project Overview and Setup Instructions\n├── LICENSE                   # (Optional) Open-source license information\n└── .gitignore                # Files and folders to ignore in version control\n\n```\n\n---\n\n## 2. What Goes Inside Each Part?\n\n### 🔵 `client/`\n- ReactJS / Vite frontend (Optional but very cool for live monitoring)\n- Components like:\n  - Live Data Display (Temperature, Soil Moisture, Light)\n  - Status Indicator (Is LED ON or OFF)\n- Responsive Web App to monitor field remotely.\n\n### 🟡 `esp8266-firmware/`\n- Your **ESP8266** code:\n  - Connects to WiFi\n  - Connects to WebSocket server\n  - Reads sensors: DHT22, Soil Moisture, Rain Sensor, LDR\n  - Applies logic: Temperature, Light, Moisture, Rain\n  - Controls: Built-in LED or Relay Module for pump.\n\n### 🟠 `server/`\n- Node.js server\n- Handles WebSocket connection with ESP8266\n- Displays received data\n- (Optional) Save to database for future analysis\n- (Optional) Expose REST APIs if needed.\n\n### 🟢 `database/`\n- MongoDB or any database setup (optional but recommended)\n- Can save history of sensor readings\n- Analyze trends later (ex: which month was driest?).\n\n---\n\n## 📡 How it Works\n1. ESP8266 connects to **WiFi**.\n2. Synchronizes time using **NTP Client** (India timezone).\n3. Connects to a **WebSocket Server** (IP \u0026 Port specified).\n4. Continuously **reads sensor data**:\n   - Temperature, Humidity, Soil Moisture, Rain Detection, Light Level.\n5. **AutoMode logic**:\n   - Turns ON the pump when:\n     - Soil is dry **AND** (Temperature is high **OR** Humidity is low)\n     - **AND** No Rain detected.\n   - Turns OFF the pump otherwise.\n6. Sends **sensor data** + **pump status** in real-time to the server.\n7. If values change, or first-time connection happens, data is sent immediately.\n\n---\n\n## 🧠 AutoMode Conditions\n- **Soil Dryness**: Soil moisture \u003c 60%\n- **High Temperature**: Temperature \u003e 30°C\n- **Low Humidity**: Humidity \u003c 40%\n- **No Rain**: Rain sensor not detecting rain\n\nIf these conditions match, pump (LED) turns **ON**, otherwise **OFF**.\n\n---\n\n## 🔧 Setup Instructions\n\n1. **Flash ESP8266 with Code**  \n   Upload the `.ino` sketch to your ESP8266 board via Arduino IDE or PlatformIO.\n2. **Libraries Needed**:\n   - `ESP8266WiFi.h`\n   - `WebSocketsClient.h`\n   - `ArduinoJson.h`\n   - `DHT.h`\n   - `WiFiUdp.h`\n   - `NTPClient.h`\n3. **Modify WiFi and WebSocket Settings**:\n   ```cpp\n   const char* ssid = \"YOUR_WIFI_SSID\";\n   const char* password = \"YOUR_WIFI_PASSWORD\";\n\n   const char* websocket_server = \"SERVER_IP_ADDRESS\";\n   const uint16_t websocket_port = 3000;\n   ```\n4. **Connect Sensors Properly**:\n   Follow pin mappings shown above carefully.\n5. **Start Your WebSocket Server**:\n   Ensure your server is running and listening to the right port and endpoint `/`.\n\n---\n\n## 📈 Data Sent to Server (JSON format)\n\n```json\n{\n  \"temperature\": 29.5,\n  \"humidity\": 60,\n  \"soilMoisture\": 45,\n  \"lightLevel\": 78,\n  \"rainDrop\": 1,\n  \"pumpStatus\": true,\n  \"autoMode\": true,\n  \"timestamp\": \"2025-04-27T15:45:30+05:30\",\n  \"espConnected\": true\n}\n```\n| Field         | Description                                |\n|---------------|--------------------------------------------|\n| temperature   | Measured in °C                             |\n| humidity      | Relative Humidity (%)                      |\n| soilMoisture  | Soil Moisture (%)                          |\n| lightLevel    | Light intensity (%) from LDR               |\n| rainDrop      | 0 = Rain detected, 1 = No rain             |\n| pumpStatus    | true = Pump ON, false = Pump OFF            |\n| autoMode      | true if auto mode is active                 |\n| timestamp     | Time when reading was taken (ISO format)    |\n| espConnected  | true if WebSocket connected                 |\n## 3. Example README.md Structure\n\n---\n\n# 🌱 Smart Irrigation System using ESP8266\n\n## 📋 Project Overview\n\nThis project implements a **Smart Irrigation System** that monitors:\n- Temperature\n- Humidity\n- Light Intensity\n- Soil Moisture\n- Rain Detection\n\nBased on environmental conditions, it automatically controls irrigation (water pump/LED). It also streams live data to a server using **WebSocket** technology.\n\n---\n\n## 🏛 Architecture\n```text\n[ ESP8266 + Sensors ]  --WebSocket--\u003e  [ Node.js Server ]  --Optional--\u003e [ Database ]\n                                               |\n                                               ↓\n                                     [ React Web App (Client) ]\n```\n\n---\n\n## ⚙️ Features\n- 🌡️ Read real-time environmental data.\n- 💧 Automatically decide when to water the plants.\n- 🌦️ Rain detection to avoid unnecessary watering.\n- 📶 WebSocket communication for fast, real-time data transfer.\n- 📊 (Optional) Web dashboard for live monitoring.\n\n---\n\n## 🧩 Technology Stack\n\n| Part              | Tech                   |\n|-------------------|-------------------------|\n| Microcontroller   | ESP8266 (NodeMCU)        |\n| Sensors           | DHT22, Soil Moisture, LDR, Rain Sensor |\n| Server            | Node.js + Express + WebSocket |\n| Frontend (Optional) | React.js + TailwindCSS + Shadcn UI |\n| Database (Optional) | MongoDB |\n\n---\n\n## 🚀 Setup Instructions\n\n### 🖥️ Server\n```bash\ncd server\nnpm install\nnode server.js\n```\n\n### 📡 ESP8266 Firmware\n- Open Arduino IDE\n- Install libraries:\n  - ESP8266WiFi\n  - WebSocketsClient\n  - DHT Sensor Library\n- Upload `SmartIrrigation.ino`\n\n### 🌐 Client (Optional)\n```bash\ncd client\nnpm install\nnpm run dev\n```\n\n---\n\n## 🛠 Hardware Requirements\n- ESP8266 NodeMCU board\n- DHT22 Temperature and Humidity Sensor\n- LDR (Light Dependent Resistor)\n- Soil Moisture Sensor (Digital/Analog)\n- Rain Detection Sensor\n- (Optional) Relay Module + Motor/Pump\n- Jumper wires, Breadboard\n\n---\n## 🔌 Hardware Required\n| Component         | Quantity | Description                               |\n|-------------------|----------|-------------------------------------------|\n| ESP8266 (e.g., NodeMCU) | 1 | WiFi-enabled microcontroller |\n| DHT11 Sensor       | 1        | Temperature and Humidity sensor           |\n| Soil Moisture Sensor | 1      | For soil moisture measurement             |\n| Rain Sensor Module | 1        | Detects rain presence                     |\n| LDR (Light Dependent Resistor) | 1 | Measures ambient light               |\n| Relay Module (optional) | 1  | To control real water pump safely         |\n| Jumper wires       | As needed | For connections                        |\n| Breadboard         | 1        | (Optional) prototyping                    |\n| LED                | 1        | Simulates the pump action (Built-in LED)  |\n\n---\n\n## 🛠️ Pin Connections\n| ESP8266 Pin | Connected To                   |\n|-------------|---------------------------------|\n| D6 (GPIO12)  | LDR Sensor Output (Digital)     |\n| D4 (GPIO2)  | DHT11 Sensor Output (Digital)   |\n| A0          | Soil Moisture Sensor (Analog)   |\n| D5 (GPIO14) | Rain Sensor Output (Digital)    |\n| LED_BUILTIN | Simulated Water Pump (LED)      |\n\n\u003e **Note**:  \n\u003e - **D3 (GPIO0)** used for LDR is set as **Input** (digital read).\n\u003e - **A0** reads analog voltage from Soil Moisture sensor.\n\n---\n## 📸 Project Images\n(Insert images of your hardware setup, screenshots of dashboard)\n![Dashboard Visulisation](./images/Dashboard.png)\n\n---\n\n## 📈 Future Improvements\n- Mobile App for notifications.\n- AI-based predictive irrigation (analyze historical data).\n- Solar-powered version.\n\n---\n\n\n\n## 🖥️ Example Serial Output\n```bash\nConnected! IP Address: 192.168.1.105\nConnected to WebSocket server\nFrontend connected, sending immediate data...\nData Sent to Server\nData Sent to Server\nFailed to read from DHT sensor!\nData Sent to Server\n```\n\n---\n\n## ⚡ Troubleshooting\n| Problem                          | Solution                                |\n|-----------------------------------|-----------------------------------------|\n| WebSocket not connecting          | Check IP address, port, server status   |\n| ESP stuck during boot             | Avoid pulling GPIO0 LOW at startup (no pressed buttons on D3 pin) |\n| DHT11 readings NaN (failed)        | Check wiring, DHT11 timing library      |\n| No soil moisture readings         | Check if Soil Moisture sensor is powered correctly |\n| Pump not switching ON/OFF         | Check your AutoMode conditions manually |\n\n---\n\n## 📚 Future Improvements\n- Add **OTA updates** (Over the Air programming).\n- Real **Relay Module** for controlling real water pump.\n- Mobile App Notification using WebSocket messages.\n- Solar powered battery management for outdoor deployment.\n\n---\n\n## ✨ Credits\n\u003e Developed by **Smitraj Bankar**  \n\u003e - B.Tech Computer Engineering | Sanjivani College of Engineering  \n\u003e - Expertise: MERN Stack, IoT Systems, Arduino, Embedded Projects\n\n---\n\n## 📄 License\nThis project is licensed under MIT License.\n\n\n# ⚡ Bonus Tip:\nYou can use **ngrok** to make your local Node.js server public if you want to control the system over the internet 🌍.\n\n\n---\n# 🎯 Conclusion:\n\n✅ This folder structure and plan will make your **Smart Irrigation System** ready for:\n- Deployment\n- Presentations\n- College Projects\n- Even Real-world Product Launch!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbyteninjasmit%2Fsmart-irrigation-system","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbyteninjasmit%2Fsmart-irrigation-system","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbyteninjasmit%2Fsmart-irrigation-system/lists"}