I am using a Raspberry Pi Model 4b with SX1262 LoRa wan hat to send data to the RAK gateway which uploads data to TTN.
I found some sample code that is called “Sx126x lorawan hat code” but after going through the code I am led to believe that it is not for a lora wan but for simple lora p2p.
I am a little confused because I cannot understand if it is possible to use the Raspberry Pi as a LoRwan node? If I can do so, what are the libraries I need to use? This is needed by my company as a part of their project so any help would be much appreciated.
Yes it is possible. However for LoRaWAN the sx1262 isn’t a good choice when used with a raspberry pi. LoRaWAN has very strict timings which are hard to realize using a non realtime Linux system. It is magnitudes easier to implement it on a microcontroller that does not run an operating system.
For use with the Raspberry Pi a module that does the critical timing itself and interfaces using an UART would be a better choice. Something like Wio-E5 from Seeed or RAK3172.
Yes it is possible. However for LoRaWAN the sx1262 isn’t a good choice when used with a raspberry pi. LoRaWAN has very strict timings which are hard to realize using a non realtime Linux system.
I see. If I have to implement it, regardless of its disadvantages, how do I go about it because the library that I linked doesn’t seem to support LoRa wan, just LoRa p2p only?
The disadvantages are that communication will not be reliable so there is a enormous chance things won’t work well resulting in lost packets and gateways having to transmit too often (causing DoS for other devices).
If you want to proceed anyway you need to find code that does implement LoRaWAN for the sx1262 chipset. Radiolib comes to mind. However, if it doesn’t work well, don’t come back complaining because a Raspberry Pi is totally unsuited for the timings involved. Too much timing noise because of the operating system. For LoRaWAN you need something that can implement strict timing or offload that burden to the module (which is not possible with the sx1262 stand-alone)
The maintainer/owner of RadioLib has tried running the LoRaWAN stack on a Raspberry Pi for 3~4 hours which reportedly ran fine, but over time it is very likely to demonstrate the behaviour explained by @kersing.
For use with the Raspberry Pi a module that does the critical timing itself and interfaces using an UART would be a better choice.
Taking your advice, I established the connection to the ESP32 with the Raspberry Pi using USB connection and it works like a charm so thank you for that.
For the esp32, I want to take the values and forward it to LoRa wan. However, one problem I encountered in the RadioLib example was the Network key. I can find the DevEUI, AppEUI, AppKey in the ttn console for the gateway but I cannot find the Network key. Could you kindly tell me how to find the Network key?
I’m assured by @CaptainAwesome that the notes.md are foolproof with lots and lots of detail on configuration on the console and for the config.h device file - have you read it?
@kersing@descartes I entered the App key to the network key field and the program shows the OTAA verification is successful and an uplink has been sent.