[Solved] Lora Arduino serial data speed

I tested two lora 433mhz with a simple test using this one minute tutorial:
Send and Receive Messages on Arduino

When i sent a single character like '1', the speed is painfully slow (both sender and receiver are in the same room). It takes 2 seconds to show up on the serial monitor of the receiving end. What causes this? Would a 2.4GHz lora make it faster?! since it claims less latency. Could it be the IDE, or would using a different microcontroller on the receiving end like an ST help?

Please post your code.
You've probably got a serial timeout issue.

Sender:

#include <SoftwareSerial.h>

SoftwareSerial loraSerial(2, 3); //TX, RX

void setup() {

  Serial.begin(9600);
  loraSerial.begin(9600);


}

void loop() {

  if (Serial.available() > 0) {
    String msg = Serial.readString();
    loraSerial.print(msg);
    Serial.println(msg);
  }

}

Receiver:

#include <SoftwareSerial.h>

SoftwareSerial loraSerial(2, 3); //TX, RX

void setup() {

  Serial.begin(9600);
  loraSerial.begin(9600);


}

void loop() {

  if (loraSerial.available() > 0) {
    String input = loraSerial.readString();
    Serial.println("Received:"); Serial.println(input);
  }

}

Why not println?

was copying tutorial, ok sure i add println and delete the line under. But what is the cause of the problem (delay) do u think?

Did you (note spelling) read the reference page for readString?

Why not?

I have not, is there a problem with the way i used it? is it causing the delay?

You can shorten the timeout, or you can use readStringUntil.

Or drop String entirely.

Serial LoRa modules can behave like this.

Can you tell us which Serial LoRa modules you are using ?

lora e32ttl100 433mhz 10mw

/*
 * LoRa E32-TTL-100
 * Write on serial to transfer a message to other device
 * https://www.mischianti.org
 *
 * E32-TTL-100----- Arduino UNO
 * M0         ----- GND
 * M1         ----- GND
 * TX         ----- PIN 2 (PullUP)
 * RX         ----- PIN 3 (PullUP & Voltage divider)
 * AUX        ----- Not connected
 * VCC        ----- 3.3v/5v
 * GND        ----- GND
 *
 */
#include "Arduino.h"
#include "LoRa_E32.h"
 
LoRa_E32 e32ttl100(2, 3); // e32 TX e32 RX
 
void setup() {
  Serial.begin(9600);
  delay(500);
 
  Serial.println("Hi, I'm going to send message!");
 
  // Startup all pins and UART
  e32ttl100.begin();
 
  // Send message
  ResponseStatus rs = e32ttl100.sendMessage("Hello, world?");
  // Check If there is some problem of successfully send
  Serial.println(rs.getResponseDescription());
}
 
void loop() {
    // If something available
  if (e32ttl100.available()>0) {
      // read the String message
    ResponseContainer rc = e32ttl100.receiveMessage();
    // Is something goes wrong print error
    if (rc.status.code!=1){
        rc.status.getResponseDescription();
    }else{
        // Print the data received
        Serial.println(rc.data);
    }
  }
  if (Serial.available()) {
      String input = Serial.readString();
      e32ttl100.sendMessage(input);
  }
}

This is the current code being tested, if i remove string code i wouldnt know what to place it with. If i remove string completely it will give an error

The e32 modules are a LoRa module with microcontroller and UART in front of it.

The issue your having is not to do with the LoRa device itself but the specific firmware used by the microcontroller and UART in the e32.

These UART based modules will have a degree of latency since the UART front end has to have a timout of sorts, it waits a period after serial input has stopped before deciding when to send a packet. Details in the devices datasheet.

But look how fast the led blinks at 12:50 in this video. Is there a way around it?

E32 blinking led

How do you shorten the timeout or drop the string entirely?

I suggested you dropped the use of String.
As for the timeout, there's always the documentation

I read the documentation and used Serial.setTimeout(1); IT DOES make it a second faster yay :slight_smile: ....what do you mean by dropping the string? because i tried using readStringUntil but that doesnt change anything..... what does dropping the string entail?

I never said you shouldn't use strings - I implied you should avoid Strings.

i want to send data from one lora to the other; is there a way to do it without using a string?

LoRa modules are SPI based and there are several libraries that make it easy to send data or variables or structures.

Its possible that someone might come up with a solution you want for these E32 modules, but the majority of LoRa stuff is done using the SPI modules and for good reasons.

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