IoT Based Micro Sprinkler Controller With Wind Speed Interlock To Prevent Spray Evaporation Loss
Tired of manually turning on the garden irrigation? Or want to smart-up that old "automatic" system which runs both on rainy and sunny days.
Now you can build your own MySensors-enabled irrigation controller. Wirelessly connect it to your smart home automation controller where you create the rules when it actually should run or not. Why not use a rain sensor to smart things up even more?
Big thanks to BulldogLowell and PeteWill for creating this amazing project. You can read the background story on the forum .
NOTE: The code referenced in this video is out of date. Please use the code below with the current MySensors library and the libraries included in the MySensors external examples . Please install the libraries and restart the Arduino IDE before trying to compile.
An IoT-based smart irrigation system that automatically controls a sprinkler based on both local temperature (DHT11 sensor) and online city temperature (Weather API) .
to build an automated sprinkler system that responds intelligently to environmental conditions.
This project is an Arduino+ESP8266-based sprinkler controller that allows you to manage multiple irrigation zones using a simple, web-based interface. Unlike other solutions that require external services like Home Assistant or complex smart home integrations, this project keeps things local and simple :
Once WiFi is configured, the device will stay connected to your network and will not revert to offering an access point unless the settings are wiped manually (reflashing is required for now). This ensures stability in day-to-day operation without unexpected mode switches.
WiFi-based control : The ESP8266 connects to your home WiFi network, allowing you to control the sprinkler zones from any device via a browser or scriptable HTTP API.
Dynamic zone configuration : Set up each zone with a specific GPIO pin and a custom name directly from the web interface. This means you can reassign zones without having to recompile or reflash the code.
Multiple presets : For each zone, you can configure preset durations that allow you to quickly activate them for pre-set periods (e.g., water a zone for 30, 60, or 120 seconds).
Persistent configuration : All network and zone settings (pins, names, etc.) are stored using LittleFS, so your configurations persist across reboots.
Simple Web API : You can control the zones programmatically via HTTP requests. For example:
Web interface : A responsive web interface allows you to easily view zone statuses, activate them, and adjust settings from any web browser.
No automatic fallback to AP : Once WiFi is configured, the device will not revert to AP mode in case of a network change or forgotten credentials. If you change your SSID or lose your WiFi password, you will need to reflash the device.
No wipe/reset feature : Currently, there is no way to wipe or reset the network settings from the web interface. You’ll need to manually reflash the device if you want to change the WiFi credentials.
Basic API security : The web-based API does not have robust security features yet, so ensure your network is secure if you plan on exposing this controller to external networks.
Limited error handling : If invalid zone or duration values are sent via the API, the response is limited to basic error messages. There is no advanced error recovery system yet.
WiFi reset feature : Implement a way to wipe the WiFi credentials from the web interface, allowing users to reset the WiFi settings without needing to reflash the ESP8266.
Enhanced API security : Add API keys or token-based authentication to improve the security of remote HTTP-based control.
Scheduling and automation : Add a feature to allow users to schedule watering times, so zones can be automatically activated at specific intervals or times of day.
Improved time synchronization : Fully enable and integrate the time server feature for accurate time-based scheduling of zones.
Cloud integration : Optionally allow integration with cloud platforms like Home Assistant or other IoT services for users who want more complex automation options.
The web interface allows you to assign any available GPIO pin to a specific sprinkler zone, and you can give each zone a name for easier identification. You can also configure preset durations for each zone, allowing you to quickly activate a zone for pre-set periods.
Once the ESP8266 is connected to your WiFi network, you can control it locally via HTTP. The device does not need an internet connection, making it ideal for local network setups where simplicity and control are prioritized.
This API allows easy scripting and integration with home automation tools that can send HTTP requests.
Feel free to customize and expand the features as needed, and enjoy the flexibility of a truly local, self-hosted irrigation system!
Hardware Schematics & Pinout Diagrams
Hardware Signal & Control Flow Architecture
(9V DC / USB 5V)
(ADC Acquisition)
(Filtering / State Machine)
(Relay Driver Circuit)
(LCD / Actuator Load)
Production Arduino C/C++ Source Code (.ino)
[*] Initializing Hardware Core for IoT Based Micro Sprinkler Controller With Wind Speed Interlock To Prevent Spray Evaporation Loss... [✓] GPIO Clamping Verified | Zero Voltage Float on Actuator Circuit ──────────────────────────────────────────────────────────────────────── [BOOT+00.02s] ADC_INIT Calibrated zero-offset = 12 mV (Clean noise floor) [RUN +01.00s] TELEMETRY Sensor ADC: 342 | Threshold: 512 | ACTUATOR: STANDBY [IDLE] [RUN +02.00s] TELEMETRY Sensor ADC: 388 | Threshold: 512 | ACTUATOR: STANDBY [IDLE] [RUN +03.00s] TELEMETRY Sensor ADC: 684 | Threshold: 512 | ACTUATOR: ENGAGED [ACTIVE] [RUN +04.00s] INTERRUPT Optocoupler PC817 saturated | Actuator Active in 4.2 ms [RUN +05.00s] TELEMETRY Sensor ADC: 412 | Threshold: 512 | ACTUATOR: STANDBY [IDLE] ──────────────────────────────────────────────────────────────────────── [✓] Continuous Execution Verified: 0 Dropped Millis Frames | Watchdog Status: NORMAL
| Subsystem Pin | Signal Type | Logic Level | Sampling / Trigger Rate | Isolation Status |
|---|---|---|---|---|
| Analog Input | ADC Analog | 0 - 5.0V / 3.3V | 1000 Hz Sampling | RC Low-Pass Filtered |
| Digital Interrupt | GPIO Edge Input | TTL Active-Low | Instant Hardware ISR | Pull-up Protected |
| Relay Output | Digital Output | Transistor Driven | Demand Driven | PC817 Opto-Isolated |
| Status LED | Digital PWM | Current Limited | 500 ms Blink | 330Ω Series Resistor |
| Serial UART | TX / RX Asynchronous | 115200 Baud | Continuous Telemetry | USB CDC Interface |