Disclosure of Invention
The invention aims to solve the problems in the prior art, provides a wireless data acquisition device, does not relate to a controller communication protocol, directly acquires the data of a dry-wet-bulb temperature sensor of a curing barn and sends the data to a server, can be compatible with most of the controllers at present, and has universality and convenient installation and use.
In order to achieve the purpose, the invention is realized by the following technical scheme:
a wireless data acquisition device is arranged on the base,
the wireless data acquisition device is provided with two double rows of bent seats, wherein one double row of bent seats is connected with a controller in the baking room, and the other double row of bent seats is connected with a sensor in the baking room;
the wireless data acquisition device is internally provided with a singlechip, a wireless communication module and a power supply circuit, and the wireless communication module and the power supply circuit are in signal connection with the singlechip;
the power supply circuit comprises a booster circuit and a charging circuit, one end of the booster circuit is connected with a power line of a sensor in the curing barn, the other end of the booster circuit is connected with the charging circuit, the charging circuit is connected with the wireless communication module, and the charging circuit comprises an energy storage element.
Preferably, the connection mode of the two double-row curved seats on the wireless data acquisition device in the wireless data acquisition device is as follows:
in the wireless data acquisition device, VIN of the two double-row curved seats are directly connected, and GND is directly connected;
DSIN1, DSIN2, DSIN3 and DSIN14 are connected with a controller, DSOUT1, DSOUT2, DSOUT3 and DSOUT4 are connected with sensors, and 4 paths of sensor signals are controlled by electronic switches, and each path is independently controlled.
Preferably, the energy storage element is a super capacitor, and the charging circuit includes a lithium battery management chip for charging the energy storage element.
Preferably, the charging circuit is provided with an adjusting switch for adjusting the charging current.
Preferably, a power pin or a ground pin of the wireless communication module is connected with a control switch.
An acquisition method of a wireless data acquisition device comprises the following steps:
s11, waiting for reading sensor data conditions;
s12, reading sensor data;
s13, judging whether the reading in the step S12 is correct or not;
if the reading is correct, storing the temperature data, waiting for the charging to be completed, and sending the data to the server;
if the reading is wrong, whether the energy storage element is charged is judged, if the charging is finished, a sensor fault marker is set, and data are sent to a server; if the charging is not completed, returning to step S11;
s14, the server waits for the end of the cycle period after receiving the data.
Preferably, the step S11 is specifically included in the acquisition method of a wireless data acquisition device:
step 1: continuously monitoring the voltage of a signal pin of the sensor, waiting for the arrival of a low level, then entering a step 2, and if the low level is not waited for after the set time is exceeded, entering a step 4;
step 2: waiting for the high level of the signal pin of the sensor to be recovered, then entering a step 3, and if the high level is not recovered after the set time is exceeded, entering a step 4;
and step 3: timing the high level time of the sensor signal pin, entering a step 5 after the high level time continuously exceeds the set time, and entering a step 2 if the high level time does not exceed the set time and is converted into a low level;
and 4, step 4: disconnecting the controller from the sensor data pin by using an electronic switch, waiting for 0.8 second, sending a conversion starting command to the sensor, and waiting for the conversion to be completed;
and 5: conditions for reading sensor data are provided.
An adaptive method of a wireless data acquisition device, comprising: the sensitivity of the connection pin of the single chip microcomputer and the sensor to the rising edge is improved; adding a parameter in a subprogram for reading sensor register bytes, wherein the parameter is the delay time between the output of a high level by a pin of a single chip microcomputer and the reading of the state of the pin of the sensor by the single chip microcomputer, and setting an array for the parameter to limit the value range; when the data of the sensor is read incorrectly, circularly switching the parameter value; if the reading of the sensor data is successful, the default parameter when the sensor data is read next time is the parameter, and if the parameter is wrong, the next parameter is switched to.
A method for using a wireless data acquisition device comprises a method for judging the baking starting moment, a method for judging the water shortage of a dry-wet bulb temperature sensor kettle, a method for judging the fault of a circulating fan and a method for judging the temperature abnormity;
the method for judging the baking starting time comprises the following steps:
arranging an environment temperature sensor on the wireless data acquisition device, comparing the environment temperature with the dry bulb temperature in the baking room, and when the dry bulb temperature in the baking room is higher than the environment temperature by a certain value, considering that baking starts;
when the temperature rising speed of the dry ball in the baking room exceeds a certain numerical value and the current temperature exceeds a certain temperature, the baking is considered to be started;
the method for judging water shortage of the wet and dry bulb temperature sensor kettle comprises the following steps:
when the dry bulb temperature is more than or equal to 42 ℃ and the wet bulb temperature is more than or equal to-1 ℃ of the dry bulb temperature, the kettle is considered to be lack of water;
when the dry bulb temperature is less than 42 ℃ and the wet bulb temperature is more than or equal to the dry bulb temperature, the kettle is considered to be lack of water;
the method for judging the fault of the circulating fan comprises the following steps: when the difference value between the corresponding temperatures of the upper shed and the lower shed exceeds a certain numerical value, the circulating fan is considered to be in fault;
the method for judging the temperature abnormity comprises the following steps:
when any one of the temperature drop rates exceeds a certain value, the temperature is considered abnormal.
When any one of the temperature rise rates exceeds a certain value, the temperature is considered abnormal.
And when the difference value between the dry bulb temperature and the wet bulb temperature of the same temperature and humidity sensor exceeds a normal range, the temperature is considered to be abnormal.
Compared with the prior art, the invention has the beneficial effects that:
1. the invention has convenient installation and use, can be used in a plug-and-play manner, does not need to change a controller and a sensor, can realize the upgrading of the Internet of things of equipment at lower cost and realize remote monitoring.
2. The invention adopts a low-power-consumption design and a low-interference program for reading sensor data, does not influence the normal operation of the sensor and equipment, and can be compatible with all controllers and sensors which conform to national tobacco integrated product No. 2009/418 at present.
3. Under the condition that the operation state of the curing barn is not read through the RS485 interface of the controller, the operation state of the equipment can be intelligently judged according to temperature and humidity data, and information is sent to relevant personnel through the server platform to assist in troubleshooting.
Detailed Description
The invention will be further illustrated with reference to the following specific examples. It should be understood that these examples are for illustrative purposes only and are not intended to limit the scope of the present invention. Further, it should be understood that various changes or modifications of the present invention may be made by those skilled in the art after reading the teaching of the present invention, and these equivalents also fall within the scope of the present application.
Example (b): the invention relates to a wireless data acquisition device, an acquisition method, a self-adaptive method and a use method for a tobacco leaf baking controller.
First, installation position and function of wireless data acquisition device
As shown in the attached figure 1, the wireless data acquisition device is connected in series between the bulk curing barn controller and the wet-dry bulb temperature sensor, the existing controller and the existing wet-dry bulb temperature sensor are not required to be modified, the device can be used in a plug-and-play mode, and the wireless data acquisition device reads data of the wet-dry bulb temperature sensor and sends the data to the server through a mobile network.
According to the technical specification of the bulk curing barn in the national tobacco integrated book (2009) 418, DS18B20 digital sensors are adopted as dry-bulb and wet-bulb temperature sensors, and 4 sensors are used in each curing barn, namely: the temperature of the dry bulb of the upper shed, the temperature of the wet bulb of the upper shed, the temperature of the dry bulb of the lower shed and the temperature of the wet bulb of the lower shed share a 6-core connecting line to form a temperature and humidity sensor, the connecting line of the temperature and humidity sensor selects a wiring connector compatible with the molex 0039291027 serial number, and the temperature and humidity sensor adopts a six-hole wiring connector in parallel connection, wherein the model is a molex0039012065 double-row plug 6PIN94V 0; the socket model on the circuit board is molex0039291067 double-row curved seat 6PIN94V0, and PIN 1 ~ 6 define in proper order: the device comprises an upper shed dry ball, an upper shed wet ball, a lower shed dry ball, a lower shed wet ball, a power supply and a ground.
Therefore, the wireless data acquisition device is provided with two molex0039291067 double-row curved seats 6PIN94V0, the sequence of the two rows of curved seats is the same as that of PINs of a controller and a sensor, one double-row curved seat is connected with the controller in the baking room, the other double-row curved seat is connected with the sensor in the baking room, and the wireless data acquisition device directly gets electricity from a power line of the sensor.
The wireless data acquisition device is internally provided with a singlechip, a wireless communication module and a power supply circuit, and the wireless communication module and the power supply circuit are in signal connection with the singlechip.
Because the wireless data acquisition device gets electricity from the sensor power cord, in order to guarantee the normal operating current of sensor, the device must adopt low-power consumption design. The main energy consumption element in the wireless data acquisition device is a wireless communication module, and because the instantaneous maximum working current of the wireless communication module is 2A, if the power is directly taken from a power line of the sensor, the sensor can not work normally, and even the normal work of the controller is influenced.
Therefore, the invention designs a low-power-consumption power supply circuit of a wireless communication module, wherein the power supply circuit comprises a booster circuit and a charging circuit, one end of the booster circuit is connected with a power line of a sensor in a curing barn, the other end of the booster circuit is connected with the charging circuit, the charging circuit is connected with the wireless communication module, and the charging circuit comprises an energy storage element.
Low-power-consumption power supply circuit of wireless communication module
As shown in fig. 2, VIN in the power supply circuit is connected to a power line of the sensor, VBAT is connected to a power pin of the wireless communication module, the circuit includes two links of a boost circuit and a charging circuit, VIN is boosted to a charging voltage, the charging voltage is 5V in the figure, and a boost chip is XC6372a 501; then, a super capacitor is used as an energy storage element, and a lithium battery management chip is used for charging the super capacitor, wherein the lithium battery management chip is TP 4065-4.20V; in order to control the charging current, Q1 in the figure is a switch for adjusting the charging current, AD _ PROG is a signal for collecting the voltage of the PROG pin, and TP _ PROG is a signal for controlling Q1.
The control steps are as follows:
(1) the single chip microcomputer collects AD _ PROG voltage, VBAT voltage and VIN voltage;
(2) judging whether the VIN voltage is higher than the working voltage of the sensor, if the VIN voltage is lower than the working voltage of the sensor, outputting a low level by TP _ PROG to disconnect Q1, returning to the step 1, and if the VIN voltage is higher than the working voltage of the sensor, entering the step 3;
(3) judging the current charging stage according to the AD _ PROG voltage and the VBAT voltage, controlling the connection and disconnection of the Q1 to enable the charging current not to exceed the set charging current, specifically, if the charging stage is a trickle charging stage, outputting a high level by the TP _ PROG to enable the Q1 to be connected, if the charging stage is a constant current charging stage or is close to a full charging stage, outputting a low level by the TP _ PROG to enable the Q1 to be disconnected, and returning to the step 1.
Attention is paid to the following points:
(1) in software, a control cycle period is shortened as much as possible, the minimum value of the period is matched with a VIN filter capacitor (C1 in the figure), the longer the period is, the larger the VIN filter capacitor is needed, in order to reduce the capacity requirement on the VIN filter capacitor and ensure that the VIN voltage can meet the normal work of the sensor, the control cycle period needs to be shortened as much as possible under the condition that the CPU occupancy rate is allowed, for example, a 100us timed interrupt program is adopted to control a TP _ PROG pin.
(2) The capacity of the super capacitor can meet the electric quantity requirement of the wireless communication module for carrying out networking once to send data, at least comprises the links of starting, networking, sending data, shutting down and the like, because the networking time of the communication module has uncertainty, the power consumption is not a fixed value, and in order to ensure that the networking can be successfully carried out to send data under most conditions, the super capacitor with enough capacity needs to be selected through testing.
Three, low interference type method for reading sensor data
In order to reduce the possibility of such a collision, the present invention provides a method for reading sensor data with low interference, which includes two aspects:
(1) reducing the number of times sensor data is read;
each duty cycle of the wireless data acquisition device includes 3 main contents: the method comprises the steps of collecting sensor data, controlling charging of a super capacitor, and sending the sensor data to a server after charging is completed, wherein the step of controlling charging of the super capacitor is a thread which runs all the time. The controller generally reads the sensor once in a few seconds, namely the sensor updates the temperature once in a few seconds, and the condition for reading the sensor data is met once, but in order to reduce the possibility of interference to the controller, the device only needs to correctly acquire the sensor data once in each working cycle of the wireless data acquisition device, and the period of each working cycle is generally from several minutes to ten and several minutes.
The wireless data acquisition device work cycle flow is shown in fig. 3, and each work cycle only needs to read the sensor data once, wherein the key steps are two steps of "waiting for reading the sensor data condition" and "reading the sensor data".
The device is not provided with a fixed data transmission period, the period of the data transmission period is determined by the charging current of the super capacitor, namely the power supply capacity of the sensor power line, and the super capacitor is connected with the server and transmits data once when being fully charged.
(2) Before reading the sensor data, selecting proper time to reduce the time conflict of reading the sensor data simultaneously with the controller, wherein the condition for reading the sensor data is established, and the sensor data is read after the condition is met.
As shown in fig. 3, the acquisition method of the wireless data acquisition device includes the steps of:
s11, waiting for reading sensor data conditions;
s12, reading sensor data;
s13, judging whether the reading in the step S12 is correct or not;
if the reading is correct, storing the temperature data, waiting for the charging to be completed, and sending the data to the server;
if the reading is wrong, whether the energy storage element is charged is judged, if the charging is finished, a sensor fault marker is set, and data are sent to a server; if the charging is not completed, returning to step S11;
s14, the server waits for the end of the cycle period after receiving the data.
The step S11 specifically includes:
step 1: continuously monitoring the voltage of a signal pin of the sensor, waiting for the arrival of a low level, then entering a step 2, and if the low level is not waited for after the set time is exceeded, entering a step 4;
step 2: waiting for the high level of the signal pin of the sensor to be recovered, then entering a step 3, and if the high level is not recovered after the set time is exceeded, entering a step 4;
and step 3: timing the high level time of the sensor signal pin, entering a step 5 after the high level time continuously exceeds the set time, and entering a step 2 if the high level time does not exceed the set time and is converted into a low level;
and 4, step 4: disconnecting the controller from the sensor data pin by using an electronic switch, waiting for 0.8 second, sending a conversion starting command to the sensor, and waiting for the conversion to be completed;
and 5: conditions for reading sensor data are provided.
Power-off processing of wireless communication module
A control switch, such as an MOS (metal oxide semiconductor) tube, is additionally arranged on a power supply pin or a grounding pin of the communication module, and the communication module is subjected to power-off processing under the following two conditions.
(1) Detecting that the VIN voltage is below a set value, such as 3.1V;
(2) sending data to the server multiple times in succession fails, for example 3 times.
For example, a MOS transistor is added between the ground pin and the ground of the wireless communication module, the circuit is shown in fig. 4, Q2 is a MOS transistor, and is controlled by a GSM _ ON signal and used for controlling the connection between the ground pin GSM _ GND and the ground GND of the communication module.
Connecting circuit between five and two interfaces
The connection mode of two double-row bent seats on the wireless data acquisition device in the wireless data acquisition device is as follows:
as shown in fig. 5, in the wireless data acquisition device, VIN of the two rows of curved seats are directly connected, and GND of the two rows of curved seats are directly connected;
DSIN1-4 is connected with a controller, DSOUT1-4 is connected with a sensor, and 4 paths of sensor signals (between DSIN1-4 and DSOUT 1-4) are controlled by electronic switches, and each path is independently controlled.
The power supply voltage of the electronic switch chip is not lower than VIN, the electronic switch chip is ADG711, and the power supply voltage is 5V. On the other hand, a pull-up resistor, a filter capacitor, a TVS tube and the like are provided on the DSOUT1-4 connection pin.
Sixth, automatic adaptation method for different sensor time sequences
As the tobacco leaf baking controllers produced by manufacturers are all matched with a set of dry-wet bulb temperature sensors, the controller software of the manufacturers is matched with the matched sensors during design, and the temperature data can be correctly read. However, by testing the controllers and sensors of different manufacturers, it is indicated that there is a large difference in communication time sequence of products of different manufacturers, and if the software of the wireless data acquisition device is written according to the time sequence on the specification of the DS18B20 sensor, all the controllers and sensors cannot be compatible, for reasons including:
(1) the characteristics of DS18B20 sensors of different manufacturer brands are different, and a large number of alternative models of non-American DALLAS original factories are currently on the market;
(2) the material and the process of the sensor connecting wires of different manufacturers are different, so that the resistance and the distributed capacitance of the connecting wires are different, and the communication time sequence is influenced;
(3) the sensor interface circuits and elements of controllers of different manufacturers are different in type selection, and the power supply voltages of the sensors are different.
In order to improve the compatibility of the wireless data acquisition device, the self-adaptive method of the wireless data acquisition device comprises the following steps:
(1) the sensitivity of a connecting pin of the singlechip and the sensor to the identification of the rising edge is improved, the singlechip supplies power by 3.3V, the filter capacitance of a signal pin is reduced, and 4.7pF is adopted;
(2) the DS18B20 sensor communication program automatically adapting to different sensor time sequences is provided, and specifically comprises the following steps:
and adding a parameter in a subprogram for reading the bytes of the sensor register of the DS18B20, wherein the parameter is the delay time between the output of a high level by the pin of the singlechip and the reading of the state of the pin of the sensor by the singlechip, and setting an array for the parameter to limit the value range.
For example, if the array is [4, 8, 12], it indicates that the parameter can only take one of three values, 4, 8, 12, when reading the sensor data incorrectly, the parameter value is switched cyclically, when the parameter is 4, if reading the sensor data successfully, the default parameter when reading the sensor data next time is 4, and if the parameter is incorrect, the parameter is switched to 8.
The method of "reading sensor data at a set timing" includes: taking an STM8S series single chip microcomputer as an example, a C language program of a subprogram for reading the bytes of a sensor register of a DS18B20 is as follows, and an adp parameter is a parameter for adjusting the timing.
Seventhly, intelligently judging the baking state and sending state information
Because the wireless data acquisition device does not read the operation state of the curing barn through the RS485 interface of the controller, only collects the temperature and humidity data of the curing barn, and does not know the setting parameters and the setting process of an operator to the controller, the operation state of the curing barn can be judged only through the change of the temperature and humidity data, and alarm information is sent to the operator if the possibility of failure is judged.
A method for using a wireless data acquisition device is characterized by comprising a method for judging the baking starting moment, a method for judging the water shortage of a dry-wet bulb temperature sensor kettle, a method for judging the fault of a circulating fan and a method for judging the temperature abnormity;
the method for judging the baking starting time comprises the following steps:
setting an environment temperature sensor on the wireless data acquisition device, comparing the environment temperature with the dry bulb temperature in the baking room, and when the dry bulb temperature in the baking room is higher than the environment temperature by a certain value, such as 5 ℃, considering that baking starts;
in addition, when the temperature of the dry bulb in the baking room increases at a speed exceeding a certain value, for example, the temperature increases at 2 ℃ within 2 hours, and the current temperature exceeds a certain temperature, for example, 38 ℃, the baking is considered to be started.
The method for judging water shortage of the wet and dry bulb temperature sensor kettle comprises the following steps:
when the dry bulb temperature is more than or equal to 42 ℃ and the wet bulb temperature is more than or equal to-1 ℃ of the dry bulb temperature, the kettle is considered to be lack of water;
when the dry bulb temperature is less than 42 ℃ and the wet bulb temperature is more than or equal to the dry bulb temperature, the kettle is considered to be lack of water.
The method for judging the fault of the circulating fan comprises the following steps:
when the difference value between the corresponding temperatures of the upper shed and the lower shed exceeds a certain value, such as 5 ℃, the circulating fan is considered to be in fault.
The method for judging the temperature abnormity comprises the following steps:
when any one temperature drop speed exceeds a certain value, such as 2 ℃/hour, the temperature is considered to be abnormal;
when any temperature rising speed exceeds a certain value, such as 4 ℃/hour, the temperature is considered to be abnormal;
when the difference between the dry bulb temperature and the wet bulb temperature of the same temperature and humidity sensor exceeds a normal range, the temperature is considered to be abnormal, for example:
when the dry bulb temperature is more than or equal to 44 ℃ and the wet bulb temperature is more than or equal to 42 ℃, the temperature is considered to be abnormal;
when the dry bulb temperature is more than or equal to 48 ℃ and the wet bulb temperature is more than or equal to 44 ℃, the temperature is considered to be abnormal.
Eight, other circuits
1. The peripheral circuits of the wireless communication module are shown in fig. 7 and comprise a SIM card interface circuit, an indicator light, an antenna and the like.
2. The single chip microcomputer and the peripheral circuit are shown in figure 8, the single chip microcomputer adopts STM8S003F3, P4 and P5 are debugging and testing interfaces, U5 is a power supply chip, 5V is converted into 3.3V to supply power to the single chip microcomputer, VIN, AD _ PROG and AD _ VBAT are 3 analog quantities to be collected by the single chip microcomputer, two transistors T6 and T7 and a peripheral resistor element are UART communication interface circuits between the single chip microcomputer and a wireless communication module, and U30 is an environment temperature sensor. In addition, the device also comprises peripheral elements such as an indicator light, a reset pull-up and the like.
The wireless data acquisition device according to the conventional design is directly connected in series between the controller and the sensor and generally cannot work normally. According to the characteristics of the current tobacco leaf baking controller, the invention adopts the following measures to solve the problems:
(1) the voltages of the sensor power lines of different controllers are different and are between 3.3 and 5V, and a low-power-consumption booster circuit is adopted to unify the voltages to 5V and then is used for a charging circuit and other partial circuits;
(2) the power supply currents of the sensor power lines of different controllers are different and can not meet the working requirement of the wireless communication module within 3-100mA, and the charging current is controlled by a lithium battery management chip, a super capacitor, an external control circuit and control logic, so that the voltage of the sensor power lines can meet the working requirement of the sensor.
The wireless communication module adopts a work flow mode of 'power on-connection of a server, data transmission, network disconnection and power off' to intermittently transmit data instead of being powered on all the time or working according to a fixed period.
The power supply circuit of the wireless communication module is additionally provided with an MOS (metal oxide semiconductor) tube for control, so that complete power failure is realized, standby current is saved, and when communication fails, the communication module is restarted after power failure, and failure removal is attempted.
(3) By testing various controllers and sensors on the market at present, the power supply voltages of the sensors of different controllers are different, the time sequences of the sensors of different brands are different, and in order to improve compatibility, through test comparison, the single chip microcomputer adopts 3.3V power supply, and the communication time sequence between the single chip microcomputer and the sensors adopts a self-adaptive mode.
(4) Tests show that the current program design of reading sensor data by partial controllers on the market does not conform to specifications in the specification of DS18B20, for example, a single chip microcomputer pin adopts a push-pull mode, the period for reading sensor data is too short, the sensor generates heat, reset signals are frequently sent to the sensor, and the like.
The device is convenient to install and use, can be used in a plug-and-play mode, does not need to change a controller and a sensor, realizes the upgrading of the Internet of things of equipment at lower cost, and realizes remote monitoring; the low-power-consumption design and the low-interference program for reading the data of the sensor are adopted, so that the normal operation of the sensor and equipment is not influenced, and the controller and the sensor which conform to the national cigarette integrated product (2009) 418) file at present can be compatible; under the condition that the operating state of the curing barn is not read through the RS485 interface of the controller, the operating state of the equipment is intelligently judged according to temperature and humidity data, and information is sent to relevant personnel through the server platform to assist in troubleshooting.