Sprays crops on a timer you set from your phone.
Built and tested by Aboobacker sidheeq K P · Industrial Robotics Institute

An automatic sprayer that sprays water, fertiliser or pesticide at regular intervals without anyone pressing the trigger. A servo presses the sprayer bottle’s nozzle, and the ESP8266 hosts a web page where you set how many seconds to wait between sprays.
| Component | Qty |
|---|---|
| ESP8266 NodeMCU | 1 |
| Servo Motor (SG90) | 1 |
| Sprayer bottle with nozzle | 1 |
| DC-DC Buck Converter | 1 |
| Lithium-ion Batteries | 2 |
| Battery Case with Switch | 1 |
| Jumper Wires | As needed |
| From | Connect to |
|---|---|
| Servo red | 5V (buck output) |
| Servo brown | GND |
| Servo orange (signal) | D4 (GPIO2) |
| Battery + | Buck IN+ |
| Battery − | Buck IN− |
| Buck OUT+ (5V) | ESP8266 VIN & servo |
| Buck OUT− | GND |
Complete, tested Arduino C++ code for this project. Copy it into Arduino IDE and upload it to the ESP8266 NodeMCU.
#include <ESP8266WiFi.h>
#include <Servo.h>
const char* ssid = "YOUR_SSID";
const char* password = "YOUR_PASSWORD";
WiFiServer server(80);
Servo sprayServo;
int servoPin = D4;
unsigned long interval = 10000; // default 10 seconds
unsigned long previousMillis = 0;
void setup()
{
Serial.begin(115200);
delay(1000);
Serial.println("Starting ESP8266...");
sprayServo.attach(servoPin);
sprayServo.write(0);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
Serial.println();
Serial.print("Device IP Address: ");
Serial.println(WiFi.localIP());
server.begin();
}
void loop()
{
unsigned long currentMillis = millis();
// ===== SPRAY LOGIC =====
if (currentMillis - previousMillis >= interval)
{
previousMillis = currentMillis;
sprayServo.write(90); // Spray
delay(1000);
sprayServo.write(0); // Reset
}
// ===== WEB CONTROL =====
WiFiClient client = server.available();
if (client)
{
String request = client.readStringUntil('\r');
if (request.indexOf("/set?time=") != -1)
{
int start = request.indexOf("=") + 1;
int end = request.indexOf(" ", start);
interval = request.substring(start, end).toInt() * 1000;
Serial.print("New Interval: ");
Serial.print(interval / 1000);
Serial.println(" seconds");
}
String html = "<html><body>";
html += "<h1>Automatic Sprayer</h1>";
html += "<form action='/set'>";
html += "Set Time (seconds): <input type='number' name='time'>";
html += "<input type='submit' value='Update'>";
html += "</form>";
html += "<p>Current Interval: ";
html += interval / 1000;
html += " sec</p>";
html += "</body></html>";
client.print("HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n");
client.print(html);
delay(1);
client.stop();
}
}An automatic sprayer that sprays water, fertiliser or pesticide at regular intervals without anyone pressing the trigger. A servo presses the sprayer bottle’s nozzle, and the ESP8266 hosts a web page where you set how many seconds to wait between sprays.
You need: ESP8266 NodeMCU (1), Servo Motor (SG90) (1), Sprayer bottle with nozzle (1), DC-DC Buck Converter (1), Lithium-ion Batteries (2), Battery Case with Switch (1), Jumper Wires. Software: Arduino IDE, ESP8266WiFi library, Servo library.
It is rated intermediate and takes about 2–3 hours to build, using the ESP8266 NodeMCU. The guide on this page explains every connection and step.
The complete, tested Arduino C++ code is free on this page. Copy it into Arduino IDE and upload it to the board.
Yes. IRI sells a kit with the parts for this project (PRJ-042). Message IRI on WhatsApp at +91 86060 82634 for the kit price and delivery details.