ESP32 randomly stop working

_joko_
Posts: 2
Joined: Tue Jun 18, 2019 5:18 pm

ESP32 randomly stop working

Postby _joko_ » Tue Jan 05, 2021 8:41 am

Hello I have random failures on the ESP32 I program with Arduino IDE.

The sketch only does a simple temperature and relay circuit via MQTT. I use a W5500 Ethernet Shield for the internet connection.

At some point I get only cryptic characters via the Serial port, but only purely randomly. Only a power interrupt can fix the error. Actually the ESP32 should run 24/7, but sometimes it doesn't last a day.

Here is an output from the Serial Monitor:

Code: Select all

�JPQ�QQB��(Q�QQQ�TU��UP��QQEQB��(QUQQQ�TU��UP��QQEQB��(QUQQQ�TU��UP��QQEQB��(Q�QQQ�TU��UP��QQ�QB��(QUQ�TU��UP��QQEQB��(QUQQQ�TU��UP��QQEQB��(Q�QQQ�TU��UP��QQQQ���(Q�QQQ�TU��UP��QQ�QB��(Q�QQQ�TU��UP��QQQQB��(QEQ�TU��UP��QQ�QB��(Q�QQQ�TU��UP��QQ�QB��(Q�QQQ�TU��UP��QQEQB��(Q�QQQ�TU��UP��QQ�QB��(QUQ�TU��UP��QQEQB��(QUQQQ�TU��UP��Q�QQ���(Q�Q�TU��UP��Q��QB��(Q*QQ�TU��UP��Q�EQB��(Q�Q�TU��UP��Q�EQB��(Q�Q�TU��UP��Q�EQB��(QJQQ�TU��UP��Q��QB��(Q�QQ�TU��UP��Q�EQB��(Q�Q�TU��UP��Q�EQB��(QjQQ�TU��UP��Q�QQ���(Q�QQ�TU��UP��Q��QB��(Q�QQ�TU��UP��Q�QQB��(Q*(Q�*�P�V��ET�Q�UU�T��-�QVQ���J�UU�UT*T*J��ZqT��T�J�R�J�u�uT�T��U���-QBU��j��EJ�R�Zq��R�Zq�uT�Zq���R�Zq��WխQ(���խQ(Eե�I���T�U�UZ�Eu����(��UVKEu��RUQj�UV+U�UJ�Q�TUU�
An excerpt from the sketch is here:

Code: Select all

void loop() {
  unsigned long currentMillis = millis();
  if (!client.connected()) {
    reconnect();
  }
  client.loop();

  if (currentMillis - Temperaturabfrage_letzter_Zeitstempel >= Temperaturabfrage_Zeitintervall) {
    Temperaturabfrage_letzter_Zeitstempel = currentMillis;
    sensors.requestTemperatures();
    Serial.print("Temperatur PCB: ");
    float temp0 = sensors.getTempC(Temp_PCB);
    temp0 = ((int)(temp0*10)) / 10.0;
    Serial.println(temp0);
    client.publish("/Temperatur/Keller/PCB", String(temp0).c_str());
    Serial.print("Temperatur Gewächshaus oben: ");
    float temp1 = sensors.getTempC(Temp_oben);
    temp1 = ((int)(temp1*10)) / 10.0;
    Serial.println(temp1);
    client.publish("/Temperatur/Keller/Gewaechshaus_oben", String(temp1).c_str());
    Serial.print("Temperatur Gewächshaus unten: ");
    float temp2 = sensors.getTempC(Temp_unten);
    temp2 = ((int)(temp2*10)) / 10.0;
    Serial.println(temp2);
    client.publish("/Temperatur/Keller/Gewaechshaus_unten", String(temp2).c_str());
  }

  if (currentMillis - Temperaturabfrage_Gewaechshaus_letzter_Zeitstempel >= Temperaturabfrage_Gewaechshaus_Zeitintervall) {
    Temperaturabfrage_Gewaechshaus_letzter_Zeitstempel = currentMillis;
    sensors.requestTemperatures();
    Serial.print("Temperatur Gewächshaus oben für Heizung: ");
    float temp_oben_heizung = sensors.getTempC(Temp_oben);
    temp_oben_heizung = ((int)(temp_oben_heizung*10)) / 10.0;
    Serial.println(temp_oben_heizung);
    client.publish("/Temperatur/Keller/Heizung/Gewaechshaus_oben", String(temp_oben_heizung).c_str());
    Serial.print("Temperatur Gewächshaus unten für Heizung: ");
    float temp_unten_heizung = sensors.getTempC(Temp_unten);
    temp_unten_heizung = ((int)(temp_unten_heizung*10)) / 10.0;
    Serial.println(temp_unten_heizung);
    client.publish("/Temperatur/Keller/Heizung/Gewaechshaus_unten", String(temp_unten_heizung).c_str());
  }

  if (currentMillis - Heizung_letzter_Zeitstempel >= Heizung_Zeitintervall) {
    Heizung_letzter_Zeitstempel = currentMillis;
    if (power_gewaechshaus == '1') {
    Serial.println("Gewächshaus Heizung: ON");
    mcp1.digitalWrite(Heizung_Power, HIGH);
    }
    if (power_gewaechshaus == '0') {
    Serial.println("Gewächshaus Heizung: OFF");
    mcp1.digitalWrite(Heizung_Power, LOW);
    }
   }
  }
Which information do you also need?
I hope you have a tip.

Who is online

Users browsing this forum: No registered users and 74 guests