Introduction: HOW TO CONNECT IFROG LORA GATEWAY TO QNAP QIOT SUITE LITE
In this tutorial, you will learn how to send data from the iFrogLab LoRa Gateway to QNAP QIoT Suite Lite.
Prepare
Set up the iFrogLab LoRa USB to QIoT Suite Lite and iFrogLab LoRa Gateway Container. Setup steps can be found at
http://www.ifroglab.com/en/?p=6613
(If in Step 10 the expected output is not displayed, using SSH to access the NAS and enter the following commands:
insmod /usr/local/modules/cdc-acm.ko
insmod /usr/local/modules/cp210x.ko
insmod /usr/local/modules/ftdi_sio.ko )
If the NAS restarts, then the commands must be entered again.
Step 1: Set Up IFrogLab LoRa Gateway MQTT
Create an IoT Application, add Things, and acquire the resourceinfo.json (refer to “How to show DHT11 data on QIoT Dashboard?“).
Step 2: Open Container Station, Choose Your IFrog Lora Gateway, and Click “Terminal“.
Step 3: Enter the Command: “nano /ifroglab/IL-LORA1272/LoRa-Gateway/Gateway/Python/ap-01-lora-gateway-2-read-httpGet.py” and Click “OK“.
Step 4: Move to “mqtt=” Mosquitto_pub -d -t Ifroglab/mqtt -m ‘%s’ -h Test.mosquitto.org”%(HexString);” and Add a “#” in Front of It.
Step 5: Add a New String :
-h : Enter the QIoT service IP (If QIoT Suite Lite and iFrogLab LoRa Gateway are in the same NAS, enter the Container Station NAT Gateway IP -the default value is 10.0.3.1)
-p : Default value: 21883, modify this according to your resourceinfo.json data
-t : (topic) Modify this according to your resourceinfo.json data-u : (username) Modify this according to your resourceinfo.json data
-P : (password) Modify this according to your resourceinfo.json data
-m : (message type) Modify this according the above example
Step 6: Click “Ctrl+O” and Click “Enter” to Save Then Click “Crtl+X” to Leave
Step 7: Open the “iFrogLora Gateway” Container. the Following Screen Will Appear If It Has Been Modified Successfully
Step 8: Open “QIoT Suite Lite” > “IoT Application“. the “Thing Data Log” Display This Status
Step 9: Go to “Rule” and You Can Start Your IoT Application. the Received Data Will Be HEX. (Example Rule As Below)
Step 10: Example Rule:
[
{
"id": "e2bd8ea5.5c613",
"type": "debug",
"z": "8cc3c0a1.b6949",
"name": "Click debug tab to watch data stream",
"active": true,
"console": "false",
"complete": "false",
"x": 557.5,
"y": 92,
"wires": []
},
{
"id": "8ff255de.850808",
"type": "qiotbroker in",
"z": "8cc3c0a1.b6949",
"name": "MQTT Message In",
"flow": "8cc3c0a1.b6949",
"opt_customtopic": false,
"customtopic": "custom_topic_c13af1572d9611e8adc49f3a1551c296",
"thing": "ec626e0b-0524-4f06-9f8d-6c590730f7a9",
"qtopic": "qiot/things/admin/loradevice/data",
"username": "admin",
"rules":
[
{
"v": "5ab347b29c31dc00322c43d0",
"meta":
{ "unit": "°C",
"datatype": "String"
},
"resid": "data"
}
],
"outputs": 1,
"key": "r:5197487d0ab31b464c745aa7b8fa2616",
"x": 108.5,
"y": 43,
"wires":
[ [ "d0d1710e.b9a8d" ] ]
},
{
"id": "d0d1710e.b9a8d",
"type": "change",
"z": "8cc3c0a1.b6949",
"name": "",
"rules": [ { "t": "move", "p": "payload.value", "pt": "msg", "to": "payload", "tot": "msg" } ],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 332,
"y": 43,
"wires": [ [ "1a8b6d9a.197722" ] ]
},
{
"id": "1a8b6d9a.197722",
"type": "function",
"z": "8cc3c0a1.b6949",
"name": "Decoded",
"func": "function convertFromHex(hex) {\n hex = hex.toString();//force conversion\n var str = '';\n for (var i = 1; i < hex.length + 1; i += 2)\n str += String.fromCharCode(parseInt(hex.substr(i, 2), 16));\n return str;\n}\n\nmsg.payload = convertFromHex(msg.payload.substring(0, msg.payload.length - 4));\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 284,
"y": 92,
"wires": [ [ "e2bd8ea5.5c613" ] ]
}
]
Step 11: More Information About QNAP QIOT
More information about QNAP QIoT, please visit
https://www.qnap.com/solution/qiot-suite/en/
More Tutorial by visiting https://www.qnap.com/en/how-to/tutorial