42Q-MES0184-IIoT Configuration
42Q Home > IIoT > Device Self Service
Contents
Introduction
The concept of GGC stands for “Green Grass Computer”, the word: “Computer” also refers to any kind of device. This document will teach users how to configure, install, and deploy a GGC, as well as create and set up an Edge Device for the purpose of establishing a connection between the computer (device) and the 42Q portal to send data (payloads).
Prerequisites
- Only Linux is supported for the computer or device to install the Green Grass Core. The related shell scripts and test code only work on Linux systems (Windows is not currently supported).
- Python 3.8 or higher must be installed and configured to run the test code.
Operating System and Software Requirements
- Linux kernel version 4.4 or later (Ubuntu 20.04 and CentOS 8.5).
- Java Runtime Environment (JRE) version 8 or greater (included in the installation script).
- Python version 3.8 for functions that use the Python 3.8 runtime (included in the installation script).
Cgroups Requirements
The AWS IoT Greengrass Core software currently only supports Cgroups v1, not v2. In order to satisfy AWS Greengrass Core dependencies as stated in the official documentation "Setting up AWS IoT Greengrass core devices" (Setting up AWS IoT Greengrass core devices - AWS IoT Greengrass ), the system should be configured with the following Linux kernel parameters and restarted:
cgroup_enable=memory cgroup_memory=1 systemd.unified_cgroup_hierarchy=0
Adjusting Cgroup configuration
- Edit /etc/default/grub - Find the line that starts with "GRUB_CMDLINE_LINUX=" and append or change the following values: cgroup_enable=memory cgroup_memory=1 systemd.unified_cgroup_hierarchy=false - Save the file
- Apply the configuration change by running: update-grub
- Restart the system
- Verify that the Cgroup configuration has been set to v1 by running the following command and ensuring that the response is "tmpfs": stat -fc %T /sys/fs/cgroup/;
Network requirements
The Green Grass Core device must be able to access the following endpoints through specific ports:
- https://www.amazontrust.com/repository/AmazonRootCA1.pem.
- https://d2s8p88vqu9w66.cloudfront.net/releases/greengrass-2.6.0.zip.
- greengrass-ats.iot.us-east-1.amazonaws.com. Ports: 8443, 443.
- .iot.us-east-1.amazonaws.com. Ports: 8883, 8443, 443.
- .credentials.iot.us-east-1.amazonaws.com. Ports: 443
For more details on what traffic needs to be authorized and why, please visit the official AWS documentation.
Functional Description
There are three different functional components: CloudPrinting, MachineInterface, and DataIngestion.
To access the Edge Devices portlet, navigate to: Shop Floor Control > Configuration > IIoT Configuration > Edge Devices.
Figure 1: Accessing Edge Devices
Figure 2: Edge Devices Functions
DSS Edge Devices Functions.png
- Users can query the list of all devices by Edge Device Name or Group Name.
- Users can create a new edge device.
- Users can view the details of the edge device.
- Users can download the software of the edge device.
- Users can upgrade this edge device with more features.
- Users can get all functional components through this button when no functional components are deployed on their local core device.
- Users can delete the edge device.
Install 42Q Edge Software
CloudPrinting
Figure 3: Cloud Printing
Please follow the steps below to create a 42Q Cloud Printing Edge Device in 42Q:
- Navigate to: Shop Floor Control > Configuration > IIoT Configuration > Edge Devices.
- Select CREATE EDGE DEVICE to create a new Green Grass Core.
Figure 4: CREATE EDGE DEVICE Button
DSS CREATE EDGE DEVICE Button.png
- Enter the Edge Device Name of the Green Grass Core. The name can be up to 128 characters. Valid characters are: a-z, A-Z, 0-9, colon (:), underscore (_), and hyphen (-).
- Select the Group Name as CloudPrintingGroup.
Note: After selecting the Group Name, the Group Version will automatically be selected.
Figure 5: Create Edge Device Form
DSS Create Edge Device Form.png
- Select the checkbox next to the desired Edge Device.
- Select the Download icon to download the Edge Device ZIP file.
Figure 6: Downloading The Files
- Right-click on the ZIP file.
- Select Extract Here to unzip the file.
- Open the Terminal.
- Enter the command: sudo su, and then press Enter.
- Enter the root user’s password, and then press Enter.
Note: If the word: root@ appears before the computer’s username as in the image below, it means that you are logged in as a root user.
Figure 7: User Logged In as a Root User
- Enter the next command: sh ggcV2.sh, and then press Enter.
Note: After the script is installed successfully, users can navigate to the local device’s path: /greengrass/v2 to check the installed folder; logs are contained in the path: /greengrass/v2/logs.
Figure 8: Edge Device Folder
Testing Label Printing Function Using Label Engine Screens
- Navigate to: Administration > Label Engine Admin > Printer.
- Select Add.
- Enter the Printer Name.
- Select the Resolution from the drop-down list.
- Select the Connectivity Type as Edge Device.
Figure 10: Entering The Printer Details
Note: The TCP IP Address should be the address of the printer or start a TCP Server as a simulator by executing the next command in the Terminal: python3 tcpServer.py.
- Navigate to: Production > Label Engine Labels > LE Labels.
- Search for the label called “entry”, which will print whatever "Entry" value is passed.
- Select the checkbox next to the printer name.
- Select Print.
Figure 11: Print Button
- Select the Printer Name previously created.
- Enter a value in the Entry field.
- Select Test Print.
Figure 12: Entering Test Print Data
- Open the Terminal.
- Navigate to the local device’s path: /greengrass/v2/logs.
- Enter the next command: tail -f {envide}_CloudPrinting.log. After that, a message will be received to confirm the successful testing.
Figure 13: Successful Testing Message
MachineInterface
This function is used for sending commands to machines from the cloud.
Below there is an example of stopping a machine when the server finds MSD material expired.
Figure 14: Server Stopping A Machine Due To Material Expired Diagram
The diagram above is divided into three steps:
- Install an Edge Device on a server in the plant.
- The plant creates a new local application that can communicate with the Edge Device by TCP and also can send commands to machines.
- The Cloud application will send commands to the Edge Device, then the Edge Device will forward the message to the local application through TCP/IP.
Please follow the steps below to create a 42Q Cloud Machine Interface Edge Device in 42Q:
- Navigate to: Shop Floor Control > Configuration > IIoT Configuration > Edge Devices.
- Select CREATE EDGE DEVICE to create a new Green Grass Core.
- Enter the Edge Device Name of the Green Grass Core. The name can be up to 128 characters. Valid characters are: a-z, A-Z, 0-9, colon (:), underscore (_), and hyphen (-).
- Select the Group Name as MachineInterfaceGroup.
Note: After selecting the Group Name, the Group Version will automatically be selected.
- Select the checkbox next to the desired Edge Device.
- Select the Download icon to download the ZIP file.
- Right-click on the ZIP file.
- Select Extract Here to unzip the file.
- Open the Terminal.
- Enter the command: sudo su, and then press Enter.
- Enter the root user’s password, and then press Enter.
- Navigate to the extract folder by using the command: cd {folder path}.
- Enter the next command: sh ggcV2.sh, and then press Enter.
Note: After the script is installed successfully, users can navigate to the computer’s path: /greengrass/v2 to check the installed folder; logs are contained in the path: /greengrass/v2/logs.
- Open Postman to test its functionality.
- Select POST as HTTP Method.
- Enter the URL.
- Enter the Topic.
- Enter the Output.
- Enter the Error.
Data nomenclature example:
URL: https://portal-uat.42-q.com/mes-api/[SiteName]/greengrass/v2/publish
Topic: [Envide]/machine-interface/[Envide]_[Edge device name]
Output: [Envide]/machine-interface/results
Error: [Envide]/machine-interface/errors
Figure 15: Sending The Payload Using Postman
- Open the Terminal.
- Navigate to the local device’s path: /greengrass/v2/log to view the logs.
Figure 16: Successful Payload Sending Logs
Note: If the message from the previous image is printed in your local log, the function has succeeded.
Adding the corresponding configuration for PTS allows PTS to send messages to Edge Device.
DataIngestion
Please follow the steps below to create a 42Q Cloud Data Ingestion Edge Device in 42Q:
- Navigate to: Shop Floor Control > Configuration > IIoT Configuration > Edge Devices.
- Select CREATE EDGE DEVICE to create a new Green Grass Core.
- Enter the Edge Device Name of the Green Grass Core. The name can be up to 128 characters. Valid characters are: a-z, A-Z, 0-9, colon (:), underscore (_), and hyphen (-).
- Select the Group Name as DataIngestionGroup.
Note: After selecting the Group Name, the Group Version will automatically be selected.
- Select the checkbox next to the desired Edge Device.
- Select the Download icon to download the ZIP file.
- Right-click on the ZIP file.
- Select Extract Here to unzip the file.
- Open the Terminal.
- Enter the command: sudo su, and then press Enter.
- Enter the root user’s password, and then press Enter.
- Enter the next command: sh ggcV2.sh, and then press Enter.
Note: After the script is installed successfully, users can navigate to the computer’s path: /greengrass/v2 to check the installed folder; logs are contained in the path: /greengrass/v2/logs.
- When the status of this Edge Device is "Healthy", select the Edit button to enter the Edge Device information.
Figure 17: Edit Button
- Select the CLIENT DEVICES tab.
- Select CREATE CLIENT DEVICES.
Figure 18: CLIENT DEVICES TAB
- Enter the name of the Client Device to be created.
Note: The name can be up to 128 characters. Valid characters: a-z, A-Z, 0-9, colon (:), underscore (_), and hyphen (-).
- Select ASSOCIATE.
Figure 19: Creating a Client Device
- Select the Download icon to download the Client Device ZIP file.
- Right-click on the ZIP file.
- Select Extract Here to unzip the file.
Figure 20: Client Device Folder
- Open the MqttTest.py file.
- Find the line that contains: ‘# Change This’.
- Modify the data information to be sent; users may see an example below (user’s will be different).
Figure 21: Data To Be Modified
- Open the Terminal.
- Enter the next command: python MqttTest.py, and then press Enter. The result should be similar to the image below:
Figure 22: Result Of Executing The MqttTest.py File
- Navigate to the local device’s path: /greengrass/v2/log to view the logs.
Figure 23: Successful MqttTest.py Running Logs
Note: If the message from the previous image is printed in your local log, the function has succeeded.
Things
In this portlet, users can make sure whether the AWS Cloud has stored the data uploaded successfully or not.
To do so, follow the steps below:
- Navigate to: Shop Floor Control > Configuration > IIoT Configuration > Things.
Figure 24: Things Portlet
- If the “Thing ID” is the same as the “id” configured in MqttTest.py file, it means that AWS Cloud has already stored the data uploaded.
Locations
The Locations portlet allows users to assign a location to the Edge Devices in order to identify their Physical Location.
To add a location, follow the steps below:
- Navigate to: Shop Floor Control > Configuration > IIoT Configuration > Locations.
Figure 26: Locations Portlet
- Select the ADD LOCATIONS button.
Figure 27: ADD LOCATION Button
- Enter the Site.
- Enter the Physical Location.
- Select the SAVE button.
Figure 28: Creating A Location
Groups
Users can create different groups of Edge Devices. Each group must have a unique name and one or more Thing IDs associated with it.
Add a Group
To add a group, follow the steps below:
- Navigate to: Shop Floor Control > Configuration > IIoT Configuration > Groups.
- Select the ADD GROUP button.
Figure 29: ADD GROUP Button
- Enter the Unique Group Name.
- Select a Thing ID.
- Select the SAVE button.
Figure 30: Creating A Group
Add a Rule To An Existing Group
To add a rule, follow the steps below:
- Hover the mouse over a Group Name from the Group list.
- Select the Edit Group icon.
Figure 31: Edit Group Icon
- Select a rule from the Select Rules drop-down list.
- Select the SAVE button.
Figure 32: Editing A Group
Notification Setup
Before creating any rules, users have to set up notifications. Each user can subscribe to one or more SNS topics (Simple Notification Service); these users will receive notifications via text messages or email.
To set up notifications, follow the steps below:
- Navigate to: Shop Floor Control > Configuration > IIoT Configuration > Notification Setup.
Figure 33: Notification Setup Portlet
- Select the CREATE SNS TOPIC button. A pop-up window will appear.
Figure 34: CREATE SNS TOPIC Button
- Enter the Topic Name.
- Select the SAVE button.
Figure 35: Create SNS Topic Pop-up Window
- Hover the cursor over the Topic.
- Select the Subscribe icon. A new pop-up window will appear.
Figure 36: Subscribe Icon
- Select the SUBSCRIBE TO SNS TOPIC button. A new pop-up window will appear.
Figure 37: SUBSCRIBE TO SNS TOPIC Button
- Select the Notification Method (Email or Phone).
- Enter the Notification End Point (email address).
- Select the SUBSCRIBE TO SNS TOPIC button to save the information.
Figure 38: Subscribe To SNS Topic Pop-up Window
- The Subscribe List will display the Pending Confirmation and Confirmed End Points.
Figure 39: Subscribe List
- A confirmation mail will be sent to the entered email address. Select the Confirm subscription link.
Figure 40: Confirmation Mail
- A window will be opened in a new tab confirming the subscription. To unsubscribe select the “click here to unsubscribe” link, else close the window.
Figure 41: Subscription Confirmation Window
Rules
In this portlet, users can create, view, edit, and delete rules. After setting up notifications, users may create rules which will trigger alerts. Each rule is associated with one or more Groups or Thing IDs.
- Navigate to: Shop Floor Control > Configuration > IIoT Configuration > Rules.
Figure 42: Rules Portlet
- Select the CREATE RULE button. A new pop-up window will appear.
Figure 43: CREATE RULE Button
- Select one or more Groups from the GROUPS tab.
Figure 44: Selecting Groups
- Select the THINGS tab.
- Select one or more Things.
- Select the NEXT button.
Figure 45: Selecting
Select one of the two Bounds (rules):
Threshold: This rule will trigger an alert whenever a measured value crosses a specific threshold.
Independent: This rule will trigger an alert whenever a measured value satisfies the user-defined criteria.
Figure 46: Defining A Bound
Select one option from the Boundary Considerations list.
Select one option from the Control Values list.
Enter the Limit Value.
Select one of the Rule Options.
Select the NEXT button.
Figure 47: Creating Rule Parameters
Enter the Rule Name.
Enter the SNS Topic.
Enter the Notification Interval(minutes).
Select the SAVE button.
Figure 48: Entering Publish Rule Information
Alerts
After setting up notifications and rules, when a rule’s conditions comply, the alerts will be triggered, causing the notifications to be sent to the subscribed users.
To access the Alerts portlet, follow the steps below:
Navigate to: Shop Floor Control > Configuration > IIoT Configuration > Alerts.
Figure 49: Alerts Portlet
To search for a specific alert, users can use the filters: Thing ID, and Rule. To do so, enter the appropriate value in the filter field; the system will automatically search the value.
Figure 50: Thing ID And Rule Filters
To delete an alert, select an alert checkbox.
Select the Delete Alert button.
Figure 51: Deleting An Alert
Select Yes to delete the alert, or No to abort.
Figure 52: Confirmation Delete Message
- Navigate to: Reporting > IIoT Dashboard.
- Select the + icon to create a new widget.
- Enter the Widget Name.
- Select the THINGS tab.
- Select the "id" value previously configured in the MqttTest.py file.
- Select the SAVE button located at the end of the Add Widget Form.
Figure 27: Creating a Widget
- Select the show/hide icon to view the values of the widget created.
Figure 28: Show/Hide Icon
Note: Users can check the payload sent through either of the following:
- IIoT widget.