Heltec-Aaron-Lee / WiFi_Kit_series

Arduino source codes and toolchain for WiFi_Kit_series made by HelTecAutomation.
GNU Lesser General Public License v2.1
769 stars 307 forks source link

WIFI_LoRa_32 Module Hangs Up when running for several hours #65

Open protopals opened 5 years ago

protopals commented 5 years ago

Below shows my setup:

[LoRa Device (sensor)] <--------(50 meters)----------> [Heltec WiFi LoRa 32] <------> (WiFi Network)

Essentially, the Heltec WiFi LoRa serves as a gateway to the cloud.

I am currently experiencing an issue where the Heltec WiFi LoRa module just hangs up after running for several hours. It works okay that first time you power it up in receiving and transmitting data to the LoRa module that is 50 meters away. The amount of data transferred is not really that many -- only about 20 bytes, and only happens once or twice a day. So basically, the Heltec WiFi LoRa module is just waiting for any data packet coming from the external LoRa device. After about a day or so, the Heltec WiFi LoRa hangs up when it receives data packet from the LoRa device. I am just wondering if this issue is already known, and if a fix is available.

I wish I can capture exception code when it happens, but the issue occurs so intermittently -- sometimes within 24 hours or sometimes within 72 hours from the time the module is powered on.

kampto commented 5 years ago

Is it really hung up or is just the OLED hung up? My OLED hangs up after a few hours but the board is still functioning but OLED is froze. So to get it going again I have a function in the sketch to reset the OLED after a given time. In my case every 2 hours. Oled_RST is Pin 16.

void OledReset(){
  if (millis() - OledResetTimer > OledResetDelay) {
//// Reset OLED incase it got hung up
    pinMode(Oled_RST,OUTPUT); digitalWrite(Oled_RST, LOW); delay(100); digitalWrite(Oled_RST, HIGH); // while OLED is running, must set GPIO16 in high
    display.init(); display.flipScreenVertically(); display.setFont(ArialMT_Plain_24); // Initialising the UI will init the display too.
    display.drawString(0, 0, "Reset");
    display.drawString(0, 24, "OLED...");
    display.display(); delay(600); display.clear();
    OledResetTimer = millis(); 
    }
 }
protopals commented 5 years ago

@kampto Thanks for your reply. In my case, the display hangs up just upon receiving the LoRa packet after it has been waiting for a long time (like ~24 hours), so I was under the impression that it is related to LoRa reception. I am not able to replicate the issue when I am constantly sending LoRa packet -- it only seem to happen when no communication is happening for several hours followed by a packet reception. In your case of OLED hung up, are you sending/receiving LoRa packets?

kampto commented 5 years ago

I dont know what triggers my OLED to hang up. Just noticed it was froze up occasionally when I go to look at it. Was figuring it was an i2c issue since its constantly scrolling data. But also could be related to a send / receive event which I have set up to about every couple minutes. It does this on a couple of my boards.

protopals commented 5 years ago

@kampto I see. Mine is more of static texts (mainly for development purposes) that only changes when I get a new data off the LoRa channel. I am using the OLED driver that uses the full buffer.

protopals commented 5 years ago

I have determined that it is the MCU that hangs up and not the OLED module. Hang up happens when receiving data from a LoRa node. Not really sure what's happening here as it occurs intermittently (several days).

KevinMOcean commented 5 years ago

Use a watchdog. Especially if always works within say a 12 hour period. Just curious, what is the environment temperature you're testing in?