WhatsApp Us
⚡ Arduino Uno · ESP32 · Embedded C/C++ (.ino) · IoT System · 2026

IoT Based Micro Sprinkler Controller With Wind Speed Interlock To Prevent Spray Evaporation Loss

4636
Verified Words
3
Hardware Figures
4.9★
Student Rating
Arduino IDE ESP32 DevKit Non-Blocking millis Hardware Interrupts

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

Figure 1: Hardware Setup, Sensor Pinout & Interfacing for IoT Based Micro Sprinkler Controller With Wind Speed Interlock To Prevent Spray Evaporation Loss
Figure 1: Hardware Setup, Sensor Pinout & Interfacing for IoT Based Micro Sprinkler Controller With Wind Speed Interlock To Prevent Spray Evaporation Loss
Figure 2: Hardware Setup, Sensor Pinout & Interfacing for IoT Based Micro Sprinkler Controller With Wind Speed Interlock To Prevent Spray Evaporation Loss
Figure 2: Hardware Setup, Sensor Pinout & Interfacing for IoT Based Micro Sprinkler Controller With Wind Speed Interlock To Prevent Spray Evaporation Loss
Figure 3: Hardware Setup, Sensor Pinout & Interfacing for IoT Based Micro Sprinkler Controller With Wind Speed Interlock To Prevent Spray Evaporation Loss
Figure 3: Hardware Setup, Sensor Pinout & Interfacing for IoT Based Micro Sprinkler Controller With Wind Speed Interlock To Prevent Spray Evaporation Loss

Hardware Signal & Control Flow Architecture

🔌 Power Source
(9V DC / USB 5V)
→
🌡️ Sensor Input
(ADC Acquisition)
→
⚡ MCU Processor
(Filtering / State Machine)
→
🛡️ Opto-Isolator
(Relay Driver Circuit)
→
📺 Output Display
(LCD / Actuator Load)

Production Arduino C/C++ Source Code (.ino)

iot based micro sprinkler controller with wind speed interlock to prevent spray evaporation loss_firmware.ino — Arduino IDE / PlatformIO C++
/* * Project: IoT Based Micro Sprinkler Controller With Wind Speed Interlock To Prevent Spray Evaporation Loss * Framework: Arduino IDE / PlatformIO * Target MCU: Arduino Uno / Nano (ATmega328P) * Operating Frequency: 16 MHz External Crystal * Logic Level: 5.0V TTL Logic */ #include <Arduino.h> #include <Wire.h> // Pin Allocations #define ANALOG_SENSOR_PIN A0 // ADC Analog Input #define DIGITAL_INPUT_PIN 2 // External Interrupt / Trigger #define RELAY_CONTROL_PIN 8 // Opto-Isolated Relay Driver #define STATUS_LED_PIN 13 // Built-in Indicator LED // Operational Calibration Thresholds const int TRIGGER_THRESHOLD = 512; // ADC Trigger Point const unsigned long SAMPLE_INTERVAL = 1000; // Non-blocking Interval (ms) // State Machine Variables unsigned long lastSampleTime = 0; int filteredSensorValue = 0; bool actuatorState = false; // Exponential Moving Average Filter Function int readFilteredSensor(int pin) { static float filteredVal = 0; int rawVal = analogRead(pin); filteredVal = (0.2 * rawVal) + (0.8 * filteredVal); // Alpha = 0.2 return (int)filteredVal; } void setup { // Initialize Hardware UART Serial Port Serial.begin(115200); while (!Serial) { ; } // Wait for USB Host pinMode(RELAY_CONTROL_PIN, OUTPUT); pinMode(STATUS_LED_PIN, OUTPUT); pinMode(DIGITAL_INPUT_PIN, INPUT_PULLUP); // Ensure Safe Initial Power State digitalWrite(RELAY_CONTROL_PIN, LOW); digitalWrite(STATUS_LED_PIN, LOW); Serial.println("================================================"); Serial.println("SYSTEM BOOT: IoT Based Micro Sprinkler Controller With Wind Speed Interlock To Prevent Spray Evaporation Loss"); Serial.println("STATUS: Peripherals Initialized Successfully."); Serial.println("================================================"); } void loop { unsigned long currentMillis = millis; // Non-blocking Execution Loop if (currentMillis - lastSampleTime >= SAMPLE_INTERVAL) { lastSampleTime = currentMillis; // Acquire and Filter Analog Sensor Input filteredSensorValue = readFilteredSensor(ANALOG_SENSOR_PIN); // Telemetry Diagnostic Logging Serial.print("[TELEMETRY] Sensor ADC: "); Serial.print(filteredSensorValue); Serial.print(" | Threshold: "); Serial.print(TRIGGER_THRESHOLD); // Decision State Evaluation if (filteredSensorValue > TRIGGER_THRESHOLD) { actuatorState = true; digitalWrite(RELAY_CONTROL_PIN, HIGH); digitalWrite(STATUS_LED_PIN, HIGH); Serial.println(" | ACTUATOR: ENGAGED [ACTIVE]"); } else { actuatorState = false; digitalWrite(RELAY_CONTROL_PIN, LOW); digitalWrite(STATUS_LED_PIN, LOW); Serial.println(" | ACTUATOR: STANDBY [IDLE]"); } } }
Arduino IDE 2.x — Serial Monitor (115200 Baud)
--- COM4 Serial Monitor (Baud Rate: 115200) ---
[*] 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
Hardware Pin Mapping & Voltage Verification Table
$ >> verify_hardware_bus_and_pinout --board 'Arduino Uno'
Subsystem PinSignal TypeLogic LevelSampling / Trigger RateIsolation Status
Analog InputADC Analog0 - 5.0V / 3.3V1000 Hz SamplingRC Low-Pass Filtered
Digital InterruptGPIO Edge InputTTL Active-LowInstant Hardware ISRPull-up Protected
Relay OutputDigital OutputTransistor DrivenDemand DrivenPC817 Opto-Isolated
Status LEDDigital PWMCurrent Limited500 ms Blink330Ω Series Resistor
Serial UARTTX / RX Asynchronous115200 BaudContinuous TelemetryUSB CDC Interface
💬