Atrop1n / LoRa_Camera_Trap

Create a remote camera trap using LoRa
15 stars 4 forks source link

Problems when trying to increase the transmission range. #1

Open Xanuman opened 3 months ago

Xanuman commented 3 months ago

Your code works. It was possible to send photos between devices. (ESP32-CAM + Lora module Ra-01) -> Sender (ESP32 WROOM 32 + Lora module Ra-01) -> Receiver

Everything worked, but there was one BIG drawback. The communication range was VERY short (15-50 meters)

Next, I tried to optimize your code for my tasks. Made the following changes: 1) Removed the SF and BW changes. Made them fixed (BW=125000, SF=8). Removed FindBW and FindSW functions 2) Added function loRa.setTxPower(20);

But that's where it stopped. I can't set up image transfer with my settings.

Returned to the original state and started making minimal changes to your code. Changed only SF, BW, int SF_find_timeout = 900 And everything stopped working. I look at the receiver signal using RTL-SDR and see that the range has increased SIGNIFICANTLY. But the devices do not see each other.

Atrop1n commented 3 months ago

Hello, thanks for your message.

The default parameters are BW=500 kHz and SF=7 which indeed mean very short range. If you want to trade off some of the data rate for a longer range, lower the BW and/or increase SF. Keep in mind that in order for packets to be trasmitted, both sender and receiver need to be configured with the same bandwidth and SF. If the parameters do not match, the receiver won't see any incoming packets. Is that the case with your edits?

The Find_BW and Find_SF functions are not necessary. They are only needed if you are chaning BW of SF on the webpage. I have implemented them so that sender tries to automatically find the bandwidth and SF of the receiver, when it is changed in the webpage. It listens on different combinations of BW and SF for a specified time period (SF_find_timeout). When it succesfully parses a message on some combination, let's say BW = 500k and SF = 8, it knows the receiver is configured with these parameters so sender will keep these parameters as well, and photo transmission can continue normally.

I am aware of the problem when the SF_find_timeout is too short, there won't be enough time for a packet to be parsed, even if it has the correct BW and SF. For example, if packet that was sent with BW=20800 and SF=10 needs 3 seconds to be parsed, and SF_find_timeout is 900 milliseconds, there would not be enough time for the packet to be parsed, because after 3 seconds, the sender is already using different combination of BW and SF. You can compensate this by changing SF_find_timeout to several seconds, but then the detection of correct parameters will take too long, we are talking 10s of minutes.

I think your safest bet is to use fixed SF and BW and not changing these parameters during transmission. In this case, the transmission should work.

Can you send me your edits, so I can troubleshoot?

pi 7. 6. 2024 o 23:15 Xanuman @.***> napísal(a):

Your code works. It was possible to send photos between devices. (ESP32-CAM + Lora module Ra-01) -> Sender (ESP32 WROOM 32 + Lora module Ra-01) -> Receiver

Everything worked, but there was one BIG drawback. The communication range was VERY short (15-50 meters)

Next, I tried to optimize your code for my tasks. Made the following changes:

  1. Removed the SF and BW changes. Made them fixed (BW=125000, SF=8). Removed FindBW and FindSW functions
  2. Added function loRa.setTxPower(20);

But that's where it stopped. I can't set up image transfer with my settings.

Returned to the original state and started making minimal changes to your code. Changed only SF, BW, int SF_find_timeout = 900 And everything stopped working. I look at the receiver signal using RTL-SDR and see that the range has increased SIGNIFICANTLY. But the devices do not see each other.

— Reply to this email directly, view it on GitHub https://github.com/Atrop1n/LoRa_Camera_Trap/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWANXHZYTMLU5YQXR5FN3LLZGIPFZAVCNFSM6AAAAABI7KEZO6VHI2DSMVQWIX3LMV43ASLTON2WKOZSGM2DCMJXGM2DGNQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Xanuman commented 2 months ago

Thank you for responding to my question. And also grateful to you for the code you created. It's unique.

I have little experience in programming and using Github. I have posted your code which I modified in my repository. It compiles, but does not want to work on my devices. Although your code worked well. Except for very short range.

Perhaps I made a mistake somewhere. Possibly in the wait_for_ack function on the ESP32-CAM side

I've added the ability for you to edit my repository. I hope this works and you can correct my mistakes.

Sincerely

Atrop1n commented 2 months ago

I have adjusted tx power and retransmission period, it is working for me now. Changes are in your repo.

I will gladly assist you if you have any more issues.

I will also try to implement a more reliable systems for dynamic parameters change in the future.

so 8. 6. 2024 o 16:44 Xanuman @.***> napísal(a):

Thank you for responding to my question. And also grateful to you for the code you created. He is unique.

I have little experience in programming and using Github. I have posted your code which I modified in my repository. It compiles, but does not want to work on my devices. Although your code worked well. Except for very short range.

Perhaps I made a mistake somewhere. Possibly in the wait_for_ack function on the ESP32-CAM side

I've added the ability for you to edit my repository. I hope this works and you can correct my mistakes.

Sincerely

— Reply to this email directly, view it on GitHub https://github.com/Atrop1n/LoRa_Camera_Trap/issues/1#issuecomment-2156062127, or unsubscribe https://github.com/notifications/unsubscribe-auth/AWANXHYA7353ZYK7BBZJTQ3ZGMKDPAVCNFSM6AAAAABI7KEZO6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJWGA3DEMJSG4 . You are receiving this because you commented.Message ID: @.***>