Sense ESP32S3 turning off after a while?

I’m running the video streaming example code with no changes other than some camera settings (Camera Usage for Sense Version | Seeed Studio Wiki). I have a heat sink on it to dissipate heat. It seems like it can run for hours at a time no problem, but at some point it will just stop working, even if the web page is open and streaming video.

When it stops working, both lights turn off and it’s no longer on the wifi network, but it’s still doing something because it’s still hot 8 hours after it stopped working.

Anyone know what could be wrong or what I can do to try to debug this?

Hi there,
Welcome. Are you using the face detection ? or the LED flash?
The default sketch has the serial port , debugging are you doing that?
Sounds like a buffer issue causing it to “Fall” off the WiFi, you have an SD card installed?
More info and real code might be a better help. Lots of smart folks on here to help too.
HTH
GL :slight_smile: PJ :christmas_tree:

1 Like

i wonder if some sleep can be incorporated in that code to reduce heat… i was like what da… when i left it plugged in and went off and did something else for a while

FYI

How is camera supposed to be connected to module or just flop around? i thought the sd card adapter was going to be big enough to stick it to… but no…

Ya, the code is just the example code other than:

  • Added a 5 second timeout so it doesn’t get stuck waiting for the serial port
  • Disabled LED flash
  • Reduced XCLK to 10MHz to try to handle heat a bit better
  • Changed some camera image settings like default frame size, quality, etc…

I think I figured out the issue though. My router restarts every night overnight and that’s when the Sense stops working. So do I need to add code to check the wifi connection and reconnect if needed? Do you know where I’d put it? The example code has “// Do nothing. Everything is done in another task by the web server” in the loop method, so I figure it has to go somewhere else.

Hi there ,
Yes I see the wiki code here;

WiFi.begin(ssid, password);
  WiFi.setSleep(false);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");

  startCameraServer();

  Serial.print("Camera Ready! Use 'http://");
  Serial.print(WiFi.localIP());
  Serial.println("' to connect");
}

void loop() {
  // Do nothing. Everything is done in another task by the web server
  delay(10000);
}

with the "DO Nothing in the Loop.
Make sure the debug tick is commented out as well.
I would implement this WIFi reconnect function.
“To reconnect to Wi-Fi after a connection is lost, you can use WiFi.reconnect() to try to reconnect to the previously connected access point:”

unsigned long previousMillis = 0;
unsigned long interval = 30000;

unsigned long currentMillis = millis();
// if WiFi is down, try reconnecting
if ((WiFi.status() != WL_CONNECTED) && (currentMillis - previousMillis >=interval)) {
  Serial.print(millis());
  Serial.println("Reconnecting to WiFi...");
  WiFi.disconnect();
  WiFi.reconnect();
  previousMillis = currentMillis;
}

Stay away from “delay(XXX);” use the millis where you can.
you can tweak that , and may not need the WiFi disconnect(); but for by the book code you do, lol :slight_smile: You also may want to flash fast the BLUE LED to indicate a Loss of WiFi while using reconnect and Go RED if it times out and fails. Gives a visual read out of the connection status.

Test by turning off the AP and see if it recover after you plug back in.
HTH
GL :slight_smile: PJ :santa: :v:

1 Like

Thanks so much, that seems to work. Here’s the code I ended up with:

// end of setup()
  WiFi.begin(wifiSsid, wifiPassword);
  WiFi.setSleep(false);
  Serial.print("Connecting WiFi...");
  waitForWifi();

  startCameraServer();
  cameraReady();
}

void loop() {
  unsigned long currentMillis = millis();
  if (currentMillis - previousWifiCheck > wifiCheckInterval) {
    if (WiFi.status() != WL_CONNECTED) {
      WiFi.disconnect();
      WiFi.reconnect();
      Serial.print("Reconnecting WiFi...");
      waitForWifi();
      cameraReady();
    }
    previousWifiCheck = currentMillis;
  }
}

void waitForWifi() {
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected.");
}

void cameraReady() {
  Serial.print("Camera ready at 'http://");
  Serial.print(WiFi.localIP());
  Serial.println("'");
}
1 Like