Line 5: |
Line 5: |
| | | |
| This article contains instructions on how to configure a RUT router in order to connect to the Azure IoT Hub.<br> | | This article contains instructions on how to configure a RUT router in order to connect to the Azure IoT Hub.<br> |
− | {{Template:Networking_rutxxx_manual_fw_disclosure | + | |
| + | {{Template:Networking_rutx_manual_fw_disclosure |
| | fw_version = RUTX_R_00.02.01.1 | | | fw_version = RUTX_R_00.02.01.1 |
| }} | | }} |
| + | |
| + | |
| ==Prerequisites== | | ==Prerequisites== |
| | | |
Line 89: |
Line 92: |
| [[File:Networking_rutx_configuration_examples_package_manager_v1.png|border|class=tlt-border]] | | [[File:Networking_rutx_configuration_examples_package_manager_v1.png|border|class=tlt-border]] |
| | | |
− | <li>Now navigate to '''Services > IoT Platforms''' </li> | + | <li>Now navigate to ''' Services > Cloud solutions > Azure IoT Hub''' </li> |
| <div>1. Select Enable '''Azure IoT Hub monitoring'''</div> | | <div>1. Select Enable '''Azure IoT Hub monitoring'''</div> |
| <div>2. Paste previously copied Connection String (For this test we leave other values as default)</div> | | <div>2. Paste previously copied Connection String (For this test we leave other values as default)</div> |
Line 95: |
Line 98: |
| <div>4. Press '''Save''' </div> | | <div>4. Press '''Save''' </div> |
| [[File:Networking_rutx_configuration_examples_azure_iot_hub_v1.png|border|class=tlt-border]] | | [[File:Networking_rutx_configuration_examples_azure_iot_hub_v1.png|border|class=tlt-border]] |
− | [[File:Azure19-1.png|f|800px]]
| |
| | | |
| </ul> | | </ul> |
Line 102: |
Line 104: |
| <li>From router side, connect to it with CLI or SSH client and write in command '''azure_iothub''' and press Enter </li> | | <li>From router side, connect to it with CLI or SSH client and write in command '''azure_iothub''' and press Enter </li> |
| <div>- You should get answer that looks something like that, depending on what information you chose to send. </div> | | <div>- You should get answer that looks something like that, depending on what information you chose to send. </div> |
− | [[File:Azure19.png|border|class=tlt-border]] | + | [[File:Azure19_RUTX.png|border|class=tlt-border]] |
| <li>From Azure IoT Hub side you can check if it receives data. Go to IoT Hub that you created previously. Select '''Overview''', there you can see: | | <li>From Azure IoT Hub side you can check if it receives data. Go to IoT Hub that you created previously. Select '''Overview''', there you can see: |
| </li> | | </li> |
Line 108: |
Line 110: |
| <div>2. Device to cloud messages, that your router is sending.</div><br> | | <div>2. Device to cloud messages, that your router is sending.</div><br> |
| <div>It should look something like that if IoT Hub is receiving data. </div> | | <div>It should look something like that if IoT Hub is receiving data. </div> |
− | [[File:Azure20.png|border|class=tlt-border|800px]] | + | [[File:Azure20_RUTX.png|border|class=tlt-border|800px]] |
| <li>To capture logs you will need '''Device Explorer''' for IoT Hub Devices.</li> | | <li>To capture logs you will need '''Device Explorer''' for IoT Hub Devices.</li> |
| <div>For Windows you can get here: https://github.com/Azure/azure-iot-sdk-csharp/releases/tag/2019-1-4 </div><br> | | <div>For Windows you can get here: https://github.com/Azure/azure-iot-sdk-csharp/releases/tag/2019-1-4 </div><br> |
Line 117: |
Line 119: |
| <div>2. Next choose '''iothubowner'''</div> | | <div>2. Next choose '''iothubowner'''</div> |
| <div>3. And copy '''Connection string – primary key'''</div> | | <div>3. And copy '''Connection string – primary key'''</div> |
− | [[File:Azure22-1.png|border|class=tlt-border|800px]] | + | [[File:Azure22-1_RUTX.png|border|class=tlt-border|800px]] |
| | | |
| <li>After that go back to Device Explorer: </li> | | <li>After that go back to Device Explorer: </li> |
Line 123: |
Line 125: |
| <div>2. Copy HostName part from connection string and paste it in '''Protocol Gateway HostName'''</div> | | <div>2. Copy HostName part from connection string and paste it in '''Protocol Gateway HostName'''</div> |
| <div>3. Click '''Update''' </div> | | <div>3. Click '''Update''' </div> |
− | [[File:Azure23.png|border|class=tlt-border|600px]] | + | [[File:Azure23_RUTX.png|border|class=tlt-border|600px]] |
| | | |
| <li>Open Management tab </li> | | <li>Open Management tab </li> |
| <div>1. Click Update </div> | | <div>1. Click Update </div> |
| <div>2. You should see your device in the list below and '''Connection state''' </div> | | <div>2. You should see your device in the list below and '''Connection state''' </div> |
− | [[File:Azure24.png|border|class=tlt-border|800px]] | + | [[File:Azure24_RUTX.png|border|class=tlt-border|800px]] |
| | | |
| <li>Go to Data tab</li> | | <li>Go to Data tab</li> |
| <div>1. Click monitor, and wait for '''Event Hub Data''' to update (Depends on yours chosen interval)</div> | | <div>1. Click monitor, and wait for '''Event Hub Data''' to update (Depends on yours chosen interval)</div> |
| <div>2. Messages like this should start appearing. </div> | | <div>2. Messages like this should start appearing. </div> |
− | [[File:Azure25.png|border|class=tlt-border|600px]] | + | [[File:Azure25_RUTX.png|border|class=tlt-border|600px]] |
| | | |
| ==Setting router to Forward MQTT messages/commands to Azure IoT Hub== | | ==Setting router to Forward MQTT messages/commands to Azure IoT Hub== |
| <div>First you will need MQTT broker to subscribe to, for testing purposes we will set MQTT Broker in same router, and will use PC from LAN to sent MQTT messages.</div> | | <div>First you will need MQTT broker to subscribe to, for testing purposes we will set MQTT Broker in same router, and will use PC from LAN to sent MQTT messages.</div> |
| | | |
− | <li>Go to Services > MQTT </li> | + | <li>Go to Services > MQTT > Broker </li> |
| <div>1. Click '''Enable'''</div> | | <div>1. Click '''Enable'''</div> |
| <div>2. Use same port in MQTT Broker and Azure IoT Hub settings.</div> | | <div>2. Use same port in MQTT Broker and Azure IoT Hub settings.</div> |
| <div>3. Press '''Save'''</div> | | <div>3. Press '''Save'''</div> |
− | [[File:Azure26-1.png|border|class=tlt-border]] | + | [[File:Azure26-1_RUTX.png]] |
| | | |
− | <li>Go to '''Service > IoT Platforms'''</li> | + | <li>Go to '''Services > Cloud solutions > Azure IoT Hub'''</li> |
| <div>1. Enable monitoring </div> | | <div>1. Enable monitoring </div> |
| <div>2. Use same Connection string as before (GSM values configuration) </div> | | <div>2. Use same Connection string as before (GSM values configuration) </div> |
Line 152: |
Line 154: |
| <div>6. And Topic under which router will subscribe to MQTT Broker</div> | | <div>6. And Topic under which router will subscribe to MQTT Broker</div> |
| <div>7. Press '''Save''', we will not need username or password.</div> | | <div>7. Press '''Save''', we will not need username or password.</div> |
− | [[File:Azure27-2.png|border|class=tlt-border]] | + | [[File:Azure27-2_RUTX.png]] |
| | | |
| </ul> | | </ul> |
Line 164: |
Line 166: |
| For our example we are using example: '''mosquito_pub -h 192.168.1.1 -p 8883 -m ‘testing Azure MQTT messages’ -t test''' </li> | | For our example we are using example: '''mosquito_pub -h 192.168.1.1 -p 8883 -m ‘testing Azure MQTT messages’ -t test''' </li> |
| <br><div>If everything was configured correctly in Device Explorer Data tab you should receive message like: </div> | | <br><div>If everything was configured correctly in Device Explorer Data tab you should receive message like: </div> |
− | [[File:Azure28.png|border|class=tlt-border|1000px]] | + | [[File:Azure28_RUTX.png|border|class=tlt-border|1000px]] |
| <div>This means our router Forwards MQTT messages to Azure IoT Hub. </div> | | <div>This means our router Forwards MQTT messages to Azure IoT Hub. </div> |
| </ul> | | </ul> |
Line 174: |
Line 176: |
| <div>2. Use the '''same broker port'''</div> | | <div>2. Use the '''same broker port'''</div> |
| <div>3. Paste your '''Connection string – primary key''' and click '''Apply'''</div> | | <div>3. Paste your '''Connection string – primary key''' and click '''Apply'''</div> |
− | [[File:Azure29-1.png|border|class=tlt-border|800px]] | + | [[File:Azure29-1_RUTX.png|border|class=tlt-border|800px]] |
| | | |
| <div>1. Connect to the server broker</div> | | <div>1. Connect to the server broker</div> |
| <div>2. Use the created topic. For this example '''test'''</div> | | <div>2. Use the created topic. For this example '''test'''</div> |
| <div>3. Send a message</div> | | <div>3. Send a message</div> |
− | [[File:Azure30.png|border|class=tlt-border|1000px]] | + | [[File:Azure30_RUTX.png|border|class=tlt-border|1000px]] |
| | | |
| <li>If you did everything right this message will be shown in the device explorer</li> | | <li>If you did everything right this message will be shown in the device explorer</li> |
| </ul> | | </ul> |
− |
| |
− | ==Checking if Modbus Data to Server is sent to Azure IoT Hub==
| |