A single channel LoRa gateway made by yourself

WARNING: the following procedure is not supported anymore by TTN and your messages wont be forwarded!
Diy lorawan gateway

A few months ago, I went to a workshop organized by the WSL & The Things Network. They taught us about using TTN hardware to create a LoRa mote that sends some basic data to the TTN backend.

Of course, as the workshop was well prepared, we were sending data rapidly and exploited this data on the backend.

When I came back home, I was sad that i could not play again with this technology, because of two things:

  • I don't have any LoRa mote
  • there is no LoRa network coverage in my area

I could get rid of the first barrier by borrowing a The Things Uno from a friend, but he doesn't have the gateway to provide the network coverage.

I decided to do some online research and build my own low-cost single channel LoRa gateway.

So now, let's get straight to the point and build our own single channel LoRa gateway!

Step 1

Get the needed hardware:

  • a raspberry pi and its SD card prepared with the latest raspbian distro - mine is an old v1 model B and works well
  • a LoRa mote - I use a The Things Uno board
  • a LoRa compatible radio chipset - I use the HopeRF RFM95W chipset
  • a converter board to connect the RFM95W more easily to the RPi
  • the SMA connector for the board and an antenna

Step 2

Now it's time to prepare the hardware.

Solder the RFM95W on the converter board, the SMA connector and plug the antenna into the connector to get the radio board ready. Pay attention to the drawings on the converter board indicating how to position the RFM95W. There are "XT" and "IC" drawings on the board to help get it right.

Hoperf rfm95w board

Step 3

Let's connect the LoRa module to the Raspberry Pi

RFM95W Raspberry Pi (BCM) WiringPi
3.3V 3.3V N/A
GND GND N/A
MISO MISO N/A
MOSI MOSI N/A
SCK CLK N/A
NSS BCM25 GPIO6
DIO0 BCM4 GPIO7
RST BCM17 GPIO0

Step 4

Configure and install the required software on the Raspberry Pi.

Start by enabling SPI:

sudo raspi-config

Then go to "9 Advanced options" -> "A6 SPI" and enable the SPI bus.

Next, install wiring-pi:

sudo apt-get update
sudo apt-get install wiringpi

Download and install the main piece of software that will turn our RPi into a LoRa gateway.

I use this library which works quite well.

wget https://github.com/tftelkamp/single_chan_pkt_fwd/archive/master.zip

Unzip the downloaded archive

unzip master.zip

Then, tweak the backend server's ip address and port to match TTN's backend: set the IP to 40.114.249.243 and the port to 1700.

cd single_chan_pkt_fwd-master/
nano main.cpp

Change the lines where server ip and port are defined:

#define SERVER1 "40.114.249.243"
#define PORT 1700

Also configure the fields that describes the gateway to provide some usefull information to TTN:

// Set location
float lat=50.445754;
float lon=3.8996654;
int alt=43;

/* Informal status fields */
static char platform[24] = "Single Channel Gateway";
static char email[40] = "me@example.com";
static char description[64] = "Testing single channel LoRa gateway";

Almost done!

make

Then run the packet forwarder

sudo ./single_chan_pkt_fwd

That's it

Now we have a successful single channel LoRa gateway forwarding our mote's packet to the TTN backend in no time!

Bear in mind that downlink is not possible with this piece of software.


Back to home page

About me

Picture jf

Passionate about hardware design and testing things, I enjoy prototyping smart connected devices.