The last few months I have been working on setting up a LoRaWAN network in and around Ede in my spare time. In this blog I want to explain the workings of LoRaWAN, the gateways I placed for it and I will give some tips on how to work with it yourself.
The LoRa protocol is specifically designed for the Internet of Things (IoT) and allows data to be sent over long distances (about 15 kilometres) through special gateways. The record is set at 160 kilometres right now, but that was in the most optimal conditions. The maximum distance in cities is 4 to 5 kilometres in normal circumstances. The power consumption for sending and receiving is also very low. A small button-cell battery can be used to power a device for years, without trouble. Because of the large coverage of a single gateway and with relatively cheap sensor nodes, it is easy to monitor a very large area. Gateways using 'The Things Network (TTN)' create an open, freely accessible international network for everyone.
Wienke Giezeman, founder of The Things Network, provides an introduction in the video below.
Nothing is more fun than finding out how things work. I pieced my first gateway together myself for exactly that reason. There were some challenges along the way. After weeks of troubleshooting and with the help of some other LoRa enthusiasts, I finally managed to get the first gateway operational.
Then I went looking for locations I could place a gateway somewhere high up.That was not always easy. Luckily BIT has the possibility to place antennas on a mast on the roof of one of their datacenters. BIT's management is always interested in new technology, so the first gateway was soon installed. To significantly expand the coverage, at least four more gateways will be placed for this project.
TTN started a while ago as a Kickstarter project for purchasing cheap, easily installed gateways. The four extra gateways I will be placing, come from this Kickstarter project and will be delivered in the coming months. There is a good chance that there are a number of other participants to the TTN Kickstarter project in Ede, allowing for even more additional coverage. This will ensure extra redundancy to the area. With some luck, a part of Lunteren, Wageningen, Veenendaal and the Ginkelse Heide will also be part of the initial coverage area.
To map the coverage of a gateway as precisely as possible, there is a tool called TTNMapper. With a LoRa node and a GPS application on your phone, you can get a good view of the coverage area. With a number of colleagues I have mapped the coverage for the single gateway at BIT in less than ideal circumstances. That resulted in the following picture.
Cities like Amsterdam, The Hague and Utrecht have been largely covered already, but the network will only take real shape when the first thousand gateways of the TTN Kickstarter are placed. KPN is also working on a nationwide network, but contrary to The Things Network, that will not be free.
Based on the distance to the gateway, the required transmission time for sending the message will be calculated and optimised automatically. This is important, because the LoRaWAN network allows a maximum transmission time per node. This way, everyone can use the network as honestly as possible. Channels are bundled for nodes closer to a gateway to send messages more quickly. Because you use less time sending the package, you can send more packages a day from these nodes.
The maximum size of a message send on LoRaWAN is 64 bytes. That is a payload with a maximum of 51 bytes and 13 bytes of metadata. That is not a lot, but LoRaWAN is not a replacement of WiFi or Bluetooth. If you pack your message properly, you can still put quite a lot of information in. Check the message below with the payload "wsqDV/8nCidFHLMzFwW+AQQAMgQO". That is 28 bytes, plus 13 bytes of metadata, coming to a total of 41 bytes. The fieldnames are not in the message, but are added for illustrative purposes
Extensions of the LoRaWAN protocol have already been announced. One of the extensions concerns location determination based on three or more gateways instead of GPS. That saves a GPS chip and power in a node, which is good for the node's battery life.
Lately, IoT devices have had some bad press. But IoT devices or networks are not necessarily unsafe. LoRaWAN packets are encrypted on both the network as the application's level so just the owner of the application can actually read the data. The devices are also not directly connected to the internet. 'Backends' form a bridge between the public internet and the LoRaWAN network. Again, of course, they will have to follow the best-practices for a stable and secure network. It is even possible to manage all parts of the network, routers, brokers, handlers and applications yourself instead of using the public network.
There are many developments in the field of the LoRaWAN and there are a fair number of projects and Kickstarter initiatives going on. I would like to highlight a few of them.
LoPy (EUR 29,95)
This relatively inexpensive node does not only have a LoRA radio, but also Bluetooth and WiFi. It is programmed with MicroPython and is Arduino compatible. Programming it is very simple with an Android app, so you can even do it without any knowledge of programming .The LoPy can also be used as a NanoGateway. It is ideal to test your IoT application locally or when there is no network coverage yet. A big brother will become available in April 2017 with the name FiPy, which will also have LTE and SigFox radios.
Sodaq ONE (EUR 108,-)
This Arduino based board is more elaborate than the LoPy and has more possibilities to attach external sensors. The board is equipped with a solar charger, battery connector, magneto and acceleration sensor and an active GPS. There are open source libraries available to combine the sensors and make the most of the battery life. For example, think about turning on the active GPS tracking only when movement or change in the magnetic field is detected. For proper operation, you do need to remove the two redundant resistances of 0 Ohms.
The Things Network Node (EUR 70,00 excl. BTW)
The Things Network UNO (EUR 50,00 excl. BTW)
The Things Network Gateway (EUR 250,00 excl. BTW)
Ofcourse the TTN devices cannot be skipped. TTN offers three products. Especially the gateway is very interesting, because it is one of the least expensive ready-to-use gateways. Also, the gateway offers many functionalities. Installing the gateway yourself becomes much more accessible to a larger audience like that.
There is plenty of documentation available for all these products to start and it is very simple to send your first data in only a few minutes. After that you can use this data in an application or respond through a simple API. Inspiration for your own LoRa implementation can be found here.
By: Bart Vrancken