Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
144 lines (108 sloc) 4.48 KB
title description services documentationcenter author manager tags keywords ms.assetid ms.service ms.devlang ms.topic ms.tgt_pltfrm ms.workload
Data conversion on IoT gateway with Azure IoT Edge | Microsoft Docs
Use IoT gateway to convert the format of sensor data through a customized module from Azure IoT Edge.
iot gateway data conversion, iot gateway data transformation

Use IoT gateway for sensor data transformation with Azure IoT Edge

[!NOTE] Before you start this tutorial, make sure you've completed the following lessons in sequence:

One purpose of an Iot gateway is to process collected data before sending it to the cloud. Azure IoT Edge introduces modules which can be created and assembled to form the data processing workflow. A module receives a message, performs some action on it, and then move it on for other modules to process.

What you learn

You learn how to create a module to convert messages from the SensorTag into a different format.

What you do

  • Create a module to convert a received message into the .json format.
  • Compile the module.
  • Add the module to the BLE sample application from Azure IoT Edge.
  • Run the sample application.

What you need

Create a module

  1. On the host computer, run the SSH client and connect to the IoT gateway.

  2. Clone the source files of the conversion module from GitHub to the home directory of the IoT gateway by running the following commands:

    cd ~
    git clone

    This is a native Azure Edge module written in the C programming language. The module converts the format of received messages into the following one:

    {"deviceId": "Intel NUC Gateway", "messageId": 0, "temperature": 0.0}

Compile the module

To compile the module, run the following commands:

cd iot-hub-c-intel-nuc-gateway-customized-module/my_module
# change the build script runnable
chmod 777
# remove the invalid windows character
sed -i -e "s/\r$//"
# run the build shell script

You get a file after the compile is completed. Make a note of the absolute path of this file.

Add the module to the BLE sample application

  1. Go to the samples folder by running the following command:

    cd /usr/share/azureiotgatewaysdk/samples
  2. Open the configuration file by running the following command:

    vi ble_gateway.json
  3. Add a module by inserting the following code to the modules section.

        "name": "MyModule",
        "loader": {
            "name": "native",
                "module.path": "[Your path]"
         "args": null
  4. Replace [Your path] in the code with the absolute path of the` file.

  5. Replace the code in the links section with the following one:

        "source": "SensorTag",
        "sink": "MyModule"
        "source": "MyModule",
        "sink": "mapping"
  6. Press ESC, and then type :wq to save the file.

Run the sample application

  1. Power on the SensorTag.

  2. Set the SSL_CERT_FILE environment variable by running the following command:

    export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
  3. Run the sample application with the added module by running the following command:

    ./ble_gateway ble_gateway.json

Next steps

You've successfully use the IoT gateway to convert the message from SensorTag into the .json format.

You can’t perform that action at this time.