A single channel LoRa gateway made by yourself
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!
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
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.
Let's connect the LoRa module to the Raspberry Pi
|RFM95W||Raspberry Pi (BCM)||WiringPi|
Configure and install the required software on the Raspberry Pi.
Start by enabling SPI:
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.
Unzip the downloaded archive
Then, tweak the backend server's ip address and port to match TTN's backend: set the IP to 18.104.22.168 and the port to 1700.
Change the lines where server ip and port are defined:
#define SERVER1 "22.214.171.124"
#define PORT 1700
Also configure the fields that describes the gateway to provide some usefull information to TTN:
// Set location
/* Informal status fields */
static char platform = "Single Channel Gateway";
static char email = "email@example.com";
static char description = "Testing single channel LoRa gateway";
Then run the packet forwarder
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.