How to use the STM32 MPU OpenSTLinux Expansion Pack for Predictive
Maintenance
Introduction
The STM32 MPU OpenSTLinux Expansion Pack for Predictive Maintenance enables the development of Edge processing
applications. It forms an end-to-end solution with corresponding hardware to allow environmental and inertial data from
industrial equipment to be sent to an IoT application with dedicated dashboard for data analysis and identification of conditions
that might require immediate or future maintenance intervention.
The application helps users manage many of the critical aspects of ef
such as registering remote devices, configuring gateways, and connecting to IoT cloud services. In particular, it interfaces with
the Amazon AWS IoT cloud and uses the AWS IoT Greengrass Edge Computing service on the gateway to run local logic and
transmit data seamlessly, even under conditions of intermittent Internet connectivity.
The development hardware for the application includes a vibration kit with motors, STEVAL-BFA001V1B IO-Link sensor boards
with inertial measurement unit, various environmental sensors plus on-board MCU for sensor data computation and
management, and the STEVAL-IDP004V1 IO-Link master board. A gateway node is set up with the STM32MP157C-DK2
Discovery board featuring various wired and wireless connectivity solutions, SD card data storage, LCD touch screen interface
and appropriate high performance STM32MP1 Series microprocessor.
The edge gateway collects environmental and FFT data from accelerometer sensors, which are then sent via MQTT over
Ethernet or Wi-Fi to a dashboard based on the AWS infrastructure.
fective condition monitoring with remote IoT sensor nodes,
Figure 1. Condition monitoring and Edge to Cloud: from sensors to gateway to cloud dashboard
UM2639 - Rev 3 - September 2020
For further information contact your local STMicroelectronics sales of
fice.
www.st.com
1Edge processing application overview
For the edge processing application setup, you need the following elements:
•
Gateway node:
–STM32MP157C-DK2 Discovery board with a minimum 4GB SD card
•Smart sensors and Master hardware:
–master board: STEVAL-IDP004V1
–sensor boards: STEVAL-BFA001V1B kit
•myST.com account for the Edge Processing Application dashboard.
•PC with the STM32 ST-LINK Utility and ST-LINK Programmer (standalone or integrated in STM32 Nucleo
boards).
•Internet connection with no proxy nor firewall.
The figure below shows a demo which integrates all the components required to monitor two motors that can be
driven at different speeds. The two motors can be balanced with different weights, and the dashboard shows the
time, environmental and frequency data of both, allowing the observer to easily identify which motor is not
performing appropriately.
UM2639
Edge processing application overview
Figure 2. Integrated demo with smart sensor nodes installed on two motors
UM2639 - Rev 3
page 2/31
DEPLOY
END
GATEWAY
(2)
GATEWAY
START
VISUALIZE DATA
Gateway
GREENGRASS
START
THE EDGE GATEWAY
INSTALL
EDGE GATEWAY
ASSIGN DEVICES TO
GREENGRASS
CONFIGURE THE
VIBRATION SETUP
STOP
THE APPLICATION
DEACTIVATE
REGISTER
IOT DEVICES
REGISTER AN
CREDENTIALS
Vibration setupDashboard
DEVICE
(3.2)
PROVISIONING
INSTALL
CREDENTIALS
(3.3)
(4)
DEPLOYMENT
APPLICATION
START
(5)
CONDITION
MONITORING
(6)
STOP
APPLICATION
Legenda
BEGIN
MASTERBOARD
INSTALL
(3) APPLICATION SETUP
FLASH THE
STOP THE
ST SDKS
SENSORS
GREENGRASS
INSTALL
(3.1)
VIBRATION SETUP
SETUP
(1)
SENSORS AND
MASTERBOARD SETUP
APPLICATION
ACTIVATE
FLASH THE
START
GREENGRASS
Edge Processing Application setup and operation
2Edge Processing Application setup and operation
The flow chart below provides an overview of the procedure involved in setting up and running the application.
Figure 3. Setup and operation
UM2639
UM2639 - Rev 3
page 3/31
2.1Sensor and master board setup
Follow the procedure below to flash the sensor board and the master board with the latest firmware.
Step 1.Download the binary files for the sensor and master boards from the following locations on the ST
website:
–
Sensor node: STSW-BFA001V1
–Master board: STSW-IDP4PREDMNT
Step 2.Flash the relevant binaries onto the STEVAL-IDP004V1 IO-Link master board and STEVAL-
BFA001V1B IO-Link sensor boards.
Use the STM32 ST-LINK (STSW-LINK004) Utility and an appropriate ST-LINK programmer/debugger
device (standalone or integrated in STM32 Nucleo boards).
2.2Gateway setup
To set up an STM32MP157C-DK2 Discovery kit as the Edge gateway for your Predictive Maintenance Platform,
you can either:
•
Flash a pre-configured image by ST:
–X-LINUX-PREDMNT
•Create and flash a custom image
UM2639
Sensor and master board setup
Figure 4. STM32MP157C-DK2 Discovery kit
STM32 MPU with dual-core Cortex-A7 CPU, 533 MHz GPU and Cortex-M4 MCU
Secure Boot and cryptography, LCD, Wi-Fi, Bluetooth Low Energy
Important:Set the micro-switches to OFF before flashing and to ON just after.
RELATED LINKS
You can use this free tool to master your binary images onto an SD card
isit the STM32 MPU wiki page for relevant guides and resources regarding the STM32 MPU
V
UM2639 - Rev 3
page 4/31
2.2.1How to create an image for the STM32MP1 Discovery kit
Follow the instructions below to configure an STM32MP157C-DK2 Discovery kit as a Linux gateway
Note:The instructions apply to the STM32MP1 DK2 C01 and C2 releases only.
Step 1.Set up your host environment according to the PC prerequisites page at the STM32 MPU wiki page:
This layer contains the recipes to install the Predictive Maintenance application, the Amazon AWS IoT
Greengrass service for edge computing (https://aws.amazon.com/it/greengrass/), and other required
Python packages (view meta-predmnt/conf/layer.conf file for further details):
2.WireST-SDK initializes the masterboard and sensor devices.
Figure 17. Greengrass startup and device initialization
UM2639
Condition Monitoring
3.Greengrass daemon contacts Greengrass core on the cloud through EdgeST
4.Devices and their counterparts on the cloud start communication.
5.The application receives data from the sensors and sends them to the cloud.
Figure 18. Gateway receives data from the sensors
-SDK.
UM2639 - Rev 3
page 15/31
UM2639
Condition Monitoring
6.Optional: if the solution deployed from the dashboard contains a Lambda function (depending on the
dashboard implementation) to process data locally (typically a filter on the Fast Fourier T
the vibration data), the alarms triggered are shown on the gateway screen.
Different alarm windows can pop up on the screen and an acoustic alarm is played through the audio jack on
a connected speaker.
Figure 19. Alarm pop-up windows
A. Normal: in case the FFT data are within the normal range
B. Warning: in case FFT data overcome the FFT warning threshold
C. Critical: in case FFT data overcome the FFT critical threshold
Moreover, a colored log of data and alarms is shown.
ransform (FFT) of
Figure 20. Alarm logs
Alarm signals are also sent to the cloud dashboard for further use.
UM2639 - Rev 3
page 16/31
2.5.2Data visualization on the dashboard
Follow the procedure below to view the sensor data on the dashboard.
Step 1.Open the dashboard and log in with myST
https://dsh-predmnt.st.com/
Step 2.Click on [DASHBOARD], then [Add Device] and select the desired devices to monitor.
A panel for each selected device opens and shows the exported data values.
Figure 21. Device panel with sensor data and parameters
UM2639
Condition Monitoring
.com credentials:
Step 3.If needed, it is possible to configure some thresholds for the feature exported by the devices, which can
be useful to quickly check the working condition of the devices through the gauge panel. From the main
page, choose [Register a new device], select a device, click on the
[Settings] gear icon, then on
[Configure Thresholds] and choose a feature from the drop-down menu to configure the desired
thresholds.
Figure 22. Threshold settings for each device
UM2639 - Rev 3
page 17/31
UM2639
Condition Monitoring
Step 4.Click on [ASSETS CONDITION MONIT
A gauge panel appears for each selected device showing its working condition according to the last
configured feature.
Figure 23. Gauge panel for each device
ORING].
UM2639 - Rev 3
page 18/31
2.6Stopping the application
2.6.1How to stop the application
Step 1.T
2.6.2How to deactivate the vibration setup
Step 1.Set the speed of the vibration setup to zero.
o stop the application:
–From the “RUN APPLICATION” GUI, click on the [Close] button
–Alternatively, press [CTRL+C] on the terminal where the application was launched
–Or, from a different terminal, run the stop script:
/home/root/stop_pmp.sh
UM2639
Stopping the application
Step 2.Power vibration setup of
f.
UM2639 - Rev 3
page 19/31
Additional information on gateway application configuration
3Additional information on gateway application configuration
Additional information, such as edge gateway credentials, Greengrass configuration and configuration of the
application on the gateway
3.1Credentials
The “/greengrass” folder contains the edge gateway credentials, the Root Certification Authority certificate file
(root.ca.pem) and the Greengrass configuration file (config.json).
The “/usr/local/predmnt/devices_pmp_aws” folder contains the device credentials.
A. Edge gateway credentials
B. Device credentials
, could be useful when developing applications and for debugging issues.
Figure 24. Credentials on the gateway filesystem
UM2639
UM2639 - Rev 3
page 20/31
3.2Greengrass configuration
As soon as the Greengrass daemon starts, the “config.json” file allows it to get information about how to connect
to the Greengrass core of the cloud application.
The code below is an example of configuration file.
The code above shows an example of application configuration file on the gateway
, containing the following
parameters:
•serial_port: name and baud rate of the serial port used
•use_sensors: to use the sensor device real setup or to simulate random data
•use_cloud: to send data to the cloud or not
•use_threads_for_polling_sensors: to run a separate thread for each data domain (Environmental,
Inertial_TDM, Inertial_FDM) for each sensor device or to poll them sequentially
•devices: to list the name and position of the configured devices on the masterboard
•dump: to dump the domain data (Environmental, Inertial_TDM, Inertial_FDM) up to the number of samples
provided
Note:You can change these parameters via command-line by editing the configuration file, if needed.
UM2639 - Rev 3
page 22/31
4Troubleshooting
4.1Correct behavior
The code below shows an example of correct behavior when running the application.
Initializing Masterboard on port "/dev/ttyUSB0" with a baud rate of "230400" [b/s]...
Masterboard on port "/dev/ttyUSB0" from "IDLE" to "CONNECTING".
Masterboard on port "/dev/ttyUSB0" found device "393832383035511900430037" on position "1".
Masterboard on port "/dev/ttyUSB0" found device "3938323830355119003B0038" on position "4".
Masterboard on port "/dev/ttyUSB0" from "CONNECTING" to "CONNECTED".
Initializing IO-Link Devices...
Device "TSDemo1" on position "1" initialized.
Device "TSDemo2" on position "4" initialized.
UM2639
Troubleshooting
IO-Link setup complete.
Initializing Edge Computing...
AWS Greengrass service with endpoint "a1azohj3ky8ktj-ats.iot.eu-west-1.amazonaws.com" from
"IDLE" to "DISCOVERING_CORE".
AWS Greengrass service with endpoint "a1azohj3ky8ktj-ats.iot.eu-west-1.amazonaws.com" from
"DISCOVERING_CORE" to "CORE_DISCOVERED".
Client "TSDemo1" from "IDLE" to "CONNECTING".
Client "TSDemo1" from "CONNECTING" to "CONNECTED".
Client "TSDemo2" from "IDLE" to "CONNECTING".
Client "TSDemo2" from "CONNECTING" to "CONNECTED".
Configuration file "/greengrass/config/config.json " not found.
Exiting...
UM2639
Missing configuration files
Solution: check whether the location of the file(s) is correct, then, when no error message is shown, run the
application again.
4.3Missing sensor devices
In case one or more device specified within the “pmp.json” configuration file cannot be initialized, you may get the
following error message:
[…]
Initializing Masterboard on port "/dev/ttyUSB0" with a baud rate of "230400" [b/s]...
Masterboard on port "/dev/ttyUSB0" from "IDLE" to "CONNECTING".
Masterboard on port "/dev/ttyUSB0" found device "393832383035511900430037" on position "1".
Masterboard on port "/dev/ttyUSB0" from "CONNECTING" to "CONNECTED".
Initializing IO-Link Devices...
Device "TSDemo1" on position "1" initialized.
IO-Link setup incomplete.
Exiting...
Solution:
•
check the connection between the missing sensor devices and the masterboard
•check the application configuration file
•when no error message is shown, run the application again
UM2639 - Rev 3
page 24/31
UM2639
Missing device credentials
4.4
4.5
Missing device credentials
In case the certificate of some of the configured devices is not found, the following error message appears:
Solution: check the location and the filenames of the certificate and the private key of the configured devices,
then, when no error message is shown, run the application again.
Dashboard issues
In case there are issues with the dashboard or the deployment is not correctly working, the following error
message appears:
[…]
Initializing Edge Computing...
AWS Greengrass service with endpoint "a1azohj3ky8ktj-ats.iot.eu-west-1.amazonaws.com" from
"IDLE" to "DISCOVERING_CORE".
Discovery of the core related to the client "TSDemo1", with certificate
"/usr/local/predmnt/devices_pmp_aws/TSDemo1.cert.pem" and key
"/usr/local/predmnt/devices_pmp_aws/TSDemo1.private.key", failed after 3 retries.
Exiting...
When deploying a solution, the Greengrass daemon has to be running and the status of the last operation on the
cloud has to be successful (either deployment or reset), whereas, when deploying via the “SETUP
APPLICATION” GUI, Greengrass automatically starts.
•Run the following command:
/greengrass/ggc/core/greengrassd restart
when deploying from command-line.
•
Deploy and run again; if the problem persists, contact the dashboard administrators.
UM2639 - Rev 3
page 25/31
4.6Cloud connectivity issues
In case there are issues with cloud connectivity, the following error message appears:
[…]
Initializing Edge Computing...
AWS Greengrass service with endpoint "a1azohj3ky8ktj-ats.iot.eu-west-1.amazonaws.com" from
"IDLE" to "DISCOVERING_CORE".
AWS Greengrass service with endpoint "a1azohj3ky8ktj-ats.iot.eu-west-1.amazonaws.com" from
"DISCOVERING_CORE" to "CORE_DISCOVERED".
Client "TSDemo2" from "IDLE" to "CONNECTING".
Client "TSDemo2" from "CONNECTING" to "UNREACHABLE".
Client "TSDemo2" cannot connect to core.
AWS setup incomplete.
Exiting...
Solution: check your connection to the Internet, then run the application again.
4.7Misalignment issues
UM2639
Cloud connectivity issues
In case you are running a firmware not aligned to the WireST
error message might appear:
[…]
Edge Computing setup complete.
Demo running...
Read 1 elements. Discarded.
[…]
Solution: update the firmware of the sensors and masterboard, the WireST-SDK
latest release. Then, run the application again.
4.8Unexpected crash of the application
In case the graphical application crashes unexpectedly, restart it via command-line:
/home/root/start_pmp.sh --gui
and the main PMP application, the following
-SDK
and the main application to the
UM2639 - Rev 3
page 26/31
Revision history
27-Nov-20191Initial release.
26-Feb-20202Minor text edits.
24-Sep-20203Updated all content to reflect new GUI release.
Figure 21. Device panel with sensor data and parameters ............................................. 17
Figure 22. Threshold settings for each device ..................................................... 17
Figure 23. Gauge panel for each device ......................................................... 18
Figure 24. Credentials on the gateway filesystem ................................................... 20
1
UM2639 - Rev 3
page 30/31
UM2639
IMPORTANT NOTICE – PLEASE READ CAREFULLY
STMicroelectronics NV and its subsidiaries (“ST”) reserve the right to make changes, corrections, enhancements, modifications, and improvements to ST
products and/or to this document at any time without notice. Purchasers should obtain the latest relevant information on ST products before placing orders. ST
products are sold pursuant to ST’
Purchasers are solely responsible for the choice, selection, and use of ST products and ST assumes no liability for application assistance or the design of
Purchasers’ products.
No license, express or implied, to any intellectual property right is granted by ST herein.
Resale of ST products with provisions different from the information set forth herein shall void any warranty granted by ST for such product.
ST and the ST logo are trademarks of ST. For additional information about ST trademarks, please refer to www
names are the property of their respective owners.
Information in this document supersedes and replaces information previously supplied in any prior versions of this document.
s terms and conditions of sale in place at the time of order acknowledgement.