Dragino LG01-S receives unusual packet from Heltec WiFi LoRa32 and stops working

Hello everybody !

I have an issue with a connection between a Dragino LG01-S and Heltec WiFi LoRa 32.

The WiFi LoRa 32 sends packets with temperature data to the LG01-S every 5 seconds. The LG01-S receives the packets constantly, but after some time (could be 20 minutes, could be 7 hours) it receives a packet that isn’t like the others. I followed the packets in the Serial Monitor until a failed one showed up, that’s how I saw what they looked like.

The “failed” packets look like this:

¹h260äàŽÛNR·à,ªê@��ö9AÚ�o…Œ?£ÚK;Ë Í×.Ü*!®d§"
¿'ZoL

Usually it’s something like:

30.00

The size of the usual packets is five byte whereas the size of the failed packet is 73 bytes.

The failure is in the receiver(LG01-S) because after a failed packet shows up it just stops receiving any data and doesn’t execute any code at all. After the fail the LoRa32 keeps sending packets.

I checked if the fails are consistent, but they are not, as mentioned they occur at different times.

Below you can see the code for both the sender and the receiver.

Sender:

#include <SPI.h>
#include <LoRa.h>
#include "SSD1306.h"
#include<Arduino.h>
#include <dht.h>


SSD1306  display(0x3c, 4, 15);

#define DHTPIN  17

#define SS      18
#define RST     14
#define DI0     26
#define BAND    915E6

//create an instance of DHT sensor
dht TempSensor;

void setup()
{
  pinMode(16, OUTPUT);
  digitalWrite(16, LOW);
  delay(50);
  digitalWrite(16, HIGH);
 
  Serial.begin(115200);
  while (!Serial);
  display.init();
  display.flipScreenVertically();
  display.setFont(ArialMT_Plain_10);
  display.setTextAlignment(TEXT_ALIGN_LEFT);
  display.drawString(5, 5, "LoRa Sender");
  display.display();

  SPI.begin(5, 19, 27, 18);
  LoRa.setPins(SS, RST, DI0);
  Serial.println("LoRa Sender");
  if (!LoRa.begin(BAND)) {
    Serial.println("Starting LoRa failed!");
    while (1);
  }

  LoRa.setSyncWord(0xF3);
  Serial.println("LoRa Initial OK!");
  display.drawString(5, 20, "LoRa Initializing OK!");
  display.display();
  delay(2000);
}

void loop() {
  double check = TempSensor.read11(DHTPIN);
  Serial.println(TempSensor.temperature);
  Serial.print("Sending temperature: ");
  Serial.println(TempSensor.temperature);
  display.clear();
  display.setFont(ArialMT_Plain_16);
  display.drawString(3, 5, "Sending temperature ");
  display.drawString(50, 30, String(TempSensor.temperature));
  display.display();
  // sending packet
  LoRa.beginPacket();
  LoRa.print(TempSensor.temperature);
  Serial.println("package sent");
  LoRa.endPacket();
  delay(5000);
}

Receiver :

#include <SPI.h>
#include <LoRa.h>
#include <Console.h>
#include <Process.h>
#include <Bridge.h>

// Set center frequency
uint32_t freq = 915E6;
Process logdata;
int timeCounter = 0;
void setup() {
  Bridge.begin(115200);
  Console.begin();
  Console.println("LoRa Receiver");

  if (!LoRa.begin(freq)) {
    Console.println("Starting LoRa failed!");
    while (1);
  }
  LoRa.setSyncWord(0xF3);
  LoRa.receive();
}

void loop() {
  // try to parse packet
  int packetSize = LoRa.parsePacket();
  if (packetSize) {
    // received a packet read packet
    while (LoRa.available()) {
      String TemperatureData = LoRa.readString();
      Console.println(TemperatureData);
      Console.println(packetSize);
      //Save in db
      logdata.begin("lua");
      logdata.addParameter("/root/LinkTempInside.lua");  //
      logdata.addParameter(String(TemperatureData));  //
      logdata.run();  // run the command

      // read the output of the command
      while (logdata.available() > 0) {
        char c = logdata.read();
      }
      Console.println("Data Sent");
    }
  }
}

Thank you for the assistance.