This tutorial takes you through all the steps required to get your RAK833 LoRa gateway module up and running with 11ac Wi-Fi as the backhaul. Surely, you can also run with other ways as the backhaul, for example, 11a/b/g/n Wi-Fi, 3G/4G, and Ethernet.
In this tutorial, we use a newest Raspberry Pi3 module B+ as the host board. You can also use other types of Raspberry Pi as the host board.
After we build a LoRa gateway successfully in this tutorial, we use the TTN network as our LoRa network server and use RAK811 as our LoRa node. If you want to use one of the other LoRa network servers, you can do it freely.
What is LoRaWAN?LoRaWAN is a Low Power, Wide Area (LPWA) networking protocol designed to wirelessly connect battery operated ‘things’ to the internet in regional, national or global networks, and targets key Internet of Things (IoT) requirements such as bi-directional communication, end-to-end security, mobility and localization services.
The Diagram above shows the various parts of the Lora wireless architecture. Some of the important parts are explained in short below:
Key Features of LoRa Technology and the LoRaWAN Protocol- GEOLOCATION: Enables GPS-free, low power tracking applications
- LOW COST: Reduces costs three ways: infrastructure investment, operating expenses and end-node sensors
- STANDARDIZED: Improved global interoperability speeds adoption and roll out of LoRaWAN-based networks and IoT applications
- LOW POWER: Protocol designed specifically for low power consumption extending battery lifetime upto 20 years
- LONG RANGE: Single base station provides deep penetration in dense urban/indoor regions, plus connectsrural areas up to 30 miles away
- SECURE: Embedded end-to-endAES128 encryption
- LOW POWER: Protocol designed specifically for low power consumption extending battery lifetime up to 20 years areas up to 30 miles away
LoRaWAN network architecture is deployed in a star-of-stars topology in which gateways relay messages between end-devices and a central network server. The gateways are connected to the network server via standard IP connections and act as a transparent bridge, simply converting RF packets to IP packets and vice versa. The wireless communication takes advantage of the Long Range characteristics of the LoRa physical layer, allowing a single-hop link between the end-device and one or many gateways. All modes are capable of bi-directional communication, and there is support for multicast addressing groups to make efficient use of spectrum during tasks such as Firmware Over-The-Air (FOTA)upgrades or other mass distribution messages.
What is RAK833
The RAK833 is a LoRa gateway mini PCIe module with SPI and USB interface.
It is a LoRa Radio frontend, and acts as a receiver of incoming LoRa data packets and forwards them to an aggregator management software/hardware host. It can also transmit LoRa data packets based on the host boards request. In our case, a raspberry Pi 3 moduleB+ is the host board controlling the RAK833 frontend.
You can learn more about RAK833 in its datasheet from the following link:
Choosing the backhaulWhat is a backhaul? Backhaul refers to how the Raspberry Pi will be connected to the Internet. This guide focuses on using Wi-Fi as backhaul, but you could also use Ethernet or 3G/4G. If you do have Ethernet available near the gateway, then prefer it over Wi-Fi or 3G/4G. This is because having an additional radio signal inside the enclosure will cause noise. The software can handle the noisy environment, so it's not a big issue, but the less noisy, the better. You can combine this choice with Power-over-Ethernet to minimize the cabling going all the way up to the gateway.
Setup the hardware:Before we connect anything, let’s get the following configurations done on the RaspberryPi 3 module B+ and the RAK833 LoRa gateway module:
RASPBERRY PI
- Get the Raspberry Pi 3 module B+ board and get a 8Gb micro SD card ready with the Raspbian software. You can even buy a noobs SD card with the software preloaded. On how to flash the OS on the SD card please follow the instructions here: https://www.raspberrypi.org/learning/hardware-guide/
- Connect the Raspberry Pi 3 module B+ board to an external power supply rated at 5V dc, and a minimum current of 2.5A. THIS IS VERY IMPORTANT. The LoRa module may draw 700 mA peak during active wireless transactions and hence have a good power brick to power the Raspberry Pi.
RAK833:
Before you even power on the board get the antennae that came in your kit and connect it to the antennae screw terminal. THIS IS ESSENTIAL.
After that, you can insert the RAK833 to the mPCIe2USB board, and plus the board to Raspberry Pi 3module B+ via USB interface.
Software installationLet’s do the following steps to get the essential software installed on the Raspberry Pi 3 module B+:
- 1) Download Raspbian Stretch with Desktop from the following link:https://www.raspberrypi.org/downloads/raspbian/
- 2) Follow the installation instruction to create the SD card. https://www.raspberrypi.org/documentation/installation/installing-images/README.md
- 3) Connect your Raspberry Pi 3 module B+ to internet via Wi-Fi (or 3G/4G, Ethernet):
Youcan refer to the method to configure the Wi-Fi credentials here: https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md
- 4) Then, configure locales and time zone on the Raspberry Pi 3 module B+
- 5) Make sure you have an updated installation and the git has been installed. Open Raspbian's Terminal and execute the following commands:
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install git
- 6) Clone the installer and start the installation as follow (check here: https://github.com/RAKWireless/RAK833-LoRaGateway-RPi):
$ git clone https://github.com/RAKWireless/RAK833-LoRaGateway-RPi.git ~/rak833-loragateway
$ cd ~/rak833-loragateway
$ sudo ./install.sh
- 7) You will see a message which ask you a question like the following information, and you should type ‘n’.
Gateway configuration:
Detected EUI B827EBFFFE9BFF6C from eth0
Do you want to use remote settings file? [y/N]
- 8) Then, you will see some messages as follow:
Host name [ttn-gateway]:
Descriptive name [ttn-rak833]:
Contact email:
Latitude [0]:
Longitude [0]:
Altitude [0]:
Just hit the Enter key to keep default or enter your information if you want.
- 9) If you want to use the remote configuration option, please make sure you have created a JSON file named as your gateway EUI(e.g. B827EBFFFE7B80CD.json) in the Gateway Remote Config repository here: https://github.com/ttn-zh/gateway-remote-config. Fork the repo, add your <EUI>.json file with the proper configuration and then commit the forked repo. Once done, send a pull request to the master repo and the file should show up in the repo the next day.
- 10)After the Raspberry Pi3 module B+ restart automatically, Congratulations, you have a running gateway in front of you now!
The Things Network provides a cloud service to parse and store the data sent by LoRa nodes via a LoRa gateway. Now, let’s use the TTN network.
Firstly, you need to register yourself on the TTN websit here: https://www.thethingsnetwork.org/
Then follow the instructions to register your gateway:
https://www.thethingsnetwork.org/docs/gateways/registration.html
As following steps:
- Log into thethingsnetwork.org Console
- Click on Gateways -> register gateway
- Select the packet forwarder protocol
- Enter your Gateway EUI (if is printed on start and end of the installer)
- Enter any description
- Select Europe 868Mhz as frequency plan or a suitable plan based on your country
- Select the correct antenna placement according to your plans
- Confirm clicking Register gateway
If you see the status is “connected”, it indicates that your gateway has been registered successfully.
There has been atutorial about how to connect RAK811 LoRa node to TTN network. You can checkfrom here: http://docs.rakwireless.com/en/RAK811/Application%20Notes/How%C2%A0To%C2%A0Connect%C2%A0Lora%C2%A0RAK811%C2%A0to%C2%A0The%20Things%20Network.pdf
Send some data via ourLoRa networkOK, let’s try to send some data via our LoRa network.
Send data from RAK811 LoRa node by using AT command like this:
You can see the data which you sent from RAK811 node on the TTN network server.
Great! You have built a LoRa network with RAK833, Raspberry Pi 3module B+, RAK811, and TTN network, and send some data via it successfully.
Comments