Method and device for debugging serial port instrument based on Bluetooth mode

By converting the 485 interface of the smart meter to Bluetooth mode, and combining it with a mobile app and cloud platform, the limitations of operating space and the high level of expertise required for smart meter debugging are solved, enabling convenient and efficient meter debugging.

CN121645188APending Publication Date: 2026-03-10SHENYANG INST OF AUTOMATION - CHINESE ACAD OF SCI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411208009.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-30
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

Existing methods for debugging smart meters have limitations such as operating space constraints, the need for proximity connections, the need to switch software for different types of meters, and complex and highly specialized operation, making it difficult to efficiently debug communication parameters and protocols in complex environments.

Method used

It adopts a Bluetooth-based serial port device to convert the instrument's 485 interface to Bluetooth mode, enabling contactless communication via a mobile app. It supports external battery and industrial power supply, and utilizes a cloud platform to share debugging templates and protocol libraries, simplifying the operation process.

Benefits of technology

It enables operation in complex environments without the need for local access, reduces hardware costs and professional requirements, improves debugging convenience and efficiency, and supports flexible debugging of various types of instruments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121645188A_ABST
    Figure CN121645188A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of Internet of Things, and particularly discloses a method and device for debugging a serial port instrument based on a Bluetooth mode. The device comprises a shell 1 and a shell 2, a TTL-to-485 module, a Bluetooth unvarnished transmission module and a power supply voltage reduction module are arranged in the shell 1, the shell 1 is connected with the outside through a 485 lead and a charging interface, and power supply of a 5V mobile power supply and a mobile phone interface is supported. The shell 2 is provided with a charging interface and a direct-current power supply lead and can be combined with the shell 1 to expand the power supply mode. The method comprises a connection starting workflow, a disconnection stopping workflow, a configuration transmitting and receiving workflow and a data transmitting and receiving workflow of the Bluetooth serial port device. And a main body working process of the applet debugging software, a platform template debugging task process and a user-defined configuration debugging process. Compared with the prior art, the debugging work of the serial port instrument is optimized from the aspects of line connection, a debugging device, integrated debugging software, industry experience sharing and the like. Debugging hardware cost, environment limitation and personnel experience requirements are reduced, and debugging efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of Internet of Things (IoT) technology, specifically a method and device for debugging serial port instruments based on Bluetooth. Background Technology

[0002] To address the development of the energy Internet of Things and the increasing demands of factories for energy information systems, more and more traditional energy metering instruments are being replaced by smart meters with communication interfaces. Currently, the market offers a wide variety of smart meters, including those conforming to industry standards or the universal Modbus protocol, as well as numerous proprietary or extended protocols. These different types of smart meters differ in their interface protocols and variable locations. While instrument manufacturers typically provide PC-based debugging software, this software cannot meet all usage scenarios.

[0003] When smart meters experience interface communication errors, abnormal remote readings, inconvenient panel operation, or require access to parameters of newly networked meters, debugging personnel need to perform instrument debugging via the communication interface. Currently, the common debugging method involves connecting the meter to a laptop via a USB-to-serial adapter and extension cable, and using debugging software tools installed on the laptop for data transmission and reception. However, this method faces numerous challenges in complex factory environments, such as limitations on the use of serial extension cables, the inability of personnel to operate them nearby, and the difficulty in finding suitable locations for laptops.

[0004] Debugging different types of smart meters often requires switching between different debugging software, as these programs frequently lack a unified user interface. Furthermore, while feature-rich serial port debugging assistants allow manual editing, sending, and receiving of query and response frames based on the meter's protocol documentation, manual parsing and processing are still necessary. Since each smart meter has its own unique user manual, debugging personnel must consult and operate each one individually, which not only requires specialized knowledge but also increases operational complexity, making it less convenient and efficient compared to dedicated debugging software.

[0005] Although existing technologies can debug and verify whether the communication function is normal, and locate information such as the instrument's communication protocol, communication parameters, and instrument address, there are also obvious shortcomings:

[0006] 1. Typically, when debugging instruments, a serial cable needs to be connected between the instrument and the debugging equipment, which restricts the operator's operating space;

[0007] 2. Different types of dedicated testing software need to be downloaded, installed, and switched between, and are usually on a PC, which is inconvenient for operators to carry and operate in a timely manner;

[0008] 3. Using serial port debugging tools based on the instrument manual to send query frames and parse response frames is difficult and requires operators to have certain professional skills.

[0009] The urgent problem to be solved is to invent a low-cost, small-sized, and portable debugging method and device that can free operators from the limitations of local operation and enable non-contact communication between instruments and debugging equipment; and to assist non-professional operators in efficiently finding the communication protocols and parameters of various types of instruments and verifying whether the instrument communication function is normal. Summary of the Invention

[0010] To address the aforementioned technical problems, this invention provides a method and apparatus for debugging serial port instruments using Bluetooth. This apparatus is low-cost, small in size, lightweight, and portable, and supports external battery power, mobile phone interface power, and wide-voltage industrial DC power supply. The apparatus can convert the RS485 interface with different communication parameters of the instrument into Bluetooth mode, enabling contactless two-way communication with mobile debugging software.

[0011] The technical solution adopted by the present invention to achieve the above objectives is as follows:

[0012] A method for debugging a serial port instrument based on Bluetooth includes the following steps:

[0013] 1) Bluetooth serial port device connection to host is enabled;

[0014] 2) Sending and receiving configuration information with the host;

[0015] 3) Sending and receiving data with the host;

[0016] 4) The Bluetooth serial port device is disconnected from the host and is disabled.

[0017] Step 1) includes the following steps:

[0018] 1.1) The Bluetooth serial port device enters Bluetooth slave mode, periodically sends fixed broadcast data, and waits for the host to connect;

[0019] 1.2) Check if a host connection request has been received. If a request is received, establish a connection with the host device and enable Bluetooth connection status monitoring. Otherwise, continue to wait for the host to connect.

[0020] 1.3) Receive the authentication information sent by the host and verify it. If the verification is successful, start the configuration and data transmission and reception process; otherwise, continue to wait for the host to connect.

[0021] 1.4) Return a connection success message to the host.

[0022] Step 2) includes the following steps:

[0023] 2.1) The configuration channel waits for configuration information sent by the host;

[0024] 2.2) Determine if configuration information has been received. If received, verify it; otherwise, continue waiting for configuration information.

[0025] 2.3) Determine if the verification is successful. If successful, update the device serial port configuration information according to the issued configuration information; otherwise, continue to wait for configuration information.

[0026] 2.4) Send configuration response information to the host through the configuration channel and return to step 2.1).

[0027] Step 3) includes the following steps:

[0028] 3.1) The data receiving channel waits for the host to send data;

[0029] 3.2) Determine whether data has been received from the host. If received, send the data to the instrument; otherwise, continue waiting for data.

[0030] 3.3) Determine whether a response has been received from the instrument. If a response is received, send the data to the host and return to step 3.1). Otherwise, continue to wait for data.

[0031] Step 4) includes the following steps:

[0032] 4.1) Receive Bluetooth connection loss trigger signal;

[0033] 4.2) Determine whether the configuration and data channels are enabled. If enabled, disable the configuration and data channels; otherwise, periodically send fixed broadcast data and wait for host connection.

[0034] The host computer debugs the Bluetooth serial port device using a mini-program debugging software, specifically including the following steps:

[0035] (1) Search for external Bluetooth devices, automatically filter the searched Bluetooth device name information, select the Bluetooth serial port device to be configured, and automatically establish a Bluetooth connection.

[0036] (2) Send authentication information to the Bluetooth serial port device and receive a successful authentication response, obtain device parameter modification permission, complete Bluetooth configuration successfully, and set the relevant flags;

[0037] (3) Determine whether to use the platform template to debug the task process based on the front-end configuration information. If the platform template is used to debug the task process, execute step (4); otherwise, execute step (5).

[0038] (4) Execute the platform template debugging task process. When the test is successful or the task boundary conditions are exceeded, end the current process and execute step (6).

[0039] (5) Execute the custom configuration debugging process, and then execute step (6);

[0040] (6) Display the debugging parameters and results, and determine whether the relevant parameter configuration information has been received from the reporting platform. If received, report the current debugging parameters to the cloud platform and store them as an instrument template according to a fixed format name. Otherwise, continue to wait for the relevant parameter configuration information.

[0041] The platform template debugging task process includes the following steps:

[0042] (4.1) The mini-program debugging software accesses the cloud platform to obtain the protocol template and debugging task of the corresponding instrument model based on the input instrument model or protocol type, and outputs the obtained default parameters to the front-end interface.

[0043] (4.2) Generate a sequence of query frames according to the configured address rules;

[0044] (4.3) According to the task serial port rules, send the serial communication parameter configuration information to the Bluetooth serial port device through the configuration channel in accordance with the format requirements;

[0045] (4.4) Monitor the Bluetooth configuration channel and wait to receive response data from the Bluetooth serial port device;

[0046] (4.5) The configuration channel receives the response data from the Bluetooth serial port device and verifies the response data according to the parameter configuration format. If the verification passes, the channel sends the currently generated query frame to the Bluetooth serial port device through the Bluetooth data channel; otherwise, the channel is reconfigured and returns to step (4.3).

[0047] (4.6) Monitor the Bluetooth data channel and wait for the response data from the Bluetooth serial port device;

[0048] (4.7) Within the configured timeout period, determine whether the response data from the Bluetooth serial port device has been received. If the response data is received, call the template protocol of the cloud platform to parse the response data, obtain the result, and output the parsed result and the current corresponding parameter configuration to the front-end interface. Otherwise, execute step (4.8).

[0049] (4.8) Determine whether the current serial port rule has been executed. If it has been executed, proceed to (4.9); otherwise, continue to adjust the serial port configuration parameters according to the rule and return to step (4.2).

[0050] (4.9) If no response is received after the debugging task is completed, output the result to the front-end interface.

[0051] The custom configuration debugging process includes the following steps:

[0052] (5.1) Read the front-end interface configuration and obtain various configuration parameters;

[0053] (5.2) Call the cloud platform protocol library to generate an inquiry frame;

[0054] (5.3) Send serial communication parameter configuration information to the Bluetooth serial port device according to the format requirements;

[0055] (5.4) Monitor the Bluetooth configuration channel and wait to receive response data from the Bluetooth serial port device;

[0056] (5.5) The configuration channel receives the response data from the Bluetooth serial port device and verifies the response data according to the parameter configuration format. If the verification passes, the channel sends the currently generated query frame to the Bluetooth serial port device through the Bluetooth data channel; otherwise, an error is reported and step (5.8) is executed.

[0057] (5.6) Monitor the Bluetooth data channel and wait for the response data from the Bluetooth serial port device;

[0058] (5.7) Within the configured timeout period, determine whether the response data from the Bluetooth serial port device has been received. If the response data is received, call the template protocol of the cloud platform to parse the response data and obtain the result. Otherwise, execute step (5.8).

[0059] (5.8) When the parsing is normal, the parsing result and the current corresponding parameter configuration are output to the front-end interface. If the parsing fails, the error message is output to the front-end interface.

[0060] A Bluetooth serial port device for debugging serial port instruments based on Bluetooth includes a main body and an expansion part, wherein,

[0061] The main body includes: a TTL to 485 module, a Bluetooth transparent transmission module, and a power step-down module connected in sequence. The TTL to 485 module is also connected to the power step-down module, the 485 lead, the power status indicator, and the serial port transceiver indicator. The power step-down module is connected to the female charging interface. The TTL to 485 module, the Bluetooth transparent transmission module, the power step-down module, the power status indicator, the serial port transceiver indicator, and the female charging interface are all located inside the first housing.

[0062] The extension includes a charging interface sub-port located within the second housing and a DC power lead connected thereto.

[0063] The present invention has the following beneficial effects and advantages:

[0064] 1. This invention utilizes an externally powered 485 to Bluetooth device, eliminating the need for serial port connection cables and matching conversion devices between debugging equipment and instruments, thus eliminating the need for local debugging, overcoming location limitations, and reducing costs.

[0065] 2. This invention utilizes a mobile app for debugging to perform complex debugging functions on various types of instruments, eliminating the need for PCs and other debugging equipment, reducing costs, and improving debugging convenience.

[0066] 3. The mini-program debugging software of the present invention can obtain debugging templates from the table protocol sharing knowledge base of the cloud platform instrument, and supports flexible debugging methods, reducing debugging difficulty and improving debugging efficiency. Attached Figure Description

[0067] Figure 1 A schematic diagram of the main body of the Bluetooth serial port device of the present invention;

[0068] Figure 2 A schematic diagram of the Bluetooth serial port device extension section of the present invention;

[0069] Figure 3 Hardware system block diagram of the main body of the Bluetooth serial port device of the present invention;

[0070] Figure 4 A schematic diagram of the combined structure of the Bluetooth serial port device of the present invention;

[0071] Figure 5 The Bluetooth serial port device connection activation workflow diagram of the present invention;

[0072] Figure 6 The Bluetooth serial port device disconnection and shutdown process diagram of the present invention;

[0073] Figure 7 The Bluetooth serial port device configuration and transmission / reception workflow diagram of the present invention;

[0074] Figure 8 A flowchart illustrating the data transmission and reception process of the Bluetooth serial port device of the present invention;

[0075] Figure 9 The main workflow diagram of the mini-program debugging software of the present invention;

[0076] Figure 10 Flowchart of debugging tasks for the mini-program debugging software platform template of the present invention;

[0077] Figure 11 The flowchart of the custom configuration debugging process for the mini-program debugging software of the present invention. Detailed Implementation

[0078] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments.

[0079] This invention provides a device for debugging serial port instruments based on Bluetooth. The Bluetooth serial port device includes a main body and an extension part.

[0080] like Figure 1 As shown, the main body includes a housing 1, a 485 lead wire 3, a charging interface 4, a power status indicator 5, and a serial port transceiver indicator 6.

[0081] like Figure 2 As shown, the extension part includes a housing 2, a charging interface 7, and a DC power lead 8.

[0082] One end of the housing 1 is equipped with a 485 lead 3, and next to it are a power status indicator 5 and a serial port transceiver indicator 6. The other end of the housing 1 is equipped with a charging interface 4.

[0083] like Figure 3 As shown, the internal hardware system of the housing 1 includes a TTL to 485 module, a Bluetooth pass-through module, and a power step-down module. The charging interface 4 and the power step-down module are connected via a power signal line. The power step-down module is connected to the Bluetooth pass-through module and the TTL to 485 module via the power signal line. The Bluetooth pass-through module and the TTL to 485 module are connected via a data signal. The 485 lead 3 and the TTL to 485 module are connected via a data signal.

[0084] One end of the housing 2 is provided with a charging interface 7, and the other end of the housing 2 is provided with a DC power lead 8. The charging interface 7 and the DC power lead 8 are connected inside the housing 2 via a power signal line.

[0085] like Figure 4 As shown, housing 1 and housing 2 can be combined together through charging interface 4 and charging interface 7 to form a combined device 9, changing the power supply of the device body to external lead power supply, thus expanding the power supply method and range of the device.

[0086] Furthermore, when the device is powered on, the power status indicator 5 remains constantly lit.

[0087] Furthermore, when the TTL to 485 module receives or sends data, the serial port transmit / receive status indicator light 6 will light up; otherwise, it will remain off.

[0088] Furthermore, the charging port 4 of the casing 1 supports 5V power supply and mobile phone interface power supply.

[0089] Furthermore, the external leads are powered by a wide voltage range of 5-30V DC, allowing for convenient access to power from nearby sources.

[0090] A method for debugging serial port instruments based on Bluetooth mainly includes: a Bluetooth serial port device connection and activation workflow, a disconnection and deactivation workflow, a configuration and transmission workflow, and a data transmission and reception workflow; and a mini-program debugging software workflow.

[0091] The connection activation workflow for Bluetooth serial devices is as follows: Figure 5 As shown, it includes the following steps:

[0092] S101: The Bluetooth pass-through module enters Bluetooth slave mode;

[0093] S102: Periodically sends fixed broadcast data, waiting for host connection;

[0094] S103: Check if a host connection request has been received. If a request is received, execute S104; otherwise, execute S102.

[0095] S104: The Bluetooth pass-through module establishes a connection with the host device and enables Bluetooth connection status monitoring;

[0096] S105: The Bluetooth pass-through module receives the authentication information sent by the host and performs authentication verification.

[0097] S106: If the host authentication information is authenticated through the Bluetooth pass-through module, execute S107; otherwise, if the authentication fails, execute S102.

[0098] S107: Start the configuration and data transmission / reception process;

[0099] S108: Returns a connection success message to the host.

[0100] Furthermore, the so-called authentication information refers to a structural parameter agreed upon by this device, including parameter name and parameter value.

[0101] Furthermore, the so-called authentication verification involves comparing the received data with the authentication information agreed upon by this device to prevent other Bluetooth hosts from configuring the parameters of this device's Bluetooth serial port module.

[0102] The disconnection and deactivation process of the Bluetooth serial port device is as follows: Figure 6 As shown, it includes the following steps:

[0103] S111: Receives Bluetooth connection loss trigger signal;

[0104] S112: Determine if the configuration and data channel are enabled. If enabled, execute S113; otherwise, execute S114.

[0105] S113: Close the configuration channel and data channel processing flow;

[0106] S114: The Bluetooth pass-through module periodically sends fixed broadcast data and waits for the host to connect.

[0107] Furthermore, the so-called configuration channel refers to the custom transmission channel of this Bluetooth pass-through module, where the UUID is 0xFFF3.

[0108] The configuration and transmission / reception workflow of the Bluetooth serial port device is as follows: Figure 7 As shown, it includes the following steps:

[0109] S121: The configuration channel is waiting to receive configuration data sent by the host;

[0110] S122: Determine if configuration data has been received. If received, execute S123; otherwise, execute S121.

[0111] S123: Verify the issued configuration data;

[0112] S124: Determine whether the configuration data sent has been successfully verified. If successful, execute S125; otherwise, execute S121.

[0113] S125: Update the Bluetooth device serial port configuration information based on the issued configuration data;

[0114] S126: Send configuration response information to the host through the configuration channel and execute S121.

[0115] Furthermore, the so-called Bluetooth serial port configuration information includes: baud rate and parity bit.

[0116] Furthermore, the so-called verification refers to the calculation and checking of the data frame structure, functional byte parameters, and check bits in the frame structure of the configuration data format.

[0117] The data transmission and reception workflow of the Bluetooth serial port device is as follows: Figure 8 As shown, it includes the following steps:

[0118] S131: The data receiving channel is waiting for the host to send data;

[0119] S132: Determine whether the data has been received. If received, execute S133; otherwise, execute S131.

[0120] S133: Data is sent to the instrument via a TTL to 485 converter;

[0121] S134: Determine if the transmitter has received a response from the instrument. If it has, execute S135; otherwise, execute S131.

[0122] S135: The data transmission channel sends instrument response data to the host, executing S131.

[0123] The main workflow of the mini-program debugging software is as follows: Figure 9 As shown, it includes the following steps:

[0124] S201: The mobile app debugging software is loaded and the mobile device's Bluetooth is enabled. It then begins searching for external Bluetooth devices.

[0125] S202: The debugging software automatically filters the searched Bluetooth device name information, selects the Bluetooth serial port device of the present invention, and automatically establishes a Bluetooth connection;

[0126] S203: The debugging software sends authentication information to the Bluetooth serial port device and receives a successful authentication response, thus obtaining permission to modify device parameters;

[0127] S204: Bluetooth configuration completed successfully, and relevant flags set. Enter debugging process S205;

[0128] S205: Determine whether to use the platform template to debug the task flow based on the front-end configuration information of the mini-program debugging software. If the platform template is used to debug the task flow, execute S206; otherwise, execute S207.

[0129] S206: Execute the platform template debugging task process. If the test is successful or the task boundary conditions are exceeded, the process will exit and S208 will be executed.

[0130] S207: The mini-program debugging software executes the custom configuration debugging process, and then executes S208 after completion;

[0131] S208: The mini-program debugging software displays debugging parameters and results;

[0132] S209: The mini-program debugging software determines whether it has received relevant parameter configuration information from the reporting platform. If it has, it executes S210; otherwise, it does not.

[0133] S210: The mini-program debugging software reports the current debugging parameters to the cloud platform and stores them as an instrument template according to a fixed format name.

[0134] Furthermore, the term "mobile terminal" mainly refers to mobile phones, smartphones with multiple application functions, and tablets. This invention relies on WeChat mini programs and does not limit the operating system of the mobile terminal.

[0135] Furthermore, the so-called device parameter modification permission refers to the ability of mobile software to modify the serial communication parameters of a Bluetooth serial port device via Bluetooth, including the baud rate and parity bit.

[0136] Furthermore, the so-called task boundary conditions include default conditions and conditions set by the operator, specifically including baud rate ranges of 1200, 2400, 4800, and 9600, parity bits of NONE and EVEN, and address ranges of 0-247 for Modbus RTU and Modbus ASCII.

[0137] Furthermore, the relevant parameter configuration information for the reporting platform is configured by the user entering a fixed format name and triggering the report to the cloud platform button, which transmits the command to the backend.

[0138] Furthermore, the fixed format name includes the instrument manufacturer, series, model, sub-model, supported protocol structure, and details, arranged in alphabetical and numerical order.

[0139] Furthermore, the platform template debugging task process is as follows: Figure 10 As shown, it includes:

[0140] S221: The mini-program debugging software accesses the cloud platform to obtain the corresponding instrument's protocol template and debugging task based on the input instrument model or protocol type, and outputs the obtained default parameters to the front-end interface.

[0141] S222: Generate a sequence of query frames according to the configured address rules;

[0142] S223: According to the task serial port rules, send serial port configuration information to the Bluetooth serial port device through the configuration channel in accordance with the format requirements;

[0143] S224: Monitor the Bluetooth configuration channel and wait to receive response data from the Bluetooth serial port device;

[0144] S225: If the configuration channel receives the response data from the Bluetooth serial port device and the response data is successfully verified according to the parameter configuration format, proceed to S226; otherwise, reconfigure and proceed to S223.

[0145] S226: The debugging software sends the currently generated query frame to the Bluetooth serial port device through the Bluetooth data channel;

[0146] S227: Monitor the Bluetooth data channel and wait for response data from the Bluetooth serial port device;

[0147] S228: Within the configured timeout period, determine whether a response data has been received from the Bluetooth serial port device. If a response data has been received, execute S229; otherwise, execute S231.

[0148] S229: The mini-program debugging software calls the cloud platform's template protocol, parses the response data, and obtains the result;

[0149] S230: Output the parsed results and the corresponding current parameter configuration to the front-end interface;

[0150] S231: Determine whether the current serial port rule has been executed. If it has been executed, it means that the adjustment of the serial port parameters still cannot get a response. Execute S232; otherwise, continue to adjust the serial port configuration parameters according to the rule and execute S223.

[0151] S232: Determine whether the current address rule has been executed. If it has been executed, it means that the query frame generated for the current address still cannot get a response, and execute S232; otherwise, continue to adjust the address parameters according to the rule and execute S222.

[0152] S233: Debugging task failed. The current instrument communication module is not working. Output results to the front-end interface.

[0153] Furthermore, the protocol types include: CJT188, DLT645-1997, DLT645-2007, DLT698.45 protocols and ModbusRTU and ModbusASCII protocols.

[0154] Furthermore, the protocol template includes: communication parameters, instrument address, instrument protocol, cumulative quantity query frame and rules, response frame data location and parsing rules.

[0155] Furthermore, the address rules include: selected range addresses and their variation patterns, broadcast addresses corresponding to the protocol, and user-defined fixed addresses.

[0156] Furthermore, the address serial port includes: the changing order of the parity bit and baud rate, the changing range of the parity bit for different protocol types, and the changing range of the baud rate.

[0157] Furthermore, the custom configuration debugging process is as follows: Figure 11 As shown, it includes:

[0158] S241: Read the front-end interface configuration and obtain various configuration parameters;

[0159] S242: The mini-program debugging software calls the cloud platform protocol library to generate an inquiry frame;

[0160] S243: The mini-program debugging software sends serial port configuration information to the Bluetooth serial port device according to the format requirements through the configuration channel;

[0161] S244: Monitor the Bluetooth configuration channel and wait to receive response data from the Bluetooth serial port device;

[0162] S245: If the configuration channel receives the response data from the Bluetooth serial port device and the response data is successfully verified according to the parameter configuration format, proceed to S246; otherwise, report an error and proceed to S250.

[0163] S246: The debugging software sends the currently generated query frame to the Bluetooth serial port device through the Bluetooth data channel;

[0164] S247: Monitor the Bluetooth data channel and wait for response data from the Bluetooth serial port device;

[0165] S248: Within the configured timeout period, determine whether a response data has been received from the Bluetooth serial port device. If a response data has been received, execute S249; otherwise, execute S250.

[0166] S249: The mini-program debugging software calls the cloud platform's template protocol, parses the response data, and obtains the result;

[0167] S250: When parsing is normal, the parsing result and the current corresponding parameter configuration are output to the front-end interface. When an error occurs, the error message is output to the front-end interface.

[0168] Furthermore, the various configuration parameters include: serial communication parameters, instrument address, protocol type, extended precision selection in the DLT698.45 protocol, function code selection in Modbus RTU and Modbus ASCII protocols, starting address, data length, and CRC order selection. Also included are the register offset address for the accumulated amount, data format, and byte order.

[0169] The debugging software can be used via a mini-program and has no restrictions on mobile devices. Southbound communication supports bidirectional communication between the mobile device and Bluetooth serial port devices; northbound communication supports bidirectional communication with the cloud platform, accessing the cloud platform interface to obtain test tasks, instrument query frames, and response frame parsing results. The debugging software interface can receive configuration parameters and display debugging results.

[0170] The cloud platform supports various common standard and general protocol libraries and debugging task templates, and supports external calls. In addition to supporting the input of standard protocol templates, it also supports the storage of user-defined debugging data templates, and improves the shared knowledge base of instrument debugging task templates.

[0171] Example

[0172] The factory's energy metering instruments mainly include water, electricity, gas, and heat meters, distributed throughout the plant according to management and wiring layout. In practical applications, the instruments being collected typically need to be converted and networked, and then connected to an edge gateway via network conversion devices; this usually results in a device-network-gateway structure. During initial network setup, instrument failure, or instrument replacement, it is necessary to debug the instruments to verify their communication functions and obtain the corresponding communication parameters and protocols in order to locate the fault and optimize the instrument network data collection.

[0173] Example 1 of specific instrument debugging:

[0174] The electricity meter at a certain location on site is a Chint DTX-XX1 model. The meter has a 485 interface and needs to be debugged to determine the meter's communication parameters, communication protocol, and to verify the accuracy of the data.

[0175] In this embodiment, after arriving at the site, the operator performs the following operations:

[0176] The Bluetooth device is connected to the instrument's 485 interface via a 485 external cable, and is powered by a portable power bank. Then, the debugging software is opened, and the debugging interface is accessed.

[0177] Select DLT645-1997 as the instrument protocol, use the default address 99 99 99 99 9999 for the instrument communication address, select the default communication parameters, select the cumulative quantity: total positive active energy reading, and click the debug button to start the custom configuration debug process.

[0178] The mini-program debugging software reads the front-end interface configuration, the protocol type is DLT645-1997, the instrument address is 99 9999 9999 99, obtains the default serial port parameter 2400EVEN, and the register offset address of the accumulated amount is 9010.

[0179] The mini-program debugging software carries configuration parameters, calls the cloud platform protocol library, and generates a cumulative quantity query frame with the format: FE FE FE FE 68 99 99 99 99 99 99 68 01 02 43C3 6F 16.

[0180] The mini-program debugging software sends serial port configuration information 2400EVEN to the Bluetooth serial port device through the configuration channel according to the format requirements. The format is: 06 00 09 00B0 04 00 00 08 01 02 74.

[0181] Monitor the Bluetooth configuration channel and wait to receive response data from the Bluetooth serial port device.

[0182] The configuration channel received response data from the Bluetooth serial port device in the format: 06 00 09 00 60 09 00 000801 02 74. The response data was successfully verified according to the parameter configuration format, that is, 74 is the sum of 00 and 60 09 0000 08 01 02.

[0183] The mini-program debugging software sends the currently generated query frame to the Bluetooth serial port device via the Bluetooth data channel.

[0184] Monitor the Bluetooth data channel and wait for response data from the Bluetooth serial port device.

[0185] If no response data is received within the configured timeout period of 1000ms, the current custom configuration debugging process ends and the debugging fails.

[0186] The user continues to modify the configuration parameters.

[0187] The mini-program debugging software reads the front-end interface configuration, protocol type DLT645-2007, instrument address AA AA AAAA AA AA, obtains the default serial port parameter 2400EVEN, and the register offset address of the accumulated amount 00000100.

[0188] The mini-program debugging software carries configuration parameters, calls the cloud platform protocol library, and generates a cumulative quantity query frame with the format: FE FE FE FE 68AA AA AA AA AA AA 68 11 04 33 33 34 33AE 16.

[0189] The mini-program debugging software sends serial port configuration information 2400EVEN to the Bluetooth serial port device through the configuration channel according to the format requirements. The format is: 06 00 09 00 60 09 00 00 08 01 02 74.

[0190] Monitor the Bluetooth configuration channel and wait to receive response data from the Bluetooth serial port device.

[0191] The configuration channel received response data from the Bluetooth serial port device in the format: 06 00 09 00 60 09 00 000801 02 74. The response data was successfully verified according to the parameter configuration format, that is, 74 is the sum of 00 and 60 09 0000 08 01 02.

[0192] The mini-program debugging software sends the currently generated query frame to the Bluetooth serial port device via the Bluetooth data channel.

[0193] Monitor the Bluetooth data channel and wait for response data from the Bluetooth serial port device.

[0194] Within the configured timeout period of 1000ms, the response data is received in the following format: FE FE FE FE 6806 0000 00 00 00 68 91 08 33 33 34 33C9 37 33 33A2 16.

[0195] The mini-program debugging software calls the cloud platform's built-in template protocol, parses the response data, and obtains the following results:

[0196] Address: 00 00 00 00 00 06

[0197] Control code: 91

[0198] Length: 08

[0199] Data identifier: 00 01 00 00

[0200] Data: 00 00 04 96

[0201] (Current) Total positive active power: 4.96

[0202] The analysis result "Total positive active energy: 4.96" and the corresponding current parameter configuration are output to the front-end interface. The read data is compared with the dial reading; if they match, the debugging is successful. The debugging information of this instrument is as follows:

[0203] The address is 00 00 00 00 00 06;

[0204] The communication baud rate is 2400;

[0205] The communication check bit is EVEN;

[0206] The supported protocol is DLT645-2007.

[0207] The cumulative reading is normal.

[0208] The mini-program detects the trigger button of the report to the cloud platform, obtains the relevant parameter configuration, and reports the debugging process parameters and results to the cloud platform in the format of "manufacturer Chint, series DTX, model DTX-XX1, protocol DLT645-2007", and stores it as a debugging protocol template.

[0209] Users can then search for DTX series or DTX-XX1 model instruments through the cloud platform and directly apply the preset debugging template to obtain the default debugging parameters, thus achieving a fast and convenient debugging process and simplifying the entire debugging process.

[0210] Example 2 of specific instrument debugging:

[0211] The steam totalizer at a certain location on site is model FLC-26XX from Feilong. The totalizer has a 485 interface and needs to be debugged to determine the instrument communication parameters, communication protocol, and verify the accuracy of the data.

[0212] In this embodiment, after arriving at the site, the operator performs the following operations:

[0213] The Bluetooth device is connected to the instrument's 485 interface via a 485 external cable, and the Bluetooth serial port device is powered by the field power supply. Open the mini-program, search for the Feilong FLC-26XX model, and after a successful search, click the debug button to start the platform template debugging task process.

[0214] The mini-program debugging software accesses the cloud platform to obtain the protocol template and debugging task for the FLC-26XX model instrument based on the input instrument model FLC-26XX, and outputs the obtained default parameters to the front-end interface.

[0215] According to the configured address rules, the new table uses the default address 01 and generates a query frame sequence in the format: 01 03 000B 00 04 35CB;

[0216] According to the task serial port rules: the default parity bit for the Feilong FLC-26XX model template is NONE, and the baud rate range is 1200-9600 incremented during debugging. The initial template default is 1200NONE. The mini-program debugging software sends the serial port configuration information 1200NONE to the Bluetooth serial port device through the configuration channel according to the format requirements. The format is: 06 00 09 00 4B 00 00 00 08 01 0054.

[0217] Monitor the Bluetooth configuration channel and wait to receive response data from the Bluetooth serial port device.

[0218] The configuration channel received response data from the Bluetooth serial port device in the format: 06 00 09 00 4B 00 00 000801 00 54. The response data was successfully verified according to the parameter configuration format, that is, 54 is the sum of 00 and 4B 00 0000 08 01 00.

[0219] The mini-program debugging software sends the currently generated query frame to the Bluetooth serial port device via the Bluetooth data channel.

[0220] Monitor the Bluetooth configuration channel and wait to receive response data from the Bluetooth serial port device.

[0221] No response data was received within the configured timeout period of 3000ms.

[0222] If the mini-program determines that the serial port rules have not been completed, it automatically modifies the configuration parameters to: 2400NONE.

[0223] The mini-program debugging software sends the serial port configuration information 2400NONE to the Bluetooth serial port device through the configuration channel according to the format requirements. The format is: 06 00 09 00 60 09 00 00 08 01 02 74.

[0224] Monitor the Bluetooth configuration channel and wait to receive response data from the Bluetooth serial port device.

[0225] The configuration channel received response data from the Bluetooth serial port device in the format: 06 00 09 00 60 09 00 000801 02 74. The response data was successfully verified according to the parameter configuration format, that is, 74 is the sum of 00 and 60 09 0000 08 01 02.

[0226] The mini-program debugging software sends the currently generated query frame to the Bluetooth serial port device via the Bluetooth data channel.

[0227] Monitor the Bluetooth configuration channel and wait to receive response data from the Bluetooth serial port device.

[0228] Within the configured timeout period of 3000ms, a response data was received in the format: 01 03 04 39 300000a0 f6.

[0229] The mini-program debugging software calls the FLC-26XX template protocol of the cloud platform, parses the response data, and obtains the following results:

[0230] Address: 01

[0231] Function code: 03

[0232] Length: 04

[0233] Data: 39 30 00 00

[0234] Total traffic: 12345

[0235] The parsed result "Cumulative Flow: 12345" and the corresponding current parameter configuration are output to the front-end interface. The read data is compared with the dial reading; if they match, the debugging is successful. The debugging information for this instrument is as follows:

[0236] The address of this instrument is: 01;

[0237] The communication baud rate is 4800;

[0238] The communication check bit is: NONE;

[0239] The supported protocol is the FLC-26XX protocol;

[0240] The cumulative reading is normal.

[0241] In this example, since the cloud platform has the FLC-26XX protocol, the operation only required two steps: model search and selection, and clicking the debug button. This completed the instrument platform template debugging task and obtained the debugging results.

[0242] This invention optimizes the debugging process of serial port instruments from aspects such as circuit connection, debugging device, integrated debugging software, and industry experience sharing. It reduces debugging hardware costs, environmental limitations, and personnel experience requirements, while improving debugging efficiency and industry resource sharing.

Claims

1. A method for debugging a serial instrument based on Bluetooth, characterized in that, The method comprises the following steps: 1) enabling the Bluetooth serial device to connect with the host; 2) transmitting and receiving configuration information with the host; 3) transmitting and receiving data with the host; 4) disabling the Bluetooth serial device to connect with the host.

2. The method for debugging serial instruments based on Bluetooth mode according to claim 1, characterized in that, The step 1) comprises the following steps: 1.1) entering the Bluetooth slave mode, sending fixed broadcast data, and waiting for the host to connect; 1.2) detecting whether the host connection request is received, if yes, establishing the connection with the host, starting the Bluetooth connection state monitoring, otherwise, continuing to wait for the host to connect; 1.3) receiving the authentication information sent by the host, and performing authentication verification, if the verification is passed, starting the configuration and data transmission process, otherwise, continuing to wait for the host to connect; 1.4) returning the connection success information to the host.

3. The method for debugging serial instruments based on Bluetooth mode according to claim 1, characterized in that, The step 2) comprises the following steps: 2.1) configuring the channel to receive the configuration information sent by the host; 2.2) judging whether the configuration information is received, if yes, performing the verification, otherwise, continuing to wait for the configuration information; 2.3) judging whether the verification is successful, if yes, updating the device serial port configuration information according to the configuration information sent, otherwise, continuing to wait for the configuration information; 2.4) sending the configuration response information to the host through the configuration channel, and returning to step 2.1).

4. The method for debugging serial instruments based on Bluetooth mode according to claim 1, characterized in that, The step 3) comprises the following steps: 3.1) waiting for the host to send data; 3.2) judging whether the data sent by the host is received, if yes, sending the data to the instrument, otherwise, continuing to wait for the data; 3.3) judging whether the response of the instrument is received, if yes, sending the data to the host, and returning to step 3.1), otherwise, continuing to wait for the data.

5. The method for debugging serial instruments based on Bluetooth mode according to claim 1, characterized in that, The step 4) comprises the following steps: 4.1) receiving the Bluetooth disconnection trigger signal; 4.2) judging whether the configuration and data channels are opened, if yes, closing the configuration channel and the data channel, otherwise, sending the fixed broadcast data, and waiting for the host to connect.

6. The method for debugging serial instruments based on Bluetooth mode according to claim 1, characterized in that, The host performs the debugging on the Bluetooth serial device through the small program debugging software, and specifically comprises the following steps: (1) searching for the external Bluetooth device, automatically screening the Bluetooth device name information, selecting the Bluetooth serial device to be configured, and automatically establishing the Bluetooth connection; (2) sending the authentication information to the Bluetooth serial device and receiving the authentication success response, obtaining the device parameter modification authority, completing the Bluetooth configuration, and setting the related flag; (3) judging whether the platform template debugging task process is used according to the front-end configuration information, if yes, executing step (4), otherwise, executing step (5); (4) executing the platform template debugging task process, when the test is successful or the task boundary condition is exceeded, ending the current process, and executing step (6); (5) executing the self-defined configuration debugging process, and executing step (6) after finishing; (6) displaying the debugging parameters and results, and judging whether the related parameter configuration information is received, if yes, reporting the current debugging parameters to the cloud platform, and storing the instrument template in the fixed format name, otherwise, continuing to wait for the related parameter configuration information.

7. The method for debugging a serial instrument based on Bluetooth according to claim 6, characterized in that, The platform template debugging task process comprises the following steps: (4.1) The applet debugging software accesses the cloud platform to obtain the protocol template and debugging task of the corresponding meter according to the input meter model or protocol type, and outputs the obtained default parameters to the front-end interface; (4.2) According to the configuration address rule, a query frame sequence is generated; (4.3) According to the task serial port rule, the serial communication parameter configuration information is sent to the Bluetooth serial port device through the configured channel according to the format requirement; (4.4) The Bluetooth configuration channel is monitored to wait for receiving the response data of the Bluetooth serial port device; (4.5) The Bluetooth serial port device receives the response data of the Bluetooth serial port device, and checks the response data according to the parameter configuration format, if the checking is passed, the current generated query frame is sent to the Bluetooth serial port device through the Bluetooth data channel, otherwise, reconfiguration is performed and step (4.3) is returned; (4.6) The Bluetooth data channel is monitored to wait for the response data of the Bluetooth serial port device; (4.7) Within the configured timeout time range, it is judged whether the response data of the Bluetooth serial port device is received, if the response data is received, the template protocol of the cloud platform is called to analyze the response data to obtain the result, and the analyzed result and the current corresponding parameter configuration are output to the front-end interface, otherwise, step (4.8) is executed; (4.8) It is judged whether the current serial port rule is executed, if the execution is completed, step (4.9) is executed; otherwise, the serial port configuration parameter is adjusted according to the rule, and step (4.2) is returned; (4.9) When the debugging task is executed, the result is output to the front-end interface if the response is not received.

8. The method for debugging a serial instrument based on Bluetooth according to claim 6, characterized in that, The custom configuration debugging process comprises the following steps: (5.1) The front-end interface configuration is read to obtain various configuration parameters; (5.2) The cloud platform protocol library is called to generate a query frame; (5.3) The serial communication parameter configuration information is sent to the Bluetooth serial port device according to the format requirement; (5.4) The Bluetooth configuration channel is monitored to wait for receiving the response data of the Bluetooth serial port device; (5.5) The Bluetooth serial port device receives the response data of the Bluetooth serial port device, and checks the response data according to the parameter configuration format, if the checking is passed, the current generated query frame is sent to the Bluetooth serial port device through the Bluetooth data channel, otherwise, an error is reported and step (5.8) is executed; (5.6) The Bluetooth data channel is monitored to wait for the response data of the Bluetooth serial port device; (5.7) Within the configured timeout time range, it is judged whether the response data of the Bluetooth serial port device is received, if the response data is received, the template protocol of the cloud platform is called to analyze the response data to obtain the result, otherwise, step (5.8) is executed; (5.8) When the analysis is normal, the analyzed result and the current corresponding parameter configuration are output to the front-end interface, if the analysis is incorrect, the error information is output to the front-end interface.

9. A Bluetooth serial device for debugging a serial instrument based on Bluetooth, characterized in that, The main part and the extension part are included, wherein, The main body part comprises: TTL-485 module, Bluetooth transparent transmission module and power down module connected in sequence, the TTL-485 module is connected with power down module, 485 lead, power state indicator lamp and serial port transceiver indicator lamp respectively, the power down module is connected with charging interface female port, the TTL-485 module, Bluetooth transparent transmission module, power down module, power state indicator lamp, serial port transceiver indicator lamp and charging interface female port are all arranged in the first shell; The expansion part comprises: charging interface male port arranged in the second shell and DC power lead connected with the charging interface male port.