A while ago I made a video where I tested the communication range of LoRa by using two modules and I got impressive results of more than 8 km while having a clear and unrestricted path between the two modules.
Since that blew my mind, I wanted to further explore the possibilities of LoRa and so I found out about LoRaWAN.
LoRa is a wireless modulation technique that allows us to send data very far with low power consumption by encoding the data inside a radio wave, but unfortunately, it does not provide any security in any way, so anyone with a LoRa module can technically intercept the data.
LoRaWAN on the other hand is a low-power wide area network protocol and network architecture that builds on the LoRa physical layer to provide bi-directional internet connectivity to low-power devices, with end-to-end security of the data.
A typical LoRaWAN setup consists of nodes and gateways, where each of the nodes represents a remote sensor or an actuator that is then connected to a gateway that connects it to the Internet.
In popular areas, there are already a ton of gateways installed and they are relaying the data to the central servers but unfortunately, where I live there were none so I partnered with Dragino and they offered me to send one of their gateways so I can install it in my home and start to further explore LoRaWAN.
The gateway that I received is the LPS8 version 2, or the so-called LoRaWAN Pico Station which is an open-source LoRaWAN gateway.
At first glance, the gateway looks like a network router and inside the box, we get the gateway, a suitable LoRa antenna, and a power adapter so we can power it. The gateway can be connected to the local network either by cable or to Wi-Fi with the built-in Wi-Fi module.
Alternatively, if the gateway needs to be installed in an area with no available local network, there is an optional 4G module that can then connect the gateway to the Internet via a cellular network.
To set up the gateway, I first plugged in the power adapter and plugged in the cable to the USB-C power port on the front. The gateway immediately turned on so I opened up the manual and tried to follow the instructions to connect to the gateway via the provided fallback IP address by directly connecting the gateway network port to the network port on my laptop.
For some reason, unknown to me, this didn’t work, and looking back at the setup I probably needed a crossover network cable for this and I used a regular one, but anyway, I then switched to connecting the gateway directly to the network on the router where it was immediately assigned a network IP address.
Typing this IP in the browser opens up the WEB UI of the gateway where we can set up all the required parameters and connections and the very first thing that I set was the SSID and password of my local Wi-Fi network so that the gateway can connect to the internet without being on a network cable.
When the gateway connected to Wi-Fi, I removed the network cable and I had to switch to the different IP that was now assigned to it by the router where on the home page I was greeted once again with the status overview of the gateway and its connection statuses.
I quickly explored the available menus, and although the gateway already showed its LoRaWAN status as available, I went to The Things Network website so I can register the gateway under my own account and monitor its activity from there.
The Things Network is a global collaborative IoT ecosystem that provides a set of open tools and a global open network for LoRaWAN devices that we can use for our projects. They are the creators of the open-source LoRaWAN network server, The Things Stack which is critical for any LoRaWAN solution and allows for easy management of applications, end devices, and gateways.
The gateway implements this server locally so if we want we can choose to run our applications without having to share the data to the cloud, but for now, I want to use the cloud version so I can then be able to view the data from anywhere.
The network and the managed community version of The Things Stack are provided for free with some limits but for the sake of our purpose of exploring the world of LoRaWAN, they should be good enough for now.
To start, I first created an account and I choose the closest cluster to me, EU1, as the base of my registration. Additionally, I made sure to verify my email address before entering the console where I was asked to either create an application or register a gateway.
Since this is my first time here, I select to register a gateway and the very first info that I was required to enter is the gateway EUI. This can be found inside the gateway UI under LoRaWAN → LoRaWAN Semtech UDP, which is the mode under which the gateway operates by default.
I copied this number from the gateway page to the things stack site and I then had to enter the gateway name and the frequency plan for the gateway. This greatly depends on the region that you are in and the gateway that you have, so in my case, because I’m located in Europe and the gateway I have works on the 865/868MHz range, I selected the Europe 863 to 870 MHz plan, which in fact was the recommended one.
With that, the gateway was now added so I also updated the email address inside the gateway UI and I went ahead to explore the built-in servers in the gateway. These include a local version of The Things Stack community version and a Node-Red application server.
Node-Red allows us to create programming flows for our connected devices by using a browser-based editor and it is definitely something that I wanted to explore for a long time now. It runs on port 1880 on the gateway so by following the gateway IP address and port in the browser, I was able to go into the Node-Red UI without any issues.
For the local Things Stack server, however, I had a bit of an issue setting it up and properly login into it. Since it uses Oauth for authentication, the domain/IP address on which it runs must match the address that it has set inside the gateway configuration.
By default, this uses local DNS based on the hostname, but this is not working on my network so I was accessing it by the IP address on port 8080.
In order to switch it so it binds to the IP address instead, there is a button we can click, next to its URL that will set the current eth, or Ethernet IP address as the default address on which it runs.
If you remember, I’ve previously set the gateway to run from Wi-Fi only, so when I clicked this button, the address was removed entirely and I was left scratching my head for a few minutes because I missed the information that it will ONLY look at the Ethernet interface for an IP address.
Once I realized this, I connected the gateway with a cable once again, and once it got an IP address on the eth interface, I clicked the Update URL button once again and the IP was set properly this time.
To make sure that this is the IP that the gateway will always get, I went into my router settings and made sure to manually assign a static IP address in the DHCP settings for the gateway so it always is on the same local IP address.
With that set, I removed the cable, restarted the router and the gateway and I now had it available on the IP address that I previously set and I now was able to also log in to the local version of The Things Stack server running on the gateway.
To make sure that the data is also handled here, inside the gateway LoRaWAN settings, I set localhost as the secondary LoRaWAN server so hopefully, we can later receive the data there as well but we will explore this in a future video where I will be diving more into nodes, applications and how it all ties together into a fully working solution.
If you are interested to see that, be sure to subscribe, let me know if you have any questions down below and since you already made it this far, I’m sure that you will be very interested in the results that I got when I first played with LoRa in this video.
Dragino website: https://dragino.com/
LPS8v2 Indoor LoRaWAN Gateway: https://dragino.com/products/lora-lorawan-gateway/item/228-lps8v2.html
LPS8v2 User Manual - http://wiki.dragino.com/xwiki/bin/view/Main/User%20Manual%20for%20All%20Gateway%20models/HP0C/
Other tools and materials for electronics projects:
- ESP32 Development board - https://s.click.aliexpress.com/e/_Dczo9a7
- NodeMCU development board - https://s.click.aliexpress.com/e/_DdIWyld
- WeMos D1 - https://s.click.aliexpress.com/e/_DCj5JSF
- Arduino Uno - https://s.click.aliexpress.com/e/_DnSgkBD
- Sensors starter kit - https://s.click.aliexpress.com/e/_DDr4m6r
- Resistirs - https://s.click.aliexpress.com/e/_DFTphqF
- Capacitors - https://s.click.aliexpress.com/e/_DBp0vpt
- LEDs - https://s.click.aliexpress.com/e/_DnP0hBV
- Multimeter - https://s.click.aliexpress.com/e/_DdpQzsX
- Soldering station - https://s.click.aliexpress.com/e/_Dd7hWJv