IoT Solutions Online Navigator

Introduction
support section

Outline

Generates a JSON string from the item data of equipment devices collected
by IoT Data Share on the PC, and sends the JSON string to Azure IoT.

Equipment information of the connection destination

* To connect IoT Data Share to the equipment, use the settings in
Chapter 1, Lesson2 of <Learning contents> [Basics].

  • Controller name : RC8
  • Item name : I10
Destination Azure IoT Hub configuration and connectivity information
  • IoT Hub (Subscription) : <Specify the subscription you are subscribing to>
  • IoT Hub (Resource group) : Tutorial
  • IoT Hub (Current location) : JAPAN West
  • IoT Hub (IoT Hub name) : tutorial
  • IoT devices (Device ID) : demo01
  • Primary connection string : HostName=tutorial.azure-devices.net;DeviceId=demo01;SharedAccessKey=xxx
    <SharedAccessKey is automatically generated>
IoT Data Share Settings Sent to Azure IoT Hub
  • Controller name : AzureIoT
  • Item name : telemetry

The following steps assume that the connection between your computer and Azure IoT Hub is already established.

Step 1Setting items to send to Azure IoT

1Select [Controller setting wizard] from the [Project] menu.

2First, setting up the controller.
Select [Category] from the Search tab.

3Select [Category], [Gateway], and [Microsoft] from the search tree.

4Select [Microsoft Azure IoT Hub] from the list displayed.
After selecting, make sure that the displayed provider name is "Azure IoT Provider", and then click the [Next] button.

5Optionally set the controller name.
Here, enter "AzureIoT".

6Set the [IoT Hub Connection Text] in [Option].
Here, enter "HostName=tutorial.azure-devices.net;DeviceId=demo01;SharedAccessKey=xxx".

7Confirm the input items, and click the [Next] button.

8Then add the item. Set [Item name] as desired.
Here, enter the item named "telemetry".

9Set the [Variable name].
Here, enter "telemetry".

Note

If the [Same as item] check box is selected, the name entered in [Item name] can be set as [Variable name] without entering [Variable name].

10Click the [Add] button to confirm that the item has been added.

Note

To add multiple items, click the [Add] button, and then enter another item name to add.

11Click the [Finish] button. Confirm the settings and click the [OK] button.

This completes the "Setting items to send to Azure IoT" procedure.

Step 2Setting of sending data to Azure IoT

To send data to Azure IoT, set the attribute of the send item "telemetry" and the trigger action of the data collection controller "RC8".

1Select the item [telemetry] from the project tree,
and select [General] for [Property (Item)] or [Write] from the [Attribute] list.

Note

The initial value of the [Attribute] property when an item is added is "Read", but the initial value can be changed by the environment setting.

2Select the controller [RC8] from the project tree,
and select [Trigger action setting] from the right-click menu.

Note

In addition to the right-click menu,
you can also select the trigger action settings from the toolbar buttons.

3Click the [Action] button.

4Select [Output JSON] from the Action List.

5Set [Action name] as desired.
Here, enter "Send data to AzureIoT" and click the [Settings] button.

Note 1

When adding a trigger action, you can leave the action name as the default, but if you add multiple actions of the same type, they will have the same action name, so it is recommended to change it to any name you want.

Note 2

You can also open the settings screen for each action by double-clicking the selected action.

6Select [Result storage item].
Click the [...] button to open the settings window.

7Select the item [telemetry] and click the [OK] button.

8Add [Object], and click the [Add] button for [Key].

9Set the Key name as desired.
Here, enter "I10" and click the [OK] button.

10Select the added Key [I10] and click [Add] in [Data].

11[Type] Select [Item] from the list.

12Click the [...] button and select [I10] for the controller [RC8] item.
Click the [OK] button.

13Check the setting items, and click the [OK] button.

Note

You can check JSON to be sent by clicking the [Preview] button.

This completes the "Setting of sending data to Azure IoT" procedure.

Step 3Checking the data sent to Azure IoT

* For details on how to save and start a project, refer to Chapter 1 Lesson2 of <Learning contents> [Basics]

1Select [Save project] from the [File] menu.

2Select [Start project] from the [Action] menu.

3Verify the data sent to Azure IoT.
* Here we are using a Microsoft Visual Studio Code that adds an extension (Azure IoT Hub) to the validation.

●This completes the "How to send data to Azure IoT" procedure.