Water irrigation project, delay(900000) syntax caused disconnection to esp8266

Hi Pete / Experts,

I am working on a water irrigation project.
the concept is simple as below.
I will get a notification from my Blynk app based on the Soil Moisture status.
Based on that status, I will water the plant by pressing the button from Blynk.

  • ESP8266
  • Soild Moisture sensor


the issue I am facing with the “Delay”
I want to get a notification when the sensor value changes every 15 minutes
(900000). The problem is, my esp8266 also getting disconnect from the internet every 15 minutes

Below is my code

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
// You should get Auth Token in the Blynk App.

// Go to the Project Settings (nut icon).
char auth[] = "MyCode";  //code sent via email
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "mywifi";
char pass[] = "Mypassword";
int sensorPin = 5; // Input pin for the Flame Sensor
int sensorValue = 0; // Variable to store the value coming from the flame sensor
void setup()
 // Debug console
 Blynk.begin(auth, ssid, pass);
 pinMode(5, INPUT);
void loop()
 sensorValue = digitalRead(sensorPin);
 if (sensorValue == 1) {
 Blynk.notify("Water your plant");
  delay(900000);  //15 minutes

I am not sure where I should be adding the delay syntax
Appreciate your advice, thank you.


The simple answer is “Nowhere”. Delays aren’t compatible with Blynk.

Instead, you need to use a timer.
Read this:

and if necessary this:


1 Like

You need a script @PeteKnight to scan for ‘delay’ then post your standard response . . . :wink:


Thanks Pete, I’ll modify my code abit, will let you know on the outcome.

:wink: cool