Skip to main content

Microsoft Simulator Module

The Simulated Temperature IoT Edge Module is a specialised software module developed by Microsoft. This module emulates data generation that is typically associated with a temperature sensor device. It is mainly used with Azure IoT Edge and can be effectively employed for testing and development purposes, especially in the absence of actual sensor devices.

Main features of the module include:

  • Simulated Data: The module continuously generates simulated temperature and pressure data and sends this information to the temperatureOutput endpoint.

  • Resettable: The module can be reset to its initial data values through a direct method invocation or via a message sent through the EdgeHub routing system to the temperature simulation module.

  • Configurable: The data sending behaviour can be configured using desired properties for the module via the module twin. This includes options like starting or stopping the pushing of messages, setting the interval between messages, and configuring the number of simulated instances.

  • Compatible: This module is designed to work seamlessly with Azure IoT Edge and can be integrated into a larger IoT solution.

To use this module, one has to build it, push the IoT Edge solution to an Azure Container Registry, and then deploy it to an IoT Edge device. The module uses .env files for setting environment variables needed for interacting with the Azure Container Registry.

What data does it simulate?

The simulated data consists of machine temperature, machine pressure, ambient temperature, and humidity. The payload looks something like this:

{
"InstanceId": 1,
"machine": {
"temperature": 55.651076260675254,
"pressure": 4.9475909664060413
},
"ambient": {
"temperature": 21.195752660602217,
"humidity": 26
},
"timeCreated": "2018-02-09T10:53:32.2731850+00:00"
}

This module can be very useful for testing and development, as it allows developers to simulate sensor data and test their IoT solutions without needing to have actual sensor devices.

Microsoft Simulator Module manifest

Creating a manifest for a Microsoft Simulator Module and configuring a template for it in Azure IoT Central involves the following steps:

Step 1: Understand the Microsoft Simulator Module

The Microsoft Azure team provides a module called SimulatedTemperatureSensor for simulation purposes. This module sends simulated machine temperature data and humidity data.

Step 2: Create a Microsoft Simulator Module Manifest

The deployment manifest is a JSON document that describes which modules to deploy to your IoT Edge device and how to configure them. Here is a sample manifest that deploys the SimulatedTemperatureSensor module:

{
"modulesContent": {
"$edgeAgent": {
"properties.desired": {
"modules": {
"SimulatedTemperatureSensor": {
"settings": {
"image": "mcr.microsoft.com/azureiotedge-simulated-temperature-sensor:1.0",
"createOptions": "{}"
},
"type": "docker",
"status": "running",
"restartPolicy": "always",
"version": "1.0"
},
// Additional modules go here
},
// Additional configuration goes here
}
},
// Additional module configurations go here
}
}

Step 3: Upload the Manifest to Azure IoT Central

Now you can upload this manifest to Azure IoT Central:

  1. In your Azure IoT Central application, go to Device Templates, and select the appropriate template for your IoT Edge device.
  2. Go to Edge Manifests.
  3. Click + New to add a new manifest.
  4. Enter a name for the manifest, and paste the manifest JSON in the Manifest field.
  5. Click Create.

Step 4: Deploy the Microsoft Simulator Module

Finally, you can deploy your Microsoft Simulator module to your IoT Edge device:

  1. In your Azure IoT Central application, go to Devices, and select your IoT Edge device.
  2. Go to Configuration.
  3. In the Configuration Manifests section, select the manifest you created in the previous step.
  4. Click Save.
info

An Azure IoT Edge device can host multiple modules, each serving a distinct function or process. It's important to understand that we don't deploy these modules individually; rather, we deploy a complete manifest. This manifest is a comprehensive description of all the modules to be installed, their configurations, and the inter-module communication routes. When the manifest is deployed, all of the outlined modules are deployed and configured together on the IoT Edge device.

Your IoT Edge device will now start deploying the SimulatedTemperatureSensor module according to the manifest. This might take a few minutes. After the deployment is complete, the SimulatedTemperatureSensor module will start running on your IoT Edge device, and you can start interacting with it through Azure IoT Central.

Please note that the exact steps and the specifics of the manifest might differ based on your specific use case.