Wifi connection problems with Arduino MKR1010 and Blynk

Hello, I have big problems with my garden automation project. I built the system, written the code and created the app with Blynk. All the system works great, with no problems at all. The problems start after some time I have powered the Arduino MKR1010 WiFi, that controls all the sensors and the water valve. After some hours it disconnected, so i tried to move the Arduino (with nothing connected) nearer the router. The problem is always the same: it works perfectly, but after some hours or days it disconnects, and sometimes it reconnects, but other times NOT. It stays disconnected until I press the reset button on the board. When I reset it, it instantly reconnects, so my idea is to find a way to automatically reset the board when there is a disconnect, maybe using a board like an esp32 connected to the reset pin of the Arduino, or without other boards, it will be better. Is this possible? Is there any other way to make the Arduino to reconnect if it loses connection? Reading in the docs.blynk I have found that the server disconnects the hardware if it is offline for more than 15 seconds. Is that right? Is there any way to modify this time? Can a ethernet shield connected to a wifi antenna (connecting directly to the router is not possible, it is too far) be a solution? I need to solve this problem, because if it disconnects for a lot of time the plants don’t have the water and will die.
As written before, I use an Arduino MKR1010 WiFi. My phone is a Samsung M31 and it is pretty new.

Here is the code. As you can see the loop is clean.

#define BLYNK_PRINT Serial

#include <SPI.h>
#include <WiFiNINA.h>
#include <BlynkSimpleWiFiNINA.h>

char auth[] = " ";

// Your WiFi credentials.
// Set password to "" for open networks.

char ssid[] = " ";
char pass[] = " ";

BlynkTimer timer;

int controlloAllarme;
int controlloIrrigazione;
int timerIrrigazione;
int manualeIrrigazione;
int resetIrrigazione;
int ledIrrigazione;

void trasmissioneDati()
  int sens5 = analogRead(A6);
  int sens4 = analogRead(A5);
  int sens3 = analogRead(A4);
  int sens2 = analogRead(A3);
  int sens1 = analogRead(A2);
  int statoAllagamento = digitalRead(3);
  Blynk.virtualWrite(V15, sens5);
  Blynk.virtualWrite(V14, sens4);
  Blynk.virtualWrite(V13, sens3);
  Blynk.virtualWrite(V12, sens2);
  Blynk.virtualWrite(V11, sens1);

  if (statoAllagamento == LOW && controlloAllarme == 1)

  if ((timerIrrigazione == 1 || manualeIrrigazione == 1) && controlloIrrigazione == 1)
    digitalWrite(4, LOW);
    Blynk.virtualWrite(V8, 255);
    digitalWrite(4, HIGH);
    Blynk.virtualWrite(V8, 0);

void setup()

  Blynk.begin(auth,  ssid, pass);

  pinMode(3, INPUT_PULLUP);
  pinMode(4, OUTPUT);

  digitalWrite(4, HIGH);

  timer.setInterval(2000L, trasmissioneDati);

  controlloAllarme = param.asInt();

  controlloIrrigazione = param.asInt();

  timerIrrigazione = param.asInt();

  manualeIrrigazione = param.asInt();

void loop()

I hope there is a solution to my problem, thank you!

What Blynk library version are you using?
What does your serial monitor show when this disconnection occurs?

Have you tried any reconnect code?


I’m using the library “BlynkSimpleWiFiNINA.h” in the online Arduino editor and I can’t find the version, but I assume it is the most recent. I cannot see the serial monitor, because the disconnect happens every 1-2 days, so I don’t want to keep the computer turned always on, but if is necessary I can do it. I’ve searched for a reconnect code and I fuond one some days ago, but now I don’t find it anymore (I haven’t saved it :shushing_face:).

In the Arduino IDE press Ctrl+Shift+I to open the Library Manager.
Search for Blynk and see which version of the library you have installed. If it’s anything other than 0.6.1 then uninstall the library and install 0.6.1 instead.

Search this forum, there are plenty of examples.