How-To: Sending data to the Data Portal

This guide provides a step-by-step introduction to using the IoT Builder tool. By following the instructions below, you’ll learn how to send signals from an ecomatDisplay or CR3171 to the Data Portal.

⚠ Important Note :
This guide applies to the ifm mobileIoT IoTBuilder CR31xx.package version 3.0.0.0 or newer.

Use cases

The IoT Builder tool allows you to transmit data from your PLC to the Data Portal. Two device families are currently supported. The CODESYS logo indicates where device programming is required.

Sending data from ecomatDisplay

One use case is sending data over Ethernet from an ecomatDisplay to one of the mobileIoT gateways:

Sending data from the CR3171

Another use case is to program the CR3171 to collect Data from one of the CAN Buses using the ifmRawCAN.library or receiving data over Ethernet from any IP device and then using IoT Builder to send it to the Data Portal:


Prerequisites

1. CR3171 with minimum FW 1.7.0

2. Running data contract (at least CZ1100 )

3. The time on the device you are using CODESYS on should be set correctly. Otherwise, the time of the data in the Data Portal will be different

4. Setting up the mobileIoT gateway:

CR3171

Log into the WebUI of the CR3171 by following CR3171 WebUI Login

Open the Advanced settings -> Device access settings

Ensure the required options are enabled:


5. Installed CODESYS packages on the service pack version for your device you are programming with CODESYS:

Install packages

5.1 Launch CODESYS Installer and select the appropriate service pack

⚠ Important Note :
Close all instances of the service pack in which you are going to install the packages


5.2 Install the CODESYS package exported from IoT Builder


5.3 Download and install the latest IIoT Libraries SL from the CODESYS Store (IIoT Libraries SL) :


⚠ Important Note :
The versions may differ after your installation.


Step 1: IoT Builder in mobileIoT suite

1. To begin, click on "IoT Builder" to open the tool.

2. Enter General Project Information

  1. Project information: Name of your project
  2. Project target : Select the machine or the type of gateway you are building the IoT Builder for
  3. My setup:
    1. Controller type: Device the IoT Builder is going to run on
    2. Controller interface: Always ETH
    3. Modem IP Address: IP of the mobileIoT gateway
  4. GPS
    1. Enable: Enable if GPS data is needed (enabled by default on CR3171 FW ≥ 1.7.0)
    2. Cycle: Time interval for GPS data collection
    3. Distance: ???

3. Define your signals you want to send to the Data Portal

  1. Signal type: Standardized metric or create own metric
  2. Signal details: Customize name and unit
  3. Configuration
    1. Cycle : Time interval for data collection
    2. Trigger : Variable in CODESYS triggering logging of the Application Variable
    3. Application variable : Name of the CODESYS variable holding the value
    4. Type : CODESYS data type
    5. Category : ???
    6. Permission : Access control in Data Portal
  4. Transformation : Optional value transformation

4. Deploy settings for your machine

5. Post deployment

If you have an already running IoT Builder in your CODESYS application and you just want to update the signals that have changed use this option:

If you dont have a running IoT Builder in your CODESYS application select the second option. This "Archive file" will include a CODESYS library and if necessary all Application variables defined as signals can be added into a GVL (global variable list) for use in CODESYS.


Step 2: Import into CODESYS

Importing mobileIoT program

1. Open a new or existing CODESYS project

2. Select application and navigate to Project -> Import PLCopenXML... -> Select project.xml out of the archive file from the export of IoT Builder.
Afterwards you should see the following:

Confirm and the program gets imported:

3. Add library to the project:
Library Manager -> Add Library -> ifm_mobileIoT


4. Resolve placeholder if necessary:
Library Manager -> Placeholders -> Check for empty libraries and select a version

⚠ Important Note :
For system libraries beginning with version 3.5 you should never choose a library above your service pack and patch version.
For example: When using SP19 Patch 7, you should not use a system library above V3.5.19.7
⚠ Important Note :
Repeat this process until all placeholders are set.

5. Make sure that you have choosen the ifmGateway library that is according to your mobileIoT gateway (in this example ifmGatewayCR3171):


6. Assigning the mIoT PRG to a task:
Make sure, that the mIoT task is assigned to a task by drag and dropping the PRG on any task


Adding values to your signals

1. Open the GVL_mobileIoT

2. You should see variables defined in IoT Builder:

3. In a separate PRG, assign values:

GVL_mobileIoT.uiAmbientHumidity := 40;

⚠ Important Note :
User and password are only needed for the use of the CR3170.
User is admin and the password must be as base64 encoded.


Snapping a value of your signal

By default values are logged cyclially. In our example we have defined that the value of uiAmbientHumidity will be logged every minute. If you want to log the value at an specific event or in between the minute, you can use the xSnapAmbientHumidity variable:

xSnapAmbientHumidity := TRUE;

The value is logged on a rising edge of the variable.


Adding mobileIoT status screen

The ifm_mobileIoT.library includes a mobileIoT_StatusScreen which is a visualization of different status information of the gateway. It visualizes the stGatewayStatus output enum of the fbGatewayManager of the imported mIoT PRG.

  1. Open or create a visualization
  2. Navigate to Visualization Toolbox -> ifm_mobileIoT -> Drag and Drop the mobileIoT_StatusScreen into the visualization

3. Set the X- and Y-Position to 0:


4. After adjusting the screen it could look like this:


After downloading the application you can see different values and statuses in the visualization:

⚠ Important Note :
Due to missing information from device side, its possible that not all values are getting displayed.