Sensor data acquisition device based on component object model and use method thereof
By adopting a sensor data acquisition device based on component object model in the Internet of Things sensor control technology, the problem of low degree of interface and poor compatibility of sensor data communication is solved, modular and low coupling of sensor data acquisition equipment is realized, cost and installation difficulty are reduced, and secondary development of intelligent applications is supported.
Patent Information
- Application Number
- CN202411691500.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-22
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2044-11-22
AI Technical Summary
In the existing IoT sensor control technology, the sensor data communication has low interface degree and poor compatibility, resulting in insufficient modularity of the equipment, high coupling, inconvenient installation, expensive price and difficult to develop secondary development.
The sensor data acquisition device based on the component object model is adopted, including sensors, analog-to-digital converters, microcontrollers and dynamic link libraries based on the component object model. Through the dynamic link library, communication between the upper computer and the microcontroller is realized, wireless network connection is supported, and sensor data is collected and processed.
It realizes the interfaceization and compatibility of sensor data communication, reduces the coupling degree of equipment, is convenient to install, economical in price, is programming friendly, is convenient to secondary development, and supports various intelligent applications.
Smart Images

Figure CN119652936A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of Internet of Things sensor control technology, and in particular to a sensor data acquisition device based on a component object model and a method for using the same. Background Art
[0002] In the field of IoT sensor control technology, in terms of sensor technology, traditional sensors need to be paired with supporting data acquisition equipment and application software. Not only do they require a large number of lines and additional data acquisition equipment, they are not only inconvenient to install, but they are also expensive and cannot achieve flexible and convenient secondary development. For example, the current mainstream strain sensors mostly need to be connected to an expensive data acquisition box, and their corresponding application software mostly only supports writing data into text documents, and cannot import real-time data into other programs to complete various intelligent applications, such as real-time structural status analysis, structural safety warning, etc.
[0003] In terms of IoT technology, traditional sensors often need to be paired with corresponding mobile phone applications. However, due to the limitations of the mobile phone platform, device control is limited to the functions provided by the application and cannot be further developed to realize various intelligent applications. For example, although the temperature can be viewed through the mobile phone application, it is impossible to draw a temperature time curve, nor can it realize functions such as temperature exceeding the threshold value alarm.
[0004] It can be seen that how to overcome the defects of existing IoT sensor control technology, such as low degree of interfaceization and poor compatibility of sensor data communication, insufficient modularization of sensor equipment leading to high coupling, etc., which bring about inconvenient installation, high price, and difficulty in secondary development, is a technical problem that needs to be solved urgently in this field. Summary of the invention
[0005] The purpose of this application is to provide a sensor data acquisition device based on a component object model and a method of using the same, which can solve the problems existing in the current Internet of Things sensor control technology, such as the low degree of sensor data communication interface and poor compatibility, and high coupling caused by insufficient modularization of equipment, thereby achieving the purpose of easy installation, economical price, programming-friendly, and convenient secondary development.
[0006] To achieve the above objectives, this application provides the following solutions:
[0007] In the first aspect, the present application provides a sensor data acquisition device based on a component object model, comprising: a sensor, an analog-to-digital converter, a single-chip microcomputer and a dynamic link library based on a component object model; the sensor is connected to the single-chip microcomputer 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 single-chip microcomputer; the control program on the host computer loads a device control object through the dynamic link library and calls the method therein to communicate with the single-chip microcomputer; during the data acquisition process, the host computer first communicates with the single-chip microcomputer through the wireless network, uses the corresponding method of the device control object and the unique device number to establish a connection with the single-chip microcomputer, and after the host computer establishes a connection with the single-chip microcomputer, completes the acquisition and processing of the sensor data through the corresponding method of the device control object.
[0008] Optionally, the sensor is connected to the analog-to-digital converter via an A data line and a B data line, and the analog-to-digital converter converts an analog signal output by the sensor into a digital signal and transmits it to the single-chip microcomputer.
[0009] Optionally, the single-chip microcomputer is an ESP32 development board; the analog-to-digital converter is a TTL to RS485 circuit board; the data sending pin of the ESP32 development board is connected to the data receiving pin of the TTL to RS485 circuit board, and the data receiving pin of the ESP32 development board is connected to the data sending pin of the TTL to RS485 circuit board; the power supply pin and the ground pin of the TTL to RS485 circuit board are respectively connected to the power supply pin and the ground pin of the ESP32 development board; and the single-chip microcomputer collects data from the sensor through 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 the method therein to send instructions to the microcontroller.
[0011] Optionally, the communication between the single chip microcomputer and the host computer adopts serial communication or wireless communication.
[0012] Optionally, the wireless communication is Wi-Fi communication or Bluetooth communication; the single-chip computer communicates with the host computer via TCP protocol.
[0013] Optionally, when the wireless communication is Wi-Fi communication; when used for the first time, the host computer and the single-chip microcomputer are connected in a wired manner, and the Wi-Fi connection information is set to the single-chip microcomputer through 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 single-chip microcomputer will automatically connect to the wireless network and enter the listening state, so that the host computer can access it at any time; during the data acquisition process, the host computer first communicates with the single-chip microcomputer through the wireless network, and uses the corresponding method of the device control object and the unique device number to establish a connection with the single-chip microcomputer; after the host computer and the single-chip microcomputer are connected, the corresponding method of the device control object is used to complete the collection and processing of sensor data.
[0014] In a second aspect, the present application provides a method for using the sensor data acquisition device based on the component object model as described above, comprising the following steps:
[0015] The analog signal output by the sensor is converted into a digital signal through an analog-to-digital converter, and the digital signal is transmitted to the single chip microcomputer.
[0016] The control program on the host computer is used to load a device control object through the dynamic link library and call the method therein to communicate with the single-chip microcomputer; the communication method adopts wired communication or wireless communication.
[0017] During 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.
[0018] After the host computer establishes a connection with the single-chip microcomputer, 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, using a control program on a host computer to load a device control object through the dynamic link library and calling a method therein to communicate with the single-chip microcomputer, specifically includes the following steps:
[0020] When used for the first time, the host computer and the single-chip microcomputer are connected in a wired manner, and Wi-Fi connection information is set to the single-chip microcomputer through the corresponding method of the device control object; the Wi-Fi connection information includes a Wi-Fi name and a Wi-Fi password.
[0021] After the Wi-Fi connection information is set, the single-chip microcomputer 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 collection process, the host computer first communicates with the single-chip microcomputer through the wireless network, and establishes a connection with the single-chip microcomputer using the corresponding method of the device control object and the unique device number.
[0023] After the host computer establishes a connection with the single-chip microcomputer, 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, using a control program on a host computer to load a device control object through the dynamic link library and calling a method therein to communicate with the single-chip microcomputer, specifically includes the following steps:
[0025] When used for the first time, the host computer and the single-chip microcomputer are connected in a wired manner, and Bluetooth connection information is set to the single-chip microcomputer through the corresponding method of the device control object; the Bluetooth connection information includes a Bluetooth ID and a Bluetooth pairing code.
[0026] After the Bluetooth connection information is set, the single-chip microcomputer will automatically connect to the Bluetooth network and enter the listening state, so that the host computer can access it at any time.
[0027] During the data collection process, the host computer first communicates with the single-chip microcomputer through the Bluetooth network, and uses the corresponding method of the device control object and the unique device number to establish a connection with the single-chip microcomputer.
[0028] After the host computer establishes a connection with the single-chip microcomputer, 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, this application discloses the following technical effects:
[0030] The present application provides a sensor data acquisition device based on a component object model and a method for using the same. The device includes: a sensor, an analog-to-digital converter, a single-chip microcomputer and a dynamic link library based on a component object model; the sensor is connected to the single-chip microcomputer via the analog-to-digital converter, the analog-to-digital converter converts the analog signal output by the sensor into a digital signal, and transmits the digital signal to the single-chip microcomputer; a control program on a host computer loads a device control object via the dynamic link library and calls a method therein to communicate with the single-chip microcomputer; during the data acquisition process, the host computer first communicates with the single-chip microcomputer via a wireless network, uses the corresponding method of the device control object and a unique device number to establish a connection with the single-chip microcomputer, and after the host computer and the single-chip microcomputer are connected, the corresponding method of the device control object is used to complete the acquisition and processing of the sensor data. This application utilizes a component object model-based dynamic link library to implement the interface of sensor communication and compatibility with any programming language, and encapsulates the sensor and the single-chip microcomputer into a plug-and-play module to realize the modularization and low coupling of the sensor data acquisition equipment, which can effectively reduce the cost and installation difficulty of the sensor equipment, and make 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 can perform self-programming and secondary development according to needs, thereby realizing various intelligent applications. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0032] Figure 1 A schematic diagram of the structure of a sensor data acquisition device based on a component object model provided in one embodiment of the present application.
[0033] Figure 2 A schematic diagram of a specific example of a sensor data acquisition device based on a component object model provided in one embodiment of the present application.
[0034] Figure 3 A flowchart of a method for using a sensor data acquisition device based on a component object model provided in one embodiment of the present application.
[0035] Figure 4 A schematic diagram of code for setting Wi-Fi connection information in different programming languages in a method for using a sensor data acquisition device based on a component object model provided in an embodiment of the present application.
[0036] Figure 5A schematic diagram of code for setting Bluetooth connection information in different programming languages in a method for using a sensor data acquisition device based on a component object model provided in an embodiment of the present application.
[0037] Figure 6 A schematic diagram of codes for collecting sensor data using different programming languages in a method for using a sensor data collection device based on a component object model provided in an embodiment of the present application.
[0038] Figure 7 A schematic diagram of a pop-up window showing the results of collecting sensor data in a method for using a sensor data collection device based on a component object model provided in one embodiment of the present application. DETAILED DESCRIPTION
[0039] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0040] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0041] In an exemplary embodiment, Figure 1 As shown, a sensor data acquisition device based on a component object model is provided, comprising: a sensor, an analog-to-digital converter, a single-chip microcomputer and a dynamic link library based on a component object model; the sensor is connected to the single-chip microcomputer 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 single-chip microcomputer; the control program on the host computer loads a device control object through the dynamic link library and calls the method therein to communicate with the single-chip microcomputer; in the data acquisition process, the host computer first communicates with the single-chip microcomputer through the wireless network, uses the corresponding method of the device control object and the unique device number to establish a connection with the single-chip microcomputer, and after the host computer is connected to the single-chip microcomputer, the corresponding method of the device control object is used to complete the acquisition and processing of the sensor data.
[0042] Specifically, in Figure 1 In the structure shown, the sensor is connected to the analog-to-digital converter through the A data line and the B data line. 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 an exemplary embodiment, Figure 2In the specific example schematic diagram shown, the host computer is an ordinary X86 computer with Windows operating system installed; the single-chip computer is an ESP32 development board; the analog-to-digital converter is a TTL to RS485 circuit board; the sensor is a temperature and humidity sensor; the data transmission pin of the ESP32 development board is connected to the data receiving pin of the TTL to RS485 circuit board, and the data receiving 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 the ground pin of the TTL to RS485 circuit board are respectively connected to the power supply pin and the ground pin of the ESP32 development board; the analog-to-digital converter is a TTL to RS485 circuit board connected to the corresponding pins of the temperature and humidity sensor through two analog signal lines (A data line and B data line). In this embodiment, the RXD (pin for receiving data) and TXD (pin for sending data) in the TTL to RS485 circuit board are connected to the RXD and TXD of the ESP32 development board respectively with a female DuPont line. The power supply pin and the ground pin are also connected to the power supply pin and the ground pin of the ESP32 development board respectively with a female DuPont line.
[0044] The host computer can communicate with the single-chip microcomputer through a wired connection or a wireless connection. In the embodiment of this example, the wired connection is a USB serial port connection, and the wireless connection is a Wi-Fi connection or a Bluetooth connection. The sensor converts the collected information into an analog signal by sensing the environment, and represents binary 1 or 0 and transmits data through the voltage difference between the two analog signal lines. The TTL to RS485 circuit board converts the continuous analog signal into a discrete and machine-recognizable digital signal and then transmits it to the ESP32 development board. The ESP32 development board requests data from the sensor through the Modbus protocol, and transmits the sensor data to the host computer through the TCP protocol.
[0045] In an exemplary embodiment, the dynamic link library is a component based on the component object model (COM), 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 the method therein to send instructions to the single-chip microcomputer. In this embodiment, the dynamic link library is specifically a set of program codes written based on the visual studio compiler and framework, that is, a dll (Dynamic Link Library) file, which is written in C language under the Visual Studio integrated development environment. The dynamic link library is characterized by being compatible with applications or scripts written in any programming language. The dynamic link library is loaded as a class library in the host computer and can instantiate a device control object. The host computer communicates with the single-chip microcomputer by calling the corresponding method of the device control object.
[0046] As several optional implementation methods, the communication method between the single-chip microcomputer and the host computer adopts serial communication or wireless communication; specifically, the wired communication is serial communication or network communication, and the wireless communication is Wi-Fi communication or Bluetooth communication; the single-chip microcomputer communicates with the host computer through the TCP protocol.
[0047] When the wireless communication is Wi-Fi communication; when used for the first time, the host computer and the single-chip microcomputer are connected in a wired manner, and the Wi-Fi connection information is set to the single-chip microcomputer through the corresponding method of the device control object; the Wi-Fi connection information includes the Wi-Fi name and the Wi-Fi password; after the Wi-Fi connection information is set, the single-chip microcomputer will automatically connect to the wireless network and enter the listening state, so that the host computer can access it at any time; in the data collection process, the host computer first communicates with the single-chip microcomputer through the wireless network, and uses the corresponding method of the device control object and the unique device number to establish a connection with the single-chip microcomputer; after the host computer and the single-chip microcomputer are connected, the corresponding method of the device control object is used to complete the collection and processing of sensor data.
[0048] In an exemplary embodiment, it is specifically explained how the host computer sets the communication mode between the single-chip microcomputer and the host computer through the dynamic link library.
[0049] During the first connection initialization, in different usage environments, the Wi-Fi name and Wi-Fi password to be connected can be passed to the ESP32 development board through wired serial communication.
[0050] After completing the setting of the MCU, the first step is to send a read command to the sensor. Taking the modbus protocol as an example, the sensor is requested to receive data through the read Input Registers method. If the Wi-Fi information is set in advance, the data is transmitted to the computer through Wi-Fi communication. If the wireless communication method is not set, the data is transmitted to the target computer through serial communication.
[0051] A piece of code needs to be written on the host computer to ensure that the data is received. Take serial communication as an example: first establish serial communication, then store the characters sent back 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 secondary developer adds the dll file to the environment he wants to develop, and then he can call the classes written in the dll and the methods in it.
[0052] The above-mentioned component compiled based on the component object model technology is in the form of a dll file. Then, you can instantiate and call the methods written in the dll using Windows API and C++ language in any programming language. The specific implementation method is:
[0053] When using the device for the first time, connect the ESP32 IoT modular device with IoT devices to the computer via a USB data cable, locate the device's port number through the device manager, and use the usbconnect(port number) method to connect to the device for wired communication. Next, use SetWiFi(Wi-Fi connection information) to set the information of the Wi-Fi to be connected, or use SetBluetooth(Bluetooth connection information) to set the information of the Bluetooth to be connected. At this time, the blue indicator light on the device turns off to indicate a successful connection to Wi-Fi or Bluetooth. At this point, all the preliminary settings have been completed. In the future, the device can be disconnected from the computer, automatically connected to Wi-Fi after power is supplied, and wireless communication is carried out through the TCP protocol. When conducting wireless communication, first use the Connect(device name) method (the device name is unique) to establish a TCP connection with the device. After the connection is established, use the Interact command method to interact or communicate with the device. After the communication is completed, use the Disconnect() method to disconnect from the device.
[0054] Based on the same inventive concept, the embodiment of the present application also provides a method for using the sensor data acquisition device based on the component object model as described in the above embodiment, such as Figure 3 The flowchart shown includes the following steps:
[0055] A1. Convert the analog signal output by the sensor into a digital signal through an analog-to-digital converter, and transmit the digital signal to the microcontroller.
[0056] A2. Use the control program on the host computer to load a device control object through the dynamic link library and call the method therein to communicate with the microcontroller; the communication method adopts wired communication or wireless communication.
[0057] A3. During the data collection process, use the corresponding method of the device control object and the unique device number to establish a connection with the microcontroller.
[0058] A4. After the host computer and the single-chip microcomputer are connected, 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. When used for the first time, connect the host computer and the MCU by wire, and set the Wi-Fi connection information to the MCU through the corresponding method of 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 MCU are connected through the USB serial port. The control program of the host computer calls the dynamic link library to instantiate a device control object named MyActiveCom, 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 MCU is disconnected and the MyActiveCom object is destroyed. The code diagram for setting Wi-Fi connection information using different programming languages is shown in the figure below. Figure 4 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 collection process, the host computer first communicates with the microcontroller through the wireless network, and uses the corresponding method of the device control object and the unique device number to establish a connection with the microcontroller.
[0064] Specifically, during the data collection process, the host computer and the MCU are first connected using Wi-Fi. The control program of the host computer calls the dynamic link library to instantiate a device control object named MyActiveCom, and uses the Connect of the MyActiveCom object and the unique device number to establish a connection with the MCU.
[0065] A24. After the host computer and the MCU are connected, the corresponding method of the device control object is used to complete the collection and processing of sensor data. Specifically, the host computer calls the Interact of the MyActiveCom object to send instructions to the MCU to let the MCU collect data from the sensor, and calls the corresponding method of the device control object to receive the digital signal from the MCU and convert it into the corresponding result.
[0066] At this time, if you need to continue data collection, repeat the call of the Interact instruction. If you do not need to collect data anymore, disconnect the wireless connection between the host computer and the microcontroller, and destroy the MyActiveCom object.
[0067] When the wireless communication is Bluetooth communication, step A2 specifically includes the following steps:
[0068] A21. When used for the first time, connect the host computer and the single-chip microcomputer by wire, and set the Bluetooth connection information to the single-chip microcomputer through the corresponding method of the device control object; the Bluetooth connection information includes the Bluetooth ID and the Bluetooth pairing code.
[0069] Specifically, the host computer and the MCU are connected through the USB serial port. The control program of the host computer calls the dynamic link library to instantiate a device control object named MyActiveCom. The host computer calls the SetBluetooth method in the MyActiveCom object to set the wireless connection information, and then disconnects the wired connection between the host computer and the MCU and destroys the MyActiveCom object. The code diagram for setting Bluetooth connection information using different programming languages is shown in the figure below. Figure 5 shown.
[0070] A22. After the Bluetooth connection information is set, the microcontroller will automatically connect to the Bluetooth network and enter the listening state, so that the host computer can access it at any time.
[0071] A23. During the data collection process, the host computer first communicates with the microcontroller through the Bluetooth network, and uses the corresponding method of the device control object and the unique device number to establish a connection with the microcontroller.
[0072] Specifically, in the data collection process, the host computer and the microcontroller are first connected using Bluetooth. The control program of the host computer calls the dynamic link library to instantiate a device control object named MyActiveCom, and uses the Connect of the MyActiveCom object and the unique device number to establish a connection with the microcontroller.
[0073] A24. After the host computer and the MCU are connected, the corresponding method of the device control object is used to complete the collection and processing of sensor data. Specifically, the host computer calls the Interact of the MyActiveCom object to send instructions to the MCU to let the MCU collect data from the sensor, and calls the corresponding method of the device control object to receive the digital signal from the MCU and convert it into the corresponding result.
[0074] At this point, if you need to continue data collection, repeat the call of the Interact instruction. If you do not need to collect data anymore, disconnect the wireless connection between the host computer and the MCU and destroy the MyActiveCom object. Figure 6 shown.
[0075] In addition, after executing steps A1 to A4 to complete the collection and local processing of sensor data, the method for using the sensor data collection device based on the component object model further includes the following steps:
[0076] B1. The read data is transferred to the cloud server database of the specified IP by calling the dynamic link library file.
[0077] The following is a specific example to illustrate the method for using the sensor data acquisition device based on the component object model provided in this embodiment, which includes the following process:
[0078] Take VB script as an example. First, connect the DHT11 temperature and humidity sensor to the ESP32 development board, and then use a USB cable to connect the ESP32 development board to a computer running Windows system, i.e. the host computer. Next, click install.bat in the host computer to register the dll file in the system.
[0079] After that, create an instance of dll, name it MyActiveCom, connect it to the ESP32 development board through the MyActiveCom.UsbConnect() method, and then use the MyActiveCom.SetWiFi() method to pass the Wi-Fi information to the ESP32 development board, and then release the instance. At this point, the communication mode of the device is set.
[0080] Then, use the mobile power supply to power the ESP32 development board, connect the sensor according to the device name through the MyActiveCom.Connect() method, set the variable MyResult to store the value returned by the MyActiveCom.Interact() method, and use the VB language loop and Msgbox() method to display the obtained information. The result of collecting sensor data is displayed in the pop-up window as shown below: Figure 7 shown.
[0081] The present application utilizes a component object model-based dynamic link library to realize the interface of sensor communication and compatibility with any programming language, and encapsulates the sensor and the single-chip microcomputer into a plug-and-play module to realize the modularization and low coupling of the sensor data acquisition device.
[0082] The design of the sensor data acquisition device based on component object model and its use method mentioned above in this application includes two aspects: software design and hardware design. In software design, a dynamic link library based on component object model is used as the communication interface between the host computer and the single-chip microcomputer. It is characterized by being compatible with any programming language and supporting interface calls, realizing the interface of sensor communication and compatibility with any programming language, reducing the programming difficulty of equipment control, and greatly facilitating related secondary development. At the hardware level, the sensor and the single-chip microcomputer are encapsulated as a plug-and-play module without the need for other data acquisition devices, realizing modularization and low coupling of sensor data acquisition, making it easy to install and economical.
[0083] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, 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 article uses specific examples to illustrate the principles and implementation methods of this application. The description of the above embodiments is only used to help understand the method and core ideas of this application. At the same time, for those skilled in the art, according to the ideas of this application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting this application.
Claims
1. A sensor data acquisition device based on component object model, characterized in that: include: Sensors, analog-to-digital converters, microcontrollers, and component object model-based dynamic link libraries; The sensor is connected to the single chip microcomputer via 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 single-chip microcomputer; the control program on the host computer loads a device control object through the dynamic link library and calls the method therein to communicate with the single-chip microcomputer; during the data acquisition process, the host computer first communicates with the single-chip microcomputer through the wireless network, uses the corresponding method of the device control object and the unique device number to establish a connection with the single-chip microcomputer, and after the host computer establishes a connection with the single-chip microcomputer, completes the acquisition and processing of the sensor data through the corresponding method of the device control object.
2. The sensor data acquisition device based on component object model according to claim 1, characterized in that: The sensor is connected to the analog-to-digital converter via the A data line and the B data line, and the analog-to-digital converter converts the analog signal output by the sensor into a digital signal and transmits it to the single-chip microcomputer.
3. The sensor data acquisition device based on component object model according to claim 1, characterized in that: The single-chip microcomputer is an ESP32 development board; the analog-to-digital converter is a TTL to RS485 circuit board; the data sending pin of the ESP32 development board is connected to the data receiving pin of the TTL to RS485 circuit board, and the data receiving pin of the ESP32 development board is connected to the data sending pin of the TTL to RS485 circuit board; the power supply pin and the ground pin of the TTL to RS485 circuit board are respectively connected to the power supply pin and the ground pin of the ESP32 development board; the single-chip microcomputer collects data from the sensor through the Modbus protocol.
4. The sensor data acquisition device based on component object model according to claim 1, characterized in that: The dynamic link library is a component based on the component object model and 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 the method therein to send instructions to the single-chip microcomputer.
5. The sensor data acquisition device based on component object model according to claim 4, characterized in that: The communication mode between the single chip microcomputer and the host computer adopts serial communication or wireless communication.
6. The sensor data acquisition device based on component object model according to claim 5, characterized in that: The wireless communication is Wi-Fi communication or Bluetooth communication; the single chip computer communicates with the host computer through the TCP protocol.
7. The sensor data acquisition device based on component object model according to claim 6, characterized in that: When the wireless communication is Wi-Fi communication; when used for the first time, the host computer and the single-chip microcomputer are connected in a wired manner, and the Wi-Fi connection information is set to the single-chip microcomputer through 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 single-chip microcomputer will automatically connect to the wireless network and enter the listening state, so that the host computer can access it at any time; in the data collection process, the host computer first communicates with the single-chip microcomputer through the wireless network, and uses the corresponding method of the device control object and the unique device number to establish a connection with the single-chip microcomputer; after the host computer and the single-chip microcomputer are connected, the corresponding method of the device control object is used to complete the collection and processing of sensor data.
8. A method for using the sensor data acquisition device based on component object model according to any one of claims 1 to 7, characterized in that: The method for using the sensor data acquisition device based on the component object model includes: Convert the analog signal output by the sensor into a digital signal through an analog-to-digital converter, and transmit the digital signal to the single chip microcomputer; Using the control program on the host computer to load a device control object through the dynamic link library and calling the method therein to communicate with the single-chip microcomputer; the communication method adopts wired communication or wireless communication; During data collection, a connection is established with the single-chip microcomputer using the corresponding method and unique device number of the device control object; After the host computer establishes a connection with the single-chip microcomputer, the sensor data is collected and processed through the corresponding method of the device control object.
9. The method for using the sensor data acquisition device based on component object model according to claim 8, characterized in that: When the wireless communication is Wi-Fi communication; using the control program on the host computer to load a device control object through the dynamic link library and calling the method therein to communicate with the single-chip microcomputer, specifically including: When used for the first time, the host computer and the single-chip microcomputer are connected in a wired manner, and Wi-Fi connection information is set to the single-chip microcomputer through 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 single-chip microcomputer will automatically connect to the wireless network and enter the listening state, so that the host computer can access it at any time; During the data collection process, the host computer first communicates with the single-chip microcomputer through the wireless network, and uses the corresponding method and unique device number of the device control object to establish a connection with the single-chip microcomputer; After the host computer establishes a connection with the single-chip microcomputer, the sensor data is collected and processed through the corresponding method of the device control object.
10. The method for using the sensor data acquisition device based on component object model according to claim 8, characterized in that: When the wireless communication is Bluetooth communication; using the control program on the host computer to load a device control object through the dynamic link library and calling the method therein to communicate with the single-chip microcomputer, specifically including: When used for the first time, the host computer and the single-chip microcomputer are connected in a wired manner, and Bluetooth connection information is set to the single-chip microcomputer through the corresponding method of the device control object; the Bluetooth connection information includes a Bluetooth ID and a Bluetooth pairing code; After the Bluetooth connection information is set, the single-chip microcomputer will automatically connect to the Bluetooth network and enter the listening state, so that the host computer can access it at any time; During the data collection process, the host computer first communicates with the single-chip microcomputer through the Bluetooth network, and uses the corresponding method and unique device number of the device control object to establish a connection with the single-chip microcomputer; After the host computer establishes a connection with the single-chip microcomputer, the sensor data is collected and processed through the corresponding method of the device control object.
Citation Information
Patent Citations
Connection method for WIFI (Wireless Fidelity) hotspot, and intelligent terminal
CN106793165A
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
Force sensor communication protocol converter
CN221575410U