How to use the STM32 MPU OpenSTLinux Expansion Pack for … · the Amazon AWS IoT cloud and uses...

22
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 effective condition monitoring with remote IoT sensor nodes, 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, IO-Link sensor boards STEVAL-BFA001V1B with inertial measurement unit, various environmental sensors and on-board MCU for sensor data computation and management, and an IO-Link master board STEVAL-IDP004V1. 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. Figure 1. Condition monitoring and Edge to Cloud: from sensors to gateway to cloud dashboard The Edge node collects environmental data and FFT data from accelerometers processed by the STEVAL-BFA001V1B kit, which is then sent via MQTT over Ethernet or Wi-Fi to the DSH-PREDMNT dashboard based on the AWS infrastructure. STM32MP157C-DK2 rev. C01 STEVAL-IDP004V1 sensor nodes STEVAL-BFA001V1B IoT Cloud Application AWS IoT Greengrass Serial Interface WireST SDK EdgeST SDK PredMnt application X-LINUX-PREDMNT DSH-PREDMNT dashboard Predictive Maintenance Cloud application How to use the STM32 MPU OpenSTLinux Expansion Pack for Predictive Maintenance UM2639 User manual UM2639 - Rev 2 - February 2020 For further information contact your local STMicroelectronics sales office. www.st.com

Transcript of How to use the STM32 MPU OpenSTLinux Expansion Pack for … · the Amazon AWS IoT cloud and uses...

Page 1: How to use the STM32 MPU OpenSTLinux Expansion Pack for … · the Amazon AWS IoT cloud and uses the AWS Greengrass Edge Computing service on the gateway to run local logic and ...

IntroductionThe STM32 MPU OpenSTLinux Expansion Pack for Predictive Maintenance enables the development of Edge processingapplications. It forms an end-to-end solution with corresponding hardware to allow environmental and inertial data fromindustrial equipment to be sent to an IoT application with dedicated Dashboard for data analysis and identification of conditionsthat might require immediate or future maintenance intervention.

The application helps users manage many of the critical aspects of effective condition monitoring with remote IoT sensor nodes,such as registering remote devices, configuring gateways, and connecting to IoT cloud services. In particular, it interfaces withthe Amazon AWS IoT cloud and uses the AWS IoT Greengrass Edge Computing service on the gateway to run local logic andtransmit data seamlessly, even under conditions of intermittent Internet connectivity.

The development hardware for the application includes a vibration kit with motors, IO-Link sensor boards STEVAL-BFA001V1Bwith inertial measurement unit, various environmental sensors and on-board MCU for sensor data computation andmanagement, and an IO-Link master board STEVAL-IDP004V1. A gateway node is set up with the STM32MP157C-DK2Discovery board featuring various wired and wireless connectivity solutions, SD card data storage, LCD touch screen interfaceand appropriate high performance STM32MP1 Series microprocessor.

Figure 1. Condition monitoring and Edge to Cloud: from sensors to gateway to cloud dashboardThe Edge node collects environmental data and FFT data from accelerometers processed by the STEVAL-BFA001V1B kit, which is then sentvia MQTT over Ethernet or Wi-Fi to the DSH-PREDMNT dashboard based on the AWS infrastructure.

STM32MP157C-DK2 rev. C01

STEVAL-IDP004V1

sensor nodesSTEVAL-BFA001V1B

IoT Cloud Application

AWS IoT Greengrass

SerialInterface

WireSTSDK

EdgeSTSDK

PredMnt application

X-LINUX-PREDMNT DSH-PREDMNT dashboard

Predictive MaintenanceCloud application

How to use the STM32 MPU OpenSTLinux Expansion Pack for Predictive Maintenance

UM2639

User manual

UM2639 - Rev 2 - February 2020For further information contact your local STMicroelectronics sales office.

www.st.com

Page 2: How to use the STM32 MPU OpenSTLinux Expansion Pack for … · the Amazon AWS IoT cloud and uses the AWS Greengrass Edge Computing service on the gateway to run local logic and ...

1 Edge processing overview

The Edge Processing Application is based on 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 or firewall.

The figure below shows a demo which integrates all the components required to monitor two motors that can bedriven at different speeds. The two motors can be balanced with different weights, and the dashboard shows thetime, environmental and frequency data of both, allowing the observer to easily identify which motor is notperforming appropriately.

Figure 2. Integrated demo with smart sensor nodes installed on two motors

UM2639Edge processing overview

UM2639 - Rev 2 page 2/22

Page 3: How to use the STM32 MPU OpenSTLinux Expansion Pack for … · the Amazon AWS IoT cloud and uses the AWS Greengrass Edge Computing service on the gateway to run local logic and ...

2 Edge 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

REGISTERIOT DEVICES

REGISTER ANEDGE GROUP

ASSIGN DEVICES TOTHE EDGE GROUP

COPY CREDENTIALSTO THE GATEWAY

CONFIGURE THEAPPLICATION

STARTGREENGRASS DEPLOY

STARTGREENGRASS

VISUALIZE DATA

Vibration Setup Gateway

Legend:

(3)DEVICE

PROVISIONING

CONFIGURE THEGATEWAY

INSTALLGREENGRASS

INSTALLST SDKS

(1)SENSOR AND

MASTER BOARD SETUP

(2)GATEWAY

SETUP

FLASH THESENSORS

FLASH THEMASTERBOARD

Dashboard

BEGIN

END

STOP THEAPPLICATION

(6)APPLICATION

START

ACTIVATEVIBRATION SETUP

START THEAPPLICATION

Guided C

onfiguration

DEACTIVATEVIBRATION SETUP

(4)APPLICATION

SETUP

(5)DEPLOYMENT

(7)CONDITION

MONITORING

(8)APPLICATION

STOP

UM2639Edge Processing Application setup and operation

UM2639 - Rev 2 page 3/22

Page 4: How to use the STM32 MPU OpenSTLinux Expansion Pack for … · the Amazon AWS IoT cloud and uses the AWS Greengrass Edge Computing service on the gateway to run local logic and ...

2.1 How to set up sensor and master boards

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 STwebsite:– 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/debuggerdevice (standalone or integrated in STM32 Nucleo boards).

2.2 STM32MP1 Discovery kit as Edge gateway

To set up an STM32MP157C-DK2 Discovery kit as the Edge gateway for your Predictive Maintenance Platform,you can either:• Use a pre-configured image by ST; these can be flashed onto an SD card and run on the Discovery board. In

this case you can skip the gateway configuration procedure and proceed directly to connecting to thegateway via SSH.– X-LINUX-PREDMNT

• Configure the Discovery kit manually according the instructions provided.

Figure 4. STM32MP157C-DK2 Discovery kitSTM32 MPU with dual-core Cortex-A7 CPU, 533 MHz GPU and Cortex-M4 MCUSecure Boot and cryptography, LCD, Wi-Fi, Bluetooth Low Energy

Important:When using the STM32MP157C-DK2 board, set the micro-switches to ON after flashing the SD card and before turning thegateway on.

RELATED LINKS 2.2.1 How to configure the STM32MP1 Discovery kit as an Edge gateway on page 4

2.2.2 How to connect to the gateway via SSH on page 7

You can use this free tool to master your binary images onto an SD card

Visit the STM32 MPU wiki page for relevant guides and resources regarding the STM32 MPU

2.2.1 How to configure the STM32MP1 Discovery kit as an Edge gatewayFollow the instructions below to configure an STM32MP157C-DK2 Discovery kit as a Linux gateway.

UM2639How to set up sensor and master boards

UM2639 - Rev 2 page 4/22

Page 5: How to use the STM32 MPU OpenSTLinux Expansion Pack for … · the Amazon AWS IoT cloud and uses the AWS Greengrass Edge Computing service on the gateway to run local logic and ...

Note: The instructions apply to the STM32MP1 DK2 C01 release only.

Step 1. Set up your host environment according to the PC prerequisites page at the STM32 MPU wiki page:https://wiki.st.com/stm32mpu/wiki/PC_prerequisites

Step 2. If this is the first use of the Discovery board, install the Starter Package and flash the image to anempty SD card so that all the partitions are created:https://wiki.st.com/stm32mpu/wiki/STM32MP15_Discovery_kits_-_Starter_Package

Important: Remember to set the micro-switches to OFF before flashing and to ON just after.

Step 3. Get the distribution package as described in the following wiki page:https://wiki.st.com/stm32mpu/wiki/STM32MP1_Distribution_Package

Step 4. Follow the instructions up to and including the command to build the image: bitbake st-image-westonThe image file is included in the distribution package.You can ignore anything after the build command.

Step 5. Move to the <layers> directory and install the meta-predmnt layer, available here:https://github.com/STMicroelectronics/meta-predmntThis layer contains the recipes to install the Predictive Maintenance application, the Amazon AWS IoTGreengrass service for edge computing (https://aws.amazon.com/it/greengrass/), and other requiredPython packages (view meta-predmnt/conf/layer.conf file for further details):

cd <path-to>/openstlinux-<version>/layers

git clone https://github.com/STMicroelectronics/meta-predmnt

cd <path-to>/openstlinux-<version>/build-openstlinuxweston-stm32mp1/conf/

Step 6. Copy and paste the following line into the bblayers.conf file, just before the BBLAYERS tokendefinition, and check that the BBLAYERS token contains the FRAMEWORKLAYERS token, otherwiseadd it:

FRAMEWORKLAYERS += "${@'${OEROOT}/layers/meta-predmnt' if os.path.isfile('${OEROOT}/layers/meta-predmnt/conf/layer.conf') else ''}"

UM2639STM32MP1 Discovery kit as Edge gateway

UM2639 - Rev 2 page 5/22

Page 6: How to use the STM32 MPU OpenSTLinux Expansion Pack for … · the Amazon AWS IoT cloud and uses the AWS Greengrass Edge Computing service on the gateway to run local logic and ...

Step 7. Move to the <openstlinux> directory, enable the USB support in the kernel, and build:

cd <path-to>/openstlinux-<version>

bitbake virtual/kernel -c menuconfig

Step 7a. Navigate to [Device Drivers]>[USB support].

Step 7b. Place a check on the following entry by pressing the [Space] key until an asterix (*)character appears and then press enter:

USB Serial Converter support

Step 7c. Place a check on the following entries by pressing the Space key until an asterix (*)character appears:

USB Serial Console device support

USB Generic Serial Driver

USB Serial Simple Driver

USB FTDI Single Port Serial Driver

Step 7d. Save and exit:

bitbake virtual/kernel

Step 8. Move to the <openstlinux> directory, and build the image:

cd <path-to>/openstlinux-<version>

DISTRO=openstlinux-weston MACHINE=stm32mp1 source layers/meta-st/scripts/envsetup.sh

bitbake st-image-weston

Step 9. Move to the <image> directory, and flash the image:

Important: Remember to set the micro-switches to OFF before flashing and to ON just after.

cd <path-to>/openstlinux-<version>/build-openstlinuxweston-stm32mp1/tmp-glibc/deploy/images/stm32mp1

STM32_Programmer_CLI -c port=usb1 -w flashlayout_st-image-weston/FlashLayout_sdcard_stm32mp157c-dk2-trusted.tsv

Step 10. Turn the gateway on.

UM2639STM32MP1 Discovery kit as Edge gateway

UM2639 - Rev 2 page 6/22

Page 7: How to use the STM32 MPU OpenSTLinux Expansion Pack for … · the Amazon AWS IoT cloud and uses the AWS Greengrass Edge Computing service on the gateway to run local logic and ...

Step 11. Open a console with keyboard and mouse input, and run:python3 /usr/local/predmnt/setup_gw.pyThe interactive script will guide you through the following steps:a. Configuring a Wi-Fi network, if needed (otherwise connect the gateway to the Internet through an

Ethernet connection)b. Installing the missing libraries:

◦ Amazon AWS IoT Python SDK:• https://github.com/aws/aws-iot-device-sdk-python

◦ WireSTSDK and EdgeSTSDK:• https://github.com/STMicroelectronics/WireSTSDK_Python• https://github.com/STMicroelectronics/EdgeSTSDK_Python

◦ Other Python packages (pyserial, futures, enum34).

2.2.2 How to connect to the gateway via SSHThe steps you should follow in this procedure depends on whether you intend to connect the STM32MP1 gatewayvia an Ethernet network or a Wi-Fi network:• Wi-Fi network:

– With a pre-configured ST image, start from Step 1– With a manually configured image and Wi-Fi not yet configured, start from Step 1– With a manually configured image and WiFi already configured: start from Step 2

• Ethernet network:– Plug an Ethernet cable into the gateway and start from Step 3

Step 1. Run the following command by specifying the SSID and password of your Wi-Fi network:wpa_passphrase <SSID> <PASSWORD> > /etc/wpa_supplicant.conf

Step 2. Connect to the configured Wi-Fi network:/home/<user>/connect_wifi.sh

Step 3. Use the following command to obtain the gateway IP address:ifconfig

Step 4. To connect to the gateway from another device via SSH, run the command:ssh <user>@<IP-ADDRESS>

2.2.3 How to Copy files to the gateway via SSHFollow the procedure below to copy files to the gateway from another device in the network.

Step 1. Open a console on the gateway, move to the destination folder, and run the command:scp –p -r <user>@<other-device-ip-address>:<path-to>/file .

2.2.4 How to reboot and turn the gateway offStep 1. To reboot the gateway, run the following command as super user:

rebootStep 2. To safely turn the gateway off, run the following command as super user:

shutdown 0

2.3 Device provisioning through the dashboard

Device provisioning is managed by the dashboard application to add devices and gateways to the cloud service.

UM2639Device provisioning through the dashboard

UM2639 - Rev 2 page 7/22

Page 8: How to use the STM32 MPU OpenSTLinux Expansion Pack for … · the Amazon AWS IoT cloud and uses the AWS Greengrass Edge Computing service on the gateway to run local logic and ...

Tip:If you want to speed up the setup process and start using the application quickly, you can run the interactive configurationroutine and skip the procedures for device provisioning, setting up the application, and deploying registered devices.

RELATED LINKS 3.1 Running the interactive procedure on page 18

2.3.1 How to register IoT devicesYou need a valid myST.com account to launch the dashboard and register devices.

Step 1. Open the dashboard and log in with myST.com credentials:– https://dsh-predmnt.st.com/

Figure 5. Predictive Maintenance Platform main screen

Step 2. Click on the [Register a new device]>[DEVICES] panel

Step 3. Click [Add Device] and register two devices with an appropriate name and optional information.

Figure 6. Add Device page

UM2639Device provisioning through the dashboard

UM2639 - Rev 2 page 8/22

Page 9: How to use the STM32 MPU OpenSTLinux Expansion Pack for … · the Amazon AWS IoT cloud and uses the AWS Greengrass Edge Computing service on the gateway to run local logic and ...

Step 4. Download the corresponding zip file before closing the popup window.The file contains the device certificate and key credentials.

Figure 7. Download configuration files

Step 5. Copy the zip file to the root directory of a USB key.This information must be copied onto the gateway later.

2.3.2 How to register an Edge groupStep 1. Go to the [Register a new device]>[EDGES] panel.

Step 2. Click [Add Device] and register an Edge group with an appropriate name.

Figure 8. Add New Edge group

Step 3. Download the corresponding zip file before closing the popup window.The file contains the Edge group certificate and key credentials.

Step 4. Copy the zip file to the root directory of a USB key.This information must be copied onto the gateway later.

Step 5. From the [EDGES] panel, click the gear icon to open the settings menu.

Step 6. Select [Devices], check the boxes of the devices you want to add, and then save.

Figure 9. Add devices to Edge group

UM2639Device provisioning through the dashboard

UM2639 - Rev 2 page 9/22

Page 10: How to use the STM32 MPU OpenSTLinux Expansion Pack for … · the Amazon AWS IoT cloud and uses the AWS Greengrass Edge Computing service on the gateway to run local logic and ...

2.4 How to set up the application

Before you set up the application on the gateway, ensure that the gateway has been set up and you haveprovisioned the devices on the dashboard.

Follow the procedure below to configure the application on the gateway.

Step 1. Copy the certificate and the private key of the devices to a /usr/local/predmnt/devices_pmp_aws folderon your gateway.

Figure 10. devices_pmp_aws folder on gateway

UM2639How to set up the application

UM2639 - Rev 2 page 10/22

Page 11: How to use the STM32 MPU OpenSTLinux Expansion Pack for … · the Amazon AWS IoT cloud and uses the AWS Greengrass Edge Computing service on the gateway to run local logic and ...

Step 2. Copy the certificate and the private key of the Edge group, as well as the Root Certification Authoritycertificate and the Greengrass configuration file, to the /greengrass folder on your gatewayKeep the folder structure provided by the dashboard and delete the two folders already there.

Figure 11. Greengrass folder on gateway

The config.json file holds the configuration data regarding the configured devices and the Edge group,similar to the file contents in the example below:

{"coreThing" : {"caPath" : "root.ca.pem","certPath" : "TSDemo.cert.pem","keyPath" : "TSDemo.private.key","thingArn" : "arn:aws:iot:eu-west-1:982787141379:thing/TSDemo_Core","iotHost" : "a1azohj3ky8ktj-ats.iot.eu-west-1.amazonaws.com","ggHost" : "greengrass-ats.iot.eu-west-1.amazonaws.com","keepAlive" : 600},"runtime" : {"cgroup" : {"useSystemd" : "yes"}},"managedRespawn" : false,"crypto" : {"principals" : {"SecretsManager" : {"privateKeyPath": "file:///greengrass/certs/TSDemo.private.key"},"IoTCertificate" : {"privateKeyPath": "file:///greengrass/certs/TSDemo.private.key","certificatePath": "file:///greengrass/certs/TSDemo.cert.pem"}},"caPath" : "file:///greengrass/certs/root.ca.pem"}}

Step 3. Download the main application and other helper files from the meta-predmnt layer:https://github.com/STMicroelectronics/meta-predmnt

Step 4. Keep the content in the meta-predmnt/recipes-predmnt/predmnt/ folder only and copy it to the /usr/local/predmnt/ folder on the gateway.

UM2639How to set up the application

UM2639 - Rev 2 page 11/22

Page 12: How to use the STM32 MPU OpenSTLinux Expansion Pack for … · the Amazon AWS IoT cloud and uses the AWS Greengrass Edge Computing service on the gateway to run local logic and ...

Step 5. Edit the pmp.cfg configuration file to ensure correct information regarding endpoint, Root CertificationAuthority certificate path, and device names:– ENDPOINT is taken from the iotHost entry in the config.json file.– ROOT_CA_PATH is taken from the caPath entry in the config.json file (remove “file://”).– DEVICE (one or more) is taken from the device names on the cloud and their position on the IO-

Link master board.

# CONFIGURATION FILE FOR PREDICTIVE MAINTENANCE PLATFORM APPLICATION.# IO-Link masterboard configuration (name and baudrate in [bit/second]).SERIAL_PORT_NAME /dev/ttyUSB0SERIAL_PORT_BAUDRATE_bs 230400# Connects to a real IO-Link masterboard, otherwise simulates data (YES/NO).FROM_IOLINK YES# Sends data to the cloud (YES/NO).TO_CLOUD YES# Uses threads when polling sensors (YES/NO).USE_THREADS YES# Dumps the given number of FDM samples to a "<device-name>_FDM.log" file for# each device, then exits.DUMP_FDM 0# Root Certification Authority certificate path on the gateway.ROOT_CA_PATH /greengrass/certs/root.ca.pem# Path of the devices credentials on the gateway.DEVICES_PATH /usr/local/predmnt/devices_pmp_aws# Amazon IoT custom endpoint.ENDPOINT a1azohj3ky8ktj-ats.iot.eu-west-1.amazonaws.com# Device(s) name on the cloud and position on the IO-Link masterboard.DEVICE TSDemo1 1DEVICE TSDemo2 4

Step 6. Copy the start_pmp.sh and stop_pmp.sh Bash scripts into the /home/<user> folder and givethem executing permissions:chmod 755 start_pmp.sh stop_pmp.sh

RELATED LINKS 3.1 Running the interactive procedure on page 18

2.5 How to deploy the registered devices and groups

You can perform this task after you have copied the credentials to the gateway.

The following procedure is used to deploy the configuration of devices and Edge groups from the cloud to thegateway.

Step 1. Start the Greengrass daemon on the gateway as a super user:/greengrass/ggc/core/greengrassd restart

Step 2. Open the dashboard and log in:https://dsh-predmnt.st.com/

Step 3. Go to the [EDGES] panel, click on the gear icon (Settings), select [Deploy], and then [CONFIRM].

Step 4. Reload the webpage after a few seconds and check that the status of the [New Deployment] operationis successful (green icon).

Figure 12. step 1.New deployment confirmation on dashboard

UM2639How to deploy the registered devices and groups

UM2639 - Rev 2 page 12/22

Page 13: How to use the STM32 MPU OpenSTLinux Expansion Pack for … · the Amazon AWS IoT cloud and uses the AWS Greengrass Edge Computing service on the gateway to run local logic and ...

RELATED LINKS 3.1 Running the interactive procedure on page 18

2.6 How to start the application

You can start the application after the configuration and deployment phases.

Follow the procedure below to activate vibration and start the application on your setup with or without motors.

Step 1. Connect the setup to the gateway via USB cable.

Step 2. If you connect rotating motors, power on the setup.

Step 3. Set the speed of the setup to the desired value.

Step 4. Enter the user home folder:cd /home/<user>

UM2639How to start the application

UM2639 - Rev 2 page 13/22

Page 14: How to use the STM32 MPU OpenSTLinux Expansion Pack for … · the Amazon AWS IoT cloud and uses the AWS Greengrass Edge Computing service on the gateway to run local logic and ...

Step 5. Run the application:– Run the starting script as a super user:

◦ ./start_pmp.sh– Alternatively, you can run the individual commands outside the script:

◦ sudo su (not needed if you are already super user)◦ /greengrass/ggc/core/greengrassd restart◦ python3 ./pmp.py –c pmp.cfg

The script will start the Greengrass daemon and run the application.Below is an example of the expected console output after running the ./start_pmp.sh command:

Greengrass successfully started with PID: 1933##################################################### Predictive Maintenance with Amazon AWS IoT cloud #####################################################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.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".Sending handshake information...[TSDemo1] (15:28:16.829431): {"state": {"reported": {"Device_Type": "STEVAL-IPD005V1", "Features": ["Environmental", "Inertial_TDM", "Inertial_FDM"], "Firmware": "Firmware Ver. 1"}}}Update request with token "aed4fb7e-1004-4130-a0d6-fada6bbfa295" accepted[TSDemo2] (15:28:21.059531): {"state": {"reported": {"Device_Type": "STEVAL-IPD005V1", "Features": ["Environmental", "Inertial_TDM", "Inertial_FDM"], "Firmware": "Firmware Ver. 1"}}}Update request with token "91d11010-e2f6-4273-92dd-89684859e81f" acceptedEdge Computing setup complete.Demo running...[TSDemo1] (15:28:24.389429): {"Humidity": 39.976, "Pressure": 990.625, "Temperature": 37.086}[TSDemo2] (15:28:26.329349): {"Humidity": 39.548, "Pressure": 991.476, "Temperature": 36.55}[TSDemo1] (15:28:27.689421): {"Peak_Acceleration": [0.147, 0.108, 0.13], "RMS_Speed": [0.023, 0.024, 0.043]}[TSDemo2] (15:28:29.529874): {"Peak_Acceleration": [0.144, 0.119, 0.127], "RMS_Speed": [0.023, 0.017, 0.021]}[TSDemo1] (15:28:33.260450): {"Ine_FFT": "[1024]"}[TSDemo2] (15:28:37.081863): {"Ine_FFT": "[1024]"}[…]

UM2639How to start the application

UM2639 - Rev 2 page 14/22

Page 15: How to use the STM32 MPU OpenSTLinux Expansion Pack for … · the Amazon AWS IoT cloud and uses the AWS Greengrass Edge Computing service on the gateway to run local logic and ...

Problem: you see the following error message:

[…]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...[…]

Cause: the config.json file may not have been found.Solution:1. Check the location of the config.json file.2. Deploy the registered devices and groups3. Start the application againProblem: you see the following error message:

[…]Initializing Edge Computing...Invalid device certificate path: "/user/local/predmnt/devices_pmp_aws/TSDemo1.cert.pem"Exiting... […]

Cause: the certificate and keys of the edge group or some of the configured devices may not have been found.Solution:1. Check the location and the file names of the certificate and the private key of the edge group and the

configured devices2. Deploy the registered devices and groups3. Start the application againProblem: you see the following error message:

[…]Edge Computing setup complete.Demo running...Read 1 elements. Discarded.[…]

Cause: You may be running firmware that is not compatible with the WireSTSDK and the main PMP applicationSolution:1. Update the firmware of the sensors and master board to the latest release2. Update the WireSTSDK and the main application to the latest release3. Deploy the registered devices and groups4. Start the application again

RELATED LINKS 2.4 How to set up the application on page 10

2.1 How to set up sensor and master boards on page 4

2.2.1 How to configure the STM32MP1 Discovery kit as an Edge gateway on page 4

2.5 How to deploy the registered devices and groups on page 12

UM2639How to start the application

UM2639 - Rev 2 page 15/22

Page 16: How to use the STM32 MPU OpenSTLinux Expansion Pack for … · the Amazon AWS IoT cloud and uses the AWS Greengrass Edge Computing service on the gateway to run local logic and ...

2.7 How to perform Condition Monitoring with the dashboard

You can proceed with Condition Monitoring after you have set up the sensor boards and the IO-Link master boardand started the application.

Follow the procedure below to view the sensor data on the dashboard.

Step 1. Open the dashboard and log in:https://dsh-predmnt.st.com/

Step 2. Click on [DASHBOARD]>[Add Device], and select the desired devices.

Figure 13. Device panel with sensor data and parameters

Step 3. Click the [Register a new device] panel from the main page.

UM2639How to perform Condition Monitoring with the dashboard

UM2639 - Rev 2 page 16/22

Page 17: How to use the STM32 MPU OpenSTLinux Expansion Pack for … · the Amazon AWS IoT cloud and uses the AWS Greengrass Edge Computing service on the gateway to run local logic and ...

Step 4. Select a device, select [gear icon (Settings)]>[Configure Thresholds], choose a parameter from thedrop-down menu and configure its thresholds.These thresholds can be useful to quickly check the operating condition of the devices through thegauges panel.

Figure 14. Threshold settings for each device

Step 5. Click on [ASSETS CONDITION MONITORING].

Figure 15. Gauge panel showing most recently configured parameter for each device.

2.8 How to stop the application

Step 1. To stop the application:– Press [CTRL+C] on the console where the application was launched– Or, enter the user home folder from a different console and run the stop script as a super user: ./

stop_pmp.shStep 2. Deactivate the setup:

Step 2a. set the speed of the vibration kit to zero

Step 2b. power off the setup

UM2639How to stop the application

UM2639 - Rev 2 page 17/22

Page 18: How to use the STM32 MPU OpenSTLinux Expansion Pack for … · the Amazon AWS IoT cloud and uses the AWS Greengrass Edge Computing service on the gateway to run local logic and ...

3 How to save time using the guided configuration routine

The guided configuration routine can help you save a lot of time by taking you through the through the deviceprovisioning, application setup, and deployment phases.

3.1 Running the interactive procedure

Step 1. Open a console on the gateway with the help of keyboard and mouse, and run:python3 /usr/local/predmnt/setup_pmp.pyThis will show a message with the following instructions:

--> Configuring edge gateway and devices1) Log in to the dashboard2) Configure your devices and copy the credentials (zip files) to the root of a USBkey3) Configure your edge gateway and copy the credentials (zip file) to the root of the USB key4) Assign the devices to the edge gateway5) Plug the USB key into the gateway

Step 2. Open the dashboard and log in:https://dsh-predmnt.st.com/

Step 3. Follow each step of the instructions on the gateway.

RELATED LINKS 2.3 Device provisioning through the dashboard on page 7

2.4 How to set up the application on page 10

2.5 How to deploy the registered devices and groups on page 12

UM2639How to save time using the guided configuration routine

UM2639 - Rev 2 page 18/22

Page 19: How to use the STM32 MPU OpenSTLinux Expansion Pack for … · the Amazon AWS IoT cloud and uses the AWS Greengrass Edge Computing service on the gateway to run local logic and ...

Revision history

Table 1. Document revision history

Date Version Changes

27-Nov-2019 1 Initial release.

26-Feb-2020 2 Minor text edits.

UM2639

UM2639 - Rev 2 page 19/22

Page 20: How to use the STM32 MPU OpenSTLinux Expansion Pack for … · the Amazon AWS IoT cloud and uses the AWS Greengrass Edge Computing service on the gateway to run local logic and ...

Contents

1 Edge processing overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2

2 Edge Processing Application setup and operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3

2.1 How to set up sensor and master boards. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2.2 STM32MP1 Discovery kit as Edge gateway . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2.2.1 How to configure the STM32MP1 Discovery kit as an Edge gateway . . . . . . . . . . . . . . . . . 4

2.2.2 How to connect to the gateway via SSH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2.2.3 How to Copy files to the gateway via SSH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2.2.4 How to reboot and turn the gateway off. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2.3 Device provisioning through the dashboard. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2.3.1 How to register IoT devices. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.3.2 How to register an Edge group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

2.4 How to set up the application. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

2.5 How to deploy the registered devices and groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

2.6 How to start the application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

2.7 How to perform Condition Monitoring with the dashboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

2.8 How to stop the application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

3 How to save time using the guided configuration routine . . . . . . . . . . . . . . . . . . . . . . . . . .18

3.1 Running the interactive procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19

UM2639Contents

UM2639 - Rev 2 page 20/22

Page 21: How to use the STM32 MPU OpenSTLinux Expansion Pack for … · the Amazon AWS IoT cloud and uses the AWS Greengrass Edge Computing service on the gateway to run local logic and ...

List of figuresFigure 1. Condition monitoring and Edge to Cloud: from sensors to gateway to cloud dashboard . . . . . . . . . . . . . . . . . . 1Figure 2. Integrated demo with smart sensor nodes installed on two motors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2Figure 3. Setup and operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3Figure 4. STM32MP157C-DK2 Discovery kit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4Figure 5. Predictive Maintenance Platform main screen. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8Figure 6. Add Device page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8Figure 7. Download configuration files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9Figure 8. Add New Edge group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9Figure 9. Add devices to Edge group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9Figure 10. devices_pmp_aws folder on gateway . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10Figure 11. Greengrass folder on gateway . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11Figure 12. step 1.New deployment confirmation on dashboard. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12Figure 13. Device panel with sensor data and parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16Figure 14. Threshold settings for each device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17Figure 15. Gauge panel showing most recently configured parameter for each device. . . . . . . . . . . . . . . . . . . . . . . . . . 17

UM2639List of figures

UM2639 - Rev 2 page 21/22

Page 22: How to use the STM32 MPU OpenSTLinux Expansion Pack for … · the Amazon AWS IoT cloud and uses the AWS Greengrass Edge Computing service on the gateway to run local logic and ...

IMPORTANT NOTICE – PLEASE READ CAREFULLY

STMicroelectronics NV and its subsidiaries (“ST”) reserve the right to make changes, corrections, enhancements, modifications, and improvements to STproducts and/or to this document at any time without notice. Purchasers should obtain the latest relevant information on ST products before placing orders. STproducts are sold pursuant to ST’s terms and conditions of sale in place at the time of order acknowledgement.

Purchasers are solely responsible for the choice, selection, and use of ST products and ST assumes no liability for application assistance or the design ofPurchasers’ 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.st.com/trademarks. All other product or servicenames are the property of their respective owners.

Information in this document supersedes and replaces information previously supplied in any prior versions of this document.

© 2020 STMicroelectronics – All rights reserved

UM2639

UM2639 - Rev 2 page 22/22