Getting Started with DCM - Azure IoT Hub
  • 07 Oct 2022
  • 2 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

Getting Started with DCM - Azure IoT Hub

  • Dark
    Light
  • PDF

The purpose of this article is to guide you through a Proof of Concept setup.
This setup is meant to be an easy way of getting, at first, simulated data to Azure IoT hub and then later you can add setup for your own devices eg PLC's, HMI's etc. for data collection from those.

Prerequisites

  • Knowledge of SiteManager configuration. See SiteManager getting started guides.
  • An Azure IoT Hub account Start a free trial here
  • A SiteManager with release 9.0 or higher
Note: From version 9.0.17 (19192) DCM requires NTP to be enabled in the SiteManager.
See more info here.
OBS: You need to have a Standard Tier (S1 at least) to use the Azure IoT hub


Goto SiteManager GUI and create an agent with DCM enabled.


(Choose a Generic / Data Collector Module device)
image.png

Click the parameter details icon
image.png

Add a DCM collector name (dcmcn) for associating the Agent and the DCM collector config.

(Remember the name for later use)

Click save
image.png

Goto DCM > edit and copy/paste the below configuration file into the editor.

{
    "ConfigName" : "AzureTest",
    "ConfigDescription" : "Azure Iot Hub test configuration",
    "Collectors" : [
        {       
            "CollectorName" : "sim",
            "CollectorDescription" : "DCM Internal Simulation Server",
            "Protocol"   : "Simulator",
            "SamplePoints" : [
                {
                    "SampleName" : "sine",
                    "SampleDescription" : "DCM simulation of sine curve",
                    "SamplesSaved" : 3,
                    "SampleDataType" : "double",
                    "SimulatorData" : {
                        "SimulatorFunction" : "sine",
                        "SimulatorInitValue" : 1000,
                        "SimulatorIncValue" : 100,
                        "SimulatorSampleInterval" : 1
                    }
                }
            ]
        }
    ],
    "DataServers" : [
        {
            "DatasrvName" : "azure",
            "DatasrvProtocol" : "AZURE\/IOTHUB",
            "ConnectRetryMin" : 2,
            "ConnectRetryMax" : 240,
            "AZUREIotHubParams" : {
                "PublishInterval" : 6,
                "ConnectName" : "azurecs",
                "PayloadFormat": "{ \"v\" : [ %jb ] }",
                "BulkElementFormat": "{ \"ts\" : %t, \"%jd:%js\" : %jv }"
            }
        }
    ]
}

Goto DCM > Status >details and copy the device "Edge ID" value.
image.png

Log in to your Azure account and go to Iot Hub->
Go to Iot Devices->
image.png

Press the [New] button
image.png

Fill in the device Edge ID, select Authentication Type "Symetric Key" and press [Save]
image.png

Click on the device Edge ID in your list of IoT Devices to view the Certificates and Keys.
image.png

Now copy the "Connection String -- Primary Key" into your clipboard.

Log into the SiteManager GUI and go into DCM->Certificates and press [New]. Select type "Azure Connection String", give it a name (fx. azurecs) click the document icon (next to save)
image.png

Paste the connection string from the clipboard. Click [Save].
image.png

Go to SiteManager GUI DCM->Edit and copy/paste this configuration, where the "ConnectName" field value is the name of the connection string value you created in the previous step (eg. azurecs).
image.png

Goto DCM > Restart and restart the DCM incl the Store'n'forward DB.

Goto DCM > Status and check that the dataserver is connected and sending data to the cloud.

Next

Now it's time to learn more about the DCM config file and how to set it up for your devices:

JSON config file basic structure


Was this article helpful?