Giter Club home page Giter Club logo

shawnlee99 / gr-lora_sdr Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tapparelj/gr-lora_sdr

0.0 0.0 0.0 1.22 MB

This is the fully-functional GNU Radio software-defined radio (SDR) implementation of a LoRa transceiver with all the necessary receiver components to operate correctly even at very low SNRs. This work has been conducted at the Telecommunication Circuits Laboratory, EPFL.

Home Page: https://www.epfl.ch/labs/tcl/

License: GNU General Public License v3.0

Shell 4.39% C++ 70.73% Python 8.72% C 9.59% CMake 6.36% Batchfile 0.20%

gr-lora_sdr's Introduction

GitHub last commit gnuradio version arXiv Hits Build conda package License: GPL v3

Summary

This is the fully-functional GNU Radio software-defined radio (SDR) implementation of a LoRa transceiver with all the necessary receiver components to operate correctly even at very low SNRs. The transceiver is available as a module for GNU Radio 3.10. This work has been conducted at the Telecommunication Circuits Laboratory, EPFL.

In the GNU Radio implementation of the LoRa Tx and Rx chains the user can choose all the parameters of the transmission, such as the spreading factor, the coding rate, the bandwidth, the sync word, the presence of an explicit header and CRC.

  • The module contains convenient hierarchical blocks for both Tx and Rx.

  • In the Tx chain, the implementation contains all the main blocks of the LoRa transceiver: the header- and the CRC-insertion blocks, the whitening block, the Hamming encoder block, the interleaver block, the Gray demapping block, and the modulation block. tx_flow

  • On the receiver side there is the packet synchronization block, which performs all the necessary tasks needed for the synchronization, such as the necessary STO and CFO estimation and correction. The demodulation block follows, along with the Gray mapping block, the deinterleaving block, the Hamming decoder block and the dewhitening block, as well as a CRC verification block. rx_flow

  • The implementation can be used for fully end-to-end experimental performance results of a LoRa SDR receiver at low SNRs.

  • A simple simulation framework is available in the apps/simulation folder.

Functionalities

  • Sending and receiving LoRa packets between USRP-USRP and USRP-commercial LoRa transceiver (tested for Adafruit Feather 32u4 RFM95 and dragino LoRa/GPS HAT).

  • Parameters available:

    • Spreading factors: 5-12*
    • Coding rates: 0-4
    • Implicit and explicit header mode
    • Payload length: 1-255 bytes
    • Sync word selection (network ID)
    • Verification of payload CRC
    • Verification of explicit header checksum
    • Low datarate optimisation mode
    • Utilisation of soft-decision decoding for improved performances

* Spreading factors 5 and 6 not compatible with SX1261/2.

Reference

J. Tapparel, O. Afisiadis, P. Mayoraz, A. Balatsoukas-Stimming and A. Burg, "An Open-Source LoRa Physical Layer Prototype on GNU Radio," 2020 IEEE 21st International Workshop on Signal Processing Advances in Wireless Communications (SPAWC), Atlanta, GA, USA, 2020, pp. 1-5.

IEEE Xplore link, arXiv link

If you find this implementation useful for your project, please consider citing the aforementioned paper.

Prerequisites

  • Gnuradio 3.10
  • python 3
  • cmake
  • libvolk
  • Boost
  • UHD
  • gcc > 9.3.0
  • gxx
  • pybind11

The conda environment used to develop this module is described by the environment.yml file.

Installation

  • Clone this repository
     git clone https://github.com/tapparelj/gr-lora_sdr.git
  • Go to the cloned repository
     cd gr-lora_sdr/
  • A functionning environment with all dependencies can be installed with conda. You can follow this tutorial or simply following:
    • First download the latest release of conda, for example:
       wget https://repo.anaconda.com/miniconda/Miniconda3-py39_4.12.0-Linux-x86_64.sh
    • Now run the downloaded file which is the Anaconda Installer script
       bash Miniconda3-py39_4.12.0-Linux-x86_64.sh
    • And reload the Shell
       source ~/.bashrc
    • Now copy our environment to install all the dependencies of the module automatically. Note that it will take quite some time (~20 min).
       conda env create -f environment.yml 
    • Start the conda environment GNU Radio 3.10 you just created
       conda activate gr310
  • To build the code, create an appropriate folder and go in it:
     mkdir build
     cd build
  • Run the main CMakeLists.txt
     cmake .. -DCMAKE_INSTALL_PREFIX=<your prefix> # default to usr/local, CONDA_PREFIX or PYBOMB_PREFIX if no install prefix selected here
  • Finally compile the custom GNU Radio blocks composing the LoRa transceiver. Replacing <X> with the number of core you want to use to speed up the compilation.
     (sudo) make install -j<X>
  • if you installed as sudo run
     sudo ldconfig 
  • Now you should be able to run some codes. For example, open the GNU Radio Companion user interface and check if the blocks of gr-lora_sdr are available on the blocks list (e.g. under LoRa_TX).
     gnuradio-companion &
  • A final verification of the transceiver functionning can be made by executing the following script, transmitting a frame every two seconds:
     python3 examples/tx_rx_functionnality_check.py 

Usage

  • An example of a LoRa transmitter and receiver can be found in gr-lora_sdr/examples/ (both python and grc).
  • The .grc files can be opened with gnuradio-companion to set the different transmission parameters.
  • The python file generated by grc can be executed with python3 ./{file_name}.py

Frequent issues:

  • "ImportError: No module named lora_sdr":
    • This issue comes probably from missing PYTHONPATH and LD_LIBRARY_PATH
    • Refer to https://wiki.gnuradio.org/index.php/ModuleNotFoundError to modify those variables. If you set a prefix during the "cmake" call, skip directly to point C.(Verifying that the paths exist in your folders might help.)
  • The OOT blocks doesn't appear in gnuradio-companion:
    • The new blocks can be loaded in gnuradio-companion by adding the following lines in home/{username}/.gnuradio/config.conf (If this file doesn't exist you need to create it):
       [grc]
       local_blocks_path=path_to_the_downloaded_folder/gr-lora_sdr/grc
      

Changelog

  • added tags to crc verification output stream indication frame start, length and CRC result.

  • added separator option for file input

  • added preamble length option

  • added parameter for frame zero-padding

  • add low datarate optimisation support

  • add support of spreading factors smaller than 7

  • add sampling frequency offset estimation and compensation

    • Estimation leverages the relation between CFO and SFO, both caused by the same reference clock
    • The compensation method consists in a two step refinement of the estimates in the preamble and a puncturing/insertion of samples during the payload
  • Add frame error rate simulation script in apps/simulation

    ...

Credit

This work was inspired from https://github.com/rpp0/gr-lora by Pieter Robyns, Peter Quax, Wim Lamotte and William Thenaers. Which architecture and functionalities have been improved to better emulate the physical layer of LoRa.

Licence

Distributed under the GPL-3.0 License License. See LICENSE for more information.

gr-lora_sdr's People

Contributors

tapparelj avatar timvrakas avatar bkerler avatar martynvdijke avatar ryanvolz avatar marktimmerman-dev avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.