LoRa gateway for DeviceHive

LoRa is a chirp spread spectrum (CSS) radio modulation technology which allows transmitting data over long distances with low power consumption. This technology is a perfect fit for communication with simple sensors across a local area like an industrial or agricultural zone. Low power consumption allows building battery-powered devices, which can operate for months or even years using a single battery. Therefore, such devices can be installed without any infrastructure, i.e. totally wirelessly.Of course, in some cases, it might be sufficient to set up communication solely between devices. However for the majority of situations, a real IoT platform is required to manage devices and to store and analyze data. Communication between such devices requires an IoT gateway which are also called "edge devices". Such gateways receive data from a wired or wireless protocol and sends data to an IoT cloud service where the real magic with data is happening.DeviceHive has an out-of-the-box solution to deploy such gateways for your LoRa devices. Dragino LG01, the most widely spread and commercially available hardware for software gateway implementation, was chosen as a reference.

DeviceHive Gateway Installation

Installation of the gateway requires firmware version 4.3 or newer. Firmwares are available on the official site.Configure the Internet connection on the gateway with a standard Web Interface. Connect to the gateway using SSH (default user name/password are root/dragino).Now follow the next steps to install the DeviceHive LoRa gateway:

Now the DeviceHive gateway is installed and should start automatically on each boot. In a few seconds an additional web interface will appear on port 8000. Go there with a web browser and configure the gateway.

That is it. The gateway is ready for transmitting data between LoRa and the DeviceHive server!

Simple LoRa Device

To demonstrate how the gateway works there is a simple Arduino-based device in the repo. It can be run with an Arduino Uno board and Dragino Lora Shield. This shield is based on HopeRF RFM95W module. Also it requires additional LED connected to digital pin #7.

Connect this board to a laptop or desktop with USB and flash sketch with Arduino IDE. Leave this board powered up.

This simple device reports the state of the analog pins every 5 seconds and can also control the connected LED. Let's see how to control it with DeviceHive through the gateway. Go to the server admin console, which is used while configuring gateway. Open the Devices tab, find your DeviceID in the list, and open it. Go to the Notifications tab. So, here it is, you may observe notifications from board with their analog pin states on the server.

To send data in another direction, go to Commands tab, create a new command named 'lora' with the parameters '{"data":"led/on"}' and send it. Your LED should light up.

In the same way your LED can be turned off with the 'led/off' data field.

Conclusion

Instead of an Arduino demo board, any LoRa device can be used and the DeviceHive gateway provides transparent communication between LoRa radio and cloud service. This allows building IoT devices using highly efficient and power saving radio technology.