Testing LoRa Radios with the LimeSDR Mini
Testing LoRa radios can be difficult but the $140 LimeSDR mini breezes through this — once you figure it out.
I’m working on a LoRa system at 915MHz. LoRa is a frequency modulation method used on low power IOT devices. Being able to see spectral lines, decipher messages and send messages is key to successful development.
I tried numerous pieces of Windows and Linux software to get a good transmitter and a good receiver. The answer changes with time. This is written June 23rd 2018. I have not yet tested this on a blank Ubuntu system so a step or two may be missing.
Windows: getting an FM broadcast receiver working in Windows is easy. The sdr-console application with sdradio works. So does gnuradio, pretty reliably. GnuRadio comes with a huge amount of code overhead because… Windows. I was never able to get transmit to work reliably except with python — and even that failed. I didn’t try decoding LoRa because of the never transmit part. So, for receiving Windows is pretty good. Sending — not yet.
Linux: using Ubuntu 18.04 I was able to get systems working reliably but it took a lot of work and it’s easy to fry things along the way. So… follow along.
First — DO NOT BUILD everything from scratch. When you’re done nothing will work and reinstalling is painful if even possible given all of the dependencies.
The most reliable application that I found for sending was SdrAngel. Second was GnuRadio. None of the others did anything useful for me on a consistent basis.
Build and Install LimeSuite
I said not to build, but here’s one build we want. The latest bug fixes are useful. See here. I’m going to put my version of the scripts as of June 23 2018.
Build and install the latest LimeSuite and drivers.
# install core library and build dependencies
sudo apt-get install git g++ cmake libsqlite3-dev
# install hardware support dependencies
sudo apt-get install libsoapysdr-dev libi2c-dev libusb-1.0-0-dev
# install graphics dependencies
sudo apt-get install libwxgtk3.0-dev freeglut3-dev
# get the limesuite git repository
git clone https://github.com/myriadrf/LimeSuite.git
# make a build subfolder
mkdir build && cd build
# install to our system
sudo make install
Then get the latest build of everything else:
sudo add-apt-repository -y ppa:myriadrf/drivers
sudo apt-get update
sudo apt-get install liblimesuite-dev limesuite-udev limesuite-images
sudo apt-get install soapysdr-module-lms7
Click Options / ConnectionSettings and the dialog should look like this:
Note the USB 3.0. A limited palette of things will work if you are only USB 2.0. Anyway, click the LimeSDR Mini line and then click Connect.
Click Reset [really, don’t skip this … click the button already]
Click Default [this too, I know it seems dumb]
To test that the Lime is working, click Calibrate RX. Then click Calibrate TX. Everything should be ok and no error showing up in the log.
Note that you can read the “Temp” all you want but there’s no temperature sensor so … duh.
sudo apt-get install gnuradio
Test it out with the following script. The two LoRa blocks are disabled and can be removed. This transmits and FM modulated signal and shows received spectrum. If this works then transmit and receive work — at least at one frequency. The values for things like antennas match the test frequency.
The script and display are shown below. Glossary: (916M <- base_freq <- base_band*1e6), (250k <- samp_rate/decim_rate), (the 915.9 is just 916 offset 100KHz for clarity, base_rate is unused here).
The device arguments for source/sink are “driver=lime,soapy=2” without the quotes. Here is what the setup looks like (black 3d printed with brass foil).
Install the LoRa Receiver Library.
There are two (or more) LoRa block sets for GnuRadio. They are completely different and they interfere with each other so you can install one or the other. The set from Bastille includes an encoder and a decoder. The set from Rpp0 only has a decoder (receiver).
I like the block set from Rpp0 because it’s painless setup and it works reliably. Both block sets need to be built. So…
git clone https://github.com/rpp0/gr-lora.git
cd gr-lora && mkdir build && cd build
sudo make install
The steps above should add three blocks to the GnuRadio set in a LoRa group. The LoRa Receiver is a simple receiver that converts an IQ stream into data.
After installing the blocks, enable the two LoRa blocks in the script above and the script should start decoding LoRa data. The decoder can be finicky. I’ve found having a sample rate for the decoder that’s about 10x the bandwidth produces enough data for the decoder to work reasonably well.
This is a real-life example. One of the units I had would communicate sometimes. It worked with some of the units but not others.
I connected up the Lime and recorded the output spectrum from a packet. Then I did the same with another unit. Here are the two spectra:
Note that the two spectra differ by more than 10KHz! Apparently the crystal on one unit is too different (I think the left is too low). When I set the transmit frequency to 916.01MHz the two communicated perfectly.
I had 5 boards lying around connected for testing so here’s the spectrum from all 5. Interestingly the RFM95 one is almost centered at frequency whereas the others are (I think) a bit low.