I received the two LoRa modules yesterday and have played around with them a little bit. I may try and do some range tests this afternoon sometime.
Module on a Pi3 (sending a .pkt):
Module on a Pi2 (receiving that .pkt):
I've played around with the example code which was kind of fun, the modules have three buttons on them, with that example code you can press a button to send a message to all nearby LoRa radios.
I modified (bastardized?) that code with code I found elsewhere to take a .pkt file from my board and break it up into chunks and send it over LoRa.
pi@pi3:~ $ ls -l *.pkt
-rw-r--r-- 1 pi pi 4164 Dec 31 08:14 12a64038.pkt
pi@pi3:~ $ ls -lh *.pkt
-rw-r--r-- 1 pi pi 4.1K Dec 31 08:14 12a64038.pkt
pi@pi3:~ $ python3 test_radio.py
Start: Fri 31 Dec 2021 11:25:08 AM EST
Finish: Fri 31 Dec 2021 11:26:34 AM EST
It takes about 86 seconds to send 4.1k to the module right next to it.
With these modules you can have up to 252 bytes in a single transmission (including control data). I tried breaking the .pkt file up into 200 character chunks, but wasn't able to receive the whole file on the other side. Breaking it up into 128 character chunks worked better, but not every time. I seem to have the best luck with 55 character chunks. This is all at close range with the antennas next to each other.
The python code I'm using doesn't have any error correction or even knows if the receiving end is actually listening, but does work to show it can be done:
[ - cut - ]
CHUNK_SIZE = 55
pkt_file = '12a64038.pkt'
display.text('Sending PKT', 35, 0, 1)
with open(pkt_file, 'rb') as infile:
chunk = infile.read(CHUNK_SIZE)
if not chunk:
[ - cut - ]
file = open('trans.pkt', 'wb')
packet = None
packet = rfm9x.receive()
if packet is None:
display.text('- Waiting for PKT -', 15, 20, 1)
display.text('Receiving PKT', 15, 20, 1)
If anyone knows of another way of sending files through LoRa please let me know. There's a way of setting up a remote serial port over LoRa that I'm looking into. It'd be neat to try using zmodem or something similar.
... Dachshunds are really small crocodiles with fur.
--- Mystic BBS v1.12 A47 2021/12/24 (Raspberry Pi/32)
* Origin: Northern Realms (21:3/110)