Building a LoRaWAN gateway

Our in-house LoRaWAN technical expert, Paul, decided to build his own LoRaWAN DIY gateway. Find out how he did it in this blog post.

If you want to experiment with LoRaWAN and aren’t lucky enough to live somewhere already covered by an existing The Things Network gateway, you’ll need to buy or make your own LoRa gateway.

When I initially started my own testing of LoRaWAN technology I built a DIY LoRaWAN gateway.

The finished gateway

Hardware build

Having already read a few guides and blog posts on building a DIY LoRaWAN gateway using a Raspberry Pi as the controller, I figured this was the best way to go.  I’ve been using Raspberry Pis for experimentation for years, have loads of them at my disposal in the office and know how to use them.

My requirements were something that is a nice self-contained box that can sit in our office and look reasonably good as opposed to a pile of circuit boards on a test bench.  I wanted to connect it directly to Ethernet and power the whole thing using Power over Ethernet (PoE) instead of a separate power supply. 

My DIY LoRaWAN gateway is for indoor use only, just to keep things simple for the housing.

First, I collected the following parts:

  • Raspberry Pi version 3
  • 4GB MicroSD card for the above.  I recommend buying Noobs cards because they are known to work well and SD cards are a bit of a weakness of the R-Pi
  • IMST iC880A SPI LoRaWAN concentrator board
  • iC880A backplane.  Various ones are available, I used the Coredump one (some basic soldering required or order it fully assembled)
  • u.fl to SMA – Pigtail cable for iC880A-SPI from IMST
  • 868MHz antenna from IMST
  • (note: the above two items are available from various places but I ordered them along with the concentrator board from IMST)
  • TP-Link TL-POE10R PoE splitter.  From Amazon.
  • Plastic project box from Farnell.  Part code: 2478793
  • Panel mount Ethernet coupler from Farnell.  Part code: 2708703
  • 2mm thick ABS (plastic) sheet (for mounting all the components to and fitting inside the project box).  From Ebay.
  • 2.1mm barrel connector with twin wire (cut this off an old dead power supply)

I already had various Ethernet cables and tools.  Not many tools are needed, a small drill with a selection of drill bits, selection of screwdrivers, sharp knife (Stanley knife or art knife) for cutting the ABS sheet, some cable ties.

You will also need a method of writing to an SD card, either a USB card reader or a card reader built into your PC/laptop.

Putting it all together

I think a picture speaks a thousand words here so this is a picture showing the internal parts inside my DIY LoRa gateway:

concentrator board inside diy lorawan gateway

  • The Coredump backplane comes with plastic standoffs which sit on the Raspberry Pi mounting holes, these are screwed through the 2mm plastic backing sheet I cut down to size to fit the mounting holes in the project box.
  • The backplane plugs into the Raspberry Pi board and the IMST LoRaWAN concentrator plugs into the backplane.
  • The backplane provides power to both the IMST concentrator board and the R-Pi.  It has a voltage regulator accepting anything from 6.7v to 28v DC input.  So the output from the PoE splitter into connected to this with the splitter set to either 9v or 12v.  This is the only power input needed.
  • In the picture, the purple Ethernet cable is the network+PoE input, the black Ethernet cable is the network connection from the splitter into the R-Pi.

Software configuration

  • Download the latest Raspbian lite/minimal image.  At the time of writing, this was based on Debian Stretch.
  • Burn this on to your SD card.  Even if you bought a Noobs SD card I would still over-write the operating system that comes pre-installed because it includes a lot of software you don’t need, including a full desktop environment.  There are loads of how-to guides on how to do this already so I’m not going to repeat them here.
  • Put the SD card into the R-Pi and then power everything up.
  • SSH into the R-Pi (default login is username ‘pi’, password ‘raspberry’, please change this to something else immediately!).
  • The R-Pi talks to the IMST board over SPI (serial peripheral interface), this needs to be enabled:
    sudo raspi-config
    Select “Interfacing Options”
    Select “SPI”
  • Assuming you want to use The Things Network, there is an installer script available on Github. Install steps:
    sudo apt update
    sudo apt install git sudo
    sudo adduser ttn
    sudo adduser ttn sudo
    sudo visudo
  • add the line:
    ttn ALL=(ALL) NOPASSWD: ALL
  • save and close that file, then install the software:
    git clone -b spi https://github.com/ttn-zh/ic880a-gateway.git ~/ic880a-gateway
    cd ~/ic880a-gateway
    sudo ./install.sh spi
    and follow the instructions. I didn’t bother with the remote management things
  • During installation, it will tell you that gateway’s EUI, you will need this to add the gateway to The Things Network so make note of it.
DIY gateway

Connecting to The Things Network

The Things Network have excellent documentation already so I’ve leave this part largely for the reader to work out.  If you’ve managed the above steps then this will be straight forward.

One thing to note is that you need to select “Legacy Packet Forwarder” when adding the gateway in the TTN Console.  Once you’ve done this you should soon see the status to go “connected” with a green icon, this means you’re ready to go!

diy lora gateway in ttn console
DIY gateway in the TTN Console

Conclusion

This is a fairly quick, relatively cheap way of getting a fully capable LoRaWAN gateway up and running.  I would consider it suitable for experimentation & hobby purposes.

Whilst I’ve found in the past that Raspberry Pis will trash their SD cards from time to time, my gateway has been running mostly non-stop for about 8 months now without any issues.  I’ve only powered it down once or twice though to move it to a different location in our office.

The total cost will be about £250.  Commercial, off the shelf LoRaWAN gateways are now getting down to that price.  The LorixOne gateway we sell for example, isn’t too far off now:

LORIX One LoRaWAN Gateway