Tx-LORA-Rx: Gaps In Tx

IDE 2.2.1, Arduino Uno 3

I'm trying to send some data from 1 Uno to another via a REYAX RYLR998 LORA module. I want this data to be sent 10 times per second. I can receive ok at lower speeds, like 5 per sec but that's it. (FYI the objective is to measure wave height out on a pier with an ultrasonic transducer and display that info several hundred feet away.)

I have condensed my code to a bare minimum to show the problem I'm facing. Here is a picture of a scope trace that demonstrates the problem:

Blue: Transmit data on Rx pin of LORA transmitting module.
Yellow: Receive data on Tx pin of LORA receiving module.
Pink: Pulse sent to piezo device when msg received (receiving Uno).

The first thing that makes no sense is the transmit data. It appears to be broken into 2 sections, one about 12ms in duration and the other around 8ms. Taken together this seems to encompass the full transmit string. Crazy thing is that the receive data (yellow) starts coincident with the start of the 2nd transmit section (the narrow pulse). Coincidence maybe.

Anyway, why am I not seeing the same transmit pulse length on every transmission?

Why are the transmit pulses not 100ms apart?

(I'm going to guess all this has something to do with lora.setTimeout. I have yet to find a detailed explanation of what this does.)

Now I'm going to try and post the code...

// TRANSMITTER CODE, BOATHOUSE

#include <SoftwareSerial.h>

SoftwareSerial lora(2, 3);

// We are unit #1 (boat dock), sending to unit #2 (house).
String boatdock_address = "1";   //Define Lora transmit address (this unit, boat dock).
String house_address = "2";   //Define Lora receiver address (remote unit, house).

void setup()
{
  pinMode(LED_BUILTIN, OUTPUT); //Transmit blinker
  Serial.begin(115200);  //set baud rate to serial monitor.
  lora.begin(9600);    //Set baud rate for LORA comm.
  lora.setTimeout(400);   //What is this???
}

void loop()
{
    lora.println("AT+SEND=" + house_address + ",5,PIEZO"); // Send "AT+SEND=2,5,PIEZO" +CRLF (19mS)
    
    delay(81); // Trying to get total loop time ~100mS.
}

// RECEIVER CODE, HOUSE

#include <SoftwareSerial.h>

#define piezo 10  //Piezo beeper on pin #10.

String incomingString;

SoftwareSerial lora(2, 3);

// We are unit #2 (house), receiving from unit #1 (boat dock).
// (We never use boatdock_address since we never xmit to boathouse. )
String house_address = "2";   //Define Lora address (this unit, house).
String boatdock_address = "1";   //Define Lora address (remote unit, boat dock).


void setup()
{
  pinMode(piezo, OUTPUT);
  Serial.begin(115200);
  lora.begin(9600);
  lora.setTimeout(125);
 }

void loop()
{
    if (lora.available()) {

    incomingString = lora.readString();
    char dataArray[30]; 
    incomingString.toCharArray(dataArray,30);
    char* data = strtok(dataArray, ",");
    data = strtok(NULL, ",");
    data = strtok(NULL, ",");
    
    if (strcmp(data,"PIEZO") == 0) {
      digitalWrite(piezo, HIGH);
      delay(10);
      digitalWrite(piezo, LOW);
    }
  
      }
}

Could be worth putting 'REYAX RYLR998' in the title of the post.

The module you using has a serial interface that has little to do with conventional LoRa as such since the device uses a custom AT serial interface for the send and receive functions.

There are some who have used the REYAX RYLR998 and you might benefit if you can grab their attention.

My bad. Blue trace was wrong. Here is the corrected trace. Different than what I described, but still showing the LORA module missing every other transmission. It seems the Uno is off the hook and the REYAX needs looking into.

This seems to be morphing into a different set of problems so I'll focus on just one.

The attached photo shows:

  1. top trace - data sent to the transmitting LORA.
  2. middle trace - data from the receiving LORA to the receiving Uno.
  3. bottom - Action the receiving Uno takes based on the received message (chirp piezo).

First is why does it take about 350ms for the message to be sent? But thats a LORA problem that I'll save for another day.

Second, why does it take the Uno so long (around 130mS) to chirp the piezo once the message has been sent to it?

readString() attempts to read a string and timesout if nothing received within the timeout period (default 1 second) - hence you can miss a sequence in the incomming data

try transmitting a newline on the end of the LoRa data

lora.println("AT+SEND=" + house_address + ",6,PIEZO\n"); // Send "AT+SEND=2,5,PIEZO" +CRLF (19mS)

and receiver reads until it finds a newline

incomingString = lora.readStringUntil('\n')

Well here's looking into it. It appears that the RYLR998 LORA does some sort of lockout after a transmission. I've discovered that if I send an AT+SEND command and follow that up with another within 170mSec then it will ignore that 2nd SEND command. So if I try to transmit a series of messages separated by more than 170mS, it works as expected. If I try to send messages with a separation of 100mS, it only transmits every other message.

Since my objective is to measure wave height and display it graphically with scrolling, I feel that I need a sample rate of around 10 Hz in order to accurately capture the wave peaks and troughs and to give a smooth flow to the graph. I can still measure every 100mS at the transmitter (the boat dock) and then transmit 2 samples in 1 message every 200mS, Then let the receiver software in the house handle displaying both samples separated by 100ms.

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