Arduino Nano 33 IOT connects to wifi, but not IDE

I picked up a Nano 33 IOT with the intention of programming it via wifi and not the cloud. The problem I'm having is that IDE can only see it sporadically. I can connect/upload to it over a USB cable, and after doing that IDE can see it, and upload to it, over wifi for a while, but the even then the IDE will only see it here and there and within a few minutes I can no longer connect to it at all.
What's confusing me is that even when IDE can't see it, it still maintains it's network connection. The router still shows it as connected and I can ping it etc, so it's still there. I have also tried disabling my computer's (Windows) firewall as well as my router's firewall, but since I know it's able to connect even with them enabled, I don't think that'll play into it.

I've spent the day trying to troubleshoot it, but I'm running into dead ends since most posts I can find are about it dropping the network connection or USB cable issues, not just IDE losing the ability to connect to it.

I'm not sure what information is going to be helpful here. The code is posted below. I'm running Arduino IDE 2.3.2. I updated to that version at some point during this project, but I honestly don't remember if the problem was present before I did that. Maybe I need to roll that back?

Also, it should be noted that this problem is present even when the board isn't connected to the rest of the project and is just plugged into a power source (either USB plugged into the wall or from a bench power supply to the Vin/Gnd pins).

Here's the code that's currently running, you'll have to excuse everything that's commented out and some of the random bits and pieces in there as I was trying to troubleshoot things. One of my thoughts was that it was dropping the connection during the delays, so I added the millis loop to see if that would give it a few seconds to connect so I could send new code over to it, but it didn't make a difference.

The board is connected to a pair of 8ch relay boards, all it's doing right now is turning one of the relays on or off every 5 minutes and at the moment, the only thing that relay is powering is a single LED and resistor. The random number stuff was the beginning of that part of the project, but then I started running into this problem and here we are.

/*

 This example connects to an WPA encrypted WiFi network.
 Then it prints the  MAC address of the Wifi shield,
 the IP address obtained, and other network details.
 It then polls for sketch updates over WiFi, sketches
 can be updated by selecting a network port from within
 the Arduino IDE: Tools -> Port -> Network Ports ...

 Circuit:
 * WiFi shield attached

 created 13 July 2010
 by dlf (Metodo2 srl)
 modified 31 May 2012
 by Tom Igoe
 modified 16 January 2017
 by Sandeep Mistry
 */
 
#include <SPI.h>
#include <WiFiNINA.h>
#include <ArduinoOTA.h>

#include "arduino_secrets.h" 
///////please enter your sensitive data in the Secret tab/arduino_secrets.h
/////// Wifi Settings ///////
char ssid[] = SECRET_SSID;      // your network SSID (name)
char pass[] = SECRET_PASS;   // your network password

const int RELAY_PIN = 3; //********
long randomNumber;  //*********
unsigned long previousMillis = 0;  //******* millis delay
const long interval = 50000;  //********millis delay
int status = WL_IDLE_STATUS;

void setup() {
  //Initialize serial:
  Serial.begin(9600);

  // check for the presence of the shield:
  if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("WiFi shield not present");
    // don't continue:
    while (true);
  }

  // attempt to connect to Wifi network:
  while ( status != WL_CONNECTED) {
    Serial.print("Attempting to connect to SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network. Change this line if using open or WEP network:
    status = WiFi.begin(ssid, pass);
  }

  // start the WiFi OTA library with internal (flash) based storage
  ArduinoOTA.begin(WiFi.localIP(), "Arduino", "password", InternalStorage);

  // you're connected now, so print out the status:
//  printWifiStatus();

    pinMode(RELAY_PIN, OUTPUT); //*************
}

void loop() {
  // check for WiFi OTA updates
 // ArduinoOTA.poll();
  //unsigned long currentMillis = millis(); //********millis delay
    //if (currentMillis - previousMillis >= interval) {  //******* millis delay
    //previousMillis = currentMillis; //*********millis delay
    //}
  
  // add your normal loop code below ...
//}

//void printWifiStatus() {
   //print the SSID of the network you're attached to:
//  Serial.print("SSID: ");
//  Serial.println(WiFi.SSID());

  // print your WiFi shield's IP address:
//  IPAddress ip = WiFi.localIP();
//  Serial.print("IP Address: ");
//  Serial.println(ip);

  // print the received signal strength:
//  long rssi = WiFi.RSSI();
//  Serial.print("signal strength (RSSI):");
//  Serial.print(rssi);
 // Serial.println(" dBm");
//randomSeed(analogRead(A7)); //*********
//randomNumber = random(2,5); //**********

    digitalWrite(RELAY_PIN, HIGH);  //********
  delay(300000);  //*************                          
  digitalWrite(RELAY_PIN, LOW);  //*********
  delay(300000);  //**********                                 
}

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.