Making a LoRa Gateway

One of the advantages of the LoRa transceivers, when compared to the traditional RTTY modulation used by most High Altitude Balloons, is that it requires very little processing power at the receiver.  So instead of using a PC or a high end tablet or phone to decode the transmissions, all you need is a simple microprocessor with (assuming you want to upload data to the web for mapping) an internet connection.

The latter requirement makes devices such as the Raspberry Pi ideal for the task.  A Pi, plus wired or wireless connection, just needs a simple board added with a LoRa transceiver connected to the SPI pins.  And that’s exactly what Uputronics has made – and here’s a prototype board that they sent to me:

IMG_1214

Normally it comes with a single 434MHz LoRa device but here I’ve added a second (you could add a 434MHz or 868MHz model).  The remainder of this post will assume that the board is populated with just one device, in position 1.

Physically install is very simple – just push on to the Pi model A+ or B+, using a standard pin header extender (supplied).  Or an pin header with extended pins can be used if you want to stack another board on top.

Next, burn an operating system onto a suitable SD card.  For this purpose anything from 4GB should be fine.  The following instructions are for Raspbian, and no other operating systems have been tested.

First, run raspi-config:

sudo raspi-config

Then expand the filesystem, as you would normally do, then choose Advanced Options –> SPI and enable SPI.

rc

It’s also worthwhile to change the hostname (Advanced Options –> Hostname).  Finally, close the program and choose the reboot option.

Once rebooted, login again.  We now have some software to install.  First, install wiringPi, which is used for the SPI library and to read the status of the LoRa module via 2 of its INT pins:

cd ~
git clone git://git.drogon.net/wiringPi
cd wiringPi
./build

Next, install SSDV which is used to decode download images:

cd ~
git clone https://github.com/fsphil/ssdv.git
cd ssdv
sudo make install

The gateway software uses the curl library for internet access (uploading telemetry data and/or image data), so install that:

sudo apt-get install libcurl4-openssl-dev

and the ncurses library used for the screen display:

sudo apt-get install libncurses5-dev

Finally, install the gateway software itself:

cd ~
git clone https://github.com/PiInTheSky/lora-gateway.git
cd lora-gateway
make

That completes the installation, so now for the configuration.  The main settings are in a file gateway.txt in the above folder (/home/pi/lora-gateway).  Here’s a simple example:

tracker=MYCALLSIGN

frequency_0=434.451
mode_0=2

#frequency_1=434.450
#mode_1=0

This firstly sets your callsign, which if you are a radio amateur would normally be your radio callsign, but it can be something else.

The next part sets the frequency and mode for the first LoRa device (the one in position “1”).  Frequency is in MHz and should match the frequency of the tracker that you intend to receive.  “Mode” is described below, where the other (optional) settings are also described.  The final lines are commented out, to disable the second LoRa module.

tracker=<callsign>.  This is whatever callsign you want to appear as on the tracking map and/or SSDV page.

EnableHabitat=<Yes/No>.  Enables/disables telemetry upload to habitat.

EnableSSDV=<Yes/No>.  Enables/disables image upload to the SSDV server.

frequency_<n>=<freq in MHz>.  This sets the frequency for LoRa module <n> (0 for first, 1 for second).  e.g. frequency_0=434.450

mode_<n>=<mode>.  Sets the "mode" for the selected LoRa module.  This offers a simple way of setting the various
                LoRa parameters (SF etc.) in one go.  The modes are:

                0 = (normal for telemetry)  Explicit mode, Error coding 4:8, Bandwidth 20.8kHz, SF 11, Low data rate optimize on
                1 = (normal for SSDV)       Implicit mode, Error coding 4:5, Bandwidth 20.8kHz,  SF 6, Low data rate optimize off
                2 = (normal for repeater)   Explicit mode, Error coding 4:8, Bandwidth 62.5kHz,  SF 8, Low data rate optimize off
                3 = (normal for fast SSDV)  Explicit mode, Error coding 4:6, Bandwidth 250kHz,   SF 7, Low data rate optimize off

SF_<n>=<Spreading Factor>  e.g. SF_0=7

Bandwidth_<n>=<Bandwidth>.  e.g. Bandwidth_0=41K7.  Options are 7K8, 10K4, 15K6, 20K8, 31K25, 41K7, 62K5, 125K, 250K, 500K

Implicit_<n>=<Y/N>.  e.g. Implicit_0=Y

Coding_<n>=<error_coding>.  e.g. Coding_0=5 (4:5)

To run, just type

sudo ./gateway

and you will see a screen like this:

gw

In this example, channel 0 (the LoRa module in position 1 on the board) is enabled, at 434.451MHz, and mode 0 which is a shorthand for a mode suitable for continuous long-range telemetry transmission.

The status display updates as packets are received:

gw2

Finally, to exit the program, press CTRL+C.

This entry was posted in Weather Balloon. Bookmark the permalink.

22 Responses to Making a LoRa Gateway

  1. Peter Waddy says:

    Dave, have you found the sensitivity of the LoRa Tx/Rx is better than a standard Radiometrix module with RTTY?

    • dave says:

      I’ve not had a flight far enough away to know, but my guess is that they’re comparable. I’ll have a better idea after more flights. The main question though is how well LoRa works in a chase car, as that’s the most important receiver when trying to retrieve a flight.

  2. Ben - PE2BZ says:

    Hi Dave, you write: The next part sets the frequency and mode for the first LoRa device (the one in position “1”). I assume that, with markers on my board CE0 and CE1 that the first line sets Frequency_0 for the device in slot CE0 and that Frequency_1 sets it for the device in slot CE1. Am I right ? I have a Pi addon board with one LoRa module in CE1, My RSSI with no signal , with frequency_0 is constant -157 and if I use Frequency_1 it’s -116 and showing changes when I disconnect the antenna. There is no error message callign a frequency on a not installed LoRa module.

    By the way, is there a way to have a test transmission myself with only the Pi and the LoRa board ? I would like to see my own signal on the SDR receiver….

    Kind regards,
    Ben

  3. Pierre-Louis says:

    Hi Dave,

    I’ve a question regarding LoRa: all examples we’ve found with LoRa are about the use of the LoRa module with an Arduino, a Raspberry and so on.
    On the other side, example about using Xbee show that we can use Xbee also with Arduino (or Raspberry) but that it’s also possible to use the Xbee alone.
    As we are working on a project on which the receiver must only light a LED, we’re interesting but a stand-alone system (so like “Xbee alone”).
    The question is: is it possible with a LoRa module?

    Thanks for your answer
    Kind regards
    Pierre-Louis

  4. Pingback: Skycademy - Balloons Everywhere! - Raspberry Pi

  5. Anonymous says:

    For a simple PICAXE-08M driven proof of concept (& LoRa™ overview) perhaps see => http://www.instructables.com/id/Introducing-LoRa-/

  6. Pingback: A DIY low-cost LoRa gateway(1) | LinkSprite Learning Center

  7. Pingback: LoRa / LoraWAN; noch ein neuer Funkstandard – Merkbar.

  8. Pingback: LoRasPI: Raspberry PI LoRa Gateway/Node #piday #raspberrypi @Raspberry_Pi - Raspberry Pi News

  9. Kenneth Chia says:

    Hi Dave, I am unable to complete the command ‘ $ sudo ./gateway ‘. Any suggestions/advice from there?

    Thanks!

    • Kenneth Chia says:

      ‘Failed to open config file’ is what I got.

      Hope to get a reply from you soon. Thanks so much!

    • Kenneth Chia says:

      Hi, I’ve solved this problem and I’ve encountered another. How do I connect the device to the gateway? In another words, how do receive the data from the device?

      Hope to hear from you. Thanks!

      • David Akerman says:

        I don’t understand your question.

        It receives data from balloon trackers (e.g. this one http://www.pi-in-the-sky.com/). It does this using a LoRa board such as the one shown in my article. Received packets are uploaded to the balloon tracker and appear on the balloon map (https://tracker.habhub.org). So the entire process is:

        GPS data at tracker –> LoRa board on tracker ——————-> LoRa board on Pi gateway –> Balloon map

        So you need balloon tracking software, a Pi and LoRa board for the balloon tracker, a Pi and LoRa board for the gateway, and of course my gateway software.

        Hope this is clear.

        Dave

  10. Gerpux says:

    Will your tutorial work with this shield?
    http://wiki.dragino.com/index.php?title=Lora/GPS_HAT
    Best, thx!

  11. jivitraa devi a/p segaran says:

    good evening, can i know if there is any possible information for me to simulate this LoRa transceiver using Simulink? is there any white papers that could help me design the block diagram using Simulink? sorry but this could help me do my final year project.

  12. Pingback: Pi-in-the-Sky IV: LoRa Tracker und Gateway - Merkbar.

  13. Akarsh Ghale says:

    Can i do this without the use of Lora?

Leave a Reply

Your email address will not be published.