Edge Sense LoRa GW Solution
Contents
Introduction
An IoT total solution, mainly composed of UTX-3117 gateway/EIS-D210 gateway, RYLR89D Lora demo board and WISE-PaaS.
LoRa GW Solution
Notice: EdgeSense LoRa GW Solution not support LoRaWAN
Support OS
- Ubuntu 16.04
- Windows 10
Topology:
Gateway Support Lists
Support Node
node type #1
Sensor:Temperature , Humidity , LED x 5 , ADC , Relay x 4 , Input x 4
(NOTE:SW 1.0.0 only support Temperature , Humidity , LED x 5 , ADC)
(NOTE:Relay x 4, Input x4 need to running SW 1.0.1-rc1 above, but not yet testing)
node type #2
Sensor:Temperature , Humidity , CO2
(NOTE:SW 1.0.0 support CO2 , but CO2 sensor not yet testing)
node type #3
Sensor:GPS
(NOTE:This node type and GPS sensor need to running SW 1.0.1-rc1 above, but not yet testing)
Software Stack
How to
Software Requirements
- Driver for USB to UART Bridge Controller , (only Windows need this)
- Microsoft Visual C++ 2015 Redistributable , (only Windows need this)
- MQTT broker
- RMM 3.3 Agent or EI Agent
- uartmgr
- API-GW
LoRa Module Firmware Upgrade
- Refer to this wiki
LoRa Module setting
After upgrade RYLRxxH mini PCIe board and RYLRxx6 demo board, need to config via AT Command.
Make sure these setting is correct for your environment.
- Firmware Version
- Band
- Address
- Network ID
Firmware Version
- To query Firmware Version , issue AT Command AT+VER? . Then, receive AT Command ex: +VER=RYLRxxP_V0.1.28
Band
- To query Band, issue AT Command AT+BAND? . Then, receive AT Command ex: +BAND=TW
- To change Band, issue AT Command AT+BAND=YOUR_OPTION , ex: AT+BAND=JP
- Detailed option, please see Configuration.
Address
- To query Address, issue AT Command AT+ADDRESS? . Then, receive AT Command ex: +ADDRESS=1
- To change Address, issue AT Command AT+ADDRESS=ADDRESS_YOU_WANT , ex: AT+ADDRESS=23
- Detailed option, please see Configuration.
Network ID
- To query Network ID, issue AT Command AT+NETWORKID? . Then, receive AT Command ex: +NETWORKID=3
- To change Network ID, issue AT Command AT+NETWORKID=NETWORK_ID_YOU_WANT , ex: AT+NETWORKID=5
- Detailed option, please see Configuration.
Software Installation for Windows 10
NOTE: Please wire the gateway to Internet with Network cable before install.
Install Steps
- Install Driver for USB to UART Bridge Controller
- Install Microsoft Visual C++ 2015 Redistributable for x86
- Install MQTT Broker
- Install uartmgr
- Install API-GW
- Install LoRaMgt_ryx , edit config, then restart service.
- Install RMM 3.3 Agent (v3.3.29 above) or EI Agent
Uninstall Steps
- Select the Start button, then select Settings > Apps. Choose the program you want to remove, and then select Uninstall.
- RMM 3.3 Agent or EI Agent
- LoRaMgt_ryx
- API-GW
- uartmgr
- MQTT Broker
Software Installation for Ubuntu 16.04
Install Steps
- Install OS - Ubuntu 16.04 (ex: ubuntu-16.04.5-desktop-amd64.iso)
- Install MQTT Broker
- Install uartmgr
- Install API-GW
- Install LoRaMgt_ryx , edit config, then restart service.
- Install RMM 3.3 Agent (v3.3.29 above) o EI Agent
$ sudo chmod +x MQTTBrokerSetup-1.0.5-Ubuntu_16.04-x86_64.run $ sudo chmod +x uartmgr-1.0.3-Ubuntu_16.04-x86_64.run $ sudo chmod +x API-GW-2.0.7-Ubuntu_16.04-x86_64.run $ sudo chmod +x LoRaMgt_ryx-1.0.3-Ubuntu_16.04-x86_64.run $ sudo chmod +x rmmagent-Ubuntu 16.04.5 LTS x86_64-1.1.3.0.run $ sudo ./MQTTBrokerSetup-1.0.5-Ubuntu_16.04-x86_64.run $ sudo ./uartmgr-1.0.3-Ubuntu_16.04-x86_64.run $ sudo ./API-GW-2.0.7-Ubuntu_16.04-x86_64.run $ sudo ./LoRaMgt_ryx-1.0.3-Ubuntu_16.04-x86_64.run $ sudo ./rmmagent-Ubuntu 16.04.5 LTS x86_64-1.1.3.0.run
NOTE: Please wire the gateway to Internet with Network cable before install, it is necessary to install the dependencies.
Uninstall Steps
To uninstall RMM 3.3 Agent or EI Agent
$ sudo /usr/local/AgentService/uninstall.sh
To uninstall LoRaMgt_ryx
$ sudo /usr/local/EdgeSense/LoRaMgt_ryx/uninstall.bash
To uninstall API-GW
$ sudo /usr/local/EdgeSense/API-GW/uninstall.bash
To uninstall uartmgr
$ sudo /usr/local/EdgeSense/uartmgr/uninstall.bash
to uninstall MQTT Broker
$ sudo /usr/local/EdgeSense/MQTTBroker/uninstall.bash
Configuration
In Windows 10
- You can edit C:\Program Files (x86)\Advantech\LoRaMgt_ryx\settings.ini to change setting.
- Once config is changed, please using Windows Services Manager to restart LoRaMgt_ryx service.
In Ubuntu 16.04
- You can edit /usr/local/EdgeSense/LoRaMgt_ryx/settings.ini to change setting.
- You can execute "sudo vi /usr/local/EdgeSense/LoRaMgt_ryx/settings.ini" command in Ubuntu terminal to modify config.
- Also you can use gedit to edit file, command is "sudo gedit /usr/local/EdgeSense/LoRaMgt_ryx/settings.ini"
- Once config is changed , please execute "sudo systemctl restart LoRaMgt_ryx.service" to restart service in order to apply new setting.
Setting File example:
[gateway] [rf] [node-2] |
node_num
- Support maxinum 4 nodes
polling_rate
- range from 5 to 3600 second, default value is 20 second
- If setting is greater than maximum value or is less than minimum value, it will use default value.
band
- option :
- TW - for Taiwan
- JP - for Japan
- KR - for Korea
- US - for US
hostaddr
- Assign address for LoRa Host (LoRa pcie module inside gateway)
- hostaddr is needed to be 1
networkid
- Network ID, default is 0
- NOTE:In firmware RYLRxxP_V0.1.22, range from 0 to 5
- NOTE:In firmware RYLRxxP_V0.2.23 and above, range from 0 to 11
crfop1 / crfop2
- LoRa module power , range from 0 to 15 dBm
addr:
- address for LoRa Node , range from 2 to 65000
notetype:
- nodetype=1 : temperature + humidity + output x 5 + adc + relay x 4 + input x 4
- nodetype=2 : temperature + humidity + co2
- nodetype=3 : GPS
Downlink for sensor
Relay
Node Type#1 have 4 Normally Close type of Relay.
When relay is triggered to On status in WISE-PaaS, relay contact is open.
When relay is triggered to Off status in WISE-PaaS, relay contact is close.
Service control
In Windows
Check if LoRaMgt_ryx service is running:
- Use Service to check status of LoRaMgt_ryx service
Restart LoRaMgt_ryx service:
- Use Service to restart LoRaMgt_ryx service
Start LoRaMgt_ryx service:
- Use Service start LoRaMgt_ryx service
Stop LoRaMgt_ryx service:
- Use Service stop LoRaMgt_ryx service
In Ubuntu
Check if LoRaMgt_ryx service is running:
$ sudo systemctl status LoRaMgt_ryx.service
Restart LoRaMgt_ryx service:
$ sudo systemctl restart LoRaMgt_ryx.service
Start LoRaMgt_ryx service:
$ sudo systemctl start LoRaMgt_ryx.service
Stop LoRaMgt_ryx service:
$ sudo systemctl stop LoRaMgt_ryx.service
Tools
Driver for USB to UART Bridge Controller
In Windows, please use Device Manager to check if Devicer for USB to UART Bridge Controller is installed.
If your Device Manager does not recognize a CP2102 USB to UART Bridge Controller, you have to install its driver.
Please visit https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers and download driver, then install it.
After installing driver, Device Manage will look like this picture
Reyax AT Command Demo Script
This demo script is a simple bash script, aim to provide a preliminary understanding about Reyax At Command.
This Script only support Ubuntu 16.04.
Script version : 0.3-beta
Support Reyax firmware version : RYLRxxP_V0.1.22
Support Lora Proprietary Command Set : V0.97
Download
- This demo script is available at Reyax-atcmd-demo.bash.tar.gz
- Download the file and upload it to Ubuntu. (Execute "wget http://ess-wiki.advantech.com.tw/wiki/images/4/4b/Reyax-atcmd-demo.bash.tar.gz" in terminal)
- Uncompress the file with command "tar zxfv Reyax-atcmd-demo.bash.tar.gz" , then reyax-atcmd-demo.bash will be ready to use.
Usage
- In Ubuntu Desktop , open two terminals.
- Terminal 1 (Left) , run "sudo cat /dev/ttyUSB0"
- Terminal 2 (Right) , run "sudo ./reyax-atcmd-demo.bash"
- You can enter your choice in the right terminal to issue AT command
- Message from AT Command RX will be shown in the left terminal.
- If you want to change node address , press 0 to enter new node's address.
Restful API
Restful API for get SenHubList
<ServerIP>:3000/restapi/WSNManage/SenHub/AllSenHubList
ex: get Sensor Hub List in Ubuntu Terminal on the gateway
$ curl -H "Content-Type: application/json" -X GET http://127.0.0.1:3000/restapi/WSNManage/SenHub/AllSenHubList
Result:
{"n":"AllSenHubList","sv":"0017000E8C000055"}
Or you can get Sensor Hub List via web browser , enter url such as:
Restful API for Get Sensor Value
<ServerIP>:3000/restapi/WSNManage/SenHub/<DEVID>/SenHub/SenData/<SENSOR>
DEVID: Device ID of LoRa SenHub ( e.g. 0017000E8C000055 )
SENSOR: Temperature / Humidity / ADC / GPIO1/ GPIO2 / GPIO3 / GPIO4 / GPIO5 / Relay1 / Relay2 / Relay3 / Relay4 / SNR / RSSI
ex: get Temperature in Ubuntu Terminal on the gateway
curl -H "Content-Type: application/json" -X GET http://127.0.0.1:3000/restapi/WSNManage/SenHub/0017000E8C000052/SenHub/SenData/Temperature
Result:
{"v":23.5}
Or you can get Temperature from device 0017000E8C000052 via web browser , enter url such as:
ex: get RSSI in Ubuntu Terminal on the gateway
curl -H "Content-Type: application/json" -X GET http://127.0.0.1:3000/restapi/WSNManage/SenHub/0017000E8C000052/SenHub/SenData/RSSI
Result:
{"v":-63}
Debug
Collect LoRa minipcie module command log
Refer to uartmgr wiki.
Check if LoRaMgt_ryx service is running
In Ubuntu ,
$ sudo systemctl status LoRaMgt_ryx.service
In Windows,
Use Service to check status of LoRaMgt_ryx service
Use Case
Release
Index | Version | Date |
Platform |
OS |
Release Note |
Download Link |
1 | 1.0.0 | 2018/08/13 | x86_64 CPU |
Ubuntu 16.04 |
|
LoRaMgt_ryx-1.0.0-Ubuntu_16.04-x86_64.run API-GW-2.0.6-Ubuntu_16.04-x86_64.run RMM 3.3 Agent: |
2 | 1.0.1 | 2018/11/27 | x86_64 CPU | Windows 10 |
|
|
3 | 1.0.2 | 2018/12/4 | x86_64 CPU |
Windows 10 |
|
|
4 | 1.0.3 | 2019/2/21 | x86_64 CPU |
Ubuntu 16.04 |
|
Above files are available at local server, please paste file's url in File Explorer to copy file.
|