sandeepmistry / arduino-LoRa

An Arduino library for sending and receiving data using LoRa radios.
MIT License
1.66k stars 633 forks source link

Issues with LoRaDuplex #88

Closed r28kumar closed 4 years ago

r28kumar commented 6 years ago

Hello,

I am working on my project and I am using LoRa/GPS shield with my Arduino Mega 2560. I want to set up sender and receiver for my application and I have 2 units each. I used the LoRaDuplex example which I downloaded with LoRa library. I made a slight modification to the code (for the pins) and put the same application on 2 units to set up 2-way communication on both units. When I run the units I can see in my serial ports that Data being transmitted from 1 unit is received by other and vice versa. However, after some time (ranging from a couple of seconds to 3-4 minutes, not fixed duration) or after 5-6 (or more) TX/RX both units do not receive anything. I can see both units are trying to send the data but nothing is received. Did anyone experience similar issues?

For my application, I am using the example code as a base and added very simple logic to transmit my data. What's puzzling me is that after some time that Data that I send isn't same what I receive on the other end...! I stripped down all of my application to bare bones so I am only dealing with TX/RX part to eliminate any other thing in my code which could cause the data reception to be different than what was transmitted. However, I still had the same issue and that's when I started experimenting with LoRaDuplex example a bit more and realized that the given code doesn't function well.

Any help on this issue would be greatly appreciated.

Thank you. Rav

sandeepmistry commented 6 years ago

@r28kumar could you please share the EXACT sketches you are using? Is it just the LoRaDuplex from the repo or did you make changes? Please also provide the output from the Serial monitor as well.

How are you powering the boards?

r28kumar commented 6 years ago

Hello Sandeep,

Thank you for responding. Following you will find the sketch that I used both units. The LoRaDuplex code is from the repo but I commented out the pin definitions and default override in the code as I used the default pin configuration declared in LoRa.h file (downloaded with LoRa library). I have also attached 2 screenshots of Serial monitors and you can clearly observe that reception stopped within 5 minutes or so. The difference in the message ids (in the screenshots) is due to the fact that both units were not powered up at the same instance.

The units (Arduino Mega with LoRa/GPS shield mounted) were USB powered through my Laptop.

Thank you, Rav

LoRaDuplex.txt

26805130_10155397603718348_719669868592535892_n

com6-lora

sandeepmistry commented 6 years ago

Are both boards sending the messages around the same time?

If so, this LoRa is half-duplex and broadcast, each board will not be able to receive the others message.

Would you be able to change the random time in the sketch from every 2 - 3 seconds to, 20 - 30 seconds or higher?

KE6MTO commented 6 years ago

Just to make sure, you have the antenna's attached to each node? Is the reg on the Arduino getting hot, maybe overtaxing the regulator? For what it's worth I had a similar issue with a Particle Proton (just stops receiving but more at hours vs minutes) but assumed it was something on that platform as I don't see it on the MCU's I've tried with this library.

r28kumar commented 6 years ago

Hello @sandeepmistry,

I had set the time up to 1 minute. The communication stops but now it takes longer to arrive at the problematic state as described in my previous update. I power the units at different times to ensure that there is no interference between TX/RX as I figured that LoRa bees are not full duplex.

@KE6MTO , Yes, the antennas are attached to each node. I have checked on both hardware sets and nothing is getting hot.

Could it be some sort of buffer, when not cleared, causes the LoRa bees to not receive the messages properly?

Thank you,

wero1414 commented 6 years ago

Hi @r28kumar, have you tried to use an SDR or spectrum analyser to know if both nodes are still sending packages?

Just want to assure that the error is at the receive part and not in the transmit.

Black3rror commented 6 years ago

Hi. I have the same problem. after a random time the receiver doesn't receive anything. I've set one module as Tx and the other as Rx (by //commenting the other side for each of them). I'm using 2*( arduino uno + LoRa-RA02(sx1278) )

hi @wero1414 , after data receiving stops in Rx side, when I restart the Rx side it continues to receive data. so there is no problem in Tx side

kovendhanj commented 6 years ago

Hi.i have the code for both Tx and Rx in same module. you can try this code.but while we send the data there is some delay to receive.

include

include

char c; void setup() { Serial.begin(9600); LoRa.begin(433E6); LoRa.setSpreadingFactor(10); LoRa.setSignalBandwidth(62.5E3); LoRa.crc(); }

void loop() { while (Serial.available())

        { 
        LoRa.beginPacket();
        c=Serial.read();
       LoRa.print(c);
       LoRa.endPacket();

        }

int packetSize = LoRa.parsePacket(); if (packetSize) { while (LoRa.available()) {
Serial.print((char)LoRa.read()); } } }

s19sara commented 5 years ago

Hi, I have used Ra-02 LoRa module , sending data from sender to receiver module is working fine. How I send acknowledgement from receiver to sender module?

AjayJassal55 commented 3 years ago

Hi.i have the code for both Tx and Rx in same module. you can try this code.but while we send the data there is some delay to receive.

include

include

char c; void setup() { Serial.begin(9600); LoRa.begin(433E6); LoRa.setSpreadingFactor(10); LoRa.setSignalBandwidth(62.5E3); LoRa.crc(); }

void loop() { while (Serial.available())

        { 
        LoRa.beginPacket();
        c=Serial.read();
       LoRa.print(c);
       LoRa.endPacket();

        }

int packetSize = LoRa.parsePacket(); if (packetSize) { while (LoRa.available()) { Serial.print((char)LoRa.read()); } } }

this program is also not working as full duplex

IoTThinks commented 3 years ago

SX1278 is not a Full Duplex chip. Either TX or RX 1 packet at a time.

By the specification.