Real time messaging solutions between IoT devices and mobile apps
Background
M2M (Machine to Machine) is an end-to-end communication technology. Alibaba Cloud IoT enterprise IoT instance realizes M2M communication between devices through the topic forwarding function based on the rule engine. You don't need to worry about high concurrency, stability, low latency and other technical difficulties in high concurrency scenarios, nor do you need to purchase a large number of servers to carry these requests. You just need to configure forwarding rules according to your own business.
Today, we will talk about the linkage between the PLC industrial computer and the manager's App in the industrial scene. This scheme is also applicable to the linkage between the temperature and humidity sensor and the air conditioner, the linkage between the air quality sensor and the air purifier in the smart home scene.
Overall technical proposal
The overall technical scheme of M2M communication between devices based on Alibaba Cloud IoT enterprise IoT instance is as follows:
Equipment M2M communication practice
1. Create a product and configure a custom topic
First, we create mobile phone App products and PLC industrial personal computers on the IoT console, and add custom topics.
Then, register a device under the product.
2. Configure the rule engine and topic forwarding
2.1 PLC industrial computer reports data flow App
After the equipment access is completed, we create new rules in the rule engine - cloud product flow, and PLC data flows to the App in real time.
① Data source - PLC industrial computer data reporting
IPC reports data Topic:
/IPC/IPC id/user/data/up
Payload:
{
"ToAppTopic": "/Mobile App/Mobile ID/user/plc2App/data",
"t":56,
"h":68
}
② Data Destination - Mobile App Subscription
Mobile App Subscription Topic:
/Mobile App/Mobile ID/user/plc2App/data
③ Parse Script
//Get the message content reported by the device through the payload function, and convert it according to the JSON format.
var data = payload("json");
//Target Topic
var toAppTopic = data.toAppTopic;
//App command flows to PLC equipment
writeIotTopic(1009, toAppTopic, data)
When the PLC industrial computer reports data, the message report and rule engine flow log are as follows:
Message track of data flow
2.2 Mobile App Push Control Command to PLC
Next, we create a new rule in the rule engine - cloud product flow, and the App command is sent to the PLC.
① Data source - control command issued by mobile phone
Mobile phone sends control commands Topic:
/Mobile App/Mobile ID/user/app2plc/cmd
Payload:
{
"ToPlcDeviceTopic": "/PLC IPC/IPC id/user/app/cmd",
"light":"on"
}
② Data destination - IPC instruction subscription
PLC industrial personal computer subscription topic:
/PLC IPC/IPC id/user/app/cmd
③ Parse Script
//Get the message content reported by the device through the payload function, and convert it according to the JSON format.
var data = payload("json");
//Target Device Topic
var toPlcDeviceTopic = data.toPlcDeviceTopic;
//App command flows to PLC equipment
writeIotTopic(1009, toPlcDeviceTopic, data)
After the mobile app sends the control command, the flow log is as follows:
The message path of data flow is as follows
So far, we have completed real-time message communication between PLC industrial personal computers and mobile apps based on Alibaba Cloud IoT enterprise Internet of Things platform. The whole process does not require the participation of business servers, ensuring real-time and efficient message communication between devices.
M2M (Machine to Machine) is an end-to-end communication technology. Alibaba Cloud IoT enterprise IoT instance realizes M2M communication between devices through the topic forwarding function based on the rule engine. You don't need to worry about high concurrency, stability, low latency and other technical difficulties in high concurrency scenarios, nor do you need to purchase a large number of servers to carry these requests. You just need to configure forwarding rules according to your own business.
Today, we will talk about the linkage between the PLC industrial computer and the manager's App in the industrial scene. This scheme is also applicable to the linkage between the temperature and humidity sensor and the air conditioner, the linkage between the air quality sensor and the air purifier in the smart home scene.
Overall technical proposal
The overall technical scheme of M2M communication between devices based on Alibaba Cloud IoT enterprise IoT instance is as follows:
Equipment M2M communication practice
1. Create a product and configure a custom topic
First, we create mobile phone App products and PLC industrial personal computers on the IoT console, and add custom topics.
Then, register a device under the product.
2. Configure the rule engine and topic forwarding
2.1 PLC industrial computer reports data flow App
After the equipment access is completed, we create new rules in the rule engine - cloud product flow, and PLC data flows to the App in real time.
① Data source - PLC industrial computer data reporting
IPC reports data Topic:
/IPC/IPC id/user/data/up
Payload:
{
"ToAppTopic": "/Mobile App/Mobile ID/user/plc2App/data",
"t":56,
"h":68
}
② Data Destination - Mobile App Subscription
Mobile App Subscription Topic:
/Mobile App/Mobile ID/user/plc2App/data
③ Parse Script
//Get the message content reported by the device through the payload function, and convert it according to the JSON format.
var data = payload("json");
//Target Topic
var toAppTopic = data.toAppTopic;
//App command flows to PLC equipment
writeIotTopic(1009, toAppTopic, data)
When the PLC industrial computer reports data, the message report and rule engine flow log are as follows:
Message track of data flow
2.2 Mobile App Push Control Command to PLC
Next, we create a new rule in the rule engine - cloud product flow, and the App command is sent to the PLC.
① Data source - control command issued by mobile phone
Mobile phone sends control commands Topic:
/Mobile App/Mobile ID/user/app2plc/cmd
Payload:
{
"ToPlcDeviceTopic": "/PLC IPC/IPC id/user/app/cmd",
"light":"on"
}
② Data destination - IPC instruction subscription
PLC industrial personal computer subscription topic:
/PLC IPC/IPC id/user/app/cmd
③ Parse Script
//Get the message content reported by the device through the payload function, and convert it according to the JSON format.
var data = payload("json");
//Target Device Topic
var toPlcDeviceTopic = data.toPlcDeviceTopic;
//App command flows to PLC equipment
writeIotTopic(1009, toPlcDeviceTopic, data)
After the mobile app sends the control command, the flow log is as follows:
The message path of data flow is as follows
So far, we have completed real-time message communication between PLC industrial personal computers and mobile apps based on Alibaba Cloud IoT enterprise Internet of Things platform. The whole process does not require the participation of business servers, ensuring real-time and efficient message communication between devices.
Related Articles
-
A detailed explanation of Hadoop core architecture HDFS
Knowledge Base Team
-
What Does IOT Mean
Knowledge Base Team
-
6 Optional Technologies for Data Storage
Knowledge Base Team
-
What Is Blockchain Technology
Knowledge Base Team
Explore More Special Offers
-
Short Message Service(SMS) & Mail Service
50,000 email package starts as low as USD 1.99, 120 short messages start at only USD 1.00