A WiFi-enabled smart irrigation controller built on the ESP8266 microcontroller. This system allows you to remotely control your irrigation system through a web interface, schedule watering times, and manage your garden or lawn watering automatically.
✨ Smart Scheduling
- Set custom watering schedules for specific days of the week
- Define start and end times for automated irrigation
- View next scheduled run time at a glance
🌐 Web Interface
- Clean, accessible web UI for remote control
- Real-time status monitoring
- Manual override controls (Force ON/OFF)
- Schedule configuration via web form
⏰ Time Management
- NTP (Network Time Protocol) synchronization for accurate timekeeping
- Configurable timezone and daylight saving offset
🎛️ Flexible Control Modes
- Automatic Mode: Follow the configured schedule
- Force ON: Override schedule to turn irrigation ON
- Force OFF: Override schedule to turn irrigation OFF
- Temporary Disable: Pause for 5 minutes (useful during maintenance)
- ESP8266 Development Board (NodeMCU, Wemos D1 Mini, or similar)
- Relay Module (5V relay recommended)
- Power Supply (5V for ESP8266, appropriate voltage for your irrigation system)
- Solenoid Valve/Pump (compatible with your relay)
- Jumper wires and breadboard (for prototyping)
| Component | ESP8266 Pin |
|---|---|
| Relay Control | D7 (GPIO13) |
| Built-in LED | D0 (GPIO16) |
ESP8266WiFi- WiFi connectivityESP8266WebServer- Web server functionalityESP32Time- RTC (Real-Time Clock) managementtime.h- Time utilities
Install the required libraries through the Arduino Library Manager or manually download them.
Open ESP8266-SmartIrrigationSystem.ino and modify the following settings:
const char *ssid = "your-wifi-ssid"; // Your WiFi network name
const char *password = "your-wifi-password"; // Your WiFi password
const long gmtOffset_sec = 3600; // GMT offset in seconds (3600 = GMT+1)
const int daylightOffset_sec = 0; // Daylight saving offset (0 or 3600)- Connect your ESP8266 board to your computer
- Select the correct board and port in Arduino IDE
- Upload the sketch
After uploading, open the Serial Monitor (115200 baud) to see the IP address assigned to your ESP8266:
Connecting to WiFi...
Connected to WiFi
ESP8266 Web Server's IP address: 192.168.x.x
Open a web browser and navigate to the IP address shown in the Serial Monitor (e.g., http://192.168.1.100)
- Navigate to the web interface
- Select the days of the week you want watering to occur
- Set the start time (when irrigation begins)
- Set the end time (when irrigation stops)
- Click "Set Schedule"
Example Schedule:
- Days: Monday, Wednesday, Friday
- Start Time: 06:00 AM
- End Time: 06:30 AM
This will water your garden for 30 minutes on Monday, Wednesday, and Friday mornings.
- Turn ON: Immediately activates irrigation, ignoring the schedule
- Turn OFF: Immediately deactivates irrigation, ignoring the schedule
- Turn with Timer: Returns to automatic schedule mode
- Disable for 5 Minutes: Temporarily pauses all irrigation for maintenance
Click "Fetch NTP Time and Calculate Difference" to:
- Update the system time from NTP servers
- View the difference between RTC and NTP time
- Ensure accurate scheduling
ESP8266 (D7) -----> Relay IN
ESP8266 (GND) ----> Relay GND
ESP8266 (3V3/5V) -> Relay VCC
Relay COM --------> Power Supply (+)
Relay NO ----------> Irrigation Valve (+)
Valve (-) ---------> Power Supply (-)
- Verify SSID and password are correct
- Check WiFi signal strength
- Ensure your router supports 2.4GHz (ESP8266 doesn't support 5GHz)
- Check wiring connections
- Verify relay is compatible with 3.3V logic or use a level shifter
- Test relay independently with a simple sketch
- Ping the ESP8266 IP address to verify network connectivity
- Check that port 80 is not blocked by firewall
- Try accessing from the same subnet
Contributions are welcome! Please feel free to submit a Pull Request.
This project is open-source and available for personal and educational use.
Made with 💧 for smarter irrigation and protecting the planet