Use a LoRa gateway and nodes to send data to an IoTool server and display it in the IoTool Dashboard
This guide will show you how to set up an Arduino with a Dragino LoRa shield to transmit sensor data, and a Dragino LoRa-enabled gateway to receive and forward sensor data to an IoTool server using the MQTT protocol.

Overview

Skill level: advanced
Knowledge of Arduino IDE, C++, and familiarity with radio signals is recommended. Basic knowledge of OpenWrt and the Linux terminal is also required.

Final set up

Dragino LG01 LoRa Gateway

Arduino + Dragino LoRa Shield

Ingredients

  1. IoTool Personal or higher account
  2. IoTool application installed and configured for IoTool Cloud
  3. Dragino LG01/OLG01 LoRa gateway (or Arduino Yún with LoRa shield – not tested)
  4. Arduino with Dragino LoRa shield
  5. An installation of Arduino IDE

Step by step

Preparing your environment

  1. First we will have to set up a custom source for the Arduino IDE so we can install the board profile for Dragino boards in the next step. Open the Arduino IDE Preferences. Paste this URL to Additional Boards Manager URLs field: http://www.dragino.com/downloads/downloads/YunShield/package_dragino_yun_test_index.json

  2. Install the board profile for Dragino boards using the Boards Manager.

  3. Download the RadioHead Arduino library from http://www.airspayce.com/mikem/arduino/RadioHead/ and extract it to your Arduino IDE libraries location which is usually located at C:\Program Files (x86)\Arduino\libraries on Windows.
  4. Install the SparkFun BME280 library using the Manage Libraries menu.

  5. Download the zip file containing the example code that is attached at the bottom of this article, and extract it to a location of your choice.

Setting up the Dragino LoRa gateway

  1. Power up your Dragino gateway with the included AC or PoE adapter and wait for the system to boot.
  2. If this is the first time the gateway is being used, you will first have to be able to access the web configuration interface.
  3. Take a look at http://www.dragino.com/downloads/downloads/UserManual/LG01_LoRa_Gateway_User_Manual.pdf to find the best way you wish to connect the gateway to the Internet. The easiest way to start with is just using an Ethernet cable or setting the gateway to connect to your existing WiFi network.
  4. Install the mosquitto-client package to the OpenWrt side. Make sure to update the package lists first. Alternatively, you can do this via SSH by using the commands opkg update and opkg install mosquitto-client.
  5. Copy over the script that receives data from the Arduino side and sends it as MQTT messages to /root/. Modify its permission so it is allowed to be executed. The easiest way is to connect to the gateway using something like WinSCP, browsing to the specified location, and dragging and dropping the file inside. Then right click the file, select Properties, and tick all checkboxes next to X to set the permissions.
  6. Configure the MQTT settings in the OpenWrt web interface.
  7. When the gateway is connected to the same network it should show up in the Arduino IDE.
  8. Open the lora_gateway sketch and upload it. If you are asked for a password, type in "dragino".
  9. Monitor the output with the Serial Monitor. Alternatively you can connect to the gateway via SSH and monitor the output there by using the command telnet localhost 6571.

Setting up the Arduino Uno

  1. Connect your BME280 sensor to the Arduino. In this tutorial, we're going with an I2C connection, so follow this connetion scheme: sensor GND pin to Arduino GND port, sensor 3.3V pin to Arduino 3.3V port, sensor SCL pin to Arduino SCL port, sensor SDA pin to Arduino SDA port.
  2. Open the lora_client_bme280 sketch and upload it. If the sensor doesn't seem to be working, try changing the I2C address to 0x77.
  3. Monitor the output with the Serial Monitor. Alternatively you can connect with any application that can read Serial port output, eg. PuTTY by connecting to the Serial port in use using the specified baud rate.

IoTool Cloud

  1. The data should have been uploaded to IoTool Cloud. Login with the user account you already set up in the OpenWrt configuration, open the <your_account>_sensors_hrf table, sort it by date, and check if the readings are present there.
  2. If the readings are there, open the <your_account>_sensors, find the sensors that your Arduino uses, and input the required data so that the readings can be correctly displayed in the IoTool app. You can find more detailed instructions by clicking the Show structure button.

 

Display the recorded data in the IoTool application

  1. We will suppose that you have IoTool Cloud already configured in the application settings. If not, follow the guide located at https://iotool.io/support/knowledgebase/connecting-to-iotool-cloud-from-your-device.
  2. Update the IoTool Cloud sensor list in the settings.
  3. Set the number of buttons that you want displayed in the dashboard.
  4. Select the measurements that you want shown for each button. Your sensor readings sent over LoRa are located in the IoTool Cloud Sensors category.
  5. Check your readings in IoTool Dashboard.