Azure is a cloud computing platform and an online portal that allows you to access and manage cloud services and resources provided by Microsoft. These services and resources include storing your data and transforming it, depending on your requirements. To get access to these resources and services, all you need to have is an active internet connection and the ability to connect to the Azure portal.
Azure Platform supports to forward the data through HTTPs and MQTT, in this manual, you will get how to connect Ursalink Gateway UG85 to Microsoft Azure using MQTT.
Preparation:
1.Ursalink UG85
2.Azure Account
3.Visual Studio Code App installed in windows
Here are the steps.
Step1. Login Portal Azure
Apply for the account then click this URL to login Azure, https://portal.Azure.com
Step2. Create IoT Hub
Step3.Create a device
You will need to input the Device ID, which is needed in Ursalink Gateway's 'Client ID' field.
Step4.MQTT Configuration details
Broker: hostname:8883
ClientID: {device-id}
username: hostname/{device-id}
password: SAS Token (Generate By Connecting string) // this is generated in Step5.
publish topic: devices/{device-id}/messages/events/
Click this link(CN) or this link (EN) to get more info.
We can check the MQTT connection status here:
Note: The Client ID should be different for each gateway.
Step5. Create SAS token for this gateway in Visual Studio Code
Download Visual Studio Code, and install it well, you will need to login your Azure account as well, then you can see the IOT HuB here.
Press ctrl+shift+p key,Choose 'generate SAS Token for device'
Choose the device UG85 for example
Configure the expiration time, in this example is 300
this is the SAS Token
Step6. Check the device status
You can also check the real-time output through Azure console
naytelwmykt@Azure:~$ az iot hub monitor-events --hub-name sway-iothub --output table
az iot hub: 'monitor-events' is not in the 'az iot hub' command group. See 'az iot hub --help'. If the command is from an extension, please make sure the corresponding extension is installed. To learn more about extensions, please visit https://docs.microsoft.com/en-us/cli/Azure/Azure-cli-extensions-overview
naytelwmykt@Azure:~$ az extension add --name Azure-cli-iot-ext
naytelwmykt@Azure:~$ az iot hub monitor-events --hub-name sway-iothub --output table
Starting event monitor, use ctrl-c to stop...
You will get the event like this, which is the uplink data from Ursalink UG85 Gateway.
event:
origin: ug85
payload: '{"applicationID":"1","applicationName":"app","data":"AwAABAEA","devEUI":"24e1641193163380","deviceName":"n1","fCnt":5,"fPort":85,"rxInfo":[{"altitude":0,"latitude":0,"loRaSNR":8.5,"longitude":0,"mac":"24e124fffef0395d","name":"local_gateway","rssi":-28,"time":"2020-06-03T08:14:23.868355Z"}],"time":"2020-06-03T08:14:23.868355Z","txInfo":{"adr":true,"codeRate":"4/5","dataRate":{"bandwidth":125,"modulation":"LORA","spreadFactor":7},"frequency":868300000}}'
Ps. If you connect the sensor node, we need to load the decoder script (Java Script), if it's Ursalink Sensor Node, you can get the decoder here.
If you didn't found the data output, try to check the "lora-app-server.log" inside the Gateway's system log, and check whether you can see the logs like this. You can download it through 'Maintenance->Log' page.
This is the log that shows UG85 has forwarded the data to Azure through MQTT
time="2020-06-03T16:15:26+08:00" level=info msg="urhandler/mqtt: publishing message" deveui=24e1641193163380 qos=0 topic=devices/ug85/messages/events/
You can also deliver ticket to us for a deeper check.
[END]
Comments
0 comments
Please sign in to leave a comment.