kopia lustrzana https://github.com/rpp0/gr-lora
- Update README.md
- New installation method via Docker - Updated examples in apps/pull/61/head v0.6.1
rodzic
2605fa1772
commit
7c3b3de7de
103
README.md
103
README.md
|
@ -1,97 +1,107 @@
|
|||
gr-lora [![Build status](https://api.travis-ci.org/rpp0/gr-lora.svg)](https://travis-ci.org/rpp0/gr-lora) [![DOI](https://zenodo.org/badge/61641535.svg)](https://zenodo.org/badge/latestdoi/61641535)
|
||||
=======
|
||||
|
||||
The gr-lora project aims to provide a collection of GNU Radio blocks for receiving LoRa modulated radio messages using Software Defined Radio (SDR). More information about LoRa itself can be found on [the website of the LoRa Alliance](https://www.lora-alliance.org/).
|
||||
The gr-lora project aims to provide a collection of GNU Radio blocks for receiving LoRa modulated radio messages using a Software Defined Radio (SDR). More information about LoRa itself can be found on [the website of the LoRa Alliance](https://www.lora-alliance.org/).
|
||||
|
||||
![alt text](https://github.com/rpp0/gr-lora/blob/master/examples/screenshot.png "gr-lora example")
|
||||
|
||||
|
||||
Update of 29th August, 2017
|
||||
---------------------------
|
||||
|
||||
I'm happy to announce that as of ```gr-lora``` version 0.6, a new clock recovery algorithm has been implemented which fixes previous issues with long LoRa messages. Other components, such as whitening, detection and decoding have been improved as well (see the Git log for more details). Given a clear signal, the decoding accuracy is now close to 100% for all SFs, and I therefore consider LoRa fully reverse engineered. Future updates will focus on improving the performance and minor details of the specification.
|
||||
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
See the LICENSE file and top of the source files for the license of this project. If you are working on a research topic or project that involves the usage of ```gr-lora``` or its algorithms, we would appreciate it if you could acknowledge us. We are currently working on a full writeup of the decoder, but in the meantime, you can cite this repository as follows:
|
||||
|
||||
```
|
||||
Pieter Robyns, Peter Quax, Wim Lamotte, William Thenaers. (2017). gr-lora: An efficient LoRa decoder for GNU Radio. Zenodo. 10.5281/zenodo.853201
|
||||
```
|
||||
|
||||
|
||||
Features
|
||||
--------
|
||||
## Features
|
||||
|
||||
All features of the LoRa physical-layer modulation scheme are described in various patents and blog posts (for a good resource, see [this RevSpace page](https://revspace.nl/DecodingLora)). ```gr-lora``` supports most of these features, except for:
|
||||
|
||||
- CRC checks of the payload and header
|
||||
- Decoding multiple channels simultaneously
|
||||
|
||||
This library was primarily tested with a USRP B201 as receiver and Microchip RN2483 as transmitter. If you encounter an issue with your particular setup, feel free to let me know in the Issues section of this repository.
|
||||
This library was primarily tested with a USRP B201 as receiver and Microchip RN2483 as transmitter. If you encounter an issue with your particular setup, feel free to let me know in the 'Issues' section of this repository.
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
### Update of 29th August, 2017
|
||||
|
||||
The following dependencies are required:
|
||||
- numpy
|
||||
- scipy
|
||||
- log4cpp
|
||||
- [liquid-dsp](https://github.com/jgaeddert/liquid-dsp)
|
||||
I'm happy to announce that as of ```gr-lora``` version 0.6, a new clock recovery algorithm has been implemented which fixes previous issues with long LoRa messages. Other components, such as whitening, detection and decoding have been improved as well (see the Git log for more details). Given a clear signal, the decoding accuracy is now [close to 100% for all SFs](https://github.com/rpp0/gr-lora/tree/master/docs/test-results), and I therefore consider LoRa fully reverse engineered. Future updates will focus on improving the performance and minor details of the specification.
|
||||
|
||||
|
||||
The installation procedure is the same as for any GNURadio OOT module:
|
||||
## Attribution
|
||||
|
||||
If you are working on a research topic or project that involves the usage of ```gr-lora``` or its algorithms, we would appreciate it if you could acknowledge us. We are currently working on a full writeup of the decoder, but in the meantime, you can cite this repository as follows:
|
||||
|
||||
> Pieter Robyns, Peter Quax, Wim Lamotte, William Thenaers. (2017). gr-lora: An efficient LoRa decoder for GNU Radio. Zenodo. 10.5281/zenodo.853201
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
Installing `gr-lora` is possible in two ways: either by downloading the Docker container, which contains all dependencies and `gr-lora` packaged in a single container, or by manual installation.
|
||||
|
||||
### Docker installation
|
||||
|
||||
To avoid installation errors and cluttering your system with the required dependencies, the best approach to install `gr-lora` is through a Docker container. Make sure the `docker` service is running, then perform the following steps:
|
||||
|
||||
```
|
||||
git clone https://github.com/rpp0/gr-lora.git .
|
||||
cd docker/
|
||||
./docker_run_grlora.sh
|
||||
```
|
||||
|
||||
The `docker_run_grlora.sh` script will download the Docker container and run it in 'privileged' mode (in order to access your SDR over USB). After that, you should get a shell inside the container:
|
||||
|
||||
```
|
||||
[root@5773ed19d95d apps]#
|
||||
```
|
||||
|
||||
See the 'Testing' section below for examples on how to use `gr-lora`.
|
||||
|
||||
### Manual installation
|
||||
|
||||
If you prefer a manual installation, the following dependencies are required: `python2-numpy`, `python2-scipy`, `swig`, `cppunit`, `fftw`, `gnuradio`, `libvolk`, `log4cpp`, `cmake`, `wx`, and [`liquid-dsp`](https://github.com/jgaeddert/liquid-dsp).
|
||||
|
||||
The installation procedure is the same as for any GNU Radio OOT module:
|
||||
|
||||
```
|
||||
git clone https://github.com/rpp0/gr-lora.git .
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ../ # Note to Arch Linux users: add "-DCMAKE_INSTALL_PREFIX=/usr"
|
||||
make && sudo make install
|
||||
```
|
||||
|
||||
Testing
|
||||
-------
|
||||
## Testing and usage
|
||||
|
||||
To test your installation, you can download one of the sample LoRa signals at [rpp0/gr-lora-samples](https://github.com/rpp0/gr-lora-samples). Configure ```apps/lora_receive_file.py``` to use the sample and run the script. You should see the decoded sample data:
|
||||
To test your installation, you can download one of the example LoRa signals at [rpp0/gr-lora-samples](https://github.com/rpp0/gr-lora-samples). Configure ```apps/lora_receive_file.py``` to use the sample and run the script. You should see the decoded sample data:
|
||||
|
||||
```
|
||||
$ ./lora_receive_file.py
|
||||
|
||||
Bits per symbol: 7
|
||||
Bits (nominal) per symbol: 7
|
||||
Bins per symbol: 128
|
||||
Header bins per symbol: 32
|
||||
Samples per symbol: 1024
|
||||
Using Volk machine: avx2_64_mmx_orc
|
||||
00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 b8 73 af 81 69
|
||||
88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 fd e5 af 81 69
|
||||
12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 a3 69 af 81 69
|
||||
00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22
|
||||
88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88
|
||||
12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12
|
||||
...
|
||||
```
|
||||
|
||||
Alternatively, if you have a LoRa transmitter, you can configure/modify ```/examples/_examplify.py``` to generate example files and add them to ```/examples/qa_BasicTest_Data.xml``` to run them automatically with ```python/qa_BasicTest_XML.py``` (```xmltodict``` module needed). Note that this script should be run with its shell script in ```build/python```. This is to ensure compatibility with ```make test```.
|
||||
Alternatively, if you have a hardware LoRa transmitter, you use ```apps/lora_receive_realtime.py``` to decode signals in real time. If you have a Microchip RN2483, you can use [python-loranode](https://github.com/rpp0/python-loranode) to easily send messages via Python.
|
||||
|
||||
By default, decoded messages will be printed to the console output. However, you can use a `message_socket_sink` to forward messages to port 40868 over UDP. See the [tutorial](https://github.com/rpp0/gr-lora/wiki/Capturing-LoRa-signals-using-an-RTL-SDR-device) for more information.
|
||||
|
||||
|
||||
Contributing
|
||||
------------
|
||||
## Contributing
|
||||
|
||||
Contributions to the project are very much appreciated! If you have an idea for improvement or noticed a bug, feel free to submit an issue. If you're up for the challenge and would like to introduce a feature yourself, we kindly invite you to submit a pull request.
|
||||
|
||||
|
||||
Hardware
|
||||
--------
|
||||
## Hardware support
|
||||
|
||||
The following LoRa modules and SDRs were also tested and work with gr-lora:
|
||||
The following LoRa modules and SDRs were tested and work with gr-lora:
|
||||
|
||||
Transmitters: Pycom LoPy, Dragino LoRa Raspberry Pi HAT, Adafruit Feather 32u4, Microchip RN 2483 (custom board)
|
||||
Receivers: HackRF One, USRP B201, RTL-SDR
|
||||
|
||||
|
||||
Changelog
|
||||
---------
|
||||
## Changelog
|
||||
|
||||
- Version 0.6.1: Minor bug fixes and improvements.
|
||||
- Version 0.6 : Significantly increased decoding accuracy and clock drift correction.
|
||||
- Version 0.5 : Major overhaul of preamble detection and upchirp syncing
|
||||
- Version 0.4 : Support for all spreading factors, though SFs 11 and 12 are still slow / experimental
|
||||
|
@ -99,3 +109,8 @@ Changelog
|
|||
- Version 0.2.1: Fixed some issues reported by reletreby
|
||||
- Version 0.2 : C++ realtime decoder, manual finetuning for correcting frequency offsets of the transmitter.
|
||||
- Version 0.1 : Python prototype file based decoder, SF7, CR4/8
|
||||
|
||||
|
||||
## License
|
||||
|
||||
See the LICENSE file and top of the source files for the license of this project.
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(8, 8)</value>
|
||||
<value>(8, 12)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
|
@ -282,7 +282,7 @@
|
|||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(280, 77)</value>
|
||||
<value>(184, 76)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
|
@ -321,7 +321,7 @@
|
|||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(16, 188)</value>
|
||||
<value>(8, 188)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
|
@ -372,7 +372,7 @@
|
|||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(224, 196)</value>
|
||||
<value>(232, 196)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
|
@ -431,7 +431,7 @@
|
|||
</param>
|
||||
<param>
|
||||
<key>threshold</key>
|
||||
<value>0.01</value>
|
||||
<value>0.002</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
|
@ -439,7 +439,7 @@
|
|||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(424, 168)</value>
|
||||
<value>(416, 164)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
|
@ -510,7 +510,7 @@
|
|||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(424, 284)</value>
|
||||
<value>(416, 276)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
##################################################
|
||||
# GNU Radio Python Flow Graph
|
||||
# Title: Lora Receive File
|
||||
# Generated: Tue Aug 29 13:32:47 2017
|
||||
# Generated: Thu Sep 7 15:38:03 2017
|
||||
##################################################
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -66,7 +66,7 @@ class lora_receive_file(grc_wxgui.top_block_gui):
|
|||
peak_hold=False,
|
||||
)
|
||||
self.Add(self.wxgui_fftsink2_1.win)
|
||||
self.lora_lora_receiver_0 = lora.lora_receiver(samp_rate, capture_freq, ([target_freq]), 7, 1000000, 0.01)
|
||||
self.lora_lora_receiver_0 = lora.lora_receiver(samp_rate, capture_freq, ([target_freq]), 7, 1000000, 0.002)
|
||||
self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True)
|
||||
self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, 'counting_cr4_sf7.cfile', True)
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(8, 8)</value>
|
||||
<value>(8, 12)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
|
@ -93,7 +93,7 @@
|
|||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(552, 13)</value>
|
||||
<value>(544, 12)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
|
@ -120,7 +120,7 @@
|
|||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(456, 13)</value>
|
||||
<value>(456, 12)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
|
@ -159,66 +159,7 @@
|
|||
</param>
|
||||
<param>
|
||||
<key>value</key>
|
||||
<value>867.8e6</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>variable_slider</key>
|
||||
<param>
|
||||
<key>comment</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>converver</key>
|
||||
<value>int_converter</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>value</key>
|
||||
<value>-95</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(968, 16)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>grid_pos</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>finetune</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>label</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>max</key>
|
||||
<value>150</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>min</key>
|
||||
<value>-150</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>notebook</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>num_steps</key>
|
||||
<value>300</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>style</key>
|
||||
<value>wx.SL_HORIZONTAL</value>
|
||||
<value>868e6</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
|
@ -233,7 +174,7 @@
|
|||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(800, 13)</value>
|
||||
<value>(768, 12)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
|
@ -252,7 +193,10 @@
|
|||
<key>variable</key>
|
||||
<param>
|
||||
<key>comment</key>
|
||||
<value></value>
|
||||
<value>The internal sampling rate determines the
|
||||
oversampling rate. 1e6 is 8 times oversampling,
|
||||
5e5 is 4 times oversampling, and so on. Set higher
|
||||
for better accuracy, but worse performance.</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
|
@ -260,7 +204,7 @@
|
|||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(376, 77)</value>
|
||||
<value>(640, 76)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
|
@ -268,11 +212,11 @@
|
|||
</param>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>offset</value>
|
||||
<value>internal_sampling_rate</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>value</key>
|
||||
<value>-(capture_freq - target_freq)</value>
|
||||
<value>5e5</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
|
@ -299,7 +243,7 @@
|
|||
</param>
|
||||
<param>
|
||||
<key>value</key>
|
||||
<value>2e6</value>
|
||||
<value>1e6</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
|
@ -314,7 +258,7 @@
|
|||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(376, 13)</value>
|
||||
<value>(384, 12)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
|
@ -326,7 +270,7 @@
|
|||
</param>
|
||||
<param>
|
||||
<key>value</key>
|
||||
<value>12</value>
|
||||
<value>11</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
|
@ -341,7 +285,7 @@
|
|||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(664, 13)</value>
|
||||
<value>(640, 12)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
|
@ -407,7 +351,7 @@
|
|||
</param>
|
||||
<param>
|
||||
<key>threshold</key>
|
||||
<value>0.01</value>
|
||||
<value>0.002</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
|
@ -415,7 +359,7 @@
|
|||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(384, 168)</value>
|
||||
<value>(392, 172)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
|
@ -435,7 +379,7 @@
|
|||
</param>
|
||||
<param>
|
||||
<key>out_samp_rate</key>
|
||||
<value>500000</value>
|
||||
<value>internal_sampling_rate</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>in_samp_rate</key>
|
||||
|
@ -446,6 +390,37 @@
|
|||
<value>sf</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>lora_message_socket_sink</key>
|
||||
<param>
|
||||
<key>alias</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>comment</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>affinity</key>
|
||||
<value></value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>True</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(640, 208)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>id</key>
|
||||
<value>lora_message_socket_sink_0</value>
|
||||
</param>
|
||||
</block>
|
||||
<block>
|
||||
<key>osmosdr_source</key>
|
||||
<param>
|
||||
|
@ -666,11 +641,11 @@
|
|||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>0</value>
|
||||
<value>1</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(16, 148)</value>
|
||||
<value>(24, 140)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
|
@ -1881,11 +1856,11 @@
|
|||
</param>
|
||||
<param>
|
||||
<key>_enabled</key>
|
||||
<value>1</value>
|
||||
<value>0</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(8, 336)</value>
|
||||
<value>(16, 340)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
|
@ -2080,7 +2055,7 @@
|
|||
</param>
|
||||
<param>
|
||||
<key>_coordinate</key>
|
||||
<value>(384, 292)</value>
|
||||
<value>(392, 292)</value>
|
||||
</param>
|
||||
<param>
|
||||
<key>_rotation</key>
|
||||
|
@ -2143,6 +2118,12 @@
|
|||
<value>10</value>
|
||||
</param>
|
||||
</block>
|
||||
<connection>
|
||||
<source_block_id>lora_lora_receiver_0</source_block_id>
|
||||
<sink_block_id>lora_message_socket_sink_0</sink_block_id>
|
||||
<source_key>frames</source_key>
|
||||
<sink_key>in</sink_key>
|
||||
</connection>
|
||||
<connection>
|
||||
<source_block_id>osmosdr_source_0</source_block_id>
|
||||
<sink_block_id>lora_lora_receiver_0</sink_block_id>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
##################################################
|
||||
# GNU Radio Python Flow Graph
|
||||
# Title: Lora Receive Realtime
|
||||
# Generated: Tue Aug 29 13:37:16 2017
|
||||
# Generated: Thu Sep 7 15:47:58 2017
|
||||
##################################################
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -18,17 +18,15 @@ if __name__ == '__main__':
|
|||
|
||||
from gnuradio import eng_notation
|
||||
from gnuradio import gr
|
||||
from gnuradio import uhd
|
||||
from gnuradio import wxgui
|
||||
from gnuradio.eng_option import eng_option
|
||||
from gnuradio.fft import window
|
||||
from gnuradio.filter import firdes
|
||||
from gnuradio.wxgui import fftsink2
|
||||
from gnuradio.wxgui import forms
|
||||
from grc_gnuradio import wxgui as grc_wxgui
|
||||
from optparse import OptionParser
|
||||
import lora
|
||||
import time
|
||||
import osmosdr
|
||||
import wx
|
||||
|
||||
|
||||
|
@ -40,15 +38,14 @@ class lora_receive_realtime(grc_wxgui.top_block_gui):
|
|||
##################################################
|
||||
# Variables
|
||||
##################################################
|
||||
self.target_freq = target_freq = 868.1e6
|
||||
self.sf = sf = 12
|
||||
self.samp_rate = samp_rate = 2e6
|
||||
self.capture_freq = capture_freq = 867.8e6
|
||||
self.sf = sf = 11
|
||||
self.samp_rate = samp_rate = 1e6
|
||||
self.bw = bw = 125e3
|
||||
self.target_freq = target_freq = 868.1e6
|
||||
self.symbols_per_sec = symbols_per_sec = bw / (2**sf)
|
||||
self.offset = offset = -(capture_freq - target_freq)
|
||||
self.internal_sampling_rate = internal_sampling_rate = 5e5
|
||||
self.firdes_tap = firdes_tap = firdes.low_pass(1, samp_rate, bw, 10000, firdes.WIN_HAMMING, 6.67)
|
||||
self.finetune = finetune = -95
|
||||
self.capture_freq = capture_freq = 868e6
|
||||
self.bitrate = bitrate = sf * (1 / (2**sf / bw))
|
||||
|
||||
##################################################
|
||||
|
@ -70,54 +67,28 @@ class lora_receive_realtime(grc_wxgui.top_block_gui):
|
|||
peak_hold=False,
|
||||
)
|
||||
self.Add(self.wxgui_fftsink2_1.win)
|
||||
self.uhd_usrp_source_0 = uhd.usrp_source(
|
||||
",".join(("", "")),
|
||||
uhd.stream_args(
|
||||
cpu_format="fc32",
|
||||
channels=range(1),
|
||||
),
|
||||
)
|
||||
self.uhd_usrp_source_0.set_samp_rate(samp_rate)
|
||||
self.uhd_usrp_source_0.set_center_freq(capture_freq, 0)
|
||||
self.uhd_usrp_source_0.set_gain(15, 0)
|
||||
self.uhd_usrp_source_0.set_antenna('RX2', 0)
|
||||
self.lora_lora_receiver_0 = lora.lora_receiver(samp_rate, capture_freq, ([target_freq]), sf, 500000, 0.01)
|
||||
_finetune_sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
self._finetune_text_box = forms.text_box(
|
||||
parent=self.GetWin(),
|
||||
sizer=_finetune_sizer,
|
||||
value=self.finetune,
|
||||
callback=self.set_finetune,
|
||||
label='finetune',
|
||||
converter=forms.int_converter(),
|
||||
proportion=0,
|
||||
)
|
||||
self._finetune_slider = forms.slider(
|
||||
parent=self.GetWin(),
|
||||
sizer=_finetune_sizer,
|
||||
value=self.finetune,
|
||||
callback=self.set_finetune,
|
||||
minimum=-150,
|
||||
maximum=150,
|
||||
num_steps=300,
|
||||
style=wx.SL_HORIZONTAL,
|
||||
cast=int,
|
||||
proportion=1,
|
||||
)
|
||||
self.Add(_finetune_sizer)
|
||||
self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + '' )
|
||||
self.osmosdr_source_0.set_sample_rate(samp_rate)
|
||||
self.osmosdr_source_0.set_center_freq(capture_freq, 0)
|
||||
self.osmosdr_source_0.set_freq_corr(0, 0)
|
||||
self.osmosdr_source_0.set_dc_offset_mode(0, 0)
|
||||
self.osmosdr_source_0.set_iq_balance_mode(0, 0)
|
||||
self.osmosdr_source_0.set_gain_mode(False, 0)
|
||||
self.osmosdr_source_0.set_gain(10, 0)
|
||||
self.osmosdr_source_0.set_if_gain(20, 0)
|
||||
self.osmosdr_source_0.set_bb_gain(20, 0)
|
||||
self.osmosdr_source_0.set_antenna('', 0)
|
||||
self.osmosdr_source_0.set_bandwidth(0, 0)
|
||||
|
||||
self.lora_message_socket_sink_0 = lora.message_socket_sink()
|
||||
self.lora_lora_receiver_0 = lora.lora_receiver(samp_rate, capture_freq, ([target_freq]), sf, internal_sampling_rate, 0.002)
|
||||
|
||||
##################################################
|
||||
# Connections
|
||||
##################################################
|
||||
self.connect((self.uhd_usrp_source_0, 0), (self.lora_lora_receiver_0, 0))
|
||||
self.connect((self.uhd_usrp_source_0, 0), (self.wxgui_fftsink2_1, 0))
|
||||
|
||||
def get_target_freq(self):
|
||||
return self.target_freq
|
||||
|
||||
def set_target_freq(self, target_freq):
|
||||
self.target_freq = target_freq
|
||||
self.set_offset(-(self.capture_freq - self.target_freq))
|
||||
self.msg_connect((self.lora_lora_receiver_0, 'frames'), (self.lora_message_socket_sink_0, 'in'))
|
||||
self.connect((self.osmosdr_source_0, 0), (self.lora_lora_receiver_0, 0))
|
||||
self.connect((self.osmosdr_source_0, 0), (self.wxgui_fftsink2_1, 0))
|
||||
|
||||
def get_sf(self):
|
||||
return self.sf
|
||||
|
@ -134,18 +105,9 @@ class lora_receive_realtime(grc_wxgui.top_block_gui):
|
|||
def set_samp_rate(self, samp_rate):
|
||||
self.samp_rate = samp_rate
|
||||
self.wxgui_fftsink2_1.set_sample_rate(self.samp_rate)
|
||||
self.uhd_usrp_source_0.set_samp_rate(self.samp_rate)
|
||||
self.osmosdr_source_0.set_sample_rate(self.samp_rate)
|
||||
self.set_firdes_tap(firdes.low_pass(1, self.samp_rate, self.bw, 10000, firdes.WIN_HAMMING, 6.67))
|
||||
|
||||
def get_capture_freq(self):
|
||||
return self.capture_freq
|
||||
|
||||
def set_capture_freq(self, capture_freq):
|
||||
self.capture_freq = capture_freq
|
||||
self.wxgui_fftsink2_1.set_baseband_freq(self.capture_freq)
|
||||
self.uhd_usrp_source_0.set_center_freq(self.capture_freq, 0)
|
||||
self.set_offset(-(self.capture_freq - self.target_freq))
|
||||
|
||||
def get_bw(self):
|
||||
return self.bw
|
||||
|
||||
|
@ -155,17 +117,24 @@ class lora_receive_realtime(grc_wxgui.top_block_gui):
|
|||
self.set_firdes_tap(firdes.low_pass(1, self.samp_rate, self.bw, 10000, firdes.WIN_HAMMING, 6.67))
|
||||
self.set_bitrate(self.sf * (1 / (2**self.sf / self.bw)))
|
||||
|
||||
def get_target_freq(self):
|
||||
return self.target_freq
|
||||
|
||||
def set_target_freq(self, target_freq):
|
||||
self.target_freq = target_freq
|
||||
|
||||
def get_symbols_per_sec(self):
|
||||
return self.symbols_per_sec
|
||||
|
||||
def set_symbols_per_sec(self, symbols_per_sec):
|
||||
self.symbols_per_sec = symbols_per_sec
|
||||
|
||||
def get_offset(self):
|
||||
return self.offset
|
||||
def get_internal_sampling_rate(self):
|
||||
return self.internal_sampling_rate
|
||||
|
||||
def set_offset(self, offset):
|
||||
self.offset = offset
|
||||
def set_internal_sampling_rate(self, internal_sampling_rate):
|
||||
self.internal_sampling_rate = internal_sampling_rate
|
||||
self.lora_lora_receiver_0.set_out_samp_rate(self.internal_sampling_rate)
|
||||
|
||||
def get_firdes_tap(self):
|
||||
return self.firdes_tap
|
||||
|
@ -173,13 +142,13 @@ class lora_receive_realtime(grc_wxgui.top_block_gui):
|
|||
def set_firdes_tap(self, firdes_tap):
|
||||
self.firdes_tap = firdes_tap
|
||||
|
||||
def get_finetune(self):
|
||||
return self.finetune
|
||||
def get_capture_freq(self):
|
||||
return self.capture_freq
|
||||
|
||||
def set_finetune(self, finetune):
|
||||
self.finetune = finetune
|
||||
self._finetune_slider.set_value(self.finetune)
|
||||
self._finetune_text_box.set_value(self.finetune)
|
||||
def set_capture_freq(self, capture_freq):
|
||||
self.capture_freq = capture_freq
|
||||
self.wxgui_fftsink2_1.set_baseband_freq(self.capture_freq)
|
||||
self.osmosdr_source_0.set_center_freq(self.capture_freq, 0)
|
||||
|
||||
def get_bitrate(self):
|
||||
return self.bitrate
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
from archlinux:latest
|
||||
|
||||
workdir /lib
|
||||
|
||||
# Update to latest arch
|
||||
run pacman -Syu --noconfirm
|
||||
|
||||
# Install required dependencies
|
||||
run pacman -S git python2-scipy swig cppunit fftw boost boost-libs gnuradio gnuradio-osmosdr libvolk log4cpp base-devel cmake wxgtk-common wxgtk2 wxgtk3 wxpython libuhd-firmware gnuradio-companion --noconfirm
|
||||
|
||||
workdir /liquid
|
||||
|
||||
# Manual liquid-dsp install
|
||||
run git clone https://github.com/jgaeddert/liquid-dsp.git . && \
|
||||
sh ./bootstrap.sh && \
|
||||
sh ./configure --prefix=/usr && \
|
||||
make && \
|
||||
make install
|
||||
|
||||
# Install gr-lora
|
||||
workdir /src
|
||||
|
||||
arg CACHEBUST
|
||||
run git clone https://github.com/rpp0/gr-lora.git . && \
|
||||
mkdir build && \
|
||||
cd build && \
|
||||
cmake ../ -DCMAKE_INSTALL_PREFIX=/usr && \
|
||||
make && \
|
||||
make install && \
|
||||
ldconfig
|
||||
|
||||
workdir /src/apps
|
||||
|
||||
expose 40868
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
LATEST_VERSION=`git ls-remote https://github.com/rpp0/gr-lora.git | grep HEAD | cut -f 1`
|
||||
docker build -t rpp0/gr-lora --build-arg CACHEBUST=$LATEST_VERSION .
|
||||
docker tag rpp0/gr-lora:latest rpp0/gr-lora:$LATEST_VERSION
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
LATEST_VERSION=`git ls-remote https://github.com/rpp0/gr-lora.git | grep HEAD | cut -f 1`
|
||||
DOCKER_XAUTH=/tmp/.docker.xauth
|
||||
touch /tmp/.docker.xauth
|
||||
xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $DOCKER_XAUTH nmerge -
|
||||
docker run -i -t --rm --privileged -e DISPLAY=$DISPLAY -e XAUTHORITY=$DOCKER_XAUTH -v /tmp/.docker.xauth:/tmp/.docker.xauth:ro -v /tmp/.X11-unix:/tmp/.X11-unix:ro -v /dev/bus/usb:/dev/bus/usb --entrypoint /bin/bash rpp0/gr-lora:$LATEST_VERSION
|
|
@ -0,0 +1,91 @@
|
|||
#
|
||||
# /etc/pacman.conf
|
||||
#
|
||||
# See the pacman.conf(5) manpage for option and repository directives
|
||||
|
||||
#
|
||||
# GENERAL OPTIONS
|
||||
#
|
||||
[options]
|
||||
# The following paths are commented out with their default values listed.
|
||||
# If you wish to use different paths, uncomment and update the paths.
|
||||
#RootDir = /
|
||||
#DBPath = /var/lib/pacman/
|
||||
#CacheDir = /var/cache/pacman/pkg/
|
||||
#LogFile = /var/log/pacman.log
|
||||
#GPGDir = /etc/pacman.d/gnupg/
|
||||
HoldPkg = pacman glibc
|
||||
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
||||
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
||||
#CleanMethod = KeepInstalled
|
||||
#UseDelta = 0.7
|
||||
Architecture = auto
|
||||
|
||||
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
|
||||
#IgnorePkg =
|
||||
#IgnoreGroup =
|
||||
|
||||
#NoUpgrade =
|
||||
#NoExtract =
|
||||
|
||||
# Misc options
|
||||
#UseSyslog
|
||||
#Color
|
||||
#TotalDownload
|
||||
# We cannot check disk space from within a chroot environment
|
||||
#CheckSpace
|
||||
#VerbosePkgLists
|
||||
|
||||
# By default, pacman accepts packages signed by keys that its local keyring
|
||||
# trusts (see pacman-key and its man page), as well as unsigned packages.
|
||||
SigLevel = Required DatabaseOptional
|
||||
LocalFileSigLevel = Optional
|
||||
#RemoteFileSigLevel = Required
|
||||
|
||||
# NOTE: You must run `pacman-key --init` before first using pacman; the local
|
||||
# keyring can then be populated with the keys of all official Arch Linux
|
||||
# packagers with `pacman-key --populate archlinux`.
|
||||
|
||||
#
|
||||
# REPOSITORIES
|
||||
# - can be defined here or included from another file
|
||||
# - pacman will search repositories in the order defined here
|
||||
# - local/custom mirrors can be added here or in separate files
|
||||
# - repositories listed first will take precedence when packages
|
||||
# have identical names, regardless of version number
|
||||
# - URLs will have $repo replaced by the name of the current repo
|
||||
# - URLs will have $arch replaced by the name of the architecture
|
||||
#
|
||||
# Repository entries are of the format:
|
||||
# [repo-name]
|
||||
# Server = ServerName
|
||||
# Include = IncludePath
|
||||
#
|
||||
# The header [repo-name] is crucial - it must be present and
|
||||
# uncommented to enable the repo.
|
||||
#
|
||||
|
||||
# The testing repositories are disabled by default. To enable, uncomment the
|
||||
# repo name header and Include lines. You can add preferred servers immediately
|
||||
# after the header, and they will be used before the default mirrors.
|
||||
|
||||
#[testing]
|
||||
#Include = /etc/pacman.d/mirrorlist
|
||||
|
||||
[core]
|
||||
Include = /etc/pacman.d/mirrorlist
|
||||
|
||||
[extra]
|
||||
Include = /etc/pacman.d/mirrorlist
|
||||
|
||||
#[community-testing]
|
||||
#Include = /etc/pacman.d/mirrorlist
|
||||
|
||||
[community]
|
||||
Include = /etc/pacman.d/mirrorlist
|
||||
|
||||
# An example of a custom package repository. See the pacman manpage for
|
||||
# tips on creating your own repositories.
|
||||
#[custom]
|
||||
#SigLevel = Optional TrustAll
|
||||
#Server = file:///home/custompkgs
|
|
@ -0,0 +1,127 @@
|
|||
#!/usr/bin/env bash
|
||||
# Generate a minimal filesystem for archlinux and load it into the local
|
||||
# docker as "archlinux"
|
||||
# requires root
|
||||
set -e
|
||||
|
||||
hash pacstrap &>/dev/null || {
|
||||
echo "Could not find pacstrap. Run pacman -S arch-install-scripts"
|
||||
exit 1
|
||||
}
|
||||
|
||||
hash expect &>/dev/null || {
|
||||
echo "Could not find expect. Run pacman -S expect"
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
export LANG="C.UTF-8"
|
||||
|
||||
ROOTFS=$(mktemp -d ${TMPDIR:-/var/tmp}/rootfs-archlinux-XXXXXXXXXX)
|
||||
chmod 755 $ROOTFS
|
||||
|
||||
# packages to ignore for space savings
|
||||
PKGIGNORE=(
|
||||
cryptsetup
|
||||
device-mapper
|
||||
dhcpcd
|
||||
iproute2
|
||||
jfsutils
|
||||
linux
|
||||
lvm2
|
||||
man-db
|
||||
man-pages
|
||||
mdadm
|
||||
nano
|
||||
netctl
|
||||
openresolv
|
||||
pciutils
|
||||
pcmciautils
|
||||
reiserfsprogs
|
||||
s-nail
|
||||
systemd-sysvcompat
|
||||
usbutils
|
||||
vi
|
||||
xfsprogs
|
||||
)
|
||||
IFS=','
|
||||
PKGIGNORE="${PKGIGNORE[*]}"
|
||||
unset IFS
|
||||
|
||||
arch="$(uname -m)"
|
||||
# Set to arch="armv7hf" in order to cross-compile
|
||||
case "$arch" in
|
||||
armv*)
|
||||
if pacman -Q archlinuxarm-keyring >/dev/null 2>&1; then
|
||||
pacman-key --init
|
||||
pacman-key --populate archlinuxarm
|
||||
else
|
||||
echo "Could not find archlinuxarm-keyring. Please, install it and run pacman-key --populate archlinuxarm"
|
||||
exit 1
|
||||
fi
|
||||
PACMAN_CONF=$(mktemp ${TMPDIR:-/var/tmp}/pacman-conf-archlinux-XXXXXXXXX)
|
||||
version="$(echo $arch | cut -c 5)"
|
||||
sed "s/Architecture = armv/Architecture = armv${version}h/g" './mkimage-archarm-pacman.conf' > "${PACMAN_CONF}"
|
||||
PACMAN_MIRRORLIST='Server = http://mirror.archlinuxarm.org/$arch/$repo'
|
||||
PACMAN_EXTRA_PKGS='archlinuxarm-keyring'
|
||||
EXPECT_TIMEOUT=1800 # Most armv* based devices can be very slow (e.g. RPiv1)
|
||||
ARCH_KEYRING=archlinuxarm
|
||||
DOCKER_IMAGE_NAME="armv${version}h/archlinux"
|
||||
;;
|
||||
*)
|
||||
PACMAN_CONF='./mkimage-arch-pacman.conf'
|
||||
PACMAN_MIRRORLIST='Server = https://mirrors.kernel.org/archlinux/$repo/os/$arch'
|
||||
PACMAN_EXTRA_PKGS=''
|
||||
EXPECT_TIMEOUT=60
|
||||
ARCH_KEYRING=archlinux
|
||||
DOCKER_IMAGE_NAME=archlinux
|
||||
;;
|
||||
esac
|
||||
|
||||
export PACMAN_MIRRORLIST
|
||||
|
||||
expect <<EOF
|
||||
set send_slow {1 .1}
|
||||
proc send {ignore arg} {
|
||||
sleep .1
|
||||
exp_send -s -- \$arg
|
||||
}
|
||||
set timeout $EXPECT_TIMEOUT
|
||||
|
||||
spawn pacstrap -C $PACMAN_CONF -c -d -G -i $ROOTFS base haveged $PACMAN_EXTRA_PKGS --ignore $PKGIGNORE
|
||||
expect {
|
||||
-exact "anyway? \[Y/n\] " { send -- "n\r"; exp_continue }
|
||||
-exact "(default=all): " { send -- "\r"; exp_continue }
|
||||
-exact "installation? \[Y/n\]" { send -- "y\r"; exp_continue }
|
||||
-exact "delete it? \[Y/n\]" { send -- "y\r"; exp_continue }
|
||||
}
|
||||
EOF
|
||||
|
||||
arch-chroot $ROOTFS /bin/sh -c 'rm -r /usr/share/man/*'
|
||||
arch-chroot $ROOTFS /bin/sh -c "haveged -w 1024; pacman-key --init; pkill haveged; pacman -Rs --noconfirm haveged; pacman-key --populate $ARCH_KEYRING; pkill gpg-agent"
|
||||
arch-chroot $ROOTFS /bin/sh -c "ln -s /usr/share/zoneinfo/UTC /etc/localtime"
|
||||
echo 'en_US.UTF-8 UTF-8' > $ROOTFS/etc/locale.gen
|
||||
arch-chroot $ROOTFS locale-gen
|
||||
arch-chroot $ROOTFS /bin/sh -c 'echo $PACMAN_MIRRORLIST > /etc/pacman.d/mirrorlist'
|
||||
|
||||
# udev doesn't work in containers, rebuild /dev
|
||||
DEV=$ROOTFS/dev
|
||||
rm -rf $DEV
|
||||
mkdir -p $DEV
|
||||
mknod -m 666 $DEV/null c 1 3
|
||||
mknod -m 666 $DEV/zero c 1 5
|
||||
mknod -m 666 $DEV/random c 1 8
|
||||
mknod -m 666 $DEV/urandom c 1 9
|
||||
mkdir -m 755 $DEV/pts
|
||||
mkdir -m 1777 $DEV/shm
|
||||
mknod -m 666 $DEV/tty c 5 0
|
||||
mknod -m 600 $DEV/console c 5 1
|
||||
mknod -m 666 $DEV/tty0 c 4 0
|
||||
mknod -m 666 $DEV/full c 1 7
|
||||
mknod -m 600 $DEV/initctl p
|
||||
mknod -m 666 $DEV/ptmx c 5 2
|
||||
ln -sf /proc/self/fd $DEV/fd
|
||||
|
||||
tar --numeric-owner --xattrs --acls -C $ROOTFS -c . | docker import - $DOCKER_IMAGE_NAME
|
||||
docker run --rm -t $DOCKER_IMAGE_NAME echo Success.
|
||||
rm -rf $ROOTFS
|
Plik binarny nie jest wyświetlany.
Przed Szerokość: | Wysokość: | Rozmiar: 9.4 KiB Po Szerokość: | Wysokość: | Rozmiar: 30 KiB |
Ładowanie…
Reference in New Issue