Method and device for interacting with PLC through Bluetooth by using WeChat applet

Through the Bluetooth connection between WeChat applet and PLC device, wireless interaction between the PLC device and the user's mobile phone is realized, solving the problem of traditional interaction inconvenience and improving the convenience and efficiency of interaction.

CN119521181APending Publication Date: 2025-02-25SHANGHAI FLEXEM TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411625262.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-14
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

In the prior art, the interaction between PLC devices and users mainly depends on the computer software on the computer, resulting in inconvenience and inefficiency in interaction, especially in lightweight interactions such as information collection, simple command issuance, engineering updates and operation log collection. In the scene.

Method used

Through the Bluetooth connection between the WeChat applet and the PLC device, wireless interaction between the user's mobile phone and the PLC device is realized. The specific steps include pairing the WeChat applet on the user's mobile phone with the PLC device Bluetooth, reading the working status of the PLC device, issuing user projects, running the PLC device, and reading and uploading the running log.

Benefits of technology

It significantly improves the interactive convenience and flexibility of PLC devices, allowing users to complete functions such as the working status collection, operation command issuance, user project updates and operation log collection of PLC devices on the mobile phone, improving user experience and work efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119521181A_ABST
    Figure CN119521181A_ABST
Patent Text Reader

Abstract

The invention relates to a method and device for interacting with a PLC through Bluetooth by using a WeChat applet, and relates to the technical field of industrial control. The method comprises the following steps that a WeChat applet on a mobile phone of a user is in Bluetooth pairing connection with PLC equipment; the WeChat applet reads the working state of the PLC equipment; if the PLC equipment is in a non-working state, the user mobile phone operates the PLC equipment through Bluetooth; and if the PLC equipment is in the working state, the user mobile phone issues the user engineering to the PLC equipment through Bluetooth, and the WeChat applet reads the running log of the PLC equipment through Bluetooth. According to the invention, interaction between the user and the PLC equipment can be realized more conveniently.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of industrial control, and more particularly to a method and device for interacting with a PLC via Bluetooth using a WeChat applet. Background Art

[0002] In the field of automation, the interaction between PLC and human can only be done through limited information transmission via indicator lights. More information needs to be communicated with the equipment through the PLC host computer installed on the computer.

[0003] In many application scenarios, in addition to the writing and debugging of user projects, there are still many lightweight interactions, such as information collection, the issuance of simple instructions, project and firmware updates, the collection of operation logs, etc. It is very inconvenient and inefficient to use the host software on the computer to interact. Summary of the invention

[0004] In order to enable more convenient interaction between users and PLC devices, the present application provides a method and device for interacting with PLC via Bluetooth using WeChat applet.

[0005] On the one hand, the present application provides a method for using a WeChat applet to interact with a PLC via Bluetooth, using the following technical solution: A method and device for using a WeChat applet to interact with a PLC via Bluetooth, comprising the following steps: The WeChat applet on the user's mobile phone is paired with the PLC device via Bluetooth; The WeChat applet reads the working status of the PLC device; If the PLC device is in a non-working state, the user's mobile phone operates the PLC device via Bluetooth; If the PLC device is in working state, the user mobile phone sends the user project to the PLC device via Bluetooth.

[0006] By adopting the above technical solution, users can more conveniently interact with PLC devices through mobile phones and WeChat applets on their mobile phones, including collecting information, issuing simple instructions and updating projects.

[0007] Preferably, the Bluetooth pairing connection between the user's mobile phone and the PLC device includes the following steps: The Bluetooth module in the PLC device obtains the identification code and serial number of the PLC device; The Bluetooth module broadcasts Bluetooth to wait for connection; the Bluetooth module periodically sends broadcast data packets, and the broadcast data includes the serial code and identification code of the PLC device; The user's mobile phone establishes a Bluetooth connection with the PLC device; the user's mobile phone searches the surrounding area for devices that can be connected by Bluetooth, and uses the serial number to filter the searched devices. The user can enable the user's mobile phone to achieve Bluetooth connection with the PLC device by entering the identification code.

[0008] By adopting the above technical solution, the serial number is used to screen the PLC devices that need Bluetooth connection, and an accurate Bluetooth connection with the PLC device is established through the identification code to facilitate the subsequent interaction.

[0009] Preferably, the WeChat applet reads the working status of the PLC device including the following steps: The user's mobile phone initiates a request to the PLC device to read the device status; The PLC device receives a request to read the device status and queries its own status; The PLC device sends its own status to the WeChat applet via Bluetooth; The WeChat applet receives and displays the device status.

[0010] By adopting the above technical solution, users can obtain information about whether the PLC device is in working or non-working state through the WeChat applet.

[0011] Preferably, if the PLC device is in a non-working state, the user's mobile phone operates the PLC device via Bluetooth, comprising the following steps: The user's mobile phone initiates a request for the PLC device to run the PLC device; The PLC device receives a request for the PLC device to run, and determines whether the PLC device can run; If the PLC device determines that the PLC device can operate, the PLC device starts to operate, and the PLC device sends the operating result to the WeChat applet via Bluetooth; The WeChat applet receives and displays the device status.

[0012] By adopting the above technical solution, users can run PLC devices through WeChat applet.

[0013] Preferably, the WeChat applet sends the user project to the PLC device via Bluetooth, including the following steps: The user's mobile phone initiates a request to the PLC device to issue a user project; The WeChat applet performs packet processing on the user project file; the WeChat applet divides the user project file into N data packets according to the data size of a single Bluetooth transmission, and generates a download request header; The PLC device is ready to receive the user project file; the WeChat applet sends the download request header to the Bluetooth firmware in the PLC device through the Bluetooth module, and the Bluetooth firmware receives and identifies the download request header. If the Bluetooth firmware identifies that it is a protocol for downloading files, the Bluetooth firmware sends a confirmation message to the WeChat applet through the Bluetooth module, and at this time the Bluetooth firmware enters a mode of cyclically receiving data packets; The Bluetooth firmware cyclically receives the user project file; the WeChat applet first sends multiple download data packets to the Bluetooth firmware through the Bluetooth module in sequence, and the Bluetooth firmware cyclically receives multiple download data packets in sequence; The Bluetooth firmware restores the user project file; after the WeChat applet sends the multiple download data packets, the WeChat applet sends a download request tail to the Bluetooth firmware through the Bluetooth module, and after receiving the download request tail, the Bluetooth firmware restores the multiple download data packets to the user project file and generates a user project file reception result; The PLC device feeds back the update project result to the WeChat applet; if the user project file is received successfully, the PLC device updates the work and sends the update project result of the new project update success to the WeChat applet; if the user project file is received unsuccessfully, the update project result of the new project update failure is sent to the WeChat applet; The WeChat applet receives and displays the update project results.

[0014] By adopting the above technical solution and sub-packaging the user project files, the accuracy and security of file transmission can be ensured, and problems such as data loss caused by one-time transmission of large files can be avoided, so that users can send the user projects that need to be run to PLC devices through WeChat applet.

[0015] Preferably, the WeChat applet requests the own cloud platform for a list of user projects available to the current user; the user selects a project in the WeChat applet, and obtains the user project file from the own cloud platform through the WeChat applet.

[0016] By adopting the above technical solution, the user can select a user project from the available user project list and send it to the PLC device.

[0017] Preferably, the WeChat applet calls the chat record, and filters and obtains the user project file in the chat record.

[0018] By adopting the above technical solution, the user project file can be obtained from the chat record, which is convenient for selecting the required user project.

[0019] Preferably, the WeChat applet reads the operation log of the PLC device via Bluetooth, and the WeChat applet reads the operation log of the PLC device via Bluetooth comprises the following steps: The user's mobile phone initiates a request to the PLC device to read the PLC operation log, and the Bluetooth firmware in the PLC device extracts the PLC operation log after receiving the request; The Bluetooth firmware processes the PLC operation log file in packets; the Bluetooth firmware divides the PLC operation log file into N data packets according to the data size of a single Bluetooth transmission, and generates an upload request header; The WeChat applet is ready to receive the PLC operation log file; the Bluetooth firmware sends the upload request header to the WeChat applet through the Bluetooth module, and the WeChat applet receives and identifies the upload request header. If the WeChat applet identifies that it is a protocol for uploading files, the WeChat applet sends a confirmation message to the Bluetooth firmware through the Bluetooth module, and at this time the WeChat applet enters a mode of cyclically receiving data packets; The WeChat applet receives files cyclically; the Bluetooth firmware first sends multiple upload data packets to the WeChat applet through the Bluetooth module in sequence, and the WeChat applet receives multiple upload data packets cyclically in sequence; The WeChat applet restores the PLC operation log file; after the Bluetooth firmware sends the multiple upload data packets, the Bluetooth firmware sends an upload request tail to the WeChat applet through the Bluetooth module, and after receiving the upload request tail, the Bluetooth firmware restores the multiple upload data packets to the operation log file; The WeChat applet receives and displays the PLC operation log upload result.

[0020] By adopting the above technical solution and subpackaging the operation log files, the accuracy and security of file transmission can be ensured, and problems such as data loss caused by one-time transmission of large files can be avoided, so that users can read the PLC operation log through the WeChat applet.

[0021] Preferably, the WeChat applet can upload the operation log file to its own cloud platform, which will store the operation log file after receiving it, and then display the storage result on the WeChat applet.

[0022] By adopting the above technical solution, the operation log can be stored in the own cloud platform for users to view.

[0023] On the other hand, the present application provides a device for interacting with a PLC via Bluetooth using a WeChat applet, which adopts the following technical solution: A device for interacting with a PLC via Bluetooth using a WeChat applet, comprising: The Bluetooth module is located inside the PLC device and is used to establish a Bluetooth connection with the user's mobile phone; A PLC other service module is arranged inside the PLC device, and the Bluetooth module is communicatively connected with the PLC other service module; A Bluetooth firmware is disposed inside the PLC device, and the Bluetooth firmware is used to connect the Bluetooth device and other service modules of the PLC; Own cloud platform, connected with WeChat mini program.

[0024] In summary, the present application includes at least one of the following beneficial technical effects: The wireless connection between PLC and user's mobile phone is realized through Bluetooth technology, which solves the limitation of traditional command interaction that requires relying on the host computer program running on the computer, significantly improves the flexibility and convenience of equipment configuration and maintenance, and enables users to collect the working status of PLC equipment, issue operation instructions, update user projects and collect operation logs directly on the mobile phone; and through the business cooperation of WeChat applet and its own cloud platform, it can realize functions such as data calling and storage, further improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 is a flow chart of the overall method of Example 1 of the present application; Figure 2 It is the overall flow chart of step S100 in Example 1 of the present application; Figure 3 is a method flow chart of step S100 in Example 1 of the present application; Figure 4 It is the overall flow chart of step S200 in Example 1 of the present application; Figure 5 is a method flow chart of step S200 in Example 1 of the present application; Figure 6 It is the overall flow chart of step S300 in Example 1 of the present application; Figure 7 is a method flow chart of step S300 in Example 1 of the present application; Figure 8 is the overall flow chart of step S400 in Example 1 of the present application; Fig. 9 is a method flow chart of step S400 in Example 1 of the present application; Fig.10 is the overall flow chart of step S500 in Example 1 of the present application; Fig.11is a method flow chart of step S500 in Example 1 of the present application; Fig.12 This is the module framework diagram of Example 2 of the present application. DETAILED DESCRIPTION

[0026] The following is combined with Figure 1 --12 Provide further details of this application.

[0027] Example 1 of the present application discloses a method of using a WeChat applet to interact with a PLC via Bluetooth.

[0028] Reference Figure 1 , a method of using WeChat applet to interact with PLC via Bluetooth includes the following steps: S100: The WeChat applet on the user's mobile phone is paired with the PLC device via Bluetooth.

[0029] S200; WeChat applet reads the working status of PLC equipment.

[0030] S300; if the PLC device is in a non-working state, the WeChat applet runs the PLC device via Bluetooth; if the PLC device is in a working state, jump to S400.

[0031] S400; WeChat applet sends user projects to PLC devices via Bluetooth.

[0032] S500: WeChat applet reads the operation log of PLC devices via Bluetooth.

[0033] Reference Figure 2 and Figure 3 Specifically, the S100 Bluetooth pairing connection includes the following steps: S110: The Bluetooth module in the PLC device obtains the identification code and serial number of the PLC device. After the servo is powered on, the Bluetooth module applies to the Bluetooth firmware for a unique device identification code and the serial number of the device. After receiving the application from the Bluetooth module, the Bluetooth firmware applies to other PLC services for the identification code and serial number. After receiving the application from the Bluetooth firmware, other PLC services generate a unique identification code corresponding to the serial number of the device, and send the device serial number and the generated identification code to the Bluetooth module via Bluetooth.

[0034] S120: The Bluetooth module broadcasts Bluetooth to wait for connection. After the Bluetooth module receives the serial number and identification code of the device, the PLC other services send specific configuration instructions to the Bluetooth module through the SPI interface, so that the Bluetooth module switches to broadcast mode. In broadcast mode, the Bluetooth module will periodically send broadcast data packets to inform surrounding devices equipped with Bluetooth function that the PLC device is pairable. Among them, the broadcast data includes the serial code and identification code of the PLC device to ensure the Bluetooth connection between specific devices.

[0035] S130: The user's mobile phone and the PLC device establish a Bluetooth connection. The user first uses the WeChat applet to scan the QR code on the body of the PLC device. The WeChat applet identifies the serial number of the PLC device from the QR code. The WeChat applet calls the mobile phone's Bluetooth function to search for nearby devices that can be connected to Bluetooth, and filters the Bluetooth devices found by serial number. After the serial number of the PLC device is filtered, the Bluetooth applet on the user's mobile phone can pair with the PLC device via Bluetooth. At this time, the user's mobile phone can receive the broadcast data packet of the Bluetooth module of the PLC device. The user can enable the user's mobile phone to achieve Bluetooth connection with the PLC device by entering the identification code, so that the WeChat applet can connect to the servo via Bluetooth.

[0036] Reference Figure 4 and Figure 5 , the S200 WeChat applet reads the working status of the PLC device, including the following steps: S210: The user's mobile phone initiates a request to read the device status to the PLC device. The user initiates a request to read the device status on the WeChat applet, and after receiving the request, the WeChat applet initiates a packaging request to the PLC Bluetooth device.

[0037] S220: The PLC device receives the request to read the device status and queries its own status. After the Bluetooth module receives the encapsulation request, it verifies the integrity of the encapsulation request. When the verification passes, the Bluetooth module sends the verified encapsulation request to the Bluetooth firmware. The Bluetooth firmware parses and identifies the encapsulation request and queries the status of the device from other PLC services.

[0038] S230: The PLC device sends its own status to the WeChat applet via Bluetooth. The PLC other services send the PLC status to the Bluetooth firmware, which then encapsulates the PLC status into a reply data packet and sends it to the Bluetooth module. The Bluetooth module performs an integrity check on the reply data packet and then replies to the WeChat applet via Bluetooth.

[0039] S240: The WeChat applet receives and displays the device status. The WeChat applet verifies the legitimacy of the reply data packet, and if the verification passes, determines the device status and displays the status on the interface and returns it to the user.

[0040] S250: When the PLC device status is abnormal, query the abnormal status details. At this time, the WeChat applet requests the proprietary cloud platform to obtain detailed information on the PLC abnormal status according to the abnormal error code. After receiving the request, the proprietary cloud platform collects relevant information on the abnormal status and queries the corresponding processing measures to be taken, and then sends the relevant information on the abnormal status and the processing measures to be taken to the WeChat applet, and displays them on the WeChat applet interface.

[0041] Reference Figure 6 and Figure 7 , S300 If the PLC device is in a non-working state, the user's mobile phone runs the PLC device via Bluetooth including the following steps: S310: The user's mobile phone initiates a request for the PLC device to run. The user initiates a request for the PLC device to run on the WeChat applet. After receiving the request, the WeChat applet encapsulates it and sends the encapsulated request to the Bluetooth module on the device via Bluetooth.

[0042] S320: The PLC device receives a request for PLC device operation and determines whether the PLC device can operate. After the Bluetooth module receives the encapsulation request, the Bluetooth module verifies the integrity of the encapsulation request. When the verification passes, the Bluetooth module sends the verified encapsulation request to the Bluetooth firmware. The Bluetooth firmware parses and identifies the encapsulation request and initiates a request for PLC operation to other PLC services. Other PLC services receive the request to determine whether the PLC device can operate and determine the result of the PLC device operation.

[0043] S330: If the PLC device determines that the PLC device can run, the PLC device starts working, and the PLC device sends the running results to the WeChat applet via Bluetooth. If the PLC other services determine that the PLC device has the conditions to run, the PLC other services control the PLC device to start working and generate a successful running result; if the PLC other services determine that the PLC device does not have the conditions to run, the PLC device cannot run and generates a failed running result. The PLC other services send the running results to the Bluetooth firmware, and the Bluetooth firmware encapsulates the running results into a reply data packet and sends it to the Bluetooth module. After the Bluetooth module performs an integrity check on the reply data packet, it replies to the WeChat applet via Bluetooth.

[0044] S340: The WeChat applet receives and displays the device status. The WeChat applet verifies the legitimacy of the reply data packet. If the verification passes, it determines whether the PLC operation result is normal and returns the PLC operation result to the user on the interface.

[0045] S350: When the user obtains the result of the PLC operation failure, query the details. At this time, the WeChat applet requests the self-owned cloud platform to obtain the detailed information of the PLC operation failure according to the abnormal error code. After receiving the request, the self-owned cloud platform collects the relevant information of the PLC operation failure and queries the corresponding processing measures to be taken, and then sends the relevant information of the abnormal state and the processing measures to be taken to the WeChat applet, and displays them on the interface of the WeChat applet.

[0046] Reference Figure 8 and Fig. 9 , the S400 WeChat applet sends the user project to the PLC device via Bluetooth, including the following steps: S410: The user's mobile phone initiates a request to send the user project to the PLC device. The user initiates a request to send the user project to the PLC device on the WeChat applet. The project selected by the user can be a self-owned cloud platform or from a WeChat chat record.

[0047] If the user chooses to obtain a user project from the own cloud platform, the WeChat Mini Program must be able to request a list of user projects that the current user can use from the own cloud platform through an API call. After receiving the request, the own cloud platform displays the list of projects that the user can access on the user interface; then the user selects the project to be distributed in the WeChat Mini Program, obtains the project from the own cloud platform through the WeChat Mini Program, and downloads the project selected by the user from the own cloud platform to the local computer.

[0048] If the user chooses to obtain the user project from the WeChat chat history, the WeChat applet will call the WeChat API to filter out the project files from the chat history and cache them locally.

[0049] S420: The WeChat applet performs packet processing on the user project file. The WeChat applet divides the user project file into N data packets according to the data size of a single Bluetooth transmission, and then assembles the MD5 of the user project file, the number of divided packets and other information into a request header for downloading the data packet.

[0050] S430: The PLC device is ready to receive the user project file. The WeChat applet first sends the download request header to the device's Bluetooth module via Bluetooth. After receiving the request header, the Bluetooth module performs an integrity check on the data in the request header. After the check passes, the request header is encapsulated. The Bluetooth module then forwards the encapsulated request header to the device's Bluetooth firmware. The Bluetooth firmware receives the request header and identifies the download data packet. When the Bluetooth firmware identifies that it is a protocol for downloading files, the Bluetooth firmware will reply with an OK message to the Bluetooth module, and the Bluetooth firmware itself will enter the mode of cyclically receiving file data packets. After receiving the OK message, the Bluetooth module will send the OK message to the WeChat applet via Bluetooth. After the WeChat applet receives the reply of the OK message, it means that the Bluetooth firmware of the PLC device is now ready to cyclically receive the download file data packets.

[0051] S440: The Bluetooth firmware receives the user project file in a loop. The WeChat applet starts by first downloading data packet 1, and then sends download data packet 1 to the device's Bluetooth module via Bluetooth; after the Bluetooth module verifies the integrity of the data in download data packet 1, it encapsulates download data packet 1, and then forwards the encapsulated download data packet 1 to the device's Bluetooth firmware without the need for a reply. The WeChat applet then sequentially sends download data packet 2, download data packet 3...download data packet N to the device's Bluetooth module via Bluetooth in accordance with the above method; the Bluetooth module then encapsulates multiple download data packets in turn, and sends the encapsulated download data packets to the Bluetooth firmware.

[0052] S450: The Bluetooth firmware restores the user project file. After the WeChat applet has sent all N download data packets, it will send another download request tail, which contains the receiving end in the protocol definition. The download request tail is sent to the Bluetooth module of the device via Bluetooth. After receiving the download request tail, the Bluetooth module encapsulates it, and then the Bluetooth module sends the encapsulated download request tail to the Bluetooth firmware. After receiving the encapsulated download request tail, the Bluetooth firmware parses the protocol. After determining that it is the end packet of the download file, the Bluetooth firmware will exit the logic of the loop reception, sort the N download data packets received previously in order, and restore them to the project file. The Bluetooth firmware then calculates the MD5 of the entire file, and compares the calculated value with the MD5 placed in the download request header. If the two are consistent, it means that the verification has passed and the file has been received successfully. If they are inconsistent, it means that the file has failed to be received.

[0053] S460: The PLC device feeds back the update project result to the WeChat applet. If the Bluetooth firmware receives the project file successfully, the Bluetooth firmware calls the service for updating the user project in the PLC other services to update the running project in the PLC device, and the PLC other services send the update project result of the successful user project update to the Bluetooth module through the Bluetooth firmware. If the Bluetooth firmware fails to receive the project file, the PLC other services send the update project result of the successful user project update with an error code to the Bluetooth firmware. After receiving the update project result, the Bluetooth module packages it and sends the packaged update project result to the WeChat applet.

[0054] S470: The WeChat applet receives and displays the update project result. After receiving the packaged update program result, the WeChat applet determines the result of the project update request, displays it on the interface and returns it to the user. If the update project fails, the WeChat applet will request the self-owned cloud platform with an abnormal error code to obtain detailed information on the failure of the update project. After receiving the request, the self-owned cloud platform retrieves the detailed information on the failure of the update project and the processing measures to be taken, and returns it to the WeChat applet.

[0055] Reference Fig.10 and Fig.11 , the S500 WeChat applet reads the operation log of the PLC device via Bluetooth, including the following steps: S510: The user's mobile phone initiates a request to the PLC device to read the PLC operation log. The user initiates a request to read the PLC operation log on the WeChat applet. After receiving the request, the WeChat applet encapsulates it and sends the encapsulated request to read the PLC operation log to the Bluetooth module on the device via Bluetooth. The Bluetooth module verifies the integrity of the request to read the PLC operation log and then forwards the request to the Bluetooth firmware. After verifying and analyzing the request, the Bluetooth firmware makes a request to other PLC services to read the PLC operation log. After receiving the request, other PLC services send the PLC log file to the Bluetooth firmware.

[0056] S520: The Bluetooth firmware processes the PLC operation log file by packetization. The Bluetooth firmware will divide the PLC operation log into N data packets according to the data size of a single Bluetooth transmission, and then assemble the MD5 of the PLC operation log file, the number of split packets and other information into the log upload request header of the upload data packet.

[0057] S530: The WeChat applet is ready to receive the PLC operation log file. The Bluetooth firmware first sends the log upload request header to the Bluetooth module, and the Bluetooth module performs a data integrity check on the log upload request header. After the check is passed, the Bluetooth module encapsulates the log upload request header, and replies the encapsulated log upload request header to the WeChat applet via Bluetooth. The WeChat applet identifies the upload data packet in the encapsulated log upload request header for identification. When the WeChat applet recognizes that it is a protocol for uploading files, the WeChat applet will reply an OK message to the Bluetooth module, and at the same time enter the mode of cyclically receiving file data packets. After receiving the OK message, the Bluetooth module will send OK to the Bluetooth firmware via Bluetooth. After the PLC Bluetooth firmware receives the OK reply, it means that the WeChat applet is now ready to cyclically receive the upload file data packets.

[0058] S540: The WeChat applet receives files in a loop. The Bluetooth firmware starts to send upload data packet 1 to the Bluetooth module in sequence, and then sends upload data packet 1 to the Bluetooth module of the device; after the Bluetooth module verifies the integrity of the data in upload data packet 1, it encapsulates upload data packet 1, and then forwards the encapsulated upload data packet 1 to the WeChat applet via Bluetooth, and no reply is required. The Bluetooth firmware then sends upload data packet 2, upload data packet 3...upload data packet N to the Bluetooth module of the device in sequence according to the above method; the Bluetooth module then encapsulates multiple upload data packets in sequence, and sends the encapsulated upload data packets to the WeChat applet via Bluetooth.

[0059] S550: WeChat applet restores the PLC operation log file. After the PLC Bluetooth firmware has sent all N upload data packets, it will send another upload request tail, which contains the receiving end in the protocol definition. The upload request tail is sent to the Bluetooth module via Bluetooth. After receiving the upload request tail, the Bluetooth module encapsulates it, and then the Bluetooth module sends the encapsulated upload request tail to the WeChat applet. After receiving the encapsulated upload request tail, the WeChat applet parses the protocol. After determining that it is the end packet of the uploaded file, the WeChat applet will exit the logic of the loop reception, sort the N previously received upload data packets in order, and restore them to the operation log file. Then the WeChat applet calculates the MD5 of the entire file, and compares the calculated value with the MD5 placed in the upload request header. If the two are consistent, it means that the verification has passed and the file has been received successfully. If they are inconsistent, it means that the file has failed to be received.

[0060] S560: The WeChat applet receives and displays the PLC operation log upload result. After receiving the operation log file, the WeChat applet determines the result of the operation log file, displays it on the interface and returns it to the user. If the operation log file fails to be received, the WeChat applet will request the self-owned cloud platform with an abnormal error code to obtain detailed information on the failure to receive the operation log file. After receiving the request, the self-owned cloud platform retrieves the detailed information on the failure to receive the operation log file and the processing measures to be taken, and returns it to the WeChat applet.

[0061] If the operation log file is received successfully, on the one hand, the user can choose to upload the operation log file to the own cloud platform. At this time, the WeChat applet sends the log file to the own cloud platform through the cloud platform's API. After receiving the operation log file, the own cloud platform will store the operation log file and display the storage result on the WeChat applet and return it to the user.

[0062] On the other hand, users can also choose to share the successfully uploaded operation log file with their WeChat friends. The WeChat applet will call the WeChat interface to select the friends to share with, and then send the operation log file.

[0063] The implementation principle of the method of using WeChat applet to interact with PLC via Bluetooth in Example 1 of the present application is as follows: by integrating a Bluetooth module in the PLC device and performing Bluetooth pairing connection with a mobile phone application, functions such as lightweight information collection and simple command issuance are realized, and daily management and maintenance work can be completed without carrying a computer, greatly improving the work efficiency of on-site engineers.

[0064] Embodiment 2 of the present application discloses a device for interacting with a PLC via Bluetooth using a WeChat applet, referring to Fig.12 , based on PLC devices and user mobile phones with Bluetooth function, also includes: The Bluetooth module is installed inside the PLC device and is used to connect to the user's mobile phone via Bluetooth. This connection method not only simplifies the process of device configuration and maintenance, but also greatly improves the convenience of user operation, allowing users to complete data exchange, status monitoring or remote control operations without physical contact with the PLC device. The Bluetooth module ensures the security and reliability of data transmission by adopting advanced Bluetooth communication technology, effectively preventing information leakage and illegal access.

[0065] The PLC other service module is located inside the PLC device. The Bluetooth module communicates with the PLC other service module through the SPI port. The PLC other service module is mainly used to realize complex logic operations, data storage, network communication and other functions. More importantly, the PLC other service module stores the unique serial number of each PLC device. A QR code containing the serial number is specially designed on the body of the PLC device. Users only need to scan it with a smartphone to quickly obtain device information, which is convenient for registration, warranty or technical support requests.

[0066] Bluetooth firmware is installed inside the PLC device. It is used to connect Bluetooth devices and existing PLC services. By optimizing the communication protocol and improving compatibility and stability, Bluetooth firmware ensures that Bluetooth devices of different brands and models can interact smoothly with PLC, thereby expanding the access capabilities and application scenarios of PLC.

[0067] The self-owned cloud platform is connected to the WeChat applet. Users only need to install and log in to the WeChat applet on their mobile phones to access the self-owned cloud platform anytime and anywhere to achieve remote monitoring, parameter setting, data analysis and other functions of PLC equipment. This cloud-based solution not only breaks geographical restrictions and improves work efficiency, but also greatly reduces maintenance costs. With its powerful data processing capabilities and rich API interfaces, the self-owned cloud platform can also be integrated with third-party systems or services to provide users with more personalized and intelligent solutions.

[0068] The above are all preferred embodiments of the present application, and the protection scope of the present application is not limited thereto. Therefore, any equivalent changes made according to the structure, shape, and principle of the present application should be included in the protection scope of the present application.

Claims

1. A method for using WeChat applet to interact with PLC via Bluetooth, characterized in that: The following steps are involved: The WeChat applet on the user's mobile phone is paired with the PLC device via Bluetooth; The WeChat applet reads the working status of the PLC device; If the PLC device is in a non-working state, the user's mobile phone operates the PLC device via Bluetooth; If the PLC device is in working state, the user mobile phone sends the user project to the PLC device via Bluetooth.

2. A method for interacting with a PLC via Bluetooth using a WeChat applet according to claim 1, characterized in that: The Bluetooth pairing connection between the user's mobile phone and the PLC device includes the following steps: The Bluetooth module in the PLC device obtains the identification code and serial number of the PLC device; The Bluetooth module broadcasts Bluetooth to wait for connection; the Bluetooth module periodically sends broadcast data packets, and the broadcast data includes the serial code and identification code of the PLC device; The user's mobile phone establishes a Bluetooth connection with the PLC device; the user's mobile phone searches the surrounding area for devices that can be connected by Bluetooth, and uses the serial number to filter the searched devices. The user can enable the user's mobile phone to achieve Bluetooth connection with the PLC device by entering the identification code.

3. A method for interacting with a PLC via Bluetooth using a WeChat applet according to claim 1, characterized in that: The WeChat applet reads the working status of the PLC device including the following steps: The user's mobile phone initiates a request to the PLC device to read the device status; The PLC device receives a request to read the device status and queries its own status; The PLC device sends its own status to the WeChat applet via Bluetooth; The WeChat applet receives and displays the device status.

4. A method for interacting with a PLC via Bluetooth using a WeChat applet according to claim 1, characterized in that: If the PLC device is in a non-working state, the user's mobile phone operates the PLC device via Bluetooth, including the following steps: The user's mobile phone initiates a request for the PLC device to run the PLC device; The PLC device receives a request for the PLC device to run, and determines whether the PLC device can run; If the PLC device determines that the PLC device can operate, the PLC device starts to operate, and the PLC device sends the operating result to the WeChat applet via Bluetooth; The WeChat applet receives and displays the device status.

5. A method for interacting with a PLC via Bluetooth using a WeChat applet according to claim 1, characterized in that: The WeChat applet sends the user project to the PLC device via Bluetooth, including the following steps: The user's mobile phone initiates a request to the PLC device to issue a user project; The WeChat applet performs packet processing on the user project file; the WeChat applet divides the user project file into N data packets according to the data size of a single Bluetooth transmission, and generates a download request header; The PLC device is ready to receive the user project file; the WeChat applet sends the download request header to the Bluetooth firmware in the PLC device through the Bluetooth module, and the Bluetooth firmware receives and identifies the download request header. If the Bluetooth firmware identifies that it is a protocol for downloading files, the Bluetooth firmware sends a confirmation message to the WeChat applet through the Bluetooth module, and at this time the Bluetooth firmware enters a mode of cyclically receiving data packets; The Bluetooth firmware cyclically receives the user project file; the WeChat applet first sends multiple download data packets to the Bluetooth firmware through the Bluetooth module in sequence, and the Bluetooth firmware cyclically receives multiple download data packets in sequence; The Bluetooth firmware restores the user project file; after the WeChat applet sends the multiple download data packets, the WeChat applet sends a download request tail to the Bluetooth firmware through the Bluetooth module, and after receiving the download request tail, the Bluetooth firmware restores the multiple download data packets to the user project file and generates a user project file reception result; The PLC device feeds back the update project result to the WeChat applet; if the user project file is received successfully, the PLC device updates the work and sends the update project result of the new project update success to the WeChat applet; if the user project file is received unsuccessfully, the update project result of the new project update failure is sent to the WeChat applet; The WeChat applet receives and displays the update project results.

6. A method for interacting with a PLC via Bluetooth using a WeChat applet according to claim 5, characterized in that: The WeChat applet requests the self-owned cloud platform for a list of user projects available to the current user; the user selects a project in the WeChat applet, and obtains the user project file from the self-owned cloud platform through the WeChat applet.

7. A method for interacting with a PLC via Bluetooth using a WeChat applet according to claim 5, characterized in that: The WeChat applet calls the chat record, and filters and obtains the user project file in the chat record.

8. A method for interacting with a PLC via Bluetooth using a WeChat applet according to claim 1, characterized in that: The WeChat applet also reads the operation log of the PLC device through Bluetooth, and the WeChat applet reads the operation log of the PLC device through Bluetooth includes the following steps: The user's mobile phone initiates a request to the PLC device to read the PLC operation log, and the Bluetooth firmware in the PLC device extracts the PLC operation log after receiving the request; The Bluetooth firmware processes the PLC operation log file in packets; the Bluetooth firmware divides the PLC operation log file into N data packets according to the data size of a single Bluetooth transmission, and generates an upload request header; The WeChat applet is ready to receive the PLC operation log file; the Bluetooth firmware sends the upload request header to the WeChat applet through the Bluetooth module, and the WeChat applet receives and identifies the upload request header. If the WeChat applet identifies that it is a protocol for uploading files, the WeChat applet sends a confirmation message to the Bluetooth firmware through the Bluetooth module, and at this time the WeChat applet enters a mode of cyclically receiving data packets; The WeChat applet receives files cyclically; the Bluetooth firmware first sends multiple upload data packets to the WeChat applet through the Bluetooth module in sequence, and the WeChat applet receives multiple upload data packets cyclically in sequence; The WeChat applet restores the PLC operation log file; after the Bluetooth firmware sends the multiple upload data packets, the Bluetooth firmware sends an upload request tail to the WeChat applet through the Bluetooth module, and after receiving the upload request tail, the Bluetooth firmware restores the multiple upload data packets to the operation log file; The WeChat applet receives and displays the PLC operation log upload result.

9. A method for interacting with a PLC via Bluetooth using a WeChat applet according to claim 8, characterized in that: The WeChat applet can upload the operation log file to its own cloud platform. After receiving the operation log file, the own cloud platform will store the operation log file, and the own cloud platform will then display the storage result on the WeChat applet.

10. A device for interacting with PLC via Bluetooth using WeChat applet, characterized in that: include: The Bluetooth module is located inside the PLC device and is used to establish a Bluetooth connection with the user's mobile phone; A PLC other service module is arranged inside the PLC device, and the Bluetooth module is communicatively connected with the PLC other service module; A Bluetooth firmware is disposed inside the PLC device, and the Bluetooth firmware is used to connect the Bluetooth device and other service modules of the PLC; Own cloud platform, connected with WeChat mini program.