From automation to intelligence: Application of IoT technology in Zhuanzhuan Intelligent Quality Inspection Center
1. Background
At Zhuanzhuan Intelligent Quality Inspection Center, with the continuous development of business, the automated testing capabilities of hardware equipment and device terminals (mobile phones, Pads, etc.) are becoming more and more abundant.
The following figure lists several automated testing equipment currently used in Zhuanzhuan Intelligent Quality Inspection Center
Mobile phone parameter detection equipment and smart charging
Appearance inspection
Camera detection
NFC and vibration detection
Audio Detection
Battery detection
In the early development process, the design and development of various types of automated detection capabilities were mainly carried out around their own functions. There was a lack of unified planning and design of the overall automation program, and the management, maintenance and iteration costs were relatively high.
In this context, there are mainly the following issues:
- High system maintenance cost: The communication protocols between quality inspection automation equipment and other equipment are not well unified, and each has its own system. As the business continues to develop, the system becomes more and more bloated, and the development and maintenance costs increase accordingly.
- Insufficient equipment status monitoring: Equipment failures cannot be detected in time, resulting in downtime and increased repair costs.
- Data delay and incompleteness: Since the equipment is running offline, the real-time and integrity of the data cannot be guaranteed.
- High equipment maintenance cost: The equipment relies on manual maintenance, which is inefficient and costly.
- As more and more devices are integrated with automation capabilities, a more stable and reliable architecture is needed: With the development of business and breakthroughs in technical capabilities, the construction of automation capabilities has progressed beyond just the scheduling of hardware devices to the scheduling of detection capabilities for the devices being tested (such as mobile phones, pads, notebooks, etc.).
In summary, my team has achieved intelligent management of automation equipment by introducing Internet of Things (IoT) technology. Through IoT technology, we can unify the technical architecture design, reduce development and maintenance costs, and improve the real-time monitoring of automation equipment to solve the main problems we are facing. This article will focus on the selection and implementation of IoT technology.
2. Introduction to the Internet of Things
2.1 Opening Story
When you are working, you long for a cup of cold coffee to refresh yourself, but every time you walk to the coffee shop downstairs, you find that the coffee shop is closed or the coffee you like is sold out. Isn't it disappointing?
In the late 1970s and early 1980s, researchers at the Department of Computer Science at Carnegie Mellon University had the same trouble: they longed for a bottle of cold cola while working, but every time they walked to the vending machine downstairs, they found that the cola was sold out or had just been restocked and had not yet cooled down. This caused them to frequently run in vain, wasting precious time and energy.
In 1982, several computer science students, including Mike Kazar, David Nichols, John Zsarnay, and Ivor Durham, decided to solve this problem through the Internet.
They installed micro switches inside the vending machines to detect the inventory status of each column of beverages. These switches are connected to a computer that reports the inventory and temperature status of the beverages to the researchers via the Internet.
This networked Coke vending machine became the world's first device connected to the Internet and is considered an early prototype of the Internet of Things.
In this way, this project inspired many subsequent research and developments, making the Internet of Things technology gradually mature and applied to a wider range of fields, including smart homes, smart agriculture, smart manufacturing, and so on.
2.2 What is the Internet of Things?
The Internet of Things (IoT) refers to connecting physical devices to the Internet through sensors, software and other technologies, enabling them to communicate with each other and share data. For example, smart home devices can be remotely controlled via mobile phones, and industrial machines can automatically monitor and report operating status.
2.3 Basic components of the Internet of Things
- Sensors and devices: collect data and perform actions, such as temperature sensors, smart light bulbs, etc.
- Network connection: Connect your device to the Internet via Wi-Fi, Bluetooth, cellular network, etc.
- Data processing and analysis: The collected data is analyzed through cloud computing or edge computing to provide valuable information.
- User interface: The user interacts with the device through an application or control panel.
3 IoT technology applications and selection solutions
3.1 Application layer protocol selection
IoT protocols can be classified according to different levels and functions, including device layer protocols, network layer protocols, transport layer protocols, data link layer protocols, and application layer protocols. Here we mainly introduce the application layer protocols of IoT.
Regarding the application layer protocol, we referred to the mainstream support of various domestic cloud platforms during the research and made a horizontal comparison from the following solutions:
3.1.1 HTTP/HTTPS
HTTP (Hypertext Transfer Protocol) and HTTPS (Secure Hypertext Transfer Protocol) are application layer protocols for distributed, collaborative and hypermedia information systems, and are widely used in Web browsing and other Internet services.
- Advantages:
- Standardized and versatile, almost all programming languages have mature libraries.
- HTTPS provides encryption to ensure secure transmission.
- insufficient:
It has high overhead, poor real-time performance, and is not suitable for resource-constrained devices.
The communication overhead and delay are high and it is not suitable for high-frequency small data transmission.
3.1.2 MQTT (Message Queuing Telemetry Transport)
MQTT is a lightweight publish/subscribe messaging protocol designed for use over low-bandwidth, high-latency, or unstable networks.
- Advantages:
- Lightweight and efficient, suitable for constrained devices and low-bandwidth environments.
- Supports different Quality of Service (QoS) levels to ensure reliable delivery of messages.
- The publish/subscribe model supports flexible communication topologies.
- Simple authentication based on username and password is supported, and communications can be encrypted using TLS (Transport Layer Security) or SSL (Secure Sockets Layer).
- insufficient:
A message broker is required, which increases the complexity of the system.
In long connections and large-scale scenarios, heartbeat packets may still cause certain network overhead.
3.1.3 CoAP (Constrained Application Protocol)
CoAP is a protocol designed specifically for the Internet of Things. It is based on UDP and is suitable for resource-constrained devices and networks.
- Advantages:
- Connectionless, lightweight, low power, designed for resource-constrained devices.
- Supports request/response model and has good real-time performance.
- Transmitted via UDP, the network overhead is small and suitable for low-bandwidth and high-latency network environments.
- insufficient:
It is not built on reliable TCP, and reliability and message confirmation require additional mechanisms.
Security requires additional consideration and is more complex to implement via DTLS.
3.1.4 Selection basis and conclusion
Considering that both automated equipment and 3C products need to be connected to the Internet during the quality inspection process, when the number of equipment reaches a certain level, the core concerns mainly include:
- Stability and reliability: The protocol needs to maintain stable data transmission in a complex network environment to ensure the reliability of the system.
- Real-time: In the quality inspection process, real-time data transmission and response are required to support quick decision-making and instant feedback.
- Network cost: As the number of devices increases, network transmission costs increase significantly. Choosing a lightweight protocol can effectively reduce costs.
Program Evaluation:
- During the frequent data exchange process of HTTP/HTTPS, the protocol packets are large and the network overhead is high.
- CoAP is suitable for resource-constrained devices and networks, such as data reporting scenarios such as smart meters and gas meters. It is not suitable for large-scale two-way communication scenarios. In order to ensure the security of data transmission, DTLS is usually required to encrypt communication. The automation device itself is not a resource-constrained device.
- MQTT is a lightweight protocol suitable for low-bandwidth and high-latency network environments. It also supports different QoS levels to ensure reliable and real-time message delivery.
In summary, the MQTT protocol can meet the needs of the intelligent quality inspection center in terms of protocol packet size, stability, reliability, etc. Especially in scenarios that require low latency and high reliability, MQTT becomes the best choice due to its lightweight and efficient features. Therefore, we finally chose the MQTT protocol as the application layer protocol.
3.2 Broker Selection
MQTT Broker is the core component of the MQTT protocol, responsible for managing message delivery between clients. It plays the role of a middleman in the publish/subscribe model, ensuring that messages are delivered from publishers to subscribers.
Currently, there are more than 20 open source MQTT Broker projects on the market. The following mainly introduces HiveMQ, RabbitMQ and EMQX.
3.2.1 HiveMQ
HiveMQ is an enterprise-grade MQTT message broker focused on high-performance and high-reliability Internet of Things (IoT) applications.
- High Availability
- Advantages: Supports distributed cluster deployment, with automatic failover and load balancing functions to ensure high availability of the system.
- Disadvantages: You need the Enterprise Edition to get the full set of high availability features; the free version has limited features.
- Security
Advantages: Supports TLS/SSL encryption, authentication, and authorization, providing enterprise-level security features, and also supports OAuth 2.0 and X.509 certificates.
Disadvantages: Advanced security features require the Enterprise Edition.
Ease of use
Pros: Intuitive management console, thorough documentation, strong community and enterprise support.
Disadvantages: The enterprise version is more expensive and has a higher entry threshold.
3.2.2 RabbitMQ
RabbitMQ is a general message broker that supports multiple message protocols, including AMQP, MQTT, STOMP, etc.
- High Availability
- Advantages: Supports distributed cluster deployment, mirrored queues, and persistence to ensure message availability in the event of system failures.
- Disadvantages: The configuration is complex, and cluster management and maintenance require high operation and maintenance experience.
- Security
Advantages: Supports TLS/SSL encryption, authentication, and authorization, providing fine-grained security control.
Disadvantages: Security configuration is complex and requires a deep understanding of RabbitMQ's security model.
Ease of use
Advantages: Supports multiple protocols and plug-in extensions, and is very feature-rich.
Disadvantages: Initial configuration and optimization can be complex and require a deep understanding of its architecture.
3.2.3 EMQX
EMQX is a high-performance, scalable MQTT message broker designed for the Internet of Things.
- High Availability
- Advantages: Native support for distributed clusters and high availability, capable of supporting millions of connections and automatic failover.
- Disadvantages: The configuration is complex and cluster management requires a certain technical background.
- Security
Advantages: Supports security mechanisms such as TLS/SSL, LDAP, JWT and ACL, providing comprehensive security protection.
Disadvantage: Advanced security configuration may require a high learning cost.
Ease of use
Advantages: Provides a wealth of plug-ins and management tools, and supports visual management.
Disadvantages: Configuration and optimization require certain technical experience, especially in large-scale deployments.
3.2.4 Selection basis and conclusion
- HiveMQ: There are open source and paid versions. The open source version is developed based on Java language and supports a maximum of 5 nodes for cluster deployment. It only supports authentication using username and password, does not support TLS encryption, and cannot meet high-level security certification.
- RabbitMQ: Completely open source, the core is developed in Erlang language, and MQTT support is implemented through extensions, so the MQTT function is relatively non-native, which may not be as good as the Broker that natively supports MQTT in terms of performance.
- EMQX: There are open source and paid versions. The open source version is developed based on the ErLang language, and cluster deployment supports up to 3 nodes. It supports basic username and password authentication while supporting TLS/SSL encryption and simple ACL (access control list), meeting the needs of most small and medium-sized applications.
In summary, the open source version of EMQX can meet the needs of most small and medium-sized applications. It is superior to HiveMQ and RabbitMQ in terms of high availability, security, performance, cost, and ease of use. Finally, we chose EMQX as the message broker for MQTT.
3.3 QoS message quality selection
In the MQTT protocol, message quality (QoS, Quality of Service) is a key concept used to determine the reliability of messages during transmission. MQTT defines three message quality levels (QoS 0, QoS 1, QoS 2), which are suitable for different application scenarios. The following is a detailed analysis of each QoS level and how to choose the appropriate QoS level in actual applications.
3.3.1 QoS 0: At most once
The message is sent once, and the sender does not ask for confirmation that the message was successfully received. Messages may be lost.
- Advantages: Minimal network overhead and lowest latency.
- Disadvantages: There is no guarantee that the message will arrive. It is suitable for scenarios where data reliability is not required.
3.3.2 QoS 1: At least once
The message will be delivered at least once, and the receiver needs to confirm receipt of the message. If the sender does not receive the confirmation, the message will be resent until it is confirmed received.
- Advantages: Provides better guarantee for message arrival.
- Disadvantage: It may cause message duplication, and additional processing logic is required to eliminate the duplication effect.
3.3.3 QoS 2: Exactly once
The message is guaranteed to be delivered exactly once without duplication or loss. The message arrival is ensured by a multi-step handshake protocol.
- Advantages: Provides the highest message delivery guarantee.
- Disadvantages: Requires more network overhead and processing time, increasing system latency.
3.3.4 Selection basis and conclusion
In actual scenarios, it is necessary to precisely control automated equipment to complete a series of interactions. Repeated execution of automated equipment instructions may have serious consequences (for example, repeated operations performed by a robot while holding a mobile phone may damage the phone). Therefore, we selected QoS 2 from the three message quality options of MQTT for the following reasons:
- Qos 0 has the highest efficiency, but does not guarantee the reliability of messages, which may result in message loss and is not suitable for scenarios that require strict control.
- QoS 1 can ensure that the message is delivered at least once, but it may cause message duplication. Each end needs to handle the logic of duplicate messages, which increases the complexity of development and operation and maintenance.
- QoS 2 ensures that messages are delivered only once and is the most reliable message quality level. Although there is a sacrifice in network latency, the size of PUBREC, PUBREL, and PUBCOMP messages is only 4 bytes, making the latency acceptable in most cases. Choosing QoS 2 allows developers to focus more on application logic without worrying too much about the reliability of message transmission.
In summary, QoS 2 is our best choice in harsh scenarios. It can effectively reduce the risks caused by message duplication while ensuring high reliability of the system.
3.4 Broker deployment plan
Earlier we introduced the selection of message publishing, message middleware, and message quality. Next, we need to consider how to deploy it. Let’s first briefly introduce the background:
- Cloud servers: mainly concentrated in North China.
- Intelligent quality inspection centers: distributed in major regions across the country.
Without considering other external environmental influences such as operators and physical distance, the message delay may increase with the increase in message volume (under normal circumstances, the network delay from South China to North China is about 50 milliseconds or more). Therefore, the following deployment plan is proposed.
3.4.1 Cloud Server Deployment
Deploy MQTT Broker on the cloud server, and the devices connect to the central server through the network for message transmission.
- Advantages: Broker can achieve unified management, simplifying maintenance and monitoring.
- Disadvantages: Due to cross-region transmission, there may be a high message delay, affecting real-time performance.
3.4.2 Local Deployment
Deployed in the intelligent quality inspection center, the device is connected to the Broker through the local area network to process the message transmission of the current quality inspection center device.
- Advantages: Message delivery is nearly instant.
- Disadvantages: Multiple local brokers need to be managed and maintained separately, which increases the complexity of operation and maintenance.
3.4.3 Hybrid Deployment (Edge Computing)
Edge nodes are deployed in the intelligent quality inspection center to process the message transmission of the current quality inspection center equipment and synchronize data with the Broker on the central cloud server. At the same time, the central server also carries out message processing for sites without server resources.
- Advantages: Extremely low latency and effective reduction of central node load.
- Disadvantages: When deployed on a large scale, the dispersion of edge nodes may increase the complexity of management.
3.4.4 Selection basis and conclusion
The main factors to consider:
- Network delay: The geographical distribution of smart quality inspection centers is uneven. For example, the network delay from South China to North China. How to deploy Broker to reduce the delay?
- Scalability: In the future, more automated equipment will be connected to the intelligent quality inspection center, so the system needs to have good scalability.
Program Evaluation:
- Cloud server deployment: The network delay is relatively high. Based on a network delay of 50 milliseconds, a single automation device may take approximately 2 seconds longer to complete a complete process.
- Local deployment: Message delay is almost zero, which can significantly improve the response speed and real-time performance of automation equipment.
- Hybrid deployment (edge computing): Reduce the load on central nodes while ensuring low latency.
At the same time, the following stress tests were performed on the cloud server and local deployment (due to limited space, only the scenario with message quality QoS 2 and message size of 1KB under different client connection numbers is shown here), and the results are as follows:
Stress testing scenario (number of client connections) | Local deployment delay | Cloud server deployment delay |
10 | 6ms | 42ms |
100 | 7ms | 47ms |
1000 | 10ms | 57ms |
In summary, we have currently chosen the local deployment solution. The local deployment solution can significantly reduce latency. Although there are certain management challenges, it can meet the current response speed requirements.
However, with the increase of automated equipment in smart quality inspection centers, hybrid deployment solutions should be the first choice in the future, that is, reducing latency through edge computing and synchronizing key information to the central server. This solution can achieve the best balance between latency, management difficulty and system performance.
4 Conclusion
Through the analysis and discussion in this article, we can clearly see that the application of IoT technology in the intelligent quality inspection center not only successfully solves many problems in traditional quality inspection methods, but also provides solid technical support for future business development.
First, by introducing the Internet of Things technology, the originally coupled business logic of each end was decoupled and the communication protocols of each end were unified.
Secondly, in the process of selecting application layer protocols, MQTT Broker, and QoS message quality, through comprehensive comparison and evaluation, we selected the technical solutions that best meet business needs. The implementation of these technical solutions enables the intelligent quality inspection center to operate more efficiently and stably.
Finally, the local deployment solution further optimized the system's response speed and reliability. In the future, we will further effectively reduce the network delay caused by geographical distribution through the hybrid deployment solution (edge computing). This deployment solution not only meets the current business needs, but also provides broad space for future expansion and optimization.
At Zhuanzhuan, IoT technology is driving the rise of "smart factories". IoT enables the interconnection of production equipment, making the production process more transparent and automated. In the future, IoT will also deepen its integration with artificial intelligence and robotics technology, opening a new chapter in smart manufacturing.
5 Reference links
- https://mqtt.org
- https://www.emqx.io
- https://www.sciencedirect.com/science/article/pii/S1389128621003364
- https://www.kepuchina.cn/article/articleinfo?business_type=100&classify=2&ar_id=455497