Tobacco flue-curing controller interface circuit compatible with two sensors and control method

文档序号:767045 发布日期:2021-04-09 浏览:51次 中文

阅读说明:本技术 兼容两种传感器的烟叶烘烤控制器接口电路及控制方法 (Tobacco flue-curing controller interface circuit compatible with two sensors and control method ) 是由 郝允志 赵虎 林毓培 周黔 陈俊杰 王靖 朱康熙 于 2020-12-17 设计创作,主要内容包括:本发明公开了一种能够兼容数字和模拟两种温度传感器的烟叶烘烤控制器接口电路及控制方法,主要涉及烟叶烘烤控制器领域;包括分压电阻R1、上拉电阻R2、保护电阻R3、滤波电容C1、滤波电容C2、稳压二极管D1、上拉开关Q1和滤波开关Q2;本发明符合国烟办综〔2009〕418号文件中的接口规范,兼容DS18B20传感器和NTC-10K-B3950热敏电阻,实现一个接口可以连接两种传感器,控制器可以自动识别传感器类型并切换至对应的软件程序。(The invention discloses a tobacco leaf baking controller interface circuit compatible with a digital temperature sensor and an analog temperature sensor and a control method, and mainly relates to the field of tobacco leaf baking controllers; the voltage-stabilizing circuit comprises a voltage-dividing resistor R1, a pull-up resistor R2, a protection resistor R3, a filter capacitor C1, a filter capacitor C2, a voltage-stabilizing diode D1, a pull-up switch Q1 and a filter switch Q2; the invention conforms to the interface specification in the file of national tobacco draft (2009) 418, is compatible with a DS18B20 sensor and an NTC-10K-B3950 thermistor, realizes that one interface can be connected with two sensors, and a controller can automatically identify the type of the sensor and switch to a corresponding software program.)

1. Tobacco flue-curing controller interface circuit of compatible two kinds of sensors, its characterized in that: one end of the tobacco leaf baking controller interface circuit compatible with the two sensors is connected with a sensor pin, and the other end of the tobacco leaf baking controller interface circuit is connected with a singlechip pin;

the tobacco leaf baking controller interface circuit compatible with the two sensors comprises a voltage dividing resistor R1, a pull-up resistor R2, a protection resistor R3, a filter capacitor C1, a filter capacitor C2, a voltage stabilizing diode D1, a pull-up switch Q1 and a filter switch Q2;

one end of the protective resistor R3 is connected with a sensor pin, and the other end of the protective resistor R3 is connected with a singlechip pin;

one end of the voltage dividing resistor R1 is connected between the protective resistor R3 and the sensor pin;

one end of the pull-up resistor R2 is connected between the protection resistor R3 and the sensor pin, and the other end of the pull-up resistor R2 is connected with the pull-up switch Q1;

one end of the filter capacitor C1 is connected between the protective resistor R3 and the sensor pin, and the other end of the filter capacitor C1 is grounded;

one end of the voltage stabilizing diode D1 is connected between the protective resistor R3 and the sensor pin, and the other end of the voltage stabilizing diode D1 is grounded;

one end of the filter capacitor C2 is connected between the protection resistor R3 and the single chip microcomputer pin, the other end of the filter capacitor C2 is connected with the filter switch Q2, and one end, far away from the filter capacitor C2, of the filter switch Q2 is grounded.

2. The two-sensor compatible tobacco flue-curing controller interface circuit of claim 1, wherein: the pull-up switch Q1 is a P-type MOS tube.

3. The two-sensor compatible tobacco flue-curing controller interface circuit of claim 1, wherein: the filtering switch Q2 is an N-type MOS tube.

4. A method of controlling the interface circuit of the tobacco curing controller compatible with two sensors according to any one of claims 1 to 3, comprising the steps of:

s1, setting the pin of the singlechip SW1 to be in a digital IO mode and outputting low level, and setting the pin of the singlechip TP1 to be in the digital IO mode;

s2, detecting whether the DS18B20 is online, and if so, entering the step S3; if not, go to step S4;

s3, reading the temperature data according to the DS18B20 program, and judging whether the temperature data are read correctly; if the temperature data are correct, storing the temperature data; if not, DS18B20 fails; then proceeds to step S6;

s4, setting the pin of the singlechip SW1 to be in a digital IO mode and outputting high level, and setting the pin of the singlechip TP1 to be in an analog AI mode;

s5, reading the temperature data according to the thermistor program, and judging whether the temperature data is read correctly; if the temperature data are correct, storing the temperature data; if not, the thermistor is in failure or the sensor is not connected; then proceeds to step S6;

and S6, updating the sensor type and the fault mark.

Technical Field

The invention relates to the field of tobacco leaf baking controllers, in particular to a tobacco leaf baking controller interface circuit compatible with a digital temperature sensor and an analog temperature sensor and a control method.

Background

According to the bulk curing barn technical specification in national tobacco integrated [ 2009 ] 418, DS18B20 digital sensors are adopted as dry-bulb and wet-bulb temperature sensors, 4 dry-bulb temperature sensors are used in each curing barn, the dry-bulb temperature sensors are respectively arranged on the upper shed, the wet-bulb temperature sensors are arranged on the upper shed, the dry-bulb temperature sensors are arranged on the lower shed, the wet-bulb temperature sensors are arranged on the lower shed, a 6-core connecting wire is shared, and temperature and humidity sensors are formed, wherein pins 1-6 are defined in sequence: the sensor comprises an upper shed dry ball, an upper shed wet ball, a lower shed dry ball, a lower shed wet ball, a power supply, a ground, a sensor main line with the length of 5m, an upper shed branch line with the length of 2.5m and a lower shed branch line with the length of 1.5 m.

The technical specification is made for a coal-fired curing barn according to the technical conditions at the time, but with the continuous appearance of novel curing barns (heat pump curing barns, solar curing barns and the like), the requirements for the sensor in the technical document can not meet the actual requirements gradually.

Firstly, a DS18B20 digital sensor is specified in the original standard, and the sensor is a temperature sensor product of the DALLAS company in the United states and is an imported chip and is in danger of supply interruption and production halt;

secondly, the length of a sensor main line required by the heat pump curing barn is not less than 10 meters, which is not in accordance with the technical specification;

in addition, after the DS18B20 adopts the lightning protection and filter circuit, especially when the length of the main line exceeds 10 meters, the error probability of the controller for reading the sensor data is greatly increased, the requirement on software design is high, and meanwhile, the anti-interference capability is reduced.

In a heat pump curing barn, in order to avoid the defect of DS18B20, part of manufacturers adopt a thermistor instead, the common specification is NTC-10K-B3950, and a singlechip measures the temperature by utilizing an analog AI pin, but the mode has several problems:

firstly, the regulation of the national tobacco draft No. (2009) 418 file is not met;

secondly, the specification and the interface standard of the thermistor sensor for the curing barn are not specified, the specification and the interface of each manufacturer are not uniform, once the sensor fails, the sensor is not easy to purchase in the market, and inconvenience is brought to a user;

in addition, due to the fact that the thermistor sensors are not uniform, interchangeability does not exist among the curing barn controllers adopting the thermistor sensors, and once the controllers break down, the controllers of other manufacturers cannot be used for replacement.

Disclosure of Invention

The invention aims to solve the problems in the prior art, provides an interface circuit of a tobacco leaf baking controller compatible with two sensors and a control method thereof, conforms to the interface specification in the national tobacco institute of technology (2009) 418, is compatible with a DS18B20 sensor and an NTC-10K-B3950 thermistor, realizes that one interface can be connected with the two sensors, and a controller can automatically identify the types of the sensors and switch the types of the sensors to corresponding software programs.

In order to achieve the purpose, the invention is realized by the following technical scheme:

the tobacco leaf baking controller interface circuit compatible with the two sensors is characterized in that one end of the tobacco leaf baking controller interface circuit compatible with the two sensors is connected with a sensor pin, and the other end of the tobacco leaf baking controller interface circuit compatible with the two sensors is connected with a singlechip pin;

the tobacco leaf baking controller interface circuit compatible with the two sensors comprises a voltage dividing resistor R1, a pull-up resistor R2, a protection resistor R3, a filter capacitor C1, a filter capacitor C2, a voltage stabilizing diode D1, a pull-up switch Q1 and a filter switch Q2;

one end of the protective resistor R3 is connected with a sensor pin, and the other end of the protective resistor R3 is connected with a singlechip pin;

one end of the voltage dividing resistor R1 is connected between the protective resistor R3 and the sensor pin;

one end of the pull-up resistor R2 is connected between the protection resistor R3 and the sensor pin, and the other end of the pull-up resistor R2 is connected with the pull-up switch Q1;

one end of the filter capacitor C1 is connected between the protective resistor R3 and the sensor pin, and the other end of the filter capacitor C1 is grounded;

one end of the voltage stabilizing diode D1 is connected between the protective resistor R3 and the sensor pin, and the other end of the voltage stabilizing diode D1 is grounded;

one end of the filter capacitor C2 is connected between the protection resistor R3 and the single chip microcomputer pin, the other end of the filter capacitor C2 is connected with the filter switch Q2, and one end, far away from the filter capacitor C2, of the filter switch Q2 is grounded.

Preferably, the pull-up switch Q1 is a P-type MOS transistor.

Preferably, the filtering switch Q2 is an N-type MOS transistor.

A control method of a tobacco flue-curing controller interface circuit compatible with two sensors comprises the following steps:

s1, setting the pin of the singlechip SW1 to be in a digital IO mode and outputting low level, and setting the pin of the singlechip TP1 to be in the digital IO mode;

s2, detecting whether the DS18B20 is online, and if so, entering the step S3; if not, go to step S4;

s3, reading the temperature data according to the DS18B20 program, and judging whether the temperature data are read correctly; if the temperature data are correct, storing the temperature data; if not, DS18B20 fails; then proceeds to step S6;

s4, setting the pin of the singlechip SW1 to be in a digital IO mode and outputting high level, and setting the pin of the singlechip TP1 to be in an analog AI mode;

s5, reading the temperature data according to the thermistor program, and judging whether the temperature data is read correctly; if the temperature data are correct, storing the temperature data; if not, the thermistor is in failure or the sensor is not connected; then proceeds to step S6;

and S6, updating the sensor type and the fault mark.

Compared with the prior art, the invention has the beneficial effects that:

1. the device conforms to the file No. 2009/418 of national tobacco institute, is compatible with a DS18B20 sensor, and has interchangeability with the existing curing barn controller.

2. The NTC-10K-B3950 thermistor can be adopted to measure the temperature, the controller software can automatically identify the type of the sensor, different software programs are switched, and the novel heat pump curing barn can be used.

3. The two sensors share the same interface, so that users do not need to access different interfaces according to the types of the sensors, and the use is convenient.

Drawings

FIG. 1 is a circuit diagram of the present invention;

FIG. 2 is a control flow diagram of the present invention.

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

as shown in the attached figure 1, the invention relates to a tobacco flue-curing controller interface circuit compatible with two sensors.

IN the circuit diagram, IN-TP1 is connected with a sensor pin, TP1 is connected with a singlechip pin, the singlechip pin with the multiplexing function of a digital IO port and an analog AI port is selected, SW1 represents a control signal for switching the two sensors, and the signal is sent by the singlechip.

The filter capacitor C1 and the voltage stabilizing diode D1 in the circuit filter and protect the sensor signal in voltage limiting mode.

When the sensor is a thermistor, a voltage dividing resistor R1 in the circuit is used as a voltage dividing resistor, and VREF is the reference voltage of the AD converter of the singlechip.

A pull-up resistor R2 in the circuit is used as a pull-up resistor when the sensor is DS18B20, a pull-up switch Q1 is used as a switch for controlling whether the R2 has a pull-up effect, Q1 is a P-type MOS tube and is connected between a resistor and VDD, and the VDD is the working voltage of a digital circuit of the single chip microcomputer.

A protection resistor R3 in the circuit is a resistor connected between a sensor pin and a singlechip pin, is used for limiting the current between the two pins and has a protection effect.

The filter capacitor C2 in the circuit is used as a filter capacitor when the sensor is a thermistor, and a filter switch Q2 is used as a switch for controlling whether the C2 has a filter function, and Q2 is an N-type MOS tube and is connected between the capacitor and the ground wire of the circuit board.

The pull-up switch Q1 and the filter switch Q2 in the circuit are controlled by SW1 signals, when SW1 is high level, the pull-up switch Q1 is turned off, the filter switch Q2 is turned on, the circuit is suitable for the thermistor sensor, when SW1 is low level, the pull-up switch Q1 is turned on, the filter switch Q2 is turned off, and the circuit is suitable for the DS18B20 sensor.

As shown in fig. 2, a method for controlling an interface circuit of a tobacco flue-curing controller compatible with two sensors includes the steps of:

s1, setting the pin of the singlechip SW1 to be in a digital IO mode and outputting low level, and setting the pin of the singlechip TP1 to be in the digital IO mode;

s2, detecting whether the DS18B20 is online, and if so, entering the step S3; if not, go to step S4;

s3, reading the temperature data according to the DS18B20 program, and judging whether the temperature data are read correctly; if the temperature data are correct, storing the temperature data; if not, DS18B20 fails; then proceeds to step S6;

s4, setting the pin of the singlechip SW1 to be in a digital IO mode and outputting high level, and setting the pin of the singlechip TP1 to be in an analog AI mode;

s5, reading the temperature data according to the thermistor program, and judging whether the temperature data is read correctly; if the temperature data are correct, storing the temperature data; if not, the thermistor is in failure or the sensor is not connected; then proceeds to step S6;

and S6, updating the sensor type and the fault mark.

The temperature is first read according to the program of the DS18B20 sensor, if the reading fails, it is indicated not to be DS18B20 but to be a thermistor, and then the temperature is read according to the program of the thermistor, while it is determined whether the sensor is connected or failed.

The invention designs an interface specification which accords with the file of No. 2009/418 of national tobacco Integrated institute (2009) by utilizing the characteristic that the signal pin of the DS18B20 sensor is acquiescently recognized as the open leakage state, is compatible with the DS18B20 sensor and the NTC-10K-B3950 thermistor, realizes that one interface can be connected with two sensors, and the controller can automatically recognize the types of the sensors and switch to a corresponding software program.

7页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种箱装片烟局部水分脱除方法及脱除设备

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!