Hello everyone,
I am trying to establish a direct connection between my Arduino MKR 1310 and a Robustel R3000-LG4LA Gateway using LoRa, without using the Internet or the LoRaWAN network. My goal is to send messages from the Arduino to the gateway and be able to view them directly on the gateway. I’m not using the Internet or network for now because this is the initial phase of a project, where the goal is to keep communication over the air (OTA) for the time being.
Current Setup:
- Hardware :
- Arduino MKR 1310 with LoRa module
- Robustel R3000-LG4LA Gateway
- Software on Robustel R3000-LG4LA Gateway :
- Firmware version 5.2.9
- Installed applications:
- Loriot version 5.0.1
- Rcms version 5.2.0
- Frequency : Both devices are set to operate at 868 MHz.
- LoRa Parameters :
- Bandwidth : 125 kHz
- Spreading Factor : 7 (I have tried values from 7 to 12)
Issues Encountered:
- No Communication : Despite both devices being set with the same parameters, I am unable to establish communication between the Arduino and the gateway.
- No Message Display : I cannot see the messages sent from the Arduino on the gateway’s monitor.
Questions:
- Are there any specific settings I need to configure on the gateway to receive data directly from the Arduino?
- How can I check if the signal is being correctly sent from the Arduino?
- Are there any code examples or configurations that might help me solve this issue?
The code I am currently using on my Arduino board is as follows.
Any help or advice would be greatly appreciated. Thank you in advance!
#include <SPI.h>
#include <LoRa.h>
int counter = 0;
bool runProgram = true; // Variable para controlar la ejecución del envío de paquetes
bool loraInitialized = false; // Variable para verificar la inicialización de LoRa
void setup() {
Serial.begin(9600);
while (!Serial); // Espera hasta que se inicie el puerto Serial
Serial.println("LoRa Sender");
// Inicializa LoRa con la frecuencia correcta (868 MHz para Europa, 915 MHz para Norteamérica)
if (!LoRa.begin(868E6)) {
Serial.println("Starting LoRa failed!");
while (1);
} else {
loraInitialized = true; // Marca como inicializado
}
// Configuración adicional de LoRa
LoRa.setSpreadingFactor(7); // Spreading Factor entre 7 y 12
LoRa.setSignalBandwidth(125E3); // Bandwidth (125 kHz es lo más común)
// Muestra en el monitor serial los parámetros de configuración solo si LoRa fue inicializado correctamente
if (loraInitialized) {
Serial.println("LoRa initialized with the following parameters:");
Serial.println("Spreading Factor: 7");
Serial.println("Signal Bandwidth: 125 kHz");
}
}
void loop() {
// Control del programa a través de comandos seriales
if (Serial.available() > 0) {
char command = Serial.read(); // Lee el comando desde el Monitor Serie
if (command == 's') { // 's' para detener el programa
runProgram = false;
Serial.println("Sending paused");
}
if (command == 'r') { // 'r' para reanudar el programa
runProgram = true;
Serial.println("Sending resumed");
}
}
// Solo envía los paquetes si el programa está corriendo y LoRa fue correctamente inicializado
if (runProgram && loraInitialized) {
String message = "Message from Arduino, packet # " + String(counter);
Serial.print("Sending packet: ");
Serial.println(message); // Muestra en el monitor serial el mensaje que se va a enviar
// Inicia el paquete de LoRa
LoRa.beginPacket();
LoRa.print(message); // Envía el mensaje
LoRa.endPacket(); // Finaliza el paquete y lo envía
counter++; // Incrementa el contador para que cada mensaje sea único
}
delay(5000); // Espera 5 segundos antes de enviar el siguiente paquete
}