Build a predictive maintenance dashboard with AWS IoT SiteWise & Advantech Wise 2410

In this tutorial you will learn how to use AWS IoT Sitewise to build a predictive maintenance dashboard based on data reported by Advantech's LoRaWAN Wireless Vibration Sensor WISE 2410. 

Before you start

Step 1 – Add your device to AWS IoT Core

Step 2 – Create your model

Step 3 – Create your Asset

Step 4 - Add your devices to a fleet

Step 5 - Connect IoT Core Things to IoT SiteWise

Step 6 – Create your SiteWise Portal

Step 7 – Create your project in your portal

Step 8 – Create your dashboard

More information

 


Before you start...

 

In order to follow this guide, you need to fulfill the following prerequisites: 

  • Have a ThingPark Community account with an active LoRaWAN™ gateway. If you don’t have a gateway, you can purchase one on ThingPark Market, ready to be activated on ThingPark Community.
  • Have an AWS IoT account with AWS IoT Core, SiteWise and the SSO services activated.
  • Have a Wise-2410 device from Advantech.
  • Connect your ThingPark Community account with your AWS IoT Core account; to do this, you can follow this tutorial.

 

 


Step 1 - Add your device to AWS IoT Core

 

First, you now need to activate your device on ThingPark Community.

Connect yourself to your ThingPark account and go to “Devices” > “Create” > “View More Manufacturers” > “Advantech".

There, you will have to select the WISE-2410 model that corresponds to your region (ETSI corresponds to Europe, FCC to the United States and AS923 to Asia). Name your device as you want and fill the fields “DevEUI”, “JoinEUI” and “AppKey” with the information you received with the device. Finally, select the two applications corresponding to AWS IoT that must have appeared (“TP Location for AWS IOT” and “AWS IoT”) and click on the “Save” button.

If you are using the WISE-2410 for the first time, go to the Advantech support website to download the guide and follow the installation steps; if your WISE-2410 is already transmitting, the easiest way to make it send a join request is to disconnect the connection between the battery holder and the PCBA as shown in step 3.4.2. Your connection status should switch to “Active”.

To find the configuration of your device at any time, plug it to your computer with an USB cable and open WISE Studio that you can download here. You can find a tutorial on how to use WISE Studio in the Chapter 4 of the user manual.

Now that your device is linked to AWS IoT, you should be able to see it on AWS IoT Core.

Go to AWS IoT, on the left click on “Manage” and then “Things”. Your screen should look like the following screenshot.

If your device isn’t present in the list, check on the upper left that the region corresponds to the one you deployed your application on.

 


Step 2 - Create your model

 

With this model, you'll create data containers for each property of your device.

From AWS Management console, go to AWS IoT SiteWise.

From Sitewise home page, click on “Create new model”. 

The model has multiple fields to fill in order to be useful, but you can give it just a name and save it if you want to fill it later. The fields are:

  • Name: the model’s name. Use it to identify the kind of device it was made for.
  • Attribute definitions: optional field, if you have values that rarely change such as the serial number, you can use this field.
  • Measurement definitions: features of your device that you want measured.
  • Transform definitions: if you want to apply a change on the measure you got from your device (example: if you collected temperature in Celsius and you wanted it in Fahrenheit)
  • Metric definitions: Aggregation of the measures you have collected with “Measurement definitions”
  • Hierarchy definitions: If you want this model’s assets to inherit properties of another model.

Click on the orange “Save” button to complete the operation, if everything was done correctly, the status should show “ACTIVE” after few seconds. You can always come back to edit your model if you want.

For the specific case of the WISE-2410, you will need the following list of measurements and transformations as some of those measures are not in regular units:

If you go in the WISE Studio application, in the I/O Status tab, you can see the exact values your device reports; you can check that the values you get after the transformations correspond to those.

 


Step 3 - Create your asset

 

Now that your model is complete, you can go to “Assets” just under the “Models” button on the left and click on “Create asset”. Pick the model you want your associated with and the name you want this asset to have.

Click on the orange button “Create asset” to confirm the creation. Once again, the status of the newly created device should quickly switch to “ACTIVE”. Select the asset you just created and click on “Edit”.

If you scroll down, you will find the “Measurement” section which is composed of every “Measurement definition” you added in your model. Just under the name of each measure, you will have to complete the “property alias” fields. You can give any alias you want; they just have to be unique.

This will be useful later when you define the rules linking IoT Core and SiteWise.

 


Step 4 - Add your assets to a fleet

 

It is important to add your assets to a fleet for the monitoring and the dashboard creation. Indeed, when you create your dashboard, you will have to put them on projects and a project can only contain assets of a same fleet.
To start, return to AWS IoT SiteWise in the “Models” section, and click on “Create model”. This new model which will be your fleet model must at least have a name and a hierarchy definition. Give the hierarchy the name you want and put your asset model as the hierarchy model.

You can now go to the “Assets” section to develop your fleet. Click on “Create asset”, give it a name, choose your fleet model as its model, and click on “Save”. Now, click on “Edit”, and then “Add associated asset”, pick the asset model in “Hierarchy” and the asset you want in “Asset”; repeat this for every device you want on this fleet and click on “Save”

 


Step 5 - Create a rule to connect ioT Core Things to IoT SiteWise

Write your SQL query

Set-up your rule

In order to link our devices to our assets, you need to create rules which you can find in IoT Core in the category “Act”.

Click on “Create” to create a new rule; give it a name and a description so you won’t mix them up when you come back later. In the “rule query statement” section, you will have to write in SQL the elements you want for which the rule will react.

The most basic SQL query is “SELECT * FROM < Topic >” which takes every information from one device corresponding to the topic you chose.

Find your device's topic

To find out the topic of a device, go to AWS IoT Core and click on “Test” in the menu on the left, there, in the “Subscribe to a topic” category, enter “#” and click on the orange button “Subscribe”. All the uplinks of your devices connected to AWS IoT will appear, wait for the device you want to publish a message and you will find out its topic. (you will recognize it as the device EUI is part of the topic)

In our case our device ID is 74FE48FFFFA3D9F and we found in test that its topic is "aws/things/74FE48FFFFA3D9F/uplink"; thus, our SQL query is SELECT * FROM 'aws/things/74FE48FFFFA3D9F/uplink'

For more information on the SQL queries, click here.

Attention: You mustn’t use a hyphen in the SQL section, otherwise it won’t work.

Set-up the links to the asset

In the “Set one or more action” sub-section, click on “Add action”, select the IoT SiteWise option down the list and click on “Configure action”.

Attention: Be careful not to click on “Add action” in the “Error action” sub-section because everything looks the same, but that sub-section is for troubleshooting.

In this tutorial, we will set the rule using “By property alias”. You need to know that no matter which option you choose, the result will be the same.

The steps to set up the rule are the following:

  • In another tab, open AWS IoT SiteWise and go on the asset you want.
  • Scroll down the page and click on “Measurements” where you should see all the measures you added to your model.
  • The “Property alias” and the “Entry ID” are written here under “Alias” and “ID”.

  • If your device reports accurate time data, you can use the time_to_epoch function. You can find more information in the following link.

    Else, use ${floor(timestamp() / 1E3)} for “Time in seconds” and  ${(timestamp() % 1E3) * 1E6} for “Offset in nanos”.
  • In “Value”, enter the topic to the data you want to retrieve separated by dots for each curly bracket you enter in your json. Start your statement with “${” at the beginning and “}” at the end.
    Example: in this example, to retrieve the temperature, you will have to enter ${DevEUI_uplink.temperature}


    For the specific case of the WISE-2410, here are some of the values:

    Temperature: ${DevEUI_uplink.payload.TempHumi.SenVal}

    Battery: ${DevEUI_uplink.payload.Device.BatteryVolt}

    CrestFactor on X: ${DevEUI_uplink.payload.Accelerometer.XAxis.CrestFactor}

    OAVelocity on Y: ${DevEUI_uplink.payload.Accelerometer.YAxis.OAVelocity}

    Deviation on Z: ${DevEUI_uplink.payload.Accelerometer.ZAxis.Deviation}

    Attention: you musn’t use a hyphen in any of those fields, otherwise it won’t work.         

  • Finally, select the data type you want.

For each measure you want to link, you have to click on “Add entry”.

Once you have finished entering all your measures, select the asset that will receive the information and either create a new role or update an old one so the different instances of AWS IoT can exchange data.

Click on “Add Action” and then “Create rule” to finalize your creation.

 

Now that the model, asset, and rule are created, data should appear in in your asset; if you go to “Measurements” in your asset, you will see that the “Latest Value” column isn’t empty anymore, which means that data is flowing through SiteWise.

 


Step 6 - Create your SiteWise Portal

 

The last step is the visualization and in order to do it, you need to create a portal. Click on the bar on the right, under “Monitor” you will find “Portal”, click on it and then on “Create Portal”.

If you haven’t already enabled AWS SSO, you will be redirected to the following page; if you have, you can skip the following step until the next picture.

In order to create your dashboard, you must enable the Single Sign-On. Fill the three fields with the information of (one of) the user you will be administrator, you will be able to create more users later.

Then, give your portal at least a name and a support email for the users in case they have a problem. Click on “Create Portal” to proceed.

The button “Create User” will guide you to a simple window to create new profiles, select all the users you want as administrator and click on “Next”; a similar page will appear to select the simple users. You are not forced to add administrator or users already, you can do it later.

Click on “Assign Users” to complete the creation of your portal.

 


Step 7 - Create your project in your portal

 

The users and administrators should have received an email, click on “Accept the invitation to configure your account; it will lead you to a new page where you will configure your password.

Now that your account is ready, the following page should appear:

Click on “IoT SiteWise”, this page will be the place where you will find all your dashboards, a list of those you already created should appear. On the left, you will find a button “Asset”, click on it. Click on “Add asset to project”, it will display the list of assets you created on SiteWise; select those you want on your project and then, click on “Next”.

Give the project you want to create a name and a description and “Add asset to project”. You have successfully created your project.

 


Step 8 - Create your dashboard

 

On the lower part of the page, you can add the owner and viewers of this project and on top, you can create dashboards.

You can fully personalize your dashboard: change its name and select the assets you want, their properties are shown in the lower left corner, drag and drop them to add them on the dashboard. You can select properties of different assets in the same dashboard as long as they belong to the same fleet. Click on “Save dashboard” to complete your project.

The easiest way to display the information is to group them by axis as KPIs. In the case of the RMS and velocity, you can add thresholds at values you choose depending on the class of your motor. For more information about the thresholds corresponding to your asset, you can go here.

 


More information

  1. Full guide by AWS IoT

    A guide containing all the information about AWS IoT SiteWise is available at https://docs.aws.amazon.com/iot-sitewise/latest/userguide/iot-sitewise-guide.pdf

  2. More on the SQL queries

    An SQL query is structured as such:

     SELECT <Attribute> FROM < Topic > WHERE <Condition>

  • In the SELECT part, you can either pick the whole message by putting “*” as the attribute or choose attributes in the message of your device.

     Attention: You can use '.' syntax to drill into nested JSON objects in the incoming payload.

     Example: In the following payload, to obtain the temperature, you will need to type “SELECT DevEUI_uplink.temperature”

     { 

          "DevEUI_uplink": {   

               "Time": "2021-03-03T16:21:44.342+01:00",   

               "DevEUI": "20635F01080008E4",      

               "temperature": 23.788235 

          }

     } 

  • You will have to fill the FROM part with the topic of your device(s), if you have only one device, copy the topic you found in “Test” in IoT Core, if you have multiple, you can use “+” if you want any topic that fits the topic you asked for and where “+” can be any option.

     Example: sensor/+/room1 receives messages published to sensor/temperature/room1 and sensor/humidity/room1.

     You can also use “#” which gives you any topic that contains at least the beginning of your topic up until “#”

     Example: sensor/# receives messages published to sensor/, sensor/temperature, sensor/temperature/room1

     Attention: sensor/temperature won’t receive messages published to sensor/temperature/room1

  • The WHERE part is optional, it is useful if you want to add a condition.

     Example: SELECT * FROM sensor/# WHERE temperature > 25 will return the whole payload of every device which topic begins with sensor and whose temperature is above 25 degrees.