lora gateway raspberry pi shield

LoRa became a very powerful wireless communication interface that gives the way to build big scale wireless networks containing hundreds and thousands of devices. Used topology is a star when all nodes send information to web server through some amount of gateways. The most interesting feature of LoRa interface that one gateway can handle thousands of nodes at the same time without any collision. Not like in car alarm system with point to point communication between car and key chain. Here described steps to use lora gateway raspberry pi shield to transform your Raspberry Pi v2/3 to fully functional multi-channel lorawan gateway.

Another advantage of LoRa interface is communication range between end node and gateway – up to 15 kilometers. LoRa interface well suited for applications that need to pass just up to few hundred bytes per day from node to web server. E.g. for low data generation applications. It can be counted as disadvantage. But in other hand it gives you way keep nodes in sleep modes more than 99% of life cycle so you get devices that able to work up to 5 years from single Li-SOCl2 battery. It means that only end node can initiate communication session. It is true. It is about LoRa.

LoRaWan is communication protocol used over LoRa interface.

Prototyping using lora gateway raspberry pi shield

What do we need to start prototyping own LoRa network?

Not much. LoRa network contain three main parts:

1. web-server

TheThingsNetwork for fast prototyping. TheThingsNetwork stack V3 or LoRaServer if you need to deploy your own private gateway. Last one can be deployed in few minutes by typing following command in you Linux driven PC:

$ docker-compose up

But current post not about this part of LoRa network. I am going to describe it lately.

2. end nodes

any end node that implement required functionality.

3. lorawan gateway.

Your Raspberry pi can be equipped with low cost LoRa shield to get lora gateway.

Just plug shield to Raspberry V3 or Raspberry V2 and get development lorawan gateway based on raspberry pi:

lora raspberry pi 3:

lora gateway raspberry pi

lora gateway raspberry pi

lora raspberry pi 2:

lora gateway raspberry pi

lora gateway raspberry pi

After that just insert ethernet cable, attach RF antenna and power up Rpi as usual. Connect over SSH as usual.

Installation.

First you need to check if SPI interface is enabled:

$ ls /dev/spidev*
/dev/spidev0.0 /dev/spidev0.1
If you don’t see any spi device enable it:
$ sudo raspi-config
 
 
lora raspberry pi
 
lora raspberry pi
 
lora raspberry pi
 
After that install all required software. lora_gateway:
$ cd ~
$ mkdir lora
$ cd lora
$ git clone https://github.com/Lora-net/lora_gateway.git
$ cd lora_gateway
$ make
packet_forwarder:
$ cd ~/lora
$ git clone https://github.com/Lora-net/packet_forwarder.git
$ cd packet_forwarder
$ ./compile.sh
$ cd lora_pkt_fwd
change your web server address and ports. In a case of TTN cloud is:
$ cd ~/lora/packet_forwarder/lora_pkt_fwd
$ nano global_conf.json
find and change following config params to:
  • “gateway_ID”: “AA555A0000000000”
  • “server_address”: “router.eu.thethings.network“,
  • “serv_port_up”: 1700,
  • “serv_port_down”: 1700,
where gateway_ID is ID of gateway from your TTN profile. Here you can find information about registering gateway on TTN cloud: ttn registering
GW-01 RPI based on SX-1301 Semtech’s LoRa PHY IC that requires reset after powering it.
To do it:
$ cd ~/lora
$ touch reset.sh
$ nano reset.sh
fill this file with following:
echo “25” > /sys/class/gpio/export
echo “out” > /sys/class/gpio/gpio25/direction
echo “1” > /sys/class/gpio/gpio25/value
sleep 3
echo “0” > /sys/class/gpio/gpio25/value
sleep 1
echo “0” > /sys/class/gpio/gpio25/value
 
Save and exit.
Now:
$ cd ~/lora
$ sudo chmod +x reset.sh

Running

$ cd ~/lora
$ sudo ./reset.sh
$ cd packet_forwarder/lora_pkt_fwd/
$ ./lora_pkt_fwd
If you see similar logs:
INFO: [main] concentrator started, packet can now be received
you got running gateway that able to receive LoRaWAN RF packets and forward them to web server. Congratulations!