-
Notifications
You must be signed in to change notification settings - Fork 118
Capturing LoRa signals using an RTL SDR device
This tutorial is intended for Software Defined Radio (SDR) beginners wishing to decode LoRa messages using gr-lora. We will be using a LoRa modem under our control in order to transmit messages, and an RTL-SDR to receive and display them back to the command line or Wireshark.
- gr-lora
- libosmocom
- GNU Radio Companion (GRC) software
- RTL-SDR device or any other SDR.
- LoRa modem for testing. The RN2483 LoRa chip is used in this tutorial.
- The python-loranode RN2483 interface (optional)
As the first step we will build the GRC flow graph. Create a new flowgraph by selecting File > New > WX GUI. Since we're using an RTL-SDR, use drag the "RTL-SDR Source" block from the block tree panel to the grid view. Create a variable "freq" and set it to 868e6. Now configure the RTL-SDR block to use "freq" as its "Ch0 frequency", and set the "samp_rate" variable to 1 Msps. Finally, connect a "WX GUI FFT Sink" block to the "RTL-SDR Source" block for now, and set "Baseband freq" to "freq". The flowgraph now looks like this:
[Figure 1]
You can verify whether the LoRa modem is working correctly by transmitting a message at 868.1 MHz. If you have an RN2483 connected via serial over USB, you can do the following:
$ python
>>> from loranode import RN2483Controller
>>> c = RN2483Controller("/dev/ttyUSB0")
>>> c.set_sf(7) # Set spreading factor 7
>>> c.set_cr("4/8") # Set 4/8 coding
>>> c.send_p2p("00FF00FF")
A peak should appear centered at 868.1 MHz in the FFT plot during the transmission.
Drag the "LoRa Receiver" block to the grid view. Configure it so that it matches the transmitter's configuration:
- Spreading factor: 7
- Sample rate: samp_rate
- Frequency: freq
- Offset: 868.1e6 - freq
The flowgraph now looks like this:
[Figure 2]
Finally, run the flowgraph and transmit a message with the LoRa device.
>>> c.send_p2p("FFFFFFFF")
The output should be printed to the terminal as shown below
[Figure 3]