Reputation: 1
I have a LoRa gateway and an end-device connected on Chirpstack. I am trying to sniff the packets sent from the end-device to the gateway. I am using a Dragino LoRa hat with a Raspberry Pi. I tried to use several libraries like LoRa and LoraRF, packet forwarder, but it's not working.
I tried this Python code and ran it on my Raspberry Pi, but it didn't capture anything, and i had the same frequency, same spreading factor and everything.
from LoRaRF import SX127x
lora = SX127x()
print("Setting frequency to 868")
lora.begin()
lora.setFrequency(868300000)
lora.setRxGain(lora.RX_GAIN_BOOSTED, lora.RX_GAIN_AUTO)
lora.setSpreadingFactor(12)
lora.setBandwidth(125000)
lora.setCodeRate(5)
lora.setCrcEnable(True)
lora.setHeaderType(lora.HEADER_EXPLICIT)
packetData=()
def getReceiveData():
global packetData
packetData = lora.read(lora.available())
print("function")
lora.onReceive(getReceiveData)
lora.request(lora.RX_CONTINUOUS)
while True:
if packetData:
print("packet data ")
length = len(packetData) -1
message = ""
for ir in range(length):
message += chr(packetData[i])
counter = packetData[length]
print(f"{message}{counter}")
print("RSSI ={0:0.2f} dBm | SNR ={1:0.2f}".format(lora.packetRssi(), lora.snr()))
packetData=()
Upvotes: 0
Views: 276
Reputation: 6213
That's NOT how it works, at all, as you may have discovered by now... Your gateway and your end-device are using LoRaWAN, not LoRa. So your devices are not communicating on a single frequency or BW/SF setting. They are using a bunch of channels, 868.3 MHz being one of them. There is no way you can predict on which frequency, and on which SF/BW setting your end-device will send a packet at time T. And even if you are lucky to scan all possible sets, and "hear" a packet, good luck with that: it is encrypted.
Upvotes: 0