CN113034873A - Sensor communication method, device and system - Google Patents

Sensor communication method, device and system Download PDF

Info

Publication number
CN113034873A
CN113034873A CN201911357238.9A CN201911357238A CN113034873A CN 113034873 A CN113034873 A CN 113034873A CN 201911357238 A CN201911357238 A CN 201911357238A CN 113034873 A CN113034873 A CN 113034873A
Authority
CN
China
Prior art keywords
sensor
data
target
protocol
sensor data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201911357238.9A
Other languages
Chinese (zh)
Inventor
钟庆彤
韩丹
闫育兴
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xian Novastar Electronic Technology Co Ltd
Original Assignee
Xian Novastar Electronic Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xian Novastar Electronic Technology Co Ltd filed Critical Xian Novastar Electronic Technology Co Ltd
Priority to CN201911357238.9A priority Critical patent/CN113034873A/en
Publication of CN113034873A publication Critical patent/CN113034873A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G08SIGNALLING
    • G08CTRANSMISSION SYSTEMS FOR MEASURED VALUES, CONTROL OR SIMILAR SIGNALS
    • G08C17/00Arrangements for transmitting signals characterised by the use of a wireless electrical link
    • G08C17/02Arrangements for transmitting signals characterised by the use of a wireless electrical link using a radio link

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Arrangements For Transmission Of Measured Signals (AREA)

Abstract

The embodiment of the invention discloses a sensor communication method, a sensor communication device and a sensor communication system, wherein the sensor communication method comprises the following steps: receiving a sensor communication instruction; reading a target sensor protocol from a configurable file according to the sensor communication instruction, wherein the configurable file comprises a plurality of sensor protocols corresponding to a plurality of sensors; sending the write sensor data in the target sensor protocol to a target sensor so that the target sensor replies initial sensor data according to the write sensor data; analyzing the initial sensor data according to the target sensor protocol to obtain target sensor data; and outputting the target sensor data. The sensor communication method disclosed by the embodiment of the invention can be compatible with sensor protocols of different manufacturers and can be adapted to various types of sensors only by one set of code logic.

Description

Sensor communication method, device and system
Technical Field
The present invention relates to the field of sensor technologies, and in particular, to a sensor communication method, a sensor communication device, and a sensor communication system.
Background
Currently, sensors are used in various fields, such as weather forecast in the meteorological field, temperature and humidity sensing in the medical field, environmental monitoring in factory building sites, and the like, and the final purpose is to acquire sensor data for analysis and prediction, wherein the sensor data is acquired by writing a designated character string to the sensor and the sensor returns corresponding data.
However, integration of sensor data reading schemes in the host computer requires code to maintain. With the increasing variety and functions of sensors, each sensor comes from different manufacturers, and the data reading and resolving rules of the sensors are different, the situation that the code for maintaining the previous sensor is not applicable to the next sensor occurs, so that a set of codes needs to be added for increasing the functions of one sensor or one sensor. Therefore, the codes of the upper computer are more and more numerous, and the performance is more and more reduced.
Therefore, the present invention provides a solution that is compatible with sensor protocols of different manufacturers and can adapt to various types of sensors with only one set of code logic.
Disclosure of Invention
Therefore, the present invention provides a sensor communication method, a sensor communication device and a sensor communication system, which can be compatible with sensor protocols of different manufacturers and can be adapted to various types of sensors only by one set of code logic.
Specifically, in a first aspect, an embodiment of the present invention provides a sensor communication method, including: receiving a sensor communication instruction; reading a target sensor protocol from a configurable file according to the sensor communication instruction, wherein the configurable file comprises a plurality of sensor protocols corresponding to a plurality of sensors; sending the write sensor data in the target sensor protocol to a target sensor so that the target sensor replies initial sensor data according to the write sensor data; analyzing the initial sensor data according to the target sensor protocol to obtain target sensor data; and outputting the target sensor data.
Sensor data reading schemes integrated in prior art related technologies require code to maintain in the upper computer. With the increasing variety and functions of the sensors, each sensor is from different manufacturers, and the data reading and analyzing rules of the sensors are different, the situation that the codes for maintaining the previous sensor are not suitable for the next sensor occurs, so that a set of codes needs to be added for increasing the functions of one sensor or one sensor, and thus, the codes of the upper computer are more and more numerous, and the performance is more and more reduced. The configurable file in the sensor communication method disclosed by the embodiment of the invention comprises a plurality of sensor protocols corresponding to a plurality of sensors, and the target sensor protocol is read from the configurable file through the sensor communication instruction, so that the sensor protocols of different manufacturers are compatible, and the conditions of various sensors can be adapted only by one set of code logic, the development difficulty of multi-sensor application is reduced, and the performance of an upper computer is greatly improved; the writing sensor data in the target sensor protocol is sent to the target sensor, so that the target sensor replies the initial sensor data, the initial sensor data is analyzed according to the target sensor protocol to obtain the target sensor data, and then the target sensor data is output, the sensor data analysis method is simplified, the process is clear and easy to understand, and the development efficiency is improved.
In an embodiment of the present invention, the reading a target sensor protocol from a configurable file according to the sensor communication instruction specifically includes: analyzing the sensor communication instruction to obtain a sensor manufacturer code and a sensor function type; and reading the target sensor protocol from the configurable file according to the sensor manufacturer code number and the sensor function type.
In an embodiment of the present invention, the sending write sensor data in the target sensor protocol to a target sensor specifically includes: acquiring a target serial port address and a target baud rate from the target sensor protocol; and sending the write sensor data to the target sensor based on the target serial port address and the target baud rate.
In an embodiment of the present invention, the analyzing the initial sensor data according to the target sensor protocol to obtain target sensor data specifically includes: judging whether the initial sensor data is complete according to a data length value in the target sensor protocol, wherein the data length value represents the data length of a packet of sensor data; and responding to the completeness of the initial sensor data, and analyzing the initial sensor data according to the target sensor protocol to obtain target sensor data.
In an embodiment of the present invention, the analyzing the initial sensor data according to the target sensor protocol to obtain target sensor data specifically includes: judging whether the data head in the initial sensor data is the same as the data head in the writing sensor data; responding to the fact that a data head in the initial sensor data is the same as a data head in the write sensor data, and verifying the initial sensor data according to a data verification mode in the target sensor protocol to obtain a verification result; judging whether a check code in the initial sensor data is the same as the check result; and combining the initial sensor data according to a data analysis rule in the target sensor protocol to obtain the target sensor data in response to the fact that the check code is the same as the check result.
In one embodiment of the present invention, the outputting the target sensor data includes: and processing the target sensor data according to the unit measuring range in the target sensor protocol and then outputting the processed target sensor data.
In an embodiment of the present invention, before sending the write sensor data in the target sensor protocol to the target sensor, the method further includes: and caching the target sensor protocol in a queue.
In a second aspect, an embodiment of the present invention provides a sensor communication device, including: the instruction receiving module is used for receiving a sensor communication instruction; the protocol reading module is used for reading a target sensor protocol from a configurable file according to the sensor communication instruction, wherein the configurable file comprises a plurality of sensor protocols corresponding to a plurality of sensors; the data sending module is used for sending the write sensor data in the target sensor protocol to a target sensor so that the target sensor replies initial sensor data according to the write sensor data; the data analysis module is used for analyzing the initial sensor data according to the target sensor protocol to obtain target sensor data; and a data output module for outputting the target sensor data.
In one embodiment of the present invention, the data parsing module includes: a first judgment unit configured to judge whether a data head in the initial sensor data and a data head in the write sensor data are the same; the data verification unit is used for responding that a data head in the initial sensor data is the same as a data head in the write sensor data, and verifying the initial sensor data according to a data verification mode in the target sensor protocol to obtain a verification result; the second judging unit is used for judging whether the check code in the initial sensor data is the same as the check result or not; and the data combination unit is used for combining the initial sensor data according to a data analysis rule in the target sensor protocol to obtain the target sensor data in response to the fact that the check code is the same as the check result.
In a third aspect, an embodiment of the present invention provides a sensor communication system, including: an upper computer; the display screen controller is connected with the upper computer; the various sensors are connected with the display screen controller; wherein, the display screen controller is used for executing any one of the sensor communication methods.
In a fourth aspect, an embodiment of the present invention provides a sensor communication system, including: a processor and a memory coupled to the processor; wherein the memory stores instructions for execution by the processor and the instructions cause the processor to perform operations to perform a sensor communication method as any one of the preceding methods.
In a fifth aspect, an embodiment of the present invention provides a computer-readable storage medium, which is a non-volatile memory and stores computer-readable instructions, where the computer-readable instructions include instructions for executing any one of the sensor communication methods described above.
As can be seen from the above, the embodiments of the present invention can achieve one or more of the following advantages: the configurable file comprises a plurality of sensor protocols corresponding to a plurality of sensors, the target sensor protocol is read from the configurable file through the sensor communication instruction, the configurable file is compatible with the sensor protocols of different manufacturers, and can be adapted to various sensors only by one set of code logic, so that the development difficulty of multi-sensor application is reduced, and the performance of an upper computer is greatly improved; the writing sensor data in the target sensor protocol is sent to the target sensor, so that the target sensor replies the initial sensor data, and the initial sensor data is analyzed according to the target sensor protocol to obtain the target sensor data and then output the target sensor data, thereby simplifying the sensor data analysis method, ensuring that the process is clear and easy to understand, and improving the development efficiency; the target sensor protocol is stored through the queue, and confusion in sending and reading sensor data is avoided; the data of the target sensor is processed and then displayed in a unit measuring range, so that the requirements of users in different scenes can be met; the safety and reliability of the sensor data are guaranteed through operations such as data head judgment, data verification and the like.
Other aspects and features of the present invention will become apparent from the following detailed description, which proceeds with reference to the accompanying drawings. It is to be understood, however, that the drawings are designed solely for purposes of illustration and not as a definition of the limits of the invention. It should be further understood that the drawings are not necessarily drawn to scale and that, unless otherwise indicated, they are merely intended to conceptually illustrate the structures and procedures described herein.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the invention and not to limit the invention. In the drawings:
fig. 1 is a flowchart illustrating steps of a sensor communication method according to a first embodiment of the present invention;
fig. 2 is a schematic diagram illustrating an architecture of a sensor communication method according to an embodiment of the present invention;
fig. 3 is a block diagram of a sensor communication device according to a second embodiment of the present invention;
FIG. 4 is a schematic diagram of the data analysis module 24 in the sensor communication device shown in FIG. 3;
fig. 5 is a schematic structural diagram of a sensor communication system according to a third embodiment of the present invention;
fig. 6 is a schematic structural diagram of a sensor communication system according to a fourth embodiment of the present invention;
fig. 7 is a schematic structural diagram of a computer-readable storage medium according to a fifth embodiment of the present invention.
[ description of reference ]
S11-S15: a sensor communication method step;
20: a sensor communication device; 21: an instruction receiving module; 22: a protocol reading module; 23: a data transmission module; 24: a data analysis module; 25: a data output module; 241: a first judgment unit; 242: a data verification unit; 243: a second judgment unit; 244: a data combining unit;
30: a sensor communication system; 31: an upper computer; 32: a display screen controller; 33: a sensor;
40: a sensor communication system; 41: a processor; 42: a memory;
50: a computer readable storage medium.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in detail below.
In order to make those skilled in the art better understand the technical solution of the present invention, the technical solution in the embodiment of the present invention will be clearly and completely described below with reference to the drawings in the embodiment of the present invention, and it is obvious that the described embodiment is only a part of the embodiment of the present invention, and not a whole embodiment. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the terms so used are interchangeable under appropriate circumstances such that the embodiments of the invention described herein are, for example, capable of operation in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
[ first embodiment ] A method for manufacturing a semiconductor device
Referring to fig. 1, a first embodiment of the present invention provides a sensor communication method. As shown in fig. 1, the sensor communication method includes, for example, steps S11 to S15.
Step S11: receiving a sensor communication instruction;
step S12: reading a target sensor protocol from a configurable file according to the sensor communication instruction, wherein the configurable file comprises a plurality of sensor protocols corresponding to a plurality of sensors;
step S13: sending the write sensor data in the target sensor protocol to a target sensor so that the target sensor replies initial sensor data according to the write sensor data;
step S14: analyzing the initial sensor data according to the target sensor protocol to obtain target sensor data;
step S15: outputting the target sensor data.
The sensor communication command mentioned in step S11 includes, for example, a sensor manufacturer code and a sensor function type corresponding to a sensor manufacturer, and further includes a sensor serial number, i.e., a sensor ID. The types of sensor functions mentioned include, for example: CO22PM2.5, PM10, barometric pressure, air humidity, air temperature, noise, wind speed, wind direction, and brightness. Wherein each function type corresponds to a different serial number, for example, 1 represents CO2And 2 representsPM2.5, PM 3 represents PM10, PM 4 represents air pressure, PM 5 represents air humidity, PM 6 represents air temperature, PM 7 represents noise, PM 8 represents wind speed, PM 9 represents wind direction, and PM10 represents brightness, but the embodiment is not limited thereto. The sensor communication instruction is from a host computer, for example, and the host computer refers to a computer that can directly issue the operation instruction, such as a personal computer, a handheld device or a portable device, a tablet device, a multiprocessor system, a microprocessor-based system, an editable consumer electronics device, a network PC, a minicomputer, a mainframe computer, a distributed computing environment including any of the above systems or devices, and the like. Further, step S11 includes, for example: analyzing the sensor communication instruction to obtain a sensor manufacturer code and a sensor function type; and reading the target sensor protocol from the configurable file according to the sensor manufacturer code number and the sensor function type.
In step S12, the configurable file may be stored in a designated location of the host computer, in a designated location local to the sending card, or in another location that the sending card can read. Wherein, the sending card is an LED display screen controller with a receiving card (scanning card) in the LED display screen control system. The configurable file provided by the embodiment integrates multiple sensor protocols, and a new sensor protocol is encapsulated on the basis of the process of accessing the sensor to acquire data by using the protocol character string in the prior art, so that the configurable file is compatible with a plurality of sensors meeting a certain technical standard. Briefly, the mentioned configurable file comprises a plurality of sensor protocols corresponding to a plurality of sensors. The sensor protocols corresponding to the same sensor by different manufacturers may be different, the sensor protocols corresponding to different sensors are different, the sensor protocols corresponding to different functions of the same sensor may also be different, the protocols are integrated into the configurable file, and the configurable file can be changed manually and flexibly, so that the operation is very convenient. The mentioned sensor protocol includes, for example, a serial port address, a sensor serial number, a sensor function type, a sensor manufacturer, a sensor product model, a sensor type, a function type corresponding to a sensor communication instruction, a baud rate, whether an integrated sensor protocol is supported, a common sensor protocol array, and an integrated sensor protocol array.
Specifically, the mentioned serial port address is a communication address for data interaction between the protocol and the sensor through the serial port. The mentioned serial number of the sensor is, for example, a serial number corresponding to the sensor in the upper computer, that is, the corresponding sensor can be found in the upper computer through the serial number. The types of sensor functions mentioned are as described above, and include, for example: one or more of CO2, PM2.5, PM10, barometric pressure, air humidity, air temperature, noise, wind speed, wind direction, and brightness. The mentioned sensor manufacturers are providers of the sensors, and the sensor protocols are different for different manufacturers. The mentioned sensor product model is the model of the sensor product corresponding to the sensor manufacturer. The mentioned sensor types comprise, for example, integrated sensors. The mentioned sensor communication instructions correspond to function types including, for example: modifying sensor addresses, reading sensor numbers, or modifying baud rates, etc. The mentioned baud rate refers to the sensor data transmission efficiency. The mentioned whether the integrated (multifunctional integrated) sensor protocol is supported or not can be understood that some sensors support multiple functions, such as the acquisition of temperature and humidity data, a user can send a protocol directly accessing the temperature or the humidity to respectively obtain the temperature data or the humidity data, or only send an integrated protocol to simultaneously obtain the temperature data and the humidity data, and whether the integrated (multifunctional integrated) sensor protocol is supported or not to represent whether a target sensor supports the sending of the special protocol or not. The mentioned generic sensor protocol array comprises, for example, a plurality of generic sensor protocols, one protocol corresponding to a function of sensor data. The mentioned integrated sensor protocol array is used to store the integrated (integrated) sensor protocol, i.e. to acquire data of all functions of the target sensor by one protocol.
It should be noted that the mentioned serial port address is located at the outermost layer of the configurable file, for example, the mentioned other parameters are located at the non-outer layer, that is, the outermost layer of the configurable file includes the serial port address and a protocol array set, the protocol array set includes a plurality of protocol arrays, each protocol array includes the aforementioned other parameters, and the contents of the protocol arrays can be manually added by a user according to an agreed protocol rule, where it is not necessary to link a sensor protocol with a sensor, and it is only necessary to ensure that the sensor protocol corresponding to the sensor exists in the configurable file.
In step S13, the written sensor data is located in, for example, a generic sensor protocol array or an integrated sensor protocol array of the target sensor protocol. The write sensor data includes, for example, a sensor device address, a function code, a register start address, a register length, and a check bit. The initial sensor data mentioned includes, for example, a sensor device address, a function code, a valid data byte, a return data field, and a check bit.
Further, the sending of the write sensor data in the target sensor protocol to the target sensor mentioned in step S13 includes, for example: acquiring a target serial port address and a target baud rate from the target sensor protocol; and sending the write sensor data to the target sensor based on the target serial port address and the target baud rate. The serial port communicating with the target sensor is found through the target serial port address, so that the required data transmission rate is selected based on the target baud rate, the data of the write sensor is sent out, and therefore the data of the write sensor can completely and accurately reach the target sensor.
In step S14, the target sensor data is, for example, data that can be output for display.
Further, step S14 includes, for example: judging whether the initial sensor data is complete according to the data length value in the target sensor protocol; and responding to the completeness of the initial sensor data, and analyzing the initial sensor data according to the target sensor protocol to obtain target sensor data. The data length values mentioned are, for example, in the generic sensor protocol array or in the integrated sensor protocol array. The data length value represents the data length of returning a packet of sensor data, namely the number of bytes included in the packet of sensor data, and whether the initial sensor data is complete is judged through the data length value, so that the complete initial sensor data can be received, and the condition that the received data is wrong is avoided.
Further, step S14 includes, for example: judging whether the data head in the initial sensor data is the same as the data head in the writing sensor data; responding to the fact that a data head in the initial sensor data is the same as a data head in the write sensor data, and verifying the initial sensor data according to a data verification mode in the target sensor protocol to obtain a verification result; judging whether a check code in the initial sensor data is the same as the check result; and combining the initial sensor data according to a data analysis rule in the target sensor protocol to obtain the target sensor data in response to the fact that the check code is the same as the check result. The data header mentioned here is, for example, the first two bytes of data, because the initial sensor data is generated based on the write sensor data, and therefore, the data headers of the initial sensor data and the write sensor data should be the same, if not the same, indicating that the data is erroneous. The last two bytes of the initial sensor data are, for example, check codes, which are calculated based on the preceding bytes. The mentioned data checking method is for example in a common sensor protocol array or an integrated sensor protocol array. If the data is correct, the verification result obtained by verifying the initial sensor data based on the data verification mode should be the same as the verification code, and the data subjected to verification is other byte data in the initial sensor data excluding the verification code. The safety and reliability of the sensor data can be ensured through the judgment of the data head and the check code. The mentioned data parsing rules are for example in a common sensor protocol array, or an all-in-one sensor protocol array, including for example: the function code corresponding to each function, the reading position of the effective data area of the function, the length to be read of the effective data area, the unit measuring range and the high-low combination mode of the data reported by the sensor. The function code corresponding to each mentioned function includes, for example: 1: CO2, 2: PM2.5, 3: PM10, 4: air pressure, 5: gas-wet, 6: air temperature, 7: noise, 8: wind speed, 9: wind direction and 10: brightness. The mentioned combination modes of high and low bits of data reported by the sensor include, for example: 0: big end and 1: a small end. The mentioned data check method includes, for example, CRC check, sum check, odd check, and the like. In addition, the data combining method includes a summation combination in addition to the above-mentioned high and low bit combinations.
In step S15, the output target sensor data is output to, for example, a host computer and displayed.
Further, step S15 includes, for example: and processing the target sensor data according to the unit measuring range in the target sensor protocol and then outputting the processed target sensor data. Specifically, the output data is, for example, the target sensor data multiplied by the unit range, for example, the unit range is, for example, 0.1, the output data needs to be obtained by multiplying the target sensor data by 0.1, and in some cases, the user wants to output the sensor data with the unit range, so that the user's requirements in different scenarios can be met.
Further, before step S13, for example, the method further includes: and caching the target sensor protocol in a queue. Specifically, a plurality of sensor protocols corresponding to a plurality of sensor communication instructions are queued, so that when a plurality of sensors access the sensors through a serial port, data can be read and written in order, and confusion of the data during sending or returning can be avoided. This avoids the confusion of sending read sensor data.
To facilitate understanding of the present embodiment, a specific implementation of the present embodiment is described below with reference to fig. 2. The sensor communication method provided by the present embodiment is implemented in the system shown in fig. 2, for example.
As shown in fig. 2, the system includes a host computer/player, a transmitter card, and various sensors. The transmitting card internally comprises a sensor function data provider, a configurable file resolver, a queue worker, a sensor data transceiver, a sensor return data resolver, a serial port interactor, a data checker and a data combiner. The operating system inside the transmitting card is, for example, a Linux system. The transmitting card is connected with various sensors through a serial port, a serial docking station or a serial hub, and the sensors comprise: temperature sensor, humidity sensor, CO2Sensors and integrated multifunction sensors.
In the following, an example will be described in which a sensor communication command is transmitted to read temperature data of a temperature sensor.
The upper computer sends a sensor communication instruction to the sending card, wherein the sensor communication instruction comprises, for example, the serial number of the temperature sensor on the upper computer, the functional type of the temperature sensor and the manufacturer of the temperature sensor. And the sensor function data provider of the sending card sends the command to the configurable file parser after receiving the command, the configurable file parser acquires a corresponding target sensor protocol according to the command and sends the target sensor protocol to the sensor function data provider, and the sensor function data provider sends the target sensor protocol to the queue work device.
The queue worker receives the target sensor protocol, then saves the protocol through the queue, and sends the protocol to the sensor data transceiver. The sensor data transceiver respectively forwards the protocol to the sensor return data parser and the serial port interactor.
The serial port interactor receives the target sensor protocol and then resolves the serial port address and the baud rate in the acquired protocol to open a corresponding serial port, namely the serial port reading and writing sensor can be used, the serial port interactor writes writing sensor data in the target sensor protocol into the temperature sensor through the serial port, and the temperature sensor returns initial temperature data to the serial port interactor according to the writing sensor data. The serial port interactor sends the initial temperature data to the sensor data transceiver, so that the sensor data transceiver reads the corresponding byte number according to the data length value in the target sensor protocol to ensure the integrity of the initial temperature data, and then sends the initial temperature data to the sensor return data analyzer.
The sensor return data analyzer firstly performs data head matching, namely matching a data head of initial temperature data with a data head of sensor data written in a protocol, and after the matching is successful, sending a target sensor protocol and the initial temperature data to the data checker. The data calibrator verifies the initial temperature data according to the data verification type in the target sensor protocol to obtain a verification result and replies the verification result to the sensor return data analyzer, the sensor return data analyzer judges that the verification result is the same as the verification code, the data analysis rule and the data in the target sensor protocol are transmitted into the data combiner, the data combiner recombines the return data to obtain effective data and replies the effective data to the sensor return data analyzer, the sensor return data analyzer transmits the effective data to the sensor function data provider, the sensor function data provider is provided with an interface for acquiring the sensor data and can output the effective data to an upper computer or a player for display, wherein the output effective data can be data with unit measuring range or data without unit measuring range.
In summary, the configurable file in the sensor communication method disclosed in the first embodiment of the present invention includes multiple sensor protocols corresponding to multiple sensors, and the target sensor protocol is read from the configurable file through the sensor communication instruction, so that the sensor communication method can be compatible with the sensor protocols of different manufacturers and can adapt to various types of sensors only through one set of code logic, thereby reducing the development difficulty of multi-sensor application and greatly improving the performance of an upper computer; the writing sensor data in the target sensor protocol is sent to the target sensor, so that the target sensor replies the initial sensor data, and the initial sensor data is analyzed according to the target sensor protocol to obtain the target sensor data and then output the target sensor data, thereby simplifying the sensor data analysis method, ensuring that the process is clear and easy to understand, and improving the development efficiency; the target sensor protocol is stored through the queue, and confusion in sending and reading sensor data is avoided; the data of the target sensor is processed and then displayed in a unit measuring range, so that the requirements of users in different scenes can be met; the safety and reliability of the sensor data are guaranteed through operations such as data head judgment, data verification and the like.
[ second embodiment ]
Referring to fig. 3, a second embodiment of the present invention provides a sensor communication device. As shown in fig. 3, the sensor communication device 20 includes, for example, an instruction receiving module 21, a protocol reading module 22, a data transmitting module 23, a data analyzing module 24, and a data outputting module 25.
Specifically, the instruction receiving module 21 is configured to receive a sensor communication instruction. The protocol reading module 22 is configured to read a target sensor protocol from a configurable file according to the sensor communication instruction, where the configurable file includes a plurality of sensor protocols corresponding to a plurality of sensors. The data sending module 23 is configured to send the write sensor data in the target sensor protocol to a target sensor, so that the target sensor replies with initial sensor data according to the write sensor data. The data analysis module 24 is configured to analyze the initial sensor data according to the target sensor protocol to obtain target sensor data. The data output module 25 is configured to output the target sensor data.
Further, as shown in fig. 4, the data parsing module 24 includes, for example: a first judgment unit 241, a data verification unit 242, a second judgment unit 243, and a data combination unit 244.
The first judging unit 241 is configured to judge whether the data head in the initial sensor data and the data head in the write sensor data are the same. The data verification unit 242 is configured to verify the initial sensor data according to a data verification method in the target sensor protocol to obtain a verification result in response to that a data header in the initial sensor data is the same as a data header in the write sensor data. The second determining unit 243 is configured to determine whether the check code in the initial sensor data is the same as the check result. The data combining unit 244 is configured to, in response to that the check code is the same as the check result, combine the initial sensor data according to a data parsing rule in the target sensor protocol to obtain the target sensor data.
The sensor communication method implemented by the sensor communication device 20 disclosed in the present embodiment is as described in the first embodiment, and therefore, will not be described in detail here. Optionally, each module, unit and other operations or functions in the second embodiment are respectively for implementing the method in the first embodiment of the present invention, and the technical effect of the sensor communication device 20 provided in this embodiment is the same as that of the sensor communication method in the first embodiment, and for brevity, no further description is provided here.
[ third embodiment ]
Referring to fig. 5, a third embodiment of the present invention provides a sensor communication system. As shown in fig. 5, the sensor communication system 30 includes, for example, an upper computer 31, a display screen controller 32, and various sensors 33.
The display screen controller 32 is connected to the upper computer 31, the various sensors 33 are connected to the display screen controller 32, and the display screen controller 32 is configured to implement the sensor communication method according to the foregoing first embodiment, which is not described herein again for brevity.
The host computer 31 is a computer capable of directly sending out control commands, and may be a personal computer, a hand-held or portable device, a tablet device, a multiprocessor system, a microprocessor-based system, an editable consumer electronics device, a network PC, a minicomputer, a mainframe computer, a distributed computing environment including any of the above systems or devices, and the like.
The display controller 32 is, for example, a transmitting card in an LED display control system, and includes, for example, a circuit board and a video source input interface, a programmable logic device connected to the video source input interface, a memory and a microcontroller connected to the programmable logic device, and a network interface connected to the programmable logic device, where the circuit board is, for example, a PCB board, the video source input interface is, for example, an HDMI interface or a DVI interface, the memory is, for example, a volatile memory SDRAM, the programmable logic device is, for example, an FPGA, the microcontroller is, for example, an MCU, and the network interface is, for example, an RJ 45.
The various sensors 33 may correspond to different manufacturers and/or different functions, for example. The function associated with each sensor 33 is, for example, CO2PM2.5, PM10, barometric pressure, air humidity, air temperature, noise, wind speed, wind direction, and brightness.
It should be noted that the sensor communication method implemented by the display controller 32 in the sensor communication system 30 disclosed in the present embodiment is as described in the first embodiment, and therefore, a detailed description thereof is omitted. The technical effect of the sensor communication system 30 disclosed in this embodiment is the same as that of the sensor communication method in the first embodiment, and for brevity, no further description is provided here.
[ fourth example ] A
Referring to fig. 6, a fourth embodiment of the present invention provides a sensor communication system. As shown in fig. 6, the sensor communication system 40 includes, for example: a processor 41 and a memory 42 connected to the processor 41. Wherein the memory 42 stores instructions for execution by the processor 41 and which cause the processor 41 to perform operations for performing the sensor communication method as described in the first embodiment.
It should be noted that the sensor communication system 40 disclosed in the present embodiment has instructions that enable the processor 41 to perform operations to perform the sensor communication method as described in the foregoing first embodiment, and therefore, the detailed description is omitted here. Optionally, each processor and each memory in this embodiment are respectively used to implement the method in the first embodiment of the present invention, and the technical effect of the sensor communication system 40 disclosed in this embodiment is the same as that of the sensor communication method in the first embodiment, and therefore, no further description is given here.
[ fifth embodiment ]
Referring to fig. 7, a fifth embodiment of the present invention provides a computer-readable storage medium. As shown in fig. 7, computer-readable storage medium 50 stores computer-readable instructions. The computer-readable instructions include instructions for performing the sensor communication method according to the first embodiment, and therefore, will not be repeated here. The computer-readable storage medium 50 is, for example, a non-volatile memory, and includes: magnetic media (e.g., hard disks, floppy disks, and magnetic tape), optical media (e.g., CDROM disks and DVDs), magneto-optical media (e.g., optical disks), and hardware devices specially constructed for storing and executing computer-executable instructions (e.g., Read Only Memories (ROMs), Random Access Memories (RAMs), flash memories, etc.). The computer-readable storage medium 50 may be executable by one or more processors or processing devices to execute computer-readable instructions.
In addition, the technical effect of the computer-readable storage medium 50 disclosed in this embodiment is the same as that of the sensor communication method in the first embodiment, and is not described herein again.
In the embodiments provided in the present invention, it should be understood that the disclosed system, apparatus and/or method may be implemented in other ways. For example, the above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and the actual implementation may have another division, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
Although the present invention has been described with reference to a preferred embodiment, it should be understood that various changes, substitutions and alterations can be made herein without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (10)

1. A sensor communication method, comprising:
receiving a sensor communication instruction; reading a target sensor protocol from a configurable file according to the sensor communication instruction, wherein the configurable file comprises a plurality of sensor protocols corresponding to a plurality of sensors;
sending the write sensor data in the target sensor protocol to a target sensor so that the target sensor replies initial sensor data according to the write sensor data;
analyzing the initial sensor data according to the target sensor protocol to obtain target sensor data; and
outputting the target sensor data.
2. The sensor communication method according to claim 1, wherein reading the target sensor protocol from the configurable file according to the sensor communication instruction specifically includes:
analyzing the sensor communication instruction to obtain a sensor manufacturer code and a sensor function type;
and reading the target sensor protocol from the configurable file according to the sensor manufacturer code number and the sensor function type.
3. The sensor communication method according to claim 1, wherein the sending of the written sensor data in the target sensor protocol to the target sensor specifically comprises:
acquiring a target serial port address and a target baud rate from the target sensor protocol;
and sending the write sensor data to the target sensor based on the target serial port address and the target baud rate.
4. The sensor communication method according to claim 1, wherein the analyzing the initial sensor data according to the target sensor protocol to obtain target sensor data specifically includes:
judging whether the initial sensor data is complete according to the data length value in the target sensor protocol; wherein the data length value represents a data length of a packet of sensor data;
and responding to the completeness of the initial sensor data, and analyzing the initial sensor data according to the target sensor protocol to obtain target sensor data.
5. The sensor communication method according to claim 1, wherein the analyzing the initial sensor data according to the target sensor protocol to obtain target sensor data specifically includes:
judging whether the data head in the initial sensor data is the same as the data head in the writing sensor data;
responding to the fact that a data head in the initial sensor data is the same as a data head in the write sensor data, and verifying the initial sensor data according to a data verification mode in the target sensor protocol to obtain a verification result;
judging whether a check code in the initial sensor data is the same as the check result;
and combining the initial sensor data according to a data analysis rule in the target sensor protocol to obtain the target sensor data in response to the fact that the check code is the same as the check result.
6. The sensor communication method of claim 1, wherein the outputting the target sensor data comprises:
and processing the target sensor data according to the unit measuring range in the target sensor protocol and then outputting the processed target sensor data.
7. The sensor communication method of claim 1, wherein prior to said sending the write sensor data in the target sensor protocol to the target sensor, further comprising:
and caching the target sensor protocol in a queue.
8. A sensor communication device, comprising:
the instruction receiving module is used for receiving a sensor communication instruction;
the protocol reading module is used for reading a target sensor protocol from a configurable file according to the sensor communication instruction, wherein the configurable file comprises a plurality of sensor protocols corresponding to a plurality of sensors;
the data sending module is used for sending the write sensor data in the target sensor protocol to a target sensor so that the target sensor replies initial sensor data according to the write sensor data;
the data analysis module is used for analyzing the initial sensor data according to the target sensor protocol to obtain target sensor data; and
and the data output module is used for outputting the target sensor data.
9. The sensor communication device of claim 8, wherein the data parsing module comprises:
a first judgment unit configured to judge whether a data head in the initial sensor data and a data head in the write sensor data are the same;
the data verification unit is used for responding that a data head in the initial sensor data is the same as a data head in the write sensor data, and verifying the initial sensor data according to a data verification mode in the target sensor protocol to obtain a verification result;
the second judging unit is used for judging whether the check code in the initial sensor data is the same as the check result or not;
and the data combination unit is used for combining the initial sensor data according to a data analysis rule in the target sensor protocol to obtain the target sensor data in response to the fact that the check code is the same as the check result.
10. A sensor communication system, comprising:
an upper computer;
the display screen controller is connected with the upper computer; and
the various sensors are connected with the display screen controller;
wherein the display screen controller is configured to perform the sensor communication method of any one of claims 1 to 7.
CN201911357238.9A 2019-12-25 2019-12-25 Sensor communication method, device and system Pending CN113034873A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911357238.9A CN113034873A (en) 2019-12-25 2019-12-25 Sensor communication method, device and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911357238.9A CN113034873A (en) 2019-12-25 2019-12-25 Sensor communication method, device and system

Publications (1)

Publication Number Publication Date
CN113034873A true CN113034873A (en) 2021-06-25

Family

ID=76458392

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911357238.9A Pending CN113034873A (en) 2019-12-25 2019-12-25 Sensor communication method, device and system

Country Status (1)

Country Link
CN (1) CN113034873A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115720231A (en) * 2022-11-22 2023-02-28 重庆长安汽车股份有限公司 Sensing data processing method and device, electronic equipment and storage medium

Citations (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102202093A (en) * 2011-05-12 2011-09-28 南京中兴新软件有限责任公司 Method for realizing sensor adaption and system thereof
CN103152368A (en) * 2011-12-06 2013-06-12 中国电信股份有限公司 Extensible method and system for Internet of things perception data display and conversion
CN103353835A (en) * 2013-01-17 2013-10-16 珠海全志科技股份有限公司 Migration processing method and device of Android system SensorHal layer compatible kinds of same Sensor devices
CN103957198A (en) * 2014-04-15 2014-07-30 深圳市玖坤信息技术有限公司 Sensor data receiving and converting method and system
CN104167088A (en) * 2014-08-26 2014-11-26 上海青芒科技有限公司 Remote control method and system of domestic appliances
CN104237089A (en) * 2014-09-15 2014-12-24 山东科技大学 Network sensor
CN104461686A (en) * 2014-11-19 2015-03-25 深圳市酷商时代科技有限公司 Method and device for providing sensor data for application program based on sensor
CN105721451A (en) * 2016-01-27 2016-06-29 深圳市盛弘电气股份有限公司 Extensible Modbus protocol analyzing method and device
KR20160123867A (en) * 2015-04-17 2016-10-26 엘지이노텍 주식회사 Sensor
CN106201952A (en) * 2016-07-25 2016-12-07 惠州Tcl移动通信有限公司 A kind of sensor compatibility processing method based on mobile terminal and system
EP3167403A1 (en) * 2014-07-07 2017-05-17 Metso Flow Control Oy Adaptive rfid reader
US20170289323A1 (en) * 1999-10-06 2017-10-05 Behnov GMBH, LLC Apparatus for internetworked wireless integrated network sensors (wins)
JP2017187907A (en) * 2016-04-05 2017-10-12 日本電信電話株式会社 Sensing system
CN207367018U (en) * 2017-11-08 2018-05-15 长沙变化率信息技术有限公司 A kind of strong sensor signal monitoring change data collector of compatibility
CN108377232A (en) * 2018-01-29 2018-08-07 杭州鸿泉物联网技术股份有限公司 A kind of multi-protocol communication method and device
CN208187439U (en) * 2018-04-28 2018-12-04 深圳远征技术有限公司 Configurable data concentrated collection system
CN109104300A (en) * 2018-07-12 2018-12-28 华清慧商(北京)科技有限公司 A kind of general sensing data acquisition parsing of software definition reports things system and method
CN109474614A (en) * 2018-12-11 2019-03-15 广州市吉华勘测股份有限公司 A kind of analytic method and system of multi-protocols
CN109917317A (en) * 2019-03-21 2019-06-21 河北申科电力股份有限公司 Hall current sensor calibration detection apparatus and method
CN109922096A (en) * 2017-12-12 2019-06-21 中国海洋大学 The communication system of multiple sensor general-purpose interfaces

Patent Citations (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170289323A1 (en) * 1999-10-06 2017-10-05 Behnov GMBH, LLC Apparatus for internetworked wireless integrated network sensors (wins)
CN102202093A (en) * 2011-05-12 2011-09-28 南京中兴新软件有限责任公司 Method for realizing sensor adaption and system thereof
CN103152368A (en) * 2011-12-06 2013-06-12 中国电信股份有限公司 Extensible method and system for Internet of things perception data display and conversion
CN103353835A (en) * 2013-01-17 2013-10-16 珠海全志科技股份有限公司 Migration processing method and device of Android system SensorHal layer compatible kinds of same Sensor devices
CN103957198A (en) * 2014-04-15 2014-07-30 深圳市玖坤信息技术有限公司 Sensor data receiving and converting method and system
EP3167403A1 (en) * 2014-07-07 2017-05-17 Metso Flow Control Oy Adaptive rfid reader
CN104167088A (en) * 2014-08-26 2014-11-26 上海青芒科技有限公司 Remote control method and system of domestic appliances
CN104237089A (en) * 2014-09-15 2014-12-24 山东科技大学 Network sensor
CN104461686A (en) * 2014-11-19 2015-03-25 深圳市酷商时代科技有限公司 Method and device for providing sensor data for application program based on sensor
KR20160123867A (en) * 2015-04-17 2016-10-26 엘지이노텍 주식회사 Sensor
CN105721451A (en) * 2016-01-27 2016-06-29 深圳市盛弘电气股份有限公司 Extensible Modbus protocol analyzing method and device
JP2017187907A (en) * 2016-04-05 2017-10-12 日本電信電話株式会社 Sensing system
CN106201952A (en) * 2016-07-25 2016-12-07 惠州Tcl移动通信有限公司 A kind of sensor compatibility processing method based on mobile terminal and system
CN207367018U (en) * 2017-11-08 2018-05-15 长沙变化率信息技术有限公司 A kind of strong sensor signal monitoring change data collector of compatibility
CN109922096A (en) * 2017-12-12 2019-06-21 中国海洋大学 The communication system of multiple sensor general-purpose interfaces
CN108377232A (en) * 2018-01-29 2018-08-07 杭州鸿泉物联网技术股份有限公司 A kind of multi-protocol communication method and device
CN208187439U (en) * 2018-04-28 2018-12-04 深圳远征技术有限公司 Configurable data concentrated collection system
CN109104300A (en) * 2018-07-12 2018-12-28 华清慧商(北京)科技有限公司 A kind of general sensing data acquisition parsing of software definition reports things system and method
CN109474614A (en) * 2018-12-11 2019-03-15 广州市吉华勘测股份有限公司 A kind of analytic method and system of multi-protocols
CN109917317A (en) * 2019-03-21 2019-06-21 河北申科电力股份有限公司 Hall current sensor calibration detection apparatus and method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
陈继欣,邓立主编: "《传感网应用开发(中级)》", 31 October 2019 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115720231A (en) * 2022-11-22 2023-02-28 重庆长安汽车股份有限公司 Sensing data processing method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
US7882395B2 (en) Debug device for embedded systems and method thereof
CN100483361C (en) Terminal user interface testing method and device
CN107404418B (en) Internet product testing method, device, equipment and storage medium
CN112527705B (en) PCIe DMA data path verification method, device and equipment
KR101874416B1 (en) Universal serial bus emulation of peripheral devices
TW201443661A (en) Coexisting standard and proprietary connection usage
US20140164845A1 (en) Host computer and method for testing sas expanders
CN113034873A (en) Sensor communication method, device and system
US8321604B2 (en) Real-time USB class level decoding
CN113946480A (en) Detection device and method for I2C bus
EP3125251A1 (en) Hamming code-based data access method and integrated random access memory
JP4455393B2 (en) Programmable logic controller
CN110457056B (en) Instrument on-line upgrading method and receiving device based on HART bus
CN111651308B (en) Method and device for acquiring debugging data of DP-HDMI chip and intelligent device
CN112346665B (en) PCIE-based communication method, device, equipment, system and storage medium
CN114610557A (en) Method and device for testing equipment driving unit
CN112395147A (en) Debugging device on SOC
CN116820867B (en) Chip debugging method and device and chip
CN111371799A (en) Method, device and equipment for controlling data transmission and reception of MCTP (Multi-channel media processing protocol) controller
JP3763182B2 (en) Configuration ROM inspection method and apparatus
CN117971608B (en) Method, device, equipment and medium for acquiring and sending hard disk logs
JP4957188B2 (en) CPU bus access auxiliary circuit
US20140195707A1 (en) Executive device and stack method and stack system thereof
CN115599721A (en) Port switching method, system, computing device and chip
CN105991368B (en) Information processing method and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20210625