Hi guys,
I would like to make two lora modules communicate, i.e. reyax rylr896 and sx1276, but during my tests I can't get any result. So I would like to know if it is possible to make these two modules communicate.
Code for reception with Sx1276
#include <SPI.h>
#include <LoRa.h>
#define rst 9
#define dio0 4
#define nss 10
String inString = ""; // string to hold incoming charaters
String MyMessage = ""; // Holds the complete message
void setup() {
LoRa.setPins(nss,rst, dio0);
Serial.begin(9600);
Serial.println("LoRa Receiver");
////////////////////////////////////////////////////////////////////
while (!Serial);
Serial.println("LoRa Receiver");
if (!LoRa.begin(868E6)) {
Serial.println("Starting LoRa failed!");
while (1);
}
LoRa.setSpreadingFactor(7);
LoRa.setTxPower(15);
LoRa.setSignalBandwidth(125000);
LoRa.setCodingRate4(1);
LoRa.setPreambleLength(5);
}
void loop() {
int packetSize = LoRa.parsePacket();
if (packetSize) {
// read packet
while (LoRa.available())
{
int inChar = LoRa.read();
inString += (char)inChar;
MyMessage = inString;
}
inString = "";
LoRa.packetRssi();
Serial.println(MyMessage);
}
}
I moved your topic to an appropriate forum category @blot_1200.
In the future, please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.
Your chances of software serial working at 115200 baud are slim, maybe 19200 baud is the maximum for reliable operation ?
Why are you trying to get a rylr896 working with a SX1276 in the first place, unless there is published working code, it might not be easy to get the two different devices to communicate, the rylr896 is not really a LoRa module as such .....
I use 112500 bauds as this is the default baud rate for rylr896.
I want to make a communication between these two modules in order to use the rylr896 as a relay because it has a longer range than the sx1276 but is more expensive.
And I don't have any functional code, just the fact that they use the same chip.
Then you either need to change the rylr896 baud rate to 9600 or use an Arduino that has a spare hardware serial port.
The rylr896 will be using an SX1276 LoRa device, so the range will be the same as a normal SPI SX1276, assuming the same LoRa settings and antennas.
The rylr896 appears to add some stuff or parameters to an outgoing packet, and might also require a specially formatted packet before it receives it.
Relay code for a SPI SX1276 would be really easy to sort out as you can use a common library for both the nodes and the relay, no packet compatibility issues either.
When I look at the specifications of the rylr896 I have a range between 4.5 and 15Km while for the sx1276 I have 5km in max distance, but I can't check if the information is good for the sx1276 because I didn't find anything in the datasheet.
Yes, the rylr896 adds an address and a NetworId, which doesn't exist on the lora sx1276. Do you think this is what prevents communication between the two?
Datasheets cannot and should not specify distances as its a figure that depends very heavily on environment and antennas.
I have had distances of circa 250km from a SX1276, so does this suggest that the SX1276 I used is massily better than the SX1276 in the rylr896 ?
Its could well do. If you want to spend hours and hours trying to make the SX1276 and rylr896 communicate then please do. Do publishe the working setup on here, others might be interested.
I use the rylr896 just because of its 15km range which was specified but if it is possible to do 250km with the sx1276 then I have no interest in continuing.
Is it possible for you to share the parameters, the type of antenna you used to reach this distance and under what conditions (environment, weather) you carried out the tests?
You should not take their silly advertisements seriously. Radio range depends on the surroundings (terrain, buildings, etc.), the antennas and the radio settings.
Your range is currently zero, because you don't have two of the same modules, using the same settings.
Only in the circumstances where there is very clear line of sight between transmitter and receiver, with no objects or ground near the line of sight path.
because I also use an sx1276 module, but with this module I can't go more than 1.5km, of course I'm doing the tests in an urban area with a lot of traffic, so assuming that my environment has a big impact on my range, it would be nice to know how much it attenuates a signal.