**LoRa E5 Need Urgent Help** Please respond!

Hi, I am coding a project for NASA Student Launch. A ground station will send an arming command for an autonomous drone deployment at 400 ft (triggered with an altimeter). I programmed a GPS transmitter and rocket using the LoRa E5s and got telemetry from apogee with it. However, using the LoRas for the drone deployment sequence has been very flaky for me. Sometimes, the Loras can send their command, but more often than not, they don’t.
To make matters worse, the LoRa that listens for the arming command sometimes gets interference from the onboard GPS transmitter, and the arming command cannot be received. The wiring is not the issue here; I feel as if I’m not programming the Loras correctly. Can anyone please suggest improvements on the code? I use the test mode for everything, and I feel that might be a contributing factor.

Please let me know if I left anything out that can be helpful for you in giving advice.

Groundstation Armer
#include <SoftwareSerial.h>
const byte Rx = 3;
const byte Tx = 2;
SoftwareSerial Serial1(Rx,Tx);
void setup() {
Serial.begin(9600);
Serial1.begin(9600);
// Serial1.write(“AT+ MODE= RESET\r\n”);
delay(1000);
Serial1.write(“AT+TEST=RFCFG,868,SF7,125,8,8,14,ON,OFF,OFF”);
delay(1000);
Serial1.write(“AT+ MODE= TEST\r\n”);
}
void loop() {
Listen();
}
void TX() {
Serial1.write(“AT+TEST=TXLRSTR, “ARM”\r\n”);
//Serial1.write(“AT+MSG=“ARM”\r\n”);
}
void Listen(){
if(char(Serial.read()) == ‘1’){
TX();
}
}

Onboard Deployment System

#include <SoftwareSerial.h>
//int enA = 4;
int in1 = 3;
int in2 = 5;
bool RSO_Permission = false;
bool configured = false;
bool configured_1 = false;
bool configured_2 = false;
bool deployed = false;
bool Open_2 = false;
const byte rxPin = A1; //Yellow on LoRa!
const byte txPin = A2; //White on LoRa!
int firingPin = 7;
int LED = 4;
SoftwareSerial mySerial(rxPin, txPin);
void setup() {
pinMode(firingPin, INPUT_PULLUP);
//pinMode(enA, OUTPUT);
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
pinMode(LED, INPUT);
Serial.begin(9600);
mySerial.begin(9600);
Configure_Receiver();
while (configured == false) {
configured = Configure_Barrel_Break(configured);
Close(5);
digitalWrite(LED, HIGH);
delay(10);
digitalWrite(LED, LOW);
delay(10);
}
while (configured_1 == false) {
configured_1 = Configure_Barrel_Break_1(configured_1);
Open(5);
digitalWrite(LED, HIGH);
delay(10);
digitalWrite(LED, LOW);
delay(10);
}
}
void loop() {
Close(5);
while (RSO_Permission == false) {
RSO_Permission = Listen(RSO_Permission);
}
// Serial.println(“STANDBY FOR SAIL DEPLOY”);
if (digitalRead(firingPin) == LOW) { // Corrected the condition here
Butter_Dawg();
deployed = true;
}
while (deployed == true){
while (Open_2 == false) {
Open_2 = Listen(Open_2);
}
Open(5);
}
}
bool Listen(bool RSO_Permission) {
if (mySerial.find("+TEST: RX “”)) {
String receivedString = mySerial.readStringUntil(’"’);
Serial.println(“Received: " + receivedString);
// Find the position of the first double quote after “+TEST: RX "
int startPos = receivedString.indexOf(””", 11);
// Extract the substring starting from startPos + 1 and with a length of 8
String parsedString = receivedString.substring(startPos + 1, startPos + 1 + 15);
Serial.println("Parsed: " + parsedString);
if (parsedString == “41524D”) {
RSO_Permission = true;
digitalWrite(LED, HIGH);
} else {

  RSO_Permission = false;
}

}
return RSO_Permission; // Return RSO_Permission outside the if block
}
void Close_Flight() {
//digitalWrite(enA,HIGH);
digitalWrite(in1, LOW);
digitalWrite(in2, HIGH);
delay(5);
}
void Close(int Time) {
//digitalWrite(enA,HIGH);
digitalWrite(in1, LOW);
digitalWrite(in2, HIGH);
delay(Time);
}
void Open(int Time) {
//digitalWrite(enA, HIGH);
digitalWrite(in1, HIGH);
digitalWrite(in2, LOW);
delay(Time);
}
void Butter_Dawg() {
Open(11000);
Close(5000);
}
void Scan() {
if (mySerial.available()) {
Serial.write(mySerial.read());
}
if (Serial.available()) {
mySerial.write(Serial.read());
}

//This checks for data from whatever is connected to Serial1 (i.e. the lora)
//if (Serial1.available())
//{
// Serial.write(Serial1.read());
//}
//if (Serial.available())
//{
// Serial1.write(Serial.read());
//}
}
void Configure_Receiver() {
// mySerial.write(“AT+ MODE= RESET\r\n”);
delay(1000);
mySerial.write(“AT+ MODE= TEST\r\n”);
delay(1000);
mySerial.write(“AT+TEST=RFCFG,868,SF7,125,8,8,14,ON,OFF,OFF”);
delay(1000);
mySerial.write(“AT+ TEST= RXLRPKT\r\n”);
delay(1000);
void Parse() {
if (mySerial.find("+TEST: RX “”)) {
String receivedString = mySerial.readStringUntil(’"’);
// Find the position of the first double quote after “+TEST: RX "
int startPos = receivedString.indexOf(”"", 11);
// Extract the substring starting from startPos + 1 and with a length of 8
String parsedString = receivedString.substring(startPos + 1, startPos + 1 + 8);
Serial.println(parsedString);
}
}
bool Configure_Barrel_Break(bool configured) {
if (mySerial.find("+TEST: RX “”)) {
String receivedString = mySerial.readStringUntil(’"’);
Serial.println(“Received: " + receivedString)
// Find the position of the first double quote after “+TEST: RX "
int startPos = receivedString.indexOf(””", 11);
// Extract the substring starting from startPos + 1 and with a length of 8
String parsedString = receivedString.substring(startPos + 1, startPos + 1 + 15);
Serial.println(“Parsed: " + parsedString);
if (parsedString == “41524D”) {
configured = true;
return configured;
} else {
configured = false;
}
}
return configured; // Return RSO_Permission outside the if block
}
bool Configure_Barrel_Break_1(bool configured) {
if (mySerial.find(”+TEST: RX “”)) {
String receivedString = mySerial.readStringUntil(’"’);
Serial.println(“Received: " + receivedString);
// Find the position of the first double quote after “+TEST: RX "
int startPos = receivedString.indexOf(””", 11);
// Extract the substring starting from startPos + 1 and with a length of 8
String parsedString = receivedString.substring(startPos + 1, startPos + 1 + 15);
Serial.println("Parsed: " + parsedString);
if (parsedString == “41524D”) {
configured = true;
return configured;
} else {
configured = false;
}
}
return configured; // Return RSO_Permission outside the if block
}

I have written a sketch in practice that uses AT commands to send and receive data. I think it may possibly be helpful.
nRF52_LoRa-E5_ATCommand.zip (5.5 KB)

When you post your sketch, use </> to make it easier for everyone to read.
(I would like to run your sketch, but my LoRa-E5 cannot run AT commands because I have rewritten the firmware.)

Thank you for the response. In the future I will make posts using the feature you mentioned, my apologies. But is there anything inherently wrong with using the test mode for p2p communications?

My sketch was able to communicate P2P without any problems. However, I remember that it did not work well depending on the timeout value or the interval between transmission and reception.

Hi there,
I can only add that your code should include a method to Acknowledge the Reception on data
LORA’s achilles heal is no Handshake or confirmation for received packets. It’s like the UDP protocol on the NET, basically a broadcast on channel and Freq. No acknowledgement.

IMO , implementing that can improve reliability and guarantee data integrity.
some form of CRC or byte count with a time, for syncing sender and receiver.
HTH
GL :slight_smile: PJ

This may be the issue I am havin. Do you see how I’m configuring the Loras? It’s this line of code:

mySerial.write(“AT+TEST=RFCFG,868,SF7,125,8,8,14,ON,OFF,OFF”);

I have my GPS system on another Lora that operates of 915 MHz. The Lora for the deployment system constantly receives packets from the GPS (even though they are on separate frequencies). This is bad because the onboard system no longer is able to receive the arming command (I think it gets flooded from too many packets from the GPS interference. Please help this is really frustrating me.

Is my approach completely wrong here? Should I be using Test mode for the Loras? This will operate in a farm field in upstate NY (where we launch our rockets) and there is no internet access. Is there any way to have these LoRas operate on specific addresses? I found the AT-MSG = “Data to send” command but idk how to configure the receiver and transmitter to talk to one another.

Also, I’ve tried to configure the receiver to have a higher sensitivity by changing the spread factor from SF7 to SF12. I do this by changing:

mySerial.write(“AT+TEST=RFCFG,868,SF7,125,8,8,14,ON,OFF,OFF”);

To this:

mySerial.write(“AT+TEST=RFCFG,868,SF12,125,8,8,14,ON,OFF,OFF”);

When I do this the lora never receives any packets. I have a similar issue with the output power of the transmitter as well. When I try to increase the output dBm to a higher number (it’s defaulted at 14) to a higher value, they behave unpredictably. Can you guys also assist me in the correct AT command to increase the spread factor of the receiver and the output power of the transmitter? As you might’ve notice by now I have a very simplistic understanding of how to use these devices. Please address these concerns above and lmk if anything is unclear. Please, please respond, the success of my rocket team is on this deployment code and I cannot find any understandable information besides the AT command manual.

Can you guys also assist me in the correct AT command to increase the spread factor of the receiver and the output power of the transmitter?

Both receiver and transmitter have the same AT+TEST=RFCFG setting.

Outputs above 14 dBm may be prohibited by firmware in some devices.
Setting to SF12 improves the reception sensitivity but increases the communication time very much, and the GPS spends more time disturbing the Arm.
I think the LoRa handshake needs to be written by the user using AT commands at the transmitter and receiver.
How does the Onboard Deployment System ensure the timing of reception from the Groundstation Armer while receiving large amounts of data from the GPS?

edit:
Could you re-submit the sketch again using </> ?
What are the specific names of the boards used in the “Groundstation Armer” and “Onboard Deployment System” ?
What are the specific names of the LoRa boards ?
Can you please provide a link to the <SoftwareSerial.h> library ?

1 Like