MKR1010 WIFI won't stay online for more than 20hrs

Hi everyone! I'm building my own observatory and trying to get things remotely controlled using Arduino MKR1010 WiFi and Blynk. It is pretty easy, I have configured all the 6 devices, building their net and making them work together (some have sensors, others control the moving roof basing on sensor data...)

Everything work fine.

The problem I am experiencing is about connection stability. I haven't mount anything in the observatory yet, actually making tests at home where I have a stable wifi ADSL signal.

Every device connects, then disconnects after some time (could be twice in an hour or once in 6 hours). I've looked for a solution in all threads already open about MKR1010 and then simply found the best and easiest code in the Blynk library examples under "handle disconnect" which has a simple sketch I copied and pasted in all my 6 sketches

if (WiFi.status() != WL_CONNECTED){
    // check delay:
    if (millis() - lastConnectionAttempt >= connectionDelay){
      lastConnectionAttempt = millis();
      // attempt to connect to Wifi network:
      if (pass && strlen(pass)){
        WiFi.begin((char*)ssid, (char*)pass);
      }
      else{
        WiFi.begin((char*)ssid);
      }
    }
  }
  else{
    Blynk.run();
  }

This is in the loop, so the first thing to do is check connection. This way I am able to solve automatically a disconnection. Anyway this is not working forever: actually I cannot reach 24 hours of continuous communication.

I absolutely excluded a wiring problem: even with nothing connected to it but the micro USB for power, MKR1010 behave the same way. (It doesn't send any data, but Blynk app notifies me when it goes offline)

I thought about a powering problem, so I tried adding a LiPo battery to buffer power issues: no way. Absolutely the same behavior. I tried it connected to the Mac USB port (0,5A), to iPhone power adapter (1A) and to a power bank QC port (2,1A). It seems to last longer on the USB, but it is an impression.

This morning I found it offline so I tried stopping power supply via USB (iPhone charger 1A) but leaving the LiPo battery connected so the MKR1010 did NOT reboot. After about 30 seconds I switched on again. Now it is connecting for short periods and going offline for minutes.

My impression is that power supply is overheating something in Arduino board and sometimes it needs to cool down. Is this possible?
I cannot find any solution and it is a month I'm trying to solve

MacBook Pro 13" late 2015 with OS X Catalina up to date
Arduino IDE version 1.8.13 with up to date libraries
Arduino MKR1010 brand new with latest WIFI NINA version (problem occurring even with default version)

I’m sorry with moderators for choosing the wrong section. I posted under “troubleshoot with Arduino boards not with projects” Because I do think there is a problem with power and overheating.
You moved the post in “Nano 33 BLE for short range BT interaction“ which has nothing to do with a WiFi problem. Can you please move in a more appropriate section so it can have the needed attentions?

I do not have the Arduino MKR WiFi but used the Arduino Nano 33 IoT. The boards are almost the same when I remember correctly.

Have a look at the following post reply #30. I have written an example of a state machine I use to restart and reconnect WiFi. I have experiments running for many month with multiple reconnects every day.

WiFi not Stable over longer periods. Is this normal? Ideas?

You need to do a little bit more work to properly restart the WiFi connection reliably.

Also, the WiFi.status function cannot be relied on to detect disconnects. It is better to check on the layers above, whether you still received data. Its OK when you use it during initialization.

Thank you Klaus for answering, I'm going to take a look.

I have an update: Arduino passed all night on battery-only and connection is on since 22.32 (10+ hours). This never happened on USB powering

I plugged in USB to recharge battery at 8.28 and had first disconnection at 8.46 (3 minutes after last reply)

Hi, did you ever come to a conclusion or solutions regarding this issue?
I'm having sort of the same issue...

eeeeivind:
Hi, did you ever come to a conclusion or solutions regarding this issue?
I'm having sort of the same issue...

Welcome to the forum

Have a look into the post in reply #2. You need to change your software to include error handling. Wireless protocols are inherently more error prone than wired ones. The universe is filled with electromagnetic waves and the 2.4 GHz ISM band is one of a few that can be used by everyone without a license.
So, with distance to your router, number of walls, wall material, the number of people around you and time of day the chances increase that messages get lost. The router assumes your device switched off or left the place and the connection is dropped.
Your sketch will need to restart the connection. My state machine example simplifies this process. It closes everything and starts all protocols.

Please read the "How to post". It is at the beginning of each sub forum. Create your own post, share your code (use code tags) and provide some more detailed description of your issues or questions you might have. Feel free to send me a PM with the link to your post.