Component object model based sensor data acquisition device and method of use

By using a sensor data acquisition device based on a component object model, the problems of low interface complexity and poor compatibility of sensor data communication are solved. This achieves modularity and low coupling of sensors, reduces costs and installation difficulty, and supports programming-friendly secondary development.

CN119652936BActive Publication Date: 2026-03-17WUHAN INST OF TECH
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-22
Publication Date
2026-03-17

AI Technical Summary

Technical Problem

In existing IoT sensor control technologies, the low degree of interfaceization and poor compatibility of sensor data communication result in inconvenient installation, high cost, and difficulty in secondary development.

Method used

A sensor data acquisition device based on a component object model is adopted, including a sensor, an analog-to-digital converter, a microcontroller, and a dynamic link library. The sensor is connected to the host computer through wireless or wired communication, and the dynamic link library is used for programmable data acquisition and processing.

Benefits of technology

It achieves modularization and low coupling of sensors, reducing equipment costs and installation difficulty, supports secondary development in any programming language, and facilitates the implementation of various intelligent applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119652936B_ABST
    Figure CN119652936B_ABST
Patent Text Reader

Abstract

The application discloses a kind of based on component object model sensor data acquisition device and its use method, it is related to Internet of Things sensor control technical field, including: sensor, analog-digital converter, single-chip microcomputer and based on component object model dynamic link library;Sensor is connected with single-chip microcomputer by analog-digital converter, and analog-digital converter converts the analog signal output by sensor into digital signal transmission to single-chip microcomputer;Dynamic link library is instantiated and called by arbitrary development language in host computer, and different commands are executed according to the different method of calling and interact with single-chip microcomputer;In data acquisition process, host computer calls corresponding method again, and completes the acquisition and processing of sensor data in single-chip microcomputer.The application realizes the interfacing of sensor communication and the compatibility of arbitrary programming language by using the dynamic link library based on component object model, encapsulates sensor and single-chip microcomputer as a plug-and-play module, and realizes the modularization and low coupling of sensor data acquisition equipment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of IoT sensor control technology, and in particular to a sensor data acquisition device based on a component object model and its usage method. Background Technology

[0002] In the field of IoT sensor control technology, traditional sensors require accompanying data acquisition equipment and application software. This not only results in inconvenient installation and high costs due to the need for extensive wiring and additional data acquisition devices, but also hinders flexible and convenient secondary development. For example, most current mainstream strain sensors require connection to an expensive data acquisition box, and their corresponding application software often only supports writing data to text documents, unable to import real-time data into other programs to complete various intelligent applications, such as real-time structural status analysis and structural safety early warning.

[0003] In the field of IoT technology, traditional sensors often require corresponding mobile applications. However, due to the limitations of mobile platforms, device control is limited to the functions provided by the application and cannot be further developed to realize various intelligent applications. For example, although temperature can be viewed through a mobile application, it is impossible to plot temperature time-history curves or implement functions such as temperature exceeding threshold alarms.

[0004] It is evident that overcoming the shortcomings of existing IoT sensor control technologies, such as low interface complexity and poor compatibility of sensor data communication, and high coupling caused by insufficient modularity of sensor devices, which lead to inconvenient installation, high cost, and difficulty in secondary development, is a technical problem that urgently needs to be solved in this field. Summary of the Invention

[0005] The purpose of this application is to provide a sensor data acquisition device and its usage method based on a component object model, which can solve the problems of low degree of sensor data communication interface and poor compatibility, and high coupling caused by insufficient modularity of the device in the current Internet of Things sensor control technology, thereby achieving the purpose of convenient installation, economical price, friendly programming and convenient secondary development.

[0006] To achieve the above objectives, this application provides the following solution:

[0007] In a first aspect, this application provides a sensor data acquisition device based on a component object model, comprising: a sensor, an analog-to-digital converter, a microcontroller, and a dynamic link library based on the component object model; the sensor is connected to the microcontroller through the analog-to-digital converter; the analog-to-digital converter is used to convert the analog signal output by the sensor into a digital signal and transmit the digital signal to the microcontroller; the control program on the host computer loads a device control object through the dynamic link library and calls methods therein to communicate with the microcontroller; during the data acquisition process, the host computer first communicates with the microcontroller through the wireless network, establishes a connection with the microcontroller using the corresponding method and unique device number of the device control object, and after the host computer and the microcontroller establish a connection, complete the acquisition and processing of sensor data through the corresponding method of the device control object.

[0008] Optionally, the sensor is connected to the analog-to-digital converter via data lines A and B, and the analog-to-digital converter converts the analog signal output by the sensor into a digital signal and transmits it to the microcontroller.

[0009] Optionally, the microcontroller is an ESP32 development board; the analog-to-digital converter is a TTL to RS485 circuit board; the data transmission pin of the ESP32 development board is connected to the data reception pin of the TTL to RS485 circuit board, and the data reception pin of the ESP32 development board is connected to the data transmission pin of the TTL to RS485 circuit board; the power supply pin and ground pin of the TTL to RS485 circuit board are respectively connected to the power supply pin and ground pin of the ESP32 development board; the microcontroller acquires data from the sensor via the Modbus protocol.

[0010] Optionally, the dynamic link library is a component based on the component object model, which is compatible with applications or scripts written in any programming language; the control program on the host computer loads a device control object through the dynamic link library and calls its methods to send instructions to the microcontroller.

[0011] Optionally, the communication between the microcontroller and the host computer can be either serial communication or wireless communication.

[0012] Optionally, the wireless communication is Wi-Fi communication or Bluetooth communication; the microcontroller communicates with the host computer via the TCP protocol.

[0013] Optionally, when the wireless communication is Wi-Fi communication; upon first use, the host computer and the microcontroller are connected via a wired connection, and Wi-Fi connection information is set for the microcontroller using the corresponding method of the device control object; the Wi-Fi connection information includes a Wi-Fi name and a Wi-Fi password; after the Wi-Fi connection information is set, the microcontroller will automatically connect to the wireless network and enter a listening state, facilitating access by the host computer at any time; during data acquisition, the host computer first communicates with the microcontroller through the wireless network, and establishes a connection with the microcontroller using the corresponding method of the device control object and a unique device number; after the connection between the host computer and the microcontroller is established, the acquisition and processing of sensor data are completed using the corresponding method of the device control object.

[0014] Secondly, this application provides a method for using a sensor data acquisition device based on a component object model as described above, comprising the following steps:

[0015] The analog signal output by the sensor is converted into a digital signal by an analog-to-digital converter, and the digital signal is transmitted to the microcontroller.

[0016] The host computer's control program loads a device control object through the dynamic link library and calls its methods to communicate with the microcontroller; the communication method can be wired or wireless.

[0017] During the data acquisition process, a connection is established with the microcontroller using the corresponding method and unique device number of the device control object.

[0018] After the host computer and the microcontroller establish a connection, the sensor data is collected and processed through the corresponding method of the device control object.

[0019] Optionally, when the wireless communication is Wi-Fi communication; the control program on the host computer loads a device control object through the dynamic link library and calls its methods to communicate with the microcontroller, specifically including the following steps:

[0020] Upon first use, the host computer and the microcontroller are connected via a wired connection, and Wi-Fi connection information is set for the microcontroller using the corresponding method of the device control object; the Wi-Fi connection information includes the Wi-Fi name and Wi-Fi password.

[0021] After the Wi-Fi connection information is set, the microcontroller will automatically connect to the wireless network and enter the listening state, so that the host computer can access it at any time.

[0022] During the data acquisition process, the host computer first communicates with the microcontroller through the wireless network, and establishes a connection with the microcontroller using the corresponding method of the device control object and the unique device number.

[0023] After the host computer and the microcontroller establish a connection, the sensor data is collected and processed through the corresponding method of the device control object.

[0024] Optionally, when the wireless communication is Bluetooth communication; the control program on the host computer loads a device control object through the dynamic link library and calls its methods to communicate with the microcontroller, specifically including the following steps:

[0025] Upon first use, the host computer and the microcontroller are connected via a wired connection, and Bluetooth connection information is set for the microcontroller using the corresponding method of the device control object; the Bluetooth connection information includes Bluetooth ID and Bluetooth pairing code.

[0026] After the Bluetooth connection information is set, the microcontroller will automatically connect to the Bluetooth network and enter listening mode, making it easy for the host computer to access it at any time.

[0027] During the data acquisition process, the host computer first communicates with the microcontroller through the Bluetooth network, and establishes a connection with the microcontroller using the corresponding method and unique device number of the device control object.

[0028] After the host computer and the microcontroller establish a connection, the sensor data is collected and processed through the corresponding method of the device control object.

[0029] According to the specific embodiments provided in this application, the following technical effects are disclosed:

[0030] This application provides a sensor data acquisition device and its usage method based on a component object model. The device includes: a sensor, an analog-to-digital converter (ADC), a microcontroller, and a dynamic link library (DLL) based on the component object model. The sensor is connected to the microcontroller via the ADC, which converts the analog signal output by the sensor into a digital signal and transmits the digital signal to the microcontroller. The control program on the host computer loads a device control object through the DLL and calls its methods to communicate with the microcontroller. During data acquisition, the host computer first communicates with the microcontroller via a wireless network, establishes a connection with the microcontroller using the corresponding method and unique device number of the device control object, and completes the acquisition and processing of sensor data through the corresponding method of the device control object after the connection is established. This application utilizes a component object model-based dynamic link library to achieve interface-based sensor communication and compatibility with any programming language. It encapsulates the sensor and microcontroller into a plug-and-play module, realizing the modularization and decoupling of sensor data acquisition equipment. This effectively reduces the cost and installation difficulty of sensor equipment, and makes it programming-friendly and easy for secondary development. Engineers or developers can easily obtain sensor data according to the methods provided by the dynamic link library, and on this basis, they can perform their own programming and secondary development according to their needs, thereby realizing various intelligent applications. Attached Figure Description

[0031] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0032] Figure 1 This is a schematic diagram of the structure of a sensor data acquisition device based on a component object model, provided in an embodiment of this application.

[0033] Figure 2 This is a schematic diagram of a specific example of a sensor data acquisition device based on a component object model, provided in an embodiment of this application.

[0034] Figure 3 This is a flowchart illustrating a method of using a sensor data acquisition device based on a component object model, as provided in an embodiment of this application.

[0035] Figure 4 This is a schematic diagram of code used in setting Wi-Fi connection information in a method of using a sensor data acquisition device based on a component object model, as provided in an embodiment of this application.

[0036] Figure 5This is a schematic diagram of code used in setting Bluetooth connection information in a method of using a sensor data acquisition device based on a component object model, as provided in an embodiment of this application.

[0037] Figure 6 This is a schematic diagram of code used in a method of using a sensor data acquisition device based on a component object model, as provided in an embodiment of this application, to acquire sensor data using different programming languages.

[0038] Figure 7 This is a schematic diagram of a pop-up window displaying the results of sensor data acquisition generated in a method of using a sensor data acquisition device based on a component object model according to an embodiment of this application. Detailed Implementation

[0039] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0040] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0041] In one exemplary embodiment, such as Figure 1 As shown, a sensor data acquisition device based on a component object model is provided, including: a sensor, an analog-to-digital converter (ADC), a microcontroller, and a dynamic link library (DLL) based on the component object model; the sensor is connected to the microcontroller via the ADC; the ADC converts the analog signal output by the sensor into a digital signal and transmits the digital signal to the microcontroller; the control program on the host computer loads a device control object through the DLL and calls its methods to communicate with the microcontroller; during data acquisition, the host computer first communicates with the microcontroller through the wireless network, establishes a connection with the microcontroller using the corresponding method and unique device number of the device control object, and after the connection is established between the host computer and the microcontroller, completes the acquisition and processing of sensor data through the corresponding method of the device control object.

[0042] Specifically, in Figure 1 In the structure shown, the sensor is connected to the analog-to-digital converter via data lines A and B. The analog-to-digital converter converts the analog signal output by the sensor into a digital signal and transmits it to the microcontroller.

[0043] In one exemplary embodiment, such as Figure 2The illustrated example shows a host computer running a standard x86 computer with Windows; an ESP32 development board as the microcontroller; a TTL-to-RS485 converter circuit board; and a temperature and humidity sensor. The data transmit pins of the ESP32 development board are connected to the data receive pins of the TTL-to-RS485 circuit board, and vice versa. The power supply and ground pins of the TTL-to-RS485 circuit board are connected to the power supply and ground pins of the ESP32 development board, respectively. The TTL-to-RS485 circuit board is connected to the corresponding pins of the temperature and humidity sensor via two analog signal lines (data line A and data line B). In this embodiment, the RXD (data receive pin) and TXD (data transmit pin) of the TTL-to-RS485 circuit board are connected to the RXD and TXD pins of the ESP32 development board using female DuPont wires. The power supply and ground pins are also connected to the power supply and ground pins of the ESP32 development board using female DuPont wires.

[0044] The host computer can communicate with the microcontroller via wired or wireless connections. In this example embodiment, the wired connection is a USB serial port connection, while the wireless connection is a Wi-Fi or Bluetooth connection. The sensor senses the environment and converts the collected information into analog signals, using the voltage difference between two analog signal lines to represent binary 1s or 0s and transmit the data. The TTL to RS485 converter converts the continuous analog signals into discrete, machine-readable digital signals before transmitting them to the ESP32 development board. The ESP32 development board simultaneously requests data from the sensor via the Modbus protocol and transmits the sensor data to the host computer via the TCP protocol.

[0045] In an exemplary embodiment, the dynamic link library (DLL) is a component based on the Component Object Model (COM), compatible with applications or scripts written in any programming language. The control program on the host computer loads a device control object through the DLL and calls its methods to send instructions to the microcontroller. In this embodiment, the DLL is specifically a set of program code, i.e., a DLL file, written in C language within the Visual Studio integrated development environment, based on the Visual Studio compiler and framework. The DLL is characterized by its compatibility with applications or scripts written in any programming language. The DLL is loaded as a class library on the host computer and can instantiate a device control object. The host computer communicates with the microcontroller by calling the corresponding methods of the device control object.

[0046] As several optional implementation methods, the communication between the microcontroller and the host computer can be either serial communication or wireless communication; specifically, wired communication can be serial communication or network communication, and wireless communication can be Wi-Fi communication or Bluetooth communication; the microcontroller communicates with the host computer via the TCP protocol.

[0047] When wireless communication is Wi-Fi communication, upon initial use, the host computer and microcontroller are connected via a wired connection, and the Wi-Fi connection information is set for the microcontroller using the corresponding method of the device control object. The Wi-Fi connection information includes the Wi-Fi name and Wi-Fi password. After the Wi-Fi connection information is set, the microcontroller will automatically connect to the wireless network and enter listening mode, allowing the host computer to access it at any time. During data acquisition, the host computer first communicates with the microcontroller via the wireless network and establishes a connection with the microcontroller using the corresponding method of the device control object and the unique device number. After the host computer and the microcontroller establish a connection, the sensor data is acquired and processed using the corresponding method of the device control object.

[0048] In one exemplary embodiment, the method of communication between the microcontroller and the host computer is specifically explained through dynamic link libraries.

[0049] During the initial connection setup, depending on the usage environment, the Wi-Fi name and password to be connected can be transmitted to the ESP32 development board via wired serial communication.

[0050] After setting up the microcontroller, the first step is to send a read command to the sensor. Taking the Modbus protocol as an example, the `read Input Registers` method is used to request data from the sensor and receive the required data. If Wi-Fi information has been configured beforehand, the data will be transmitted to the computer via Wi-Fi communication. If wireless communication has not been configured, the data will be transmitted to the target computer via serial communication.

[0051] The host computer also needs to write some code to ensure that the data is received. Taking serial communication as an example: first establish serial communication, then store the characters returned by the microcontroller and declare a method called read serialdata for the second developer to call. Finally, package all the class files written above into a DLL file. The second developer adds the DLL file to the environment they want to develop, and can then call the classes and methods written in the DLL.

[0052] The component compiled using the Component Object Model (COM) technology described above is a DLL file. It can then be instantiated and its methods (written using Windows API and C++) can be called from any programming language. The specific implementation method is as follows:

[0053] Upon first use, connect the ESP32 IoT modular device (containing IoT components) to the computer via USB cable. Locate the device's port number using Device Manager and connect via the `usbconnect(port number)` method for wired communication. Next, use `SetWiFi(Wi-Fi connection information)` to configure the Wi-Fi network or `SetBluetooth(Bluetooth connection information)` to configure the Bluetooth network. The constantly lit blue indicator light on the device will turn off, indicating a successful Wi-Fi or Bluetooth connection. This completes the initial setup. Afterward, the device can be disconnected from the computer and automatically connect to Wi-Fi upon powering on, enabling wireless communication via the TCP protocol. For wireless communication, first use the `Connect(device name)` method (the device name is unique) to establish a TCP connection. Once established, use the `Interact` command to interact or communicate with the device. After communication ends, use the `Disconnect()` method to disconnect from the device.

[0054] Based on the same inventive concept, this application also provides a method for using a sensor data acquisition device based on a component object model as described in the foregoing embodiments, such as... Figure 3 The flowchart shown includes the following steps:

[0055] A1. The analog signal output by the sensor is converted into a digital signal by an analog-to-digital converter, and the digital signal is transmitted to the microcontroller.

[0056] A2. Use the control program on the host computer to load a device control object through a dynamic link library and call its methods to communicate with the microcontroller; the communication method can be wired or wireless.

[0057] A3. During the data acquisition process, a connection is established with the microcontroller using the corresponding method and unique device number of the device control object.

[0058] A4. After the host computer and the microcontroller establish a connection, the sensor data is collected and processed through the corresponding method of the device control object.

[0059] Specifically, when the wireless communication is Wi-Fi communication, step A2 includes the following steps:

[0060] A21. Upon first use, connect the host computer and the microcontroller via a wired connection, and set the Wi-Fi connection information for the microcontroller using the corresponding method for the device control object; the Wi-Fi connection information includes the Wi-Fi name and Wi-Fi password.

[0061] Specifically, the host computer and the microcontroller are connected via a USB serial port. The host computer's control program instantiates a device control object named MyActiveCom using a dynamic link library, and calls the SetWiFi method in the MyActiveCom object to set the wireless connection information. Then, the wired connection between the host computer and the microcontroller is disconnected, and the MyActiveCom object is destroyed. Code diagrams illustrating Wi-Fi connection information settings using different programming languages ​​are shown below. Figure 4 As shown.

[0062] A22. After the Wi-Fi connection information is set, the microcontroller will automatically connect to the wireless network and enter the listening state, making it easy for the host computer to access it at any time.

[0063] A23. During the data acquisition process, the host computer first communicates with the microcontroller via a wireless network and establishes a connection with the microcontroller using the corresponding method of the device control object and the unique device number.

[0064] Specifically, during the data acquisition process, the host computer and the microcontroller are first connected via Wi-Fi. The host computer's control program calls the dynamic link library to instantiate a device control object named MyActiveCom, and uses the Connect property of the MyActiveCom object and its unique device number to establish a connection with the microcontroller.

[0065] A24. After the host computer and the microcontroller establish a connection, the sensor data is acquired and processed through the corresponding methods of the device control object. Specifically, the host computer calls the `Interact` method of the `MyActiveCom` object to send instructions to the microcontroller to acquire data from the sensor, and calls the corresponding methods of the device control object to receive the digital signals from the microcontroller and convert them into corresponding results.

[0066] If data acquisition needs to continue, repeat the Interact instruction call. If data acquisition is no longer needed, disconnect the wireless connection between the host computer and the microcontroller and destroy the MyActiveCom object.

[0067] When the wireless communication is Bluetooth, step A2 specifically includes the following steps:

[0068] A21. Upon first use, connect the host computer and the microcontroller via a wired connection, and set the Bluetooth connection information for the microcontroller using the corresponding method of the device control object; the Bluetooth connection information includes the Bluetooth ID and Bluetooth pairing code.

[0069] Specifically, the host computer and the microcontroller are connected via a USB serial port. The host computer's control program instantiates a device control object named MyActiveCom using a dynamic link library. The host computer then calls the SetBluetooth method in the MyActiveCom object to set the wireless connection information. Afterward, the wired connection between the host computer and the microcontroller is disconnected, and the MyActiveCom object is destroyed. Code diagrams illustrating Bluetooth connection information settings using different programming languages ​​are shown below. Figure 5 As shown.

[0070] A22. After the Bluetooth connection information is set, the microcontroller will automatically connect to the Bluetooth network and enter the listening state, making it easy for the host computer to access it at any time.

[0071] A23. During the data acquisition process, the host computer first communicates with the microcontroller via Bluetooth network and establishes a connection with the microcontroller using the corresponding method of the device control object and the unique device number.

[0072] Specifically, during the data acquisition process, the host computer and the microcontroller are first connected via Bluetooth. The host computer's control program calls the dynamic link library to instantiate a device control object named MyActiveCom, and uses the Connect property of the MyActiveCom object and its unique device number to establish a connection with the microcontroller.

[0073] A24. After the host computer and the microcontroller establish a connection, the sensor data is acquired and processed through the corresponding methods of the device control object. Specifically, the host computer calls the `Interact` method of the `MyActiveCom` object to send instructions to the microcontroller to acquire data from the sensor, and calls the corresponding methods of the device control object to receive the digital signals from the microcontroller and convert them into corresponding results.

[0074] If data acquisition needs to continue, the Interact instruction call should be repeated. If data acquisition is no longer needed, the wireless connection between the host computer and the microcontroller can be disconnected, and the MyActiveCom object can be destroyed. Code diagrams for acquiring sensor data using different programming languages ​​are shown below. Figure 6 As shown.

[0075] In addition to the steps A1 to A4, after completing the acquisition and local processing of sensor data, the method of using the sensor data acquisition device based on the component object model also includes the following steps:

[0076] B1. Transfer the read data to the cloud server database at the specified IP address by calling the dynamic link library file.

[0077] The following is a specific example illustrating the usage of the sensor data acquisition device based on the component object model provided in this embodiment, including the following process:

[0078] Taking the VB script as an example, first, connect the DHT11 temperature and humidity sensor to the ESP32 development board, and then connect the ESP32 development board to a Windows computer (the host computer) using a USB cable. Next, click install.bat on the host computer to register the DLL file in the system.

[0079] Next, create an instance of the DLL named MyActiveCom, connect it to the ESP32 development board using the MyActiveCom.UsbConnect() method, and then use the MyActiveCom.SetWiFi() method to send Wi-Fi information to the ESP32 development board. Afterward, release the instance. At this point, the device's communication settings are complete.

[0080] Next, the ESP32 development board was powered by a power bank. The MyActiveCom.Connect() method was used to connect to the sensor based on its device name. A variable MyResult was set to store the value returned by the MyActiveCom.Interact() method. VB's loop and Msgbox() method were used to display the obtained information. A pop-up window showing the results of the sensor data collection was displayed. Figure 7 As shown.

[0081] This application utilizes a component object model-based dynamic link library to achieve interface-based sensor communication and compatibility with any programming language, encapsulating the sensor and microcontroller into a plug-and-play module, thus realizing the modularization and decoupling of sensor data acquisition equipment.

[0082] The design of the sensor data acquisition device and its usage method based on the component object model described in this application includes both software and hardware design. In terms of software design, a dynamic link library based on the component object model is used as the communication interface between the host computer and the microcontroller. Its characteristics include compatibility with any programming language and support for interface-based calls, achieving interface-based communication for sensors and compatibility with any programming language, reducing the programming difficulty of device control, and greatly facilitating related secondary development. At the hardware level, the sensor and microcontroller are encapsulated as a plug-and-play module without the need for other data acquisition devices, achieving modularity and low coupling of sensor data acquisition, making it easy to install and economical.

[0083] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0084] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A component object model based sensor data acquisition apparatus, characterized in that, The application relates to a sensor data acquisition device based on a component object model. The dynamic link library is a component based on a component object model, and can be compatible with application programs or script programs written in any programming language; a control program on an upper computer loads a device control object and calls a method in the device control object to communicate with a single-chip microcomputer through the dynamic link library; The single-chip microcomputer is an ESP32 development board; a data sending pin of the ESP32 development board is connected with a data receiving pin of a TTL-to-RS485 circuit board, a data receiving pin of the ESP32 development board is connected with a data sending pin of the TTL-to-RS485 circuit board, and the TTL-to-RS485 circuit board is connected with corresponding pins of a sensor through an A data line and a B data line; a power supply pin and a grounding pin of the TTL-to-RS485 circuit board are connected with a power supply pin and a grounding pin of the ESP32 development board respectively; and the single-chip microcomputer collects data of the sensor through a Modbus protocol. The communication mode between the single-chip microcomputer and the upper computer is serial communication or wireless communication, the wireless communication is Wi-Fi communication or Bluetooth communication, and the single-chip microcomputer communicates with the upper computer through a TCP protocol; if Wi-Fi information is set in advance, data is transmitted to a computer through Wi-Fi communication, and if the wireless communication mode is not set, data is transmitted to a target computer through serial communication. In the data collection process, the upper computer first communicates with the single-chip microcomputer through a wireless network, uses a corresponding method of the device control object and a unique device number to establish a connection with the single-chip microcomputer, when the wireless communication is Wi-Fi communication, the upper computer is connected with the single-chip microcomputer in a wired mode for the first time, and Wi-Fi connection information is set to the single-chip microcomputer through a corresponding method of the device control object; the Wi-Fi connection information comprises a Wi-Fi name and a Wi-Fi password; after the Wi-Fi connection information is set, the single-chip microcomputer automatically connects to the wireless network and enters a listening state, so that the upper computer can access at any time; after the upper computer establishes a connection with the single-chip microcomputer, sensor data is collected and processed through a corresponding method of the device control object. The control program on the upper computer loads a device control object through the dynamic link library and calls a method in the device control object to send an instruction to the single-chip microcomputer.

2. The component object model based sensor data acquisition apparatus of claim 1, wherein, The use method of the sensor data acquisition device based on the component object model comprises the following steps:

3. A method of using a component object model based sensor data acquisition apparatus as claimed in any one of claims 1-2, characterized in that, TTL-to-RS485 circuit boards are used to acquire signals output by sensors in the form of differential digital signals, and the differential digital signals are converted into TTL digital signals in the form of high and low levels and are transmitted to a single-chip microcomputer; A control program on an upper computer loads a device control object through a dynamic link library and calls a method in the device control object to communicate with a single-chip microcomputer; the communication mode is wired communication or wireless communication; In the data collection process, a corresponding method of the device control object and a unique device number are used to establish a connection with the single-chip microcomputer. ​ After the host computer and the single-chip microcomputer establish connection, the corresponding method of the device control object is used to complete the collection and processing of sensor data.

4. The method of using a component object model based sensor data collection apparatus according to claim 3, wherein, When the wireless communication is Wi-Fi communication, a control program on the host computer loads a device control object through the dynamic link library and calls the method in the device control object to communicate with the single-chip microcomputer, and the communication specifically includes: When used for the first time, the host computer and the single-chip microcomputer are connected in a wired manner, and the corresponding method of the device control object is used to set Wi-Fi connection information for the single-chip microcomputer; the Wi-Fi connection information includes a Wi-Fi name and a Wi-Fi password; After the Wi-Fi connection information is set, the single-chip microcomputer automatically connects to the wireless network and enters a listening state, so that the host computer can access at any time; During data collection, the host computer communicates with the single-chip microcomputer through the wireless network, and uses the corresponding method of the device control object and a unique device number to establish connection with the single-chip microcomputer; After the host computer and the single-chip microcomputer establish connection, the corresponding method of the device control object is used to complete the collection and processing of sensor data.

5. The method of using a component object model based sensor data collection apparatus according to claim 3, wherein, When the wireless communication is Bluetooth communication, a control program on the host computer loads a device control object through the dynamic link library and calls the method in the device control object to communicate with the single-chip microcomputer, and the communication specifically includes: When used for the first time, the host computer and the single-chip microcomputer are connected in a wired manner, and the corresponding method of the device control object is used to set Bluetooth connection information for the single-chip microcomputer; the Bluetooth connection information includes a Bluetooth ID and a Bluetooth pairing code; After the Bluetooth connection information is set, the single-chip microcomputer automatically connects to the Bluetooth network and enters a listening state, so that the host computer can access at any time; During data collection, the host computer communicates with the single-chip microcomputer through the Bluetooth network, and uses the corresponding method of the device control object and a unique device number to establish connection with the single-chip microcomputer; After the host computer and the single-chip microcomputer establish connection, the corresponding method of the device control object is used to complete the collection and processing of sensor data.

Citation Information

Patent Citations

  • Method and device for establishing interaction between embedded equipment and WIFI module

    CN109992320A

  • Equipment connecting method for automatic production

    CN111752242A

  • High precision sensor signal collector

    CN201302717Y