|
| 1 | +## **Overview** |
| 2 | + |
| 3 | +With the rapid advancement of artificial intelligence (AI) technologies, industrial enterprises are increasingly exploring their potential in smart manufacturing and industrial data analytics. Meanwhile, the Industrial Internet of Things (IIoT) continues to drive the evolution of device connectivity and data collection, providing a robust data foundation for AI-enabled industrial applications. |
| 4 | + |
| 5 | +This article demonstrates an application for IIoT data exploration and analysis, integrating multiple cutting-edge technologies. The application combines large language models (LLM), Retrieval-Augmented Generation (RAG), Model Context Protocol(MCP), Sparkplug B protocol, MQTT message broker, time-series databases, and relational databases. It delivers an intelligent, interactive industrial data application, enabling users to query device data, analyze historical metrics, and monitor status by simply entering natural language queries in a dialogue box. The system also vectorizes product manuals, automatically providing users with relevant solutions when error codes are reported, facilitating rapid issue identification and resolution. |
| 6 | + |
| 7 | +Readers will gain insights into developing AI-driven IIoT applications and leveraging AI’s value in industrial manufacturing scenarios. |
| 8 | + |
| 9 | +## **Scenario Description** |
| 10 | + |
| 11 | +We assume a typical industrial scenario with the following structure defined using the SparkPlug B protocol: |
| 12 | + |
| 13 | +- **Factory**: Identified as `factory_1` in SparkPlug. |
| 14 | +- **Production Line**: Identified as `assembly_1` in SparkPlug. |
| 15 | +- **Specific Device**: Identified as `demo` in SparkPlug (nicknamed "Optimus Prime," with this information stored in a third-party relational database). |
| 16 | + |
| 17 | +In this demo, we simulated the runtime data of an ABB FlexPendant virtual device and used its public documentation as the knowledge base. ABB FlexPendant is a handheld touchscreen device used for programming and controlling industrial robots. This device serves as the user interface for the robot controller, allowing operators to perform various operations such as modifying and running programs, teaching new robot actions, and adjusting parameters. To simplify the scenario, we define the following data tags, representing: |
| 18 | + |
| 19 | +- Voltage and current values of the robotic arm. |
| 20 | +- Diagnostic error codes. |
| 21 | + |
| 22 | +```json |
| 23 | +{ |
| 24 | + "robotic_arm": { "voltage": 3.14, "current": 5.0}, |
| 25 | + "diagnose": {"error_code": 50153} |
| 26 | +} |
| 27 | +``` |
| 28 | + |
| 29 | +### **Interactive Scenario Examples** |
| 30 | + |
| 31 | +Users can interact with the system through an AI dialogue box. The system incorporates built-in Agentic capabilities and integrates various MCP services, automatically generating relevant query requests based on user needs and returning data analysis reports. Typical interaction scenarios include: |
| 32 | + |
| 33 | +- **List the tree structure of device** `demo`: The AI queries relevant data and displays the logical structure diagram of the device. |
| 34 | +- **Query the latest** `robotic_arm/voltage` tag data for device `demo`: The AI retrieves the most recent data reported for the `robotic_arm/voltage` tag of the `demo` device. |
| 35 | +- **Analyze the past week's** `robotic_arm/voltage` tag data for device `demo`: The AI queries and analyzes one week's worth of `robotic_arm/voltage` data for the `demo` device stored in the TDengine database. Given the potentially large data volume, the AI will automatically aggregate the data based on built-in instructions and provide a corresponding analysis report. |
| 36 | +- **Query the latest** `robotic_arm/current` tag data for the device nicknamed "Optimus Prime": Since the user queries using the nickname "Optimus Prime," the AI retrieves the corresponding device ID (`demo`) from the MariaDB MCP service and fetches the latest data point. |
| 37 | +- **Query the latest** `diagnose/error_code` tag data for device `demo`: The AI retrieves the latest `diagnose/error_code` tag, uses RAG technology to access relevant manual knowledge from the vector database, and presents the user with a comprehensive error report and solution. |
| 38 | +- **Analyze the past day's** `diagnose/error_code` tag data for device `demo`: The AI queries the diagnostic error codes from the past day, combines them with operational manual data from the vector database, and generates a comprehensive error report, solutions, and recommendations. |
| 39 | + |
| 40 | +## Demo |
| 41 | + |
| 42 | +### **List the tree structure of device** `demo` |
| 43 | + |
| 44 | +Below is a screenshot of the result after the user inputs "List the tree structure of device `demo`". |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | +### Query the latest `robotic_arm/current` tag data for the device nicknamed "Optimus Prime" |
| 49 | + |
| 50 | +1. **Overview** |
| 51 | + - **Analysis Time Range:** Latest data point (real-time) |
| 52 | + - **Record Count:** 1 entry |
| 53 | + - **Key Findings:** The latest current value for the device with alias **"Optimus Prime"** (actual device key: **demo**) is **2.5A**. |
| 54 | + |
| 55 | +2. **Detailed Analysis** |
| 56 | + |
| 57 | +  |
| 58 | + |
| 59 | +3. **Diagnosis & Recommendations** |
| 60 | + - **Current Status Assessment:** The current value is within the normal range (typical operating current for ABB FlexPendant robots is 2–6A). |
| 61 | + - **Recommended Actions:** |
| 62 | + - Continue monitoring the trend of this value. |
| 63 | + - If it consistently stays below 3A, consider checking: |
| 64 | + - Whether the robotic arm is underloaded |
| 65 | + - Whether the program is executing completely |
| 66 | + - Whether the power supply voltage is stable |
| 67 | + |
| 68 | +4. **Additional Notes** |
| 69 | + |
| 70 | + This report is based on a single-point instantaneous data sample. For trend analysis, it is recommended to query data over a time range. Normal current fluctuation for ABB FlexPendant devices is within ±10% of the nominal value. |
| 71 | + |
| 72 | +### Analyze the past week's `robotic_arm/voltage` tag data for device `demo`: |
| 73 | + |
| 74 | +**Device Name:** demo |
| 75 | + |
| 76 | +**Tag:** robotic_arm/voltage |
| 77 | + |
| 78 | +**Time Range:** 2025-05-13 to 2025-05-20 |
| 79 | + |
| 80 | +1. **Data Overview** |
| 81 | + - **Total Raw Records:** 8,982 |
| 82 | + - **Sampling Strategy:** 6-hour average aggregation (28 data points in total) |
| 83 | + - **Voltage Range:** -17.40V to 3.40V |
| 84 | + |
| 85 | +2. **Key Findings** |
| 86 | + - **Stable Main Voltage:** 3.40V (observed during most time periods) |
| 87 | + - **Abnormally Low Voltage:** -17.40V (requires further investigation) |
| 88 | + |
| 89 | +… |
| 90 | + |
| 91 | +### Query Latest `diagnose/error_code` Data for Device `demo` and Retrieve Related Knowledge Base Information |
| 92 | + |
| 93 | +1. **Overview** |
| 94 | + - **Device Name:** demo |
| 95 | + - **Analysis Time:** Latest data |
| 96 | + - **Tag:** diagnose/error_code |
| 97 | + - **Key Finding:** The device has reported **error code 10139** |
| 98 | + |
| 99 | +2. **Error Details** |
| 100 | + |
| 101 | +  |
| 102 | + |
| 103 | +3. **Diagnostic Analysis** |
| 104 | + - **Error Description:** This error indicates that the system stopped execution as a safety measure due to an edit monitor timeout. |
| 105 | + - **Impact Scope:** |
| 106 | + - RAPID program execution was interrupted |
| 107 | + - Robot operation is paused |
| 108 | + - **Possible Causes:** |
| 109 | + - Watchdog commands were not sent periodically during RAPID and main program execution |
| 110 | + - RobotControlMate connection issues (if in use) |
| 111 | + - Misconfigured system monitoring parameters |
| 112 | + |
| 113 | +4. **Recommended Solutions** |
| 114 | + |
| 115 | + - **Immediate Actions:** |
| 116 | + **[Basic Fix]** |
| 117 | + |
| 118 | + - Check and restart RAPID program execution |
| 119 | + - Verify RobotControlMate connection status (if applicable) |
| 120 | + |
| 121 | + **[Configuration Adjustment]** |
| 122 | + *If not using RobotControlMate:* |
| 123 | + |
| 124 | + 1. Open the controller configuration interface |
| 125 | + 2. Navigate to `Controller/OperatorSafety/Heartbeat` |
| 126 | + 3. Set the parameter value to `"False"` |
| 127 | + 4. Save changes and restart the system |
| 128 | + |
| 129 | + - **Long-Term Prevention:** |
| 130 | + |
| 131 | + - Regularly inspect the watchdog command mechanism |
| 132 | + - Establish a heartbeat monitoring log system |
| 133 | + - Consider upgrading to the latest control system software |
| 134 | + |
| 135 | + - **Notes** |
| 136 | + - Back up current settings before modifying configuration parameters |
| 137 | + - Restarting may cause loss of unsaved program changes |
| 138 | + - Maintenance is recommended during non-production hours |
| 139 | + |
| 140 | +Would you like more detailed guidance on RAPID program debugging or other related topics? |
| 141 | + |
| 142 | +## **Related Technologies and Software** |
| 143 | + |
| 144 | +The software used in this application is as follows: |
| 145 | + |
| 146 | + |
| 147 | + |
| 148 | +- **Industrial Data Collection Software - NeuronEX:** Defines data collection and includes a northbound Sparkplug B plugin to report tag data to the cloud in Sparkplug B format. |
| 149 | +- **Message Broker - EMQX:** |
| 150 | + - Receives Sparkplug B data packets reported from the edge. |
| 151 | + - The Sparkplug App subscribes to relevant topics, storing the data in a time-series database. |
| 152 | +- **Time-Series Database - TDengine:** Stores tag data reported by devices and provides flexible data access capabilities. |
| 153 | +- **Relational Database - MariaDB:** Stores the mapping between devices and their nicknames, e.g., the device demo is nicknamed "Optimus Prime," facilitating the connection between OT and IT systems. In real-world business systems, this represents IT system data such as MES, ERP, and CRM. |
| 154 | +- **LLM - Deepseek v3:** Powered by Deepseek v3 from SiliconFlow. |
| 155 | +- **RAG Knowledge Base:** |
| 156 | + - Supports BAAI/bge-base-en-v1.5 and Aliyun vector models. |
| 157 | + - Uses a local MilvusVectorStore for the vector database. |
| 158 | + - User manuals are vectorized and stored in the vector database. When users query error codes, the application retrieves relevant content from the vector database, and the LLM generates solutions and recommendations based on this data. |
| 159 | +- **MCP:** |
| 160 | + - Encapsulates MCP services for TDengine time-series data to retrieve device-reported tag data, node status, and device online/offline information. |
| 161 | + - Encapsulates MCP services for MariaDB relational data to store mappings between OT device data and IT business data, e.g., the OT identifier demo corresponds to the IT nickname "Optimus Prime." Users typically query data using IT nicknames or aliases. |
| 162 | + |
| 163 | +The relevant code has been open-sourced, and readers can access the source code at [GitHub - emqx/uns-demo: Use natural language to explore IIoT Sparkplug B data by leveraging MCP, AI and agent](https://github.com/emqx/uns-demo). |
| 164 | + |
| 165 | +## **Summary** |
| 166 | + |
| 167 | +This article briefly introduces how to leverage AI and various foundational software to build a cutting-edge IIoT data exploration application, providing insights for readers to develop their own AI-driven industrial applications. The EMQ industrial team is planning to officially integrate Sparkplug B data reporting, storage, and AI-based analysis into the EMQX ECP, with a release expected in the second half of the year. Interested readers are welcome to contact our sales team for early access. |
| 168 | + |
| 169 | + |
| 170 | + |
| 171 | +<section class="promotion"> |
| 172 | + <div> |
| 173 | + Talk to an Expert |
| 174 | + </div> |
| 175 | + <a href="https://www.emqx.com/en/contact?product=solutions" class="button is-gradient">Contact Us →</a> |
| 176 | +</section> |
0 commit comments