CN113433899A - Signal detection and control method based on serial communication - Google Patents

Signal detection and control method based on serial communication Download PDF

Info

Publication number
CN113433899A
CN113433899A CN202110665028.7A CN202110665028A CN113433899A CN 113433899 A CN113433899 A CN 113433899A CN 202110665028 A CN202110665028 A CN 202110665028A CN 113433899 A CN113433899 A CN 113433899A
Authority
CN
China
Prior art keywords
sensor
data
value
control module
upper computer
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
CN202110665028.7A
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.)
Nanjing University of Aeronautics and Astronautics
Original Assignee
Nanjing University of Aeronautics and Astronautics
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 Nanjing University of Aeronautics and Astronautics filed Critical Nanjing University of Aeronautics and Astronautics
Priority to CN202110665028.7A priority Critical patent/CN113433899A/en
Publication of CN113433899A publication Critical patent/CN113433899A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B19/00Programme-control systems
    • G05B19/02Programme-control systems electric
    • G05B19/418Total factory control, i.e. centrally controlling a plurality of machines, e.g. direct or distributed numerical control [DNC], flexible manufacturing systems [FMS], integrated manufacturing systems [IMS], computer integrated manufacturing [CIM]
    • G05B19/4185Total factory control, i.e. centrally controlling a plurality of machines, e.g. direct or distributed numerical control [DNC], flexible manufacturing systems [FMS], integrated manufacturing systems [IMS], computer integrated manufacturing [CIM] characterised by the network communication
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04BTRANSMISSION
    • H04B17/00Monitoring; Testing
    • H04B17/10Monitoring; Testing of transmitters
    • H04B17/11Monitoring; Testing of transmitters for calibration
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04BTRANSMISSION
    • H04B17/00Monitoring; Testing
    • H04B17/20Monitoring; Testing of receivers
    • H04B17/21Monitoring; Testing of receivers for calibration; for correcting measurements
    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B2219/00Program-control systems
    • G05B2219/30Nc systems
    • G05B2219/33Director till display
    • G05B2219/33139Design of industrial communication system with expert system
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Abstract

The invention discloses a signal detection and control method based on serial communication, which comprises an upper computer, a sensor interface and a control module, wherein the upper computer is connected with the sensor interface; the sensor is connected with the control module through a sensor interface to form a sampling circuit, and the sampling circuit receives data measured and collected by the sensor and sends the data to the control module for processing; the control module classifies and filters the received sensor data and then sends the sensor data to the upper computer; when the upper computer is used as an output end, the digital quantity data is received, calibration calculation is carried out, and the actual numerical value size and the image curve are displayed in real time; when the upper computer is used as an input end, after receiving an instruction of an operator, the upper computer sends the instruction to the control module through the RS232, and the control module receives the instruction and then controls the specific external equipment through the output port. The invention can realize the value reading and calibration of the sensor information, and the intercommunication of various sensor information, has low cost and strong expansibility, and is suitable for various occasions.

Description

Signal detection and control method based on serial communication
Technical Field
The invention relates to the field of signal processing, in particular to a signal detection and control method based on serial communication.
Background
In modern industrial, especially automated, processes, various sensors are used to monitor and control various parameters of the process, to operate the equipment in a normal or optimal state, and to maximize the quality of the product. Sensors have long penetrated extremely widespread fields such as industrial production, space development, marine exploration, environmental protection, resource investigation, medical diagnostics, biotechnology, and even cultural relic protection. It can be said that from vast amounts of space, to vast amounts of ocean, to complex engineering systems, almost every modernization project, is not open to a wide variety of sensors.
However, the sensors are of various types, the numerical value display function integrated in the sensors has slow response, and is not suitable for occasions with high requirements on numerical value real-time performance, and meanwhile, the sensors are mutually independent, so that the information intercommunication of the sensors is difficult to realize.
Disclosure of Invention
In order to overcome the defects, the invention discloses a signal detection and control method based on serial communication, which can simultaneously receive signals of a switching value sensor, a current sensor, a voltage sensor and a digital sensor, complete the real-time detection and analysis of sensor data, and send, process and calibrate the data through an algorithm to realize the intercommunication of sensor information.
A signal detection and control method based on serial communication is characterized in that: the device comprises an upper computer, a sensor interface and a control module; the sensor is connected with the control module through a sensor interface to form a sampling circuit, and the sampling circuit receives data measured and collected by the sensor, converts the data into digital quantity data through the AD module and sends the digital quantity data to the control module for processing; the control module classifies and filters the received digital quantity data and then sends the digital quantity data to the upper computer; the upper computer is connected with the control module through RS232 and used as an output end, receives digital quantity data, performs calibration calculation, and displays an image curve of actual numerical values changing along with time and specific numerical values on a display in real time; when the upper computer is used as an input end, after receiving an instruction sent by an operator through a keyboard and a mouse, the upper computer sends the instruction to the control module through the RS232, and the control module receives the instruction and then controls the specific external equipment through the output port RS485 module port, the DA module port and the relay module port.
Preferably, the sensor comprises a switch quantity sensor, a digital quantity sensor, a current quantity sensor and a voltage quantity sensor, and the sensor interface matched with the sensor comprises a switch quantity sensor interface, a digital quantity sensor interface, a current quantity sensor interface and a voltage quantity sensor interface. The switching value sensor interface is connected with an external switching value sensor and is connected with the control module to form a sampling circuit, and the switching value signal output by the switching value sensor is sent to the control module. The interface of the digital quantity sensor is connected with an external digital quantity sensor, the digital quantity sensor is connected with the control module through RS485 to form a sampling circuit, data measured by the digital quantity sensor is converted into digital quantity through an MODBUS communication protocol and is sent to the control module to be processed, and parameters of the digital quantity sensor are set by the upper computer. The current sensor interface is connected with an external current sensor, is sequentially connected with the AD module and the control module to form a sampling circuit, converts data measured by the current sensor into digital quantity through the AD module and sends the digital quantity to the control module for processing. The voltage sensor is connected with an external voltage sensor, is sequentially connected with the AD module and the control module to form a sampling circuit, and converts data measured by the voltage sensor into digital quantity through the AD module and sends the digital quantity to the control module for processing.
Preferably, the current sensor interface and the voltage sensor interface are both analog sensor interfaces, and the analog sensor interface and the control module interface are sequentially connected with the switch and the R100 resistor and are grounded through the R100 resistor; when the switch dials the current signal, the current signal introduced by the current quantity sensor is collected, and when the switch dials the voltage signal, the voltage signal introduced by the voltage quantity sensor is collected.
Preferably, the control module is an ARM controller, and the AD values of the multiple sensors are detected and filtered through internal programming and are sent to the upper computer.
Preferably, the upper computer program is written by C #, the upper computer completes communication with the control module through RS232, and after receiving the AD value sent by the control module, the upper computer completes analysis of the AD value, calculation and calibration of an actual numerical value through an internal algorithm, and displays a numerical curve and the numerical value on a display in real time.
Preferably, the data sending method comprises:
step1.1: the method comprises the steps that a timer generated by STM32F107ZET6 chip internal clock frequency division is set, interruption is generated every 50ms, and a control module completes classification of sensor AD values once in the interruption and sends the AD values to an upper computer.
Step1.2: the control module calculates the formula: NumSend is 0x30+ Data% 10, Data is Data/10, the AD value of the sensor is separated and converted into ASCII code according to the sequence of units, tens, hundreds, thousands and tens, and the ASCII code is sent to the upper computer, wherein NumSend is the Data sent to the upper computer, and Data is the AD value of the sensor.
Step1.3: the control module sends eight effective data to the upper computer every time, wherein the first data is a function code and is outside 0x30 to 0x39, and the function code is used for classifying and confirming which sensor the sent AD value belongs to; the second, third, fourth, fifth and sixth data are respectively the units, tens, hundreds, thousands and tens of digits of the AD value; the seventh bit and the eighth bit are fixed to 0x0D and 0x0A for confirming that the group of data transmission is completed.
Preferably, the data processing method comprises the following steps: the upper computer stores the received Data in a cache array Data [ ] and then traverses the Data [ ] to process the Data. The method specifically comprises the following steps:
step2.1: find the function codes Data [ i ] of 0x30 to 0x39, which are not equal to 0x0D and 0x 0A.
Step2.2: and judging the second, third, fourth, fifth and sixth data, if the data is between 0x30 and 0x39, processing the data according to a formula tempData + (bData-0x30) tempBase and a formula tempBase-10, reducing the data into decimal numbers, and otherwise, repeating Step2.1. Wherein tempBase is a decimal number obtained by reduction, and the initial value of the decimal number is 0; tempBase is a base number, and the initial value of the tempBase is 1; bData is an element between 0x30 and 0x39 in the array Data [ ].
Step2.3: and judging that if the seventh and eighth data after the sixth data are 0x0D and 0x0A and the reception of one group of data is completed, storing the tempData to the corresponding positions according to the functional code classification.
Preferably, the calibration method of the sensor value is as follows: and recording the AD value as x, recording the actual value acquired by the sensor as y, and satisfying that y is kx + b, wherein k and b are calibration parameters, changing the actual value y acquired by the sensor to obtain a corresponding AD value x, and obtaining n groups of x values and y values through a calibration test. And (4) on the upper computer calibration interface, the n groups of x values and y values are input, and the calculation of the calibration parameters k and b can be realized through an internal algorithm. And the upper computer substitutes the AD value x into a formula y which is kx + b according to the calibration parameters k and b obtained by calibration, so that the real-time actual value y collected by the sensor can be obtained.
Preferably, the internal algorithm for calculating the calibration parameters k and b is: by the formula
Figure BDA0003116987750000041
Determining the ith calibration parameter kiWherein x isiIs the ith AD value, yiActual values collected for the ith sensor; calibrating the parameter kiSubstitution formula
Figure BDA0003116987750000042
To obtain a calibration parameter k value; by the formula: bi=yi-k×xi
Figure BDA0003116987750000043
And (5) obtaining the value of the calibration parameter b.
Preferably, the upper computer can realize manual fine adjustment of the sensor value, and after the upper computer automatically calculates and obtains the calibration parameter, if the actual value acquired by the sensor and the sensor value obtained by calculation have deviation, the upper computer interface fine adjusts the calibration parameters k and b so as to realize manual calibration of the sensor value.
Preferably, the upper computer further comprises a function of displaying a numerical curve and outputting to generate an EXCEL report; after receiving the digital quantity sent by the control module, the upper computer classifies the digital quantity, converts the digital quantity into a specific numerical value and stores the specific numerical value in a temporary memory opened up by the computer, and displays an image and numerical value size of the specific numerical value measured by the sensor along with time change on a display in real time; an operator can store the measured data in the EXCEL file by clicking a report generation button on an upper computer interface and generate a data curve as required.
Has the advantages that:
(1) the invention has simple structure and reasonable design, and can realize the numerical value reading and calibration of any switching value, current magnitude, voltage magnitude or digital quantity sensor;
(2) the operation interface of the invention is more humanized, the display can display the experimental data in real time, and the operability of the system is improved;
(3) the data receiving and calibration algorithm adopted by the invention is simple and clear, and low delay and high accuracy of sensor parameter acquisition are realized.
Drawings
FIG. 1 is a schematic structural diagram of one embodiment of the present invention;
FIG. 2 is a block diagram of the architecture of one embodiment of the present invention;
FIG. 3 is a block diagram of a sensor signal input detection architecture in accordance with one embodiment of the present invention;
fig. 4 is a block diagram of the output terminal structure of the relay module according to an embodiment of the invention;
FIG. 5 is a block diagram of the output terminal structure of the PWM module according to one embodiment of the present invention;
FIG. 6 is a block diagram of the output terminal structure of the digital module according to an embodiment of the present invention;
FIG. 7 is an acquisition circuit for an analog semaphore sensor signal according to an embodiment of the invention;
fig. 8 is a schematic diagram of an upper computer program interface according to an embodiment of the present invention.
Reference numerals: the device comprises a 1-switching value sensor interface, a 2-digital value sensor interface, a 3-AD module, a 4-current value sensor interface, a 5-AD module, a 6-voltage value sensor interface, a 7-water pump, an 8-motor, a 9-RS485 module port, a 10-frequency converter, an 11-DA module port, a 12-electric lamp, a 13-fan, a 14-relay module port, a 15-control module, a 16-upper computer, a 17-analog value sensor interface, an 18-control module port, a 19-resistor and a 20-switch.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. 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.
The invention discloses a signal acquisition and control method based on serial communication, which is characterized in that a sensor interface is interconnected with a sensor, so that the real-time detection and analysis of data of any switching value, current magnitude, voltage magnitude or digital quantity sensor can be realized, and the data is sent, processed and calibrated through an algorithm, so that the intercommunication of sensor information is realized.
With reference to fig. 1 to 8, a signal detection and control method based on serial communication includes an upper computer 16, a sensor interface and control module 15; the sensor is connected with the control module 15 through a sensor interface to form a sampling circuit, and the sampling circuit receives data measured and collected by the sensor, converts the data into digital quantity data through the AD module 5 and sends the digital quantity data to the control module 15 for processing.
The sensor types comprise a switching value sensor, a digital value sensor, a current value sensor and a voltage value sensor, and the sensor interfaces matched with the sensors comprise a switching value sensor interface 1, a digital value sensor interface 2, a current value sensor interface 4 and a voltage value sensor interface 6. The switching value sensor interface 1 is connected with an external switching value sensor and is connected with the control module to form a sampling circuit, and switching value signals output by the switching value sensor are sent to the control module. Digital quantity sensor interface 2 connects outside digital quantity sensor, and digital quantity sensor interface 2 can realize the communication with arbitrary digital quantity sensor, links to each other through RS485 and control module and constitutes a sampling circuit, converts the data that digital quantity sensor surveyed into the digital quantity through MODBUS communication protocol and sends control module for handling to and the settlement of receiving the host computer to digital quantity sensor parameter. The current sensor interface is connected with an external current sensor, is sequentially connected with the AD module and the control module to form a sampling circuit, converts data measured by the current sensor into digital quantity through the AD module and sends the digital quantity to the control module for processing. The voltage sensor is connected with an external voltage sensor, is sequentially connected with the AD module and the control module to form a sampling circuit, and converts data measured by the voltage sensor into digital quantity through the AD module and sends the digital quantity to the control module for processing.
Specifically, the sending method for sending data by the sensor is as follows:
step1.1: the method comprises the steps that a timer generated by STM32F107ZET6 chip internal clock frequency division is set, interruption is generated every 50ms, and a control module completes classification of sensor AD values once in the interruption and sends the AD values to an upper computer.
Step1.2: the control module calculates the formula: NumSend is 0x30+ Data% 10, Data is Data/10, the AD value of the sensor is separated and converted into ASCII code according to the sequence of units, tens, hundreds, thousands and tens, and the ASCII code is sent to the upper computer, wherein NumSend is the Data sent to the upper computer, and Data is the AD value of the sensor.
Step1.3: the control module sends eight effective data to the upper computer every time, wherein the first data is a function code and is outside 0x30 to 0x39, and the function code is used for classifying and confirming which sensor the sent AD value belongs to; the second, third, fourth, fifth and sixth data are respectively the units, tens, hundreds, thousands and tens of digits of the AD value; the seventh bit and the eighth bit are fixed to 0x0D and 0x0A for confirming that the group of data transmission is completed.
Specifically, the method for processing data by the control module 15 is as follows: the upper computer stores the received Data in a cache array Data [ ] and then traverses the Data [ ] to process the Data.
Step2.1: find the function codes Data [ i ] of 0x30 to 0x39, which are not equal to 0x0D and 0x 0A.
Step2.2: judging the second, third, fourth, fifth and sixth data, if the second, third, fourth, fifth and sixth data is between 0x30 and 0x39, processing the data according to a formula tempData + (bData-0x30) tempBase and a formula tempBase + 10, reducing the data into decimal numbers, otherwise, repeating Step2.1, wherein the tempData is the decimal numbers obtained by reduction, and the initial value of the data is 0; tempBase is a base number, and the initial value is 1; bData is an element between 0x30 and 0x39 in the array Data [ ].
Step2.3: and judging that if the seventh and eighth data after the sixth data are 0x0D and 0x0A and the reception of one group of data is completed, storing the tempData to the corresponding positions according to the functional code classification.
The control module 14 is an ARM controller, and is used for detecting, classifying and filtering the AD values of the multiple sensors and sending the AD values to the upper computer 16. The upper computer 16 is connected with the control module through the RS232, when the upper computer serves as an output end, after the digital quantity is received, the relation between the digital quantity and an actual numerical value is calculated through an internal calibration algorithm to be corrected, and an image curve and a specific numerical value size of the actual numerical value changing along with time are displayed on the display in real time. When the upper computer is used as an input end, after receiving an instruction sent by an operator through a keyboard and a mouse, the upper computer sends the instruction to the control module through the RS232, and the control module receives the instruction and then controls the specific external equipment through the output port. The output ports include an RS485 module port 9, a DA module port 11, and a relay module port 14. The RS485 module port 9 can be connected with a device supporting RS485 communication, the communication between the device and a digital device is completed through an MODBUS communication protocol, and the control of the external digital device is realized, for example, the frequency converter 10 is controlled, and the control of the water pump on the constant water flow in the pipeline is realized through a PID algorithm according to a voltage feedback signal output by the water pump 7; the DA module port 11 can output and generate analog voltage, and the rotating speed of the motor 8 can be controlled through an external motor driving circuit; relay module port 14 lug connection relay through the switching value signal that control module 15 produced, drives normally opening and the normal close of relay output end contact to the realization is if to external equipment: on-off control of the fan 13, the lamp 12, and the like.
Specifically, the calibration method of the sensor value comprises the following steps: recording the AD value as x, recording the actual value acquired by the sensor as y, and satisfying that y is kx + b, wherein k and b are calibration parameters, changing the actual value y acquired by the sensor to obtain a corresponding AD value x, and obtaining n groups of x values and y values through a calibration test: by the formula
Figure BDA0003116987750000081
Determining the ith calibration parameter kiWherein x isiIs the ith AD value, yiActual values collected for the ith sensor; calibrating the parameter kiSubstitution formula
Figure BDA0003116987750000082
To obtain a calibration parameter k value; by the formula: bi=yi-k×xi
Figure BDA0003116987750000083
And (5) obtaining the value of the calibration parameter b.
On the upper computer calibration interface, the n groups of x values and y values are input, and then the calculation of calibration parameters k and b can be realized through an internal algorithm; and the upper computer substitutes the AD value x into a formula y which is kx + b according to the calibration parameters k and b obtained by calibration, so that the real-time actual value y collected by the sensor can be obtained.
As shown in fig. 7, the analog semaphore sensor signal acquisition circuit is shown. The current sensor interface 4 and the voltage sensor interface 6 are both analog quantity sensor interfaces 17, and the two types of quantity interfaces can be used universally through the acquisition circuit, namely: two signal interfaces of the analog quantity sensor interface 17 and the control module interface 18 are sequentially connected with the switch 20 and the R100 resistor 19, and the R100 resistor 19 is grounded. When the switch 20 dials a current signal, the current signal acquired by the current sensor interface 4 is grounded through the R100 resistor 19, and at this time, the voltage at the analog sensor interface 17 and the control module interface 18 is measured, so that the current can be calculated, and the signal acquisition of the current sensor is completed; when the switch 20 dials the voltage signal, the voltage at the interface 6 of the voltage sensor and the interface 18 of the control module is directly measured, and the signal acquisition of the voltage sensor is completed. The data acquisition of any current sensor or any voltage sensor can be realized through the acquisition circuit of the analog signal quantity sensor signal.
Fig. 8 is a schematic diagram of an upper computer program interface. When the upper computer is used as an input end, the upper computer receives instructions sent by an operator through a keyboard and a mouse, and controls the control module 15. In the text box of the area 22, the specific values measured by the sensors can be displayed in real time. The correct serial port number and baud rate are selected in the area 26, and the connection button is clicked, so that normal communication between the upper computer 16 and the control module 15 can be completed. In the area 27, the calibration of the sensor values can be achieved by entering the parameters in a text box and clicking on the set button. In area 28, the control module 15 can be caused to start or stop sending sensor data to the host computer 16 by clicking on the send data/stop button in area 29. In the region 30, the time-dependent profile of the particular value measured by the sensor can be displayed in real time. In the area 21, by clicking different buttons, the relay connected to the relay module port 14 can be controlled, and the corresponding controlled component is turned on and turned off, for example: the on button under the motor fan icon may turn on the fan, and the flow chart is shown in fig. 4. In the area 25, by clicking the set button, the numerical value in the text box can be sent to the external digital device through the digital module port 9, and the control of the specific functions of the device is completed, for example: inputting a flow value in the text box and clicking the setting button, the upper computer converts the flow value into a frequency value through an internal algorithm, and sends the frequency value to the frequency converter through the digital module port 9, the frequency converter realizes that the flow value in the controlled pipeline reaches the setting value through an internal PID algorithm according to a voltage signal fed back by the motor and keeps constant, and a flow chart is shown in FIG. 6. In the area 24, by clicking a setting button, it can be set that the setting of the parameters of the connected digital quantity sensor is completed through the digital quantity sensor interface 2: such as setting the upper and lower limits of the digital type temperature sensor. In the area 23, the on/off button is clicked, enabling the setting of the rotation speed of the motor connected through the DA module port 11, for example: inputting a target rotating speed of the motor in the text box, clicking an on button, converting the value into a digital quantity by an upper computer through an internal algorithm and sending the digital quantity to the control module, converting the digital quantity into an analog quantity by the control module after receiving the digital quantity, outputting a corresponding analog quantity value through the DA module, and clicking a driving circuit through the outside to achieve the purpose of controlling the rotating speed of the motor, wherein a flow chart is shown in fig. 5. In the area 26, the text box is clicked to select the report saving path, and then the report generating button is clicked, so that the collected data can be automatically saved in the EXCEL, and a report is generated and saved according to the EXCEL template.
Finally, it should be noted that: although the present invention has been described in detail with reference to the foregoing embodiments, it will be apparent to those skilled in the art that changes may be made in the embodiments and/or equivalents thereof without departing from the spirit and scope of the invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A signal detection and control method based on serial communication is characterized in that: the device comprises an upper computer, a sensor interface and a control module; the sensor is connected with the control module through a sensor interface to form a sampling circuit, and the sampling circuit receives data measured and collected by the sensor and sends the data to the control module for processing; the control module classifies and filters the received sensor data and then sends the sensor data to the upper computer; the upper computer is connected with the control module through the RS232, receives the digital quantity data and carries out calibration calculation when the upper computer is used as an output end, and displays an image curve of the actual numerical value measured by the sensor along with time and the specific numerical value size on the display in real time; when the upper computer is used as an input end, the upper computer receives instructions sent by an operator through a keyboard and a mouse and sends the instructions to the control module through the RS232, and the control module receives the instructions and then controls the specific external equipment through the output port.
2. The serial communication based signal detection and control method of claim 1, wherein: the sensor comprises a switching value sensor, a digital value sensor, a current sensor and a voltage sensor, and the sensor interface matched with the sensor comprises a switching value sensor interface, a digital value sensor interface, a current sensor interface and a voltage sensor interface;
the switching value sensor interface is connected with an external switching value sensor and is connected with the control module to form a sampling circuit, and a switching value signal output by the switching value sensor is sent to the control module;
the interface of the digital quantity sensor is connected with an external digital quantity sensor, the digital quantity sensor is connected with the control module through RS485 to form a sampling circuit, data measured by the digital quantity sensor is converted into digital quantity through an MODBUS communication protocol and is sent to the control module for processing, and the setting of an upper computer on the parameters of the digital quantity sensor is received;
the current sensor interface is connected with an external current sensor, is sequentially connected with the AD module and the control module to form a sampling circuit, converts data measured by the current sensor into digital quantity through the AD module and sends the digital quantity to the control module for processing;
the voltage sensor is connected with an external voltage sensor, is sequentially connected with the AD module and the control module to form a sampling circuit, and converts data measured by the voltage sensor into digital quantity through the AD module and sends the digital quantity to the control module for processing.
3. The serial communication based signal detection and control method according to claim 1 or 2, wherein: the current sensor interface and the voltage sensor interface are both analog sensor interfaces, and a control module interface is matched with the control module; the analog quantity sensor interface and the control module interface are sequentially connected with the switch and the R100 resistor and are grounded through the R100 resistor; when the switch dials the current signal, the current signal introduced by the current quantity sensor is collected, and when the switch dials the voltage signal, the voltage signal introduced by the voltage quantity sensor is collected.
4. The serial communication based signal detection and control method of claim 3, wherein: the control module is an ARM controller, and the AD value of the multi-path sensor is detected, filtered and sent to an upper computer through internal programming; the program of the upper computer is compiled by C #, the upper computer is communicated with the control module through RS232, the AD value is analyzed, the actual numerical value is calculated and calibrated through an internal algorithm after the AD value sent by the control module is received, and a numerical curve and the numerical value are displayed on the display in real time.
5. The serial communication based signal detection and control method according to claim 1 or 4, wherein: the sending method of the sensor data comprises the following steps:
step1.1: setting a timer generated by clock frequency division in an STM32F107ZET6 chip, generating an interrupt every 50ms, finishing classification of an AD value of a sensor by a control module in the interrupt, and sending the AD value to an upper computer;
step1.2: the control module calculates the formula: NumSend is 0x30+ Data% 10, Data is Data/10, the AD value of the sensor is separated and converted into ASCII code one by one according to the sequence of one place, ten places, hundred places, thousand places and ten thousand places, and the ASCII code is sent to the upper computer, wherein NumSend is the Data sent to the upper computer, and Data is the AD value of the sensor;
step1.3: the control module sends eight effective data to the upper computer every time, wherein the first data is a function code and is outside 0x30 to 0x39, and the function code is used for classifying and confirming which sensor the sent AD value belongs to; the second, third, fourth, fifth and sixth data are respectively the units, tens, hundreds, thousands and tens of digits of the AD value; the seventh bit and the eighth bit are fixed to 0x0D and 0x0A for confirming that the group of data transmission is completed.
6. The serial communication based signal detection and control method of claim 5, wherein: the data processing method comprises the following steps: the upper computer stores the received Data in a cache array Data [ ] and then traverses the Data [ ] to process the Data;
step2.1: searching a functional code Data [ i ] which is not equal to 0x0D and 0x0A except 0x 30-0 x 39;
step2.2: judging the second, third, fourth, fifth and sixth data, if the second, third, fourth, fifth and sixth data is between 0x30 and 0x39, processing the data according to a formula tempData + (bData-0x30) tempBase and a formula tempBase + 10, reducing the data into decimal numbers, otherwise, repeating Step2.1, wherein the tempData is the decimal numbers obtained by reduction, and the initial value of the data is 0; tempBase is a base number, and the initial value is 1; bData is an element between 0x30 and 0x39 in the Data array [ ];
step2.3: and judging that if the seventh and eighth data after the sixth data are 0x0D and 0x0A and the reception of one group of data is completed, storing the tempData to the corresponding positions according to the functional code classification.
7. The serial communication based signal detection and control method according to claim 1 or 6, wherein: the calibration method of the sensor value comprises the following steps: recording the AD value as x, recording the actual value acquired by the sensor as y, and satisfying that y is kx + b, wherein k and b are calibration parameters, changing the actual value y acquired by the sensor to obtain a corresponding AD value x, and obtaining n groups of x values and y values through a calibration test; on the upper computer calibration interface, the n groups of x values and y values are input, and then the calculation of calibration parameters k and b can be realized through an internal algorithm; and the upper computer substitutes the AD value x into a formula y which is kx + b according to the calibration parameters k and b obtained by calibration, so that the real-time actual value y collected by the sensor can be obtained.
8. Root of herbaceous plantThe serial communication based signal detection and control method of claim 7, wherein: the internal algorithm for realizing the calculation of the calibration parameters k and b is as follows: by the formula
Figure FDA0003116987740000041
Determining the ith calibration parameter kiWherein x isiIs the ith AD value, yiActual values collected for the ith sensor; calibrating the parameter kiSubstitution formula
Figure FDA0003116987740000042
To obtain a calibration parameter k value; by the formula: bi=yi-k×xiFinding the ith calibration parameter biAnd by the formula:
Figure FDA0003116987740000043
find out biIs the value of the calibration parameter b.
9. The serial communication based signal detection and control method according to claim 1 or 8, wherein: the upper computer can be used for manually fine-tuning the sensor value, after the upper computer automatically calculates and calculates the calibration parameter, if the actual value acquired by the sensor and the sensor value obtained by calculation have deviation, the calibration parameter k and b are fine-tuned on the interface of the upper computer, so that the manual calibration of the sensor value is realized.
10. The serial communication based signal detection and control method of claim 9, wherein: the upper computer also comprises a function of displaying a numerical curve and outputting and generating an EXCEL report; after receiving the digital quantity sent by the control module, the upper computer classifies the digital quantity, converts the digital quantity into a specific numerical value and stores the specific numerical value in a temporary memory opened up by the computer, and displays an image and numerical value size of the specific numerical value measured by the sensor along with time change on a display in real time; an operator can store the measured data in the EXCEL file by clicking a report generation button on an upper computer interface and generate a data curve as required.
CN202110665028.7A 2021-06-16 2021-06-16 Signal detection and control method based on serial communication Pending CN113433899A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110665028.7A CN113433899A (en) 2021-06-16 2021-06-16 Signal detection and control method based on serial communication

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110665028.7A CN113433899A (en) 2021-06-16 2021-06-16 Signal detection and control method based on serial communication

Publications (1)

Publication Number Publication Date
CN113433899A true CN113433899A (en) 2021-09-24

Family

ID=77756116

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110665028.7A Pending CN113433899A (en) 2021-06-16 2021-06-16 Signal detection and control method based on serial communication

Country Status (1)

Country Link
CN (1) CN113433899A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117434876A (en) * 2023-12-19 2024-01-23 深圳市森威尔科技开发股份有限公司 OT communication detection circuit and device

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101158855A (en) * 2007-10-25 2008-04-09 苏州工业园区新大诚科技发展有限公司 Serial interface type single-chip data acquisition system
CN101738210A (en) * 2008-11-14 2010-06-16 沈阳中科博微自动化技术有限公司 Device and method for measuring resistance bridge sensor simultaneously supporting voltage excitation and current excitation
CN202472342U (en) * 2012-03-06 2012-10-03 楚天科技股份有限公司 Temperature monitoring loop calibration device for rubber plug or aluminum cover cleaning system
CN108286987A (en) * 2017-11-30 2018-07-17 深圳市科卫泰实业发展有限公司 A kind of unmanned plane flies the calibration method of control module MEMS motion sensors
CN109164404A (en) * 2018-08-10 2019-01-08 烽火通信科技股份有限公司 The system and method that sample circuit in circuit board is calibrated automatically
CN109781179A (en) * 2019-01-25 2019-05-21 云南保利天同仪器有限公司 Multi-channel multi-parameter sensor detecting system and its detection method
CN209496471U (en) * 2019-01-11 2019-10-15 中国石油大学(华东) A kind of multifunctional universal interface arrangement

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101158855A (en) * 2007-10-25 2008-04-09 苏州工业园区新大诚科技发展有限公司 Serial interface type single-chip data acquisition system
CN101738210A (en) * 2008-11-14 2010-06-16 沈阳中科博微自动化技术有限公司 Device and method for measuring resistance bridge sensor simultaneously supporting voltage excitation and current excitation
CN202472342U (en) * 2012-03-06 2012-10-03 楚天科技股份有限公司 Temperature monitoring loop calibration device for rubber plug or aluminum cover cleaning system
CN108286987A (en) * 2017-11-30 2018-07-17 深圳市科卫泰实业发展有限公司 A kind of unmanned plane flies the calibration method of control module MEMS motion sensors
CN109164404A (en) * 2018-08-10 2019-01-08 烽火通信科技股份有限公司 The system and method that sample circuit in circuit board is calibrated automatically
CN209496471U (en) * 2019-01-11 2019-10-15 中国石油大学(华东) A kind of multifunctional universal interface arrangement
CN109781179A (en) * 2019-01-25 2019-05-21 云南保利天同仪器有限公司 Multi-channel multi-parameter sensor detecting system and its detection method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117434876A (en) * 2023-12-19 2024-01-23 深圳市森威尔科技开发股份有限公司 OT communication detection circuit and device
CN117434876B (en) * 2023-12-19 2024-03-08 深圳市森威尔科技开发股份有限公司 Open temperature control protocol communication detection circuit and device

Similar Documents

Publication Publication Date Title
US11886176B2 (en) Bioreactor control system and method of use
CN110057477B (en) Multi-channel alternating/direct current excited signal measuring system for strain type force sensor
CN101709983A (en) On-line actual error compensation system of sine and cosine encoder
CN102944426A (en) Measurement and control system and method for test bed of X-type aero-engine
CN115014696B (en) Method for synchronous acquisition and integrated processing of wind tunnel multi-signal source data
CN113433899A (en) Signal detection and control method based on serial communication
CN107042513B (en) Machining robot system
CN111605724B (en) Simulation test method for atmospheric data system
CN208270992U (en) intelligent network sensor device
CN103576643A (en) HART analog input module with differential input stage
CN101603838B (en) Intelligent transducer and calibration method thereof
CN104501854A (en) Intelligent test system based on TEDS sensor and matrix switch technology and test method thereof
CN106556724A (en) Ammeter and its clock correcting method
CN209857935U (en) Detection device for detecting precision of photoelectric encoder
CN204330003U (en) The intelligent test system of new architecture
CN115308664B (en) Calibration device and method for Hall current sensor
CN111006728A (en) Flow rate controller converter and control method thereof
CN114859149A (en) Test system for electrical parameters of rotary encoder
CN103019170A (en) Method and apparatus for eliminating aliasing
CN208459818U (en) Source signal capture card
CN111026194A (en) Intelligent integrated control display device and method
CN102053008B (en) Display equipment evaluation system and display equipment evaluation method
CN205676495U (en) A kind of converter inclination angle local display unit
CN113110279B (en) PLC analog output module for remote anti-electromagnetic interference transmission of analog signal
EP2784651B1 (en) Transmitter with rotating knob

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: 20210924