Hello,
We encountered difficulty trying to transmit and receive a message from 5 km apart. We bought two transceiver modules from Sparkfun (LoRa 1W Breakout, 433M30S) with a matched antenna at 50 ohms impedance. The codes for transmitter and receiver can be found at the end of the document. When the power command (lora.setOutputPower(30)) was set at 30 dbm (1W), the Arduino library didn’t accept it and didn’t work. Moreover, when set at 20 dBm, the transmission worked but with a weak signal (high RSSI). Both receiver and transmitter codes can be seen at the end for your kind attention.
Kindly could you indicate the way forward or otherwise so we could be able to transmit at full power at 1W?
We also followed the FAQ found on the user manual but with no avail, as seen below.
• The communication distance will be affected when obstacle exists.
When tested, no obstacles were here.
• Data lose rate will be affected by temperature, humidity and co-channel interference.
No abnormal temperature and humidity, and no co-channel interference.
• The ground will absorb and reflect wireless radio wave, so the performance will be poor when testing near ground.
The receiver and transmitter were placed 1.5 meters above the ground on a stand when testing.
• Sea water has great ability in absorbing wireless radio wave, so performance will be poor when testing near the sea.
The setup was tested at the countryside.
• The signal will be affected when the antenna is near metal object or put in a metal case.
The setup was tested with no near metal objects nor placed in metal case at the line of sight.
• Power register was set incorrectly, air data rate is set as too high (the higher the air data rate, the shorter the distance).
Power register was set 30dbm and the outcome was the Arduino library didn’t accept it, and also when the register was at 20dbm the signal was too weak. Moreover, the air data rate was selected at minimum.
• The power supply low voltage under room temperature is lower than 2.5V, the lower the voltage, the lower the
transmitting power.
The power supply was correctly given 5.0V at 1A.
• Due to antenna quality or poor matching between antenna and module.
The antenna is perfectly matched at 50ohms for both module and antenna.
LoRa 1W Breakout - 433M30S for both transmitter and Receiver
Transmitter code
#include <RadioLib.h>
// SX1276 has the following connections: NSS, DIO0, DIO1, RST, MOSI, MISO, SCK
SX1276 lora = new Module(10, 2, 9, 3); // NSS, DIO0, RESET, DIO1
int txPower = 30; //
void setup() {
Serial.begin(9600);
// Initialize LoRa communication at the desired frequency (e.g., 433 MHz or 915 MHz)
Serial.print(F("Initializing LoRa… "));
int state = lora.begin(433.0);
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F(“success!”));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
}
// Set output power
lora.setOutputPower(txPower);
Serial.print(F(“Transmit power set to: “));
Serial.print(txPower);
Serial.println(F(” dBm”));
}
void loop() {
// Send packet every second
String message = “LoRa Test Packet”;
Serial.print(F("Sending packet: "));
Serial.println(message);
int state = lora.transmit(message);
// Check for transmit success
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F(“success!”));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
}
// Wait a second before sending another packet
delay(1000);
Receiver Code
#include <RadioLib.h>
#include <math.h>
// SX1276 module configuration
SX1276 lora = new Module(10, 2, 9, 3); // NSS, DIO0, RESET, DIO1
// Propagation parameters
float A = -71; // RSSI at 1 meter (calibrated value)
float n = 2.0; // Path loss exponent (adjust based on environment)
void setup() {
Serial.begin(9600);
// Initialize LoRa communication at the desired frequency (433 MHz for this example)
Serial.print(F("Initializing LoRa… "));
int state = lora.begin(433.0);
if (state == RADIOLIB_ERR_NONE) {
Serial.println(F(“success!”));
} else {
Serial.print(F("failed, code "));
Serial.println(state);
while (true);
}
Serial.println(F(“LoRa Receiver Ready”));
}
void loop() {
// Receive LoRa packet
String str;
int state = lora.receive(str);
// Check if a packet was received
if (state == RADIOLIB_ERR_NONE) {
// Packet received successfully
Serial.print(F("Received packet: "));
Serial.println(str);
// Get RSSI
int rssi = lora.getRSSI();
Serial.print(F("RSSI: "));
Serial.println(rssi);
// Calculate and display estimated distance
float distance = calculateDistance(rssi, A, n);
Serial.print(F("Estimated distance: "));
Serial.print(distance);
Serial.println(F(" meters"));
} else if (state == RADIOLIB_ERR_RX_TIMEOUT) {
// Timeout error, no packet received
//Serial.println(F(“Receive timeout”));
} else {
// Some other error occurred
Serial.print(F("Receive failed, code "));
Serial.println(state);
}
// Wait a moment before checking for another packet
delay(1000);
}
// Function to calculate distance based on RSSI
float calculateDistance(int rssi, float A, float n) {
// RSSI distance formula: d = 10^((A - RSSI) / (10 * n))
float distance = pow(10, (A - rssi) / (10 * n));
return distance;
}
Thank you very much in advance for your kind help
Saviour