Interface circuit compatible with PNP type and NPN type sensors and detection equipment

By using two optocouple isolation chips in the circuit to detect sensor signals, the problem of confusion of PNP-type and NPN-type sensor interface circuits is solved, and an interface circuit that is compatible with the two sensors is realized, reducing circuit costs and simplifying design.

CN119030523APending Publication Date: 2024-11-26OPTOFIDELITY TECH (ZHUHAI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411030731.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-30
Publication Date
2024-11-26

AI Technical Summary

Technical Problem

In the prior art, the interface circuits of PNP type and NPN type sensors are easily confused, resulting in the system not working properly, and compatibility of two sensors on the same circuit board requires additional complex circuit design and program processing, resulting in an increase in circuit cost.

Method used

By setting two optocouple isolation chips in the circuit to detect the signal output by the sensor, and through the output interface signal of the working state control circuit of the optocouple isolation chip, an interface circuit compatible with PNP type and NPN type sensors is realized, reducing circuit cost.

Benefits of technology

An interface circuit is implemented to be compatible with both PNP and NPN sensors, simplifying circuit design, reducing circuit costs, and determining sensor type by outputting level signals.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119030523A_ABST
    Figure CN119030523A_ABST
Patent Text Reader

Abstract

The invention discloses an interface circuit compatible with PNP type and NPN type sensors and detection equipment, and belongs to the technical field of electronic circuits. The circuit is characterized in that a power interface is connected to a first power supply and the input end of a first optocoupler isolation chip; the input end of the first optocoupler isolation chip is connected to one end of the first resistor; the other end of the first resistor and one end of the second resistor are connected to the signal interface; the other end of the second resistor is connected to the input end of the second optocoupler isolation chip; the second power supply is connected to the third resistor; the third resistor is connected to the output end and the output interface of the first optocoupler isolation chip; the output end of the first optocoupler isolation chip is connected to the output end of the second optocoupler isolation chip. The two optocoupler isolation chips are arranged in the circuit to detect the signals output by the sensors, the output interface signals of the circuit are controlled through the working states of the optocoupler isolation chips, one interface circuit can be compatible with the PNP type sensor and the NPN type sensor at the same time, and the circuit cost is effectively reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of electronic circuits, and in particular to an interface circuit and a detection device compatible with PNP and NPN sensors. Background Art

[0002] At present, with the rapid development of the manufacturing industry, production lines and equipment in all walks of life are transforming towards automation, and various sensors have emerged. For example, PNP and NPN sensors have been widely used.

[0003] In the related art, the interface circuit of the PNP sensor needs to use a pull-down load, and the interface circuit of the NPN sensor needs to use a pull-up load. However, in actual applications, it is often found that the entire system cannot work properly due to confusion between PNP and NPN types, or two different interface circuits are set on the same circuit board to be compatible with PNP and NPN sensors, which greatly increases the circuit cost.

[0004] In summary, the technical problems existing in the relevant technologies need to be improved Summary of the invention

[0005] The embodiments of the present application provide an interface circuit and detection device that are compatible with PNP and NPN sensors, which can realize an interface circuit that is compatible with both PNP and NPN sensors, effectively reducing circuit costs.

[0006] On the one hand, an embodiment of the present application provides an interface circuit compatible with PNP and NPN sensors, including:

[0007] Sensor detection subcircuit, signal output subcircuit;

[0008] The sensor detection subcircuit includes a sensor interface, a first power supply, a first optical coupling isolation chip, a second optical coupling isolation chip, a first resistor and a second resistor;

[0009] The sensor interface includes a power interface, a signal interface, and a ground interface; the power interface is connected to the first power supply and the input end of the first optical coupling isolation chip;

[0010] The input end of the first optical coupling isolation chip is connected to one end of the first resistor; the other end of the first resistor and one end of the second resistor are both connected to the signal interface; the other end of the second resistor is connected to the input end of the second optical coupling isolation chip;

[0011] The input terminal and the ground interface of the second optical coupling isolation chip are both connected to the first ground point;

[0012] The signal output subcircuit includes a second power supply, a third resistor, a first optical coupling isolation chip, a second optical coupling isolation chip and an output interface;

[0013] The second power supply is connected to one end of the third resistor; the other end of the third resistor is connected to the output end and output interface of the first optocoupler isolation chip; the output end of the first optocoupler isolation chip is connected to the output end of the second optocoupler isolation chip; the output end of the second optocoupler isolation chip is connected to the second ground point.

[0014] Optionally, the interface circuit compatible with PNP and NPN sensors further includes: a first diode;

[0015] The anode of the first diode is connected to the input end of the first optical coupling isolation chip; the cathode of the first diode is connected to one end of the first resistor.

[0016] Optionally, a power supply voltage of the first power supply is different from a power supply voltage of the second power supply.

[0017] Optionally, the input end of the first optocoupler isolation chip includes a positive pin and a negative pin, and the output end of the first optocoupler isolation chip includes an emitter pin and a collector pin;

[0018] The positive pin of the first optical coupling isolation chip is connected to the first power supply, and the negative pin of the first optical coupling isolation chip is connected to the positive electrode of the first diode;

[0019] The emitter pin of the first optocoupler isolation chip is connected to the output end of the second optocoupler isolation chip, and the collector pin of the first optocoupler isolation chip is connected to the other end of the third resistor.

[0020] Optionally, the input end of the second optocoupler isolation chip includes a positive pin and a negative pin, and the output end of the second optocoupler isolation chip includes an emitter pin and a collector pin;

[0021] The positive pin of the second optical coupling isolation chip is connected to the other end of the second resistor, and the negative pin of the second optical coupling isolation chip is connected to the first grounding point;

[0022] The emitter pin of the second optocoupler isolation chip is connected to the second ground point, and the collector pin of the second optocoupler isolation chip is connected to the output end of the first optocoupler isolation chip.

[0023] Optionally, the models of the first optocoupler isolation chip and the second optocoupler isolation chip are EL817.

[0024] Optionally, the first power supply is a 24V DC power supply.

[0025] Optionally, the second power supply is a 12V DC power supply.

[0026] On the other hand, an embodiment of the present application provides a detection device, including: an interface circuit compatible with PNP and NPN sensors as described in any one of the above.

[0027] The embodiment of the present application detects the signal output by the sensor by setting two optocoupler isolation chips in the circuit, and then controls the output interface signal of the circuit according to the working state of the optocoupler isolation chip, so as to realize an interface circuit compatible with both PNP and NPN sensors, thereby effectively reducing the circuit cost. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 It is a structural schematic diagram of an interface circuit of an NPN type sensor and an interface circuit of a PNP type sensor provided by the related technology;

[0029] Figure 2 It is a schematic diagram of the structure of an interface circuit compatible with PNP and NPN sensors provided in an embodiment of the present application. DETAILED DESCRIPTION

[0030] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is further described in detail below in conjunction with the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the embodiments of the present application. They are only examples of devices and methods consistent with some aspects of the embodiments of the present application as detailed in the attached claims.

[0031] It is understood that the terms "first", "second", etc. used in this application can be used to describe various concepts in this article, but unless otherwise specified, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another concept. For example, without departing from the scope of the embodiment of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the words "if" and "if" as used herein can be interpreted as "at the time of" or "when" or "in response to determination".

[0032] The terms "at least one", "multiple", "each", "any", etc. used in this application, at least one includes one, two or more, multiple includes two or more, each refers to each of the corresponding multiple, and any refers to any one of the multiple.

[0033] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0034] At present, with the rapid development of the manufacturing industry, production lines and equipment in all walks of life are transforming towards automation, and various sensors have emerged. For example, PNP and NPN sensors have been widely used.

[0035] For related technologies, please refer to Figure 1 , Figure 1 It is a structural schematic diagram of the interface circuit of the NPN type sensor and the interface circuit of the PNP type sensor provided by the relevant technology. Figure 1 The interface circuit of NPN type sensor and the interface circuit of PNPN type sensor are given respectively.

[0036] Specifically, in the interface circuit of the NPN sensor, a power interface, a signal interface and a ground interface are led out in the sensor, wherein the power interface is connected to the positive pole of the power supply, the ground interface is connected to the negative pole of the power supply, and a pull-up load is provided at the signal interface. The working principle of the interface circuit of the NPN sensor is that when a signal is detected, the signal interface is short-connected to the ground interface and a low-level signal is output; when no signal is detected, the signal interface is suspended and a high-level signal is output. In the interface circuit of the PNP sensor, a power interface, a signal interface and a ground interface are led out in the sensor, wherein the power interface is connected to the positive pole of the power supply, the ground interface is connected to the negative pole of the power supply, and a pull-down load is provided at the signal interface. The working principle of the interface circuit of the PNP sensor is that when a signal is detected, the signal interface is short-connected to the power interface and a high-level signal is output; when no signal is detected, the signal interface is suspended and a low-level signal is output.

[0037] However, in actual applications, it is found that after designing the interface circuit according to the sensor type, the entire system often fails to work properly due to confusion between PNP and NPN types, or two different interface circuits are set on the same circuit board to be compatible with PNP and NPN sensors (such as using two comparators to detect sensor signals separately, one configured as PNP and the other configured as NPN). In this case, it is necessary to modify the circuit or the program to control the relay switching according to the sensor type. The program processing is more complicated, which greatly increases the circuit cost.

[0038] In view of this, an interface circuit and detection equipment compatible with PNP and NPN sensors are provided in an embodiment of the present application. By setting two optocoupler isolation chips in the circuit to detect the signal output by the sensor, and then controlling the output interface signal of the circuit through the working state of the optocoupler isolation chip, an interface circuit can be realized that is compatible with both PNP and NPN sensors, thereby effectively reducing the circuit cost.

[0039] The specific implementation of the embodiment of the present application is described in detail below in conjunction with the accompanying drawings. First, an interface circuit compatible with PNP and NPN sensors provided in the embodiment of the present application is described in conjunction with the accompanying drawings.

[0040] Please refer to Figure 2 , Figure 2 : is a schematic diagram of the structure of an interface circuit compatible with PNP and NPN sensors provided in an embodiment of the present application, including:

[0041] Sensor detection subcircuit, signal output subcircuit;

[0042] The sensor detection subcircuit includes a sensor interface J1, a first power supply VCC1, a first optical coupling isolation chip U1, a second optical coupling isolation chip U2, a first resistor R1 and a second resistor R2;

[0043] The sensor interface J1 includes a power interface 1, a signal interface 2, and a ground interface 3; the power interface 1 is connected to the first power supply VCC1 and the input end of the first optical coupling isolation chip U1;

[0044] The input end of the first optical coupler isolation chip U1 is connected to one end of the first resistor R1; the other end of the first resistor R1 and one end of the second resistor R2 are both connected to the signal interface 2; the other end of the second resistor R2 is connected to the input end of the second optical coupler isolation chip U2;

[0045] The input end of the second optical coupling isolation chip U2 and the ground interface 3 are both connected to the first ground point GND1;

[0046] The signal output subcircuit includes a second power supply VCC2, a third resistor R3, a first optical coupling isolation chip U1, a second optical coupling isolation chip U2 and an output interface output;

[0047] The second power supply VCC2 is connected to one end of the third resistor R3; the other end of the third resistor R3 is connected to the output end of the first optocoupler isolation chip U1 and the output interface output; the output end of the first optocoupler isolation chip U1 is connected to the output end of the second optocoupler isolation chip U2; the output end of the second optocoupler isolation chip U2 is connected to the second ground point GND2.

[0048] In the embodiments of the present application, Figure 2 As shown, the sensor interface J1 is provided with three power supply interfaces 1, signal interface 2, and ground interface 3 connected to the sensor, wherein the power supply interface 1 is connected to the first power supply VCC1 and the input end of the first optocoupler isolation chip U1, the signal interface 2 is connected to the other end of the first resistor R1 and one end of the second resistor R2, and the ground interface 3 is connected to the first ground point GND1 and the input end of the second optocoupler isolation chip U2.

[0049] In the sensor detection sub-circuit, the input end of the first optical coupling isolation chip U1 is connected to one end of the first resistor R1, and the input end of the second optical coupling isolation chip U2 is connected to the other end of the second resistor R2.

[0050] In the signal output subcircuit, the second power supply VCC2 is connected to one end of the third resistor R3, the other end of the third resistor R3 is respectively connected to the output end of the first optocoupler isolation chip U1 and the output interface output, the output end of the first optocoupler isolation chip U1 is connected to the output end of the second optocoupler isolation chip U2, and the output end of the second optocoupler isolation chip U2 is connected to the second ground point GND2. Among them, the output interface output is used to detect the level signal.

[0051] In the embodiment of the present application, the sensor signal is detected by two optical coupling isolation chips, and the specific working principle is as follows:

[0052] When the sensor does not detect a signal, the signal interface 2 in the sensor interface J1 is suspended, and the first power supply VCC1 drives the input ends of the first optocoupler isolation chip U1 and the second optocoupler isolation chip U2 through the first resistor R1 and the second resistor R2, so that the first optocoupler isolation chip U1 and the second optocoupler isolation chip U2 are in a working state, and the output end of the first optocoupler isolation chip U1 and the output end of the second optocoupler isolation chip U2 will both become conductive, that is, the second power supply VCC2 flows through the third resistor R3, the output end of the first optocoupler isolation chip U1, and the output end of the second optocoupler isolation chip U2 to the second grounding point GND2, forming an output loop, so that the output interface output in the signal output subcircuit outputs a low level.

[0053] When the sensor detects a signal, since the interface circuit provided in this application is compatible with PNP and NPN sensors, it can be divided into two cases for discussion:

[0054] First, when the NPN sensor detects a signal, the signal interface 2 will be short-connected to the ground interface 3. At this time, the voltage at the signal interface 2 is 0V, that is, the first power supply VCC1 forms a current loop through the first optocoupler isolation chip U1, the first resistor R1 and the sensor, and the input voltage of the second optocoupler isolation chip U2 is 0V, which causes the first optocoupler isolation chip U1 to be in a working state, and the second optocoupler isolation chip U2 to be in a non-working state, so that the output end of the second optocoupler isolation chip U2 becomes disconnected. At this time, the voltage of the output interface output in the signal output subcircuit will be pulled up to the power supply voltage of the second power supply VCC2 by the third resistor R3, and a high-level signal is output.

[0055] Secondly, when the PNP sensor detects a signal, the signal interface 2 will be short-connected to the power interface 1. At this time, the voltage at the signal interface 2 is equal to the voltage of the first power supply VCC1. The first power supply VCC1 forms a current loop through the sensor, the second resistor R2 and the second optocoupler isolation chip U2. The input voltage of the first optocoupler isolation chip U1 is 0V, which causes the second optocoupler isolation chip U2 to be in a working state, and the first optocoupler isolation chip U1 to be in a non-working state, so that the output end of the first optocoupler isolation chip U1 becomes disconnected. At this time, the voltage of the output interface output in the signal output subcircuit will be pulled up to the power supply voltage of the second power supply VCC2 by the third resistor R3, and a high-level signal is output.

[0056] That is to say, when the sensor does not detect a signal, the signal interface 2 is left floating, so that the first optocoupler isolation chip U1 and the second optocoupler isolation chip U2 are both in working state. In the signal output sub-circuit, the second power supply VCC2 forms a current loop through the third resistor R3, the output end of the first optocoupler isolation chip U1 and the output end of the second optocoupler isolation chip U2, so that the output interface output in the signal output sub-circuit outputs a low-level signal; when the sensor detects a signal, whether it is a PNP type or an NPN type sensor, one of the two optocoupler isolation chips will be in working state and the other will be in non-working state, so that the second power supply VCC2 in the signal output sub-circuit no longer passes through the output end of the first optocoupler isolation chip U1 and the output end of the second optocoupler isolation chip U2, but the voltage of the output interface output will be pulled up to the power supply voltage of the second power supply VCC2 by the third resistor R3, and a high-level signal is output.

[0057] Finally, Table 1 is an output status table of the interface circuit compatible with PNP and NPN sensors. As shown in Table 1, it can be determined that when the output interface output in the signal output subcircuit outputs a low-level signal, the sensor does not detect a signal, and when the output interface output outputs a high-level signal, the sensor detects a signal. Furthermore, when the output interface output outputs a high-level signal, the type of sensor connected to the sensor interface J1 at this time can also be determined by detecting the working states of the first optocoupler isolation chip U1 and the second optocoupler isolation chip U2. For example, when the output interface output outputs a high-level signal, it is determined that the first optocoupler isolation chip U1 is in a working state and the second optocoupler isolation chip U2 is in a non-working state, then it can be determined that the type of sensor connected to the sensor interface J1 is an NPN sensor.

[0058] Table 1 Output status table of interface circuit compatible with PNP and NPN sensors

[0059]

[0060] Specifically, as an optional embodiment, the interface circuit compatible with PNP and NPN sensors further includes: a first diode D1;

[0061] The anode of the first diode D1 is connected to the input end of the first optocoupler isolation chip U1 ; the cathode of the first diode D1 is connected to one end of the first resistor R1 .

[0062] In this application example, Figure 2 As shown, a first diode D1 is also provided in the interface circuit compatible with PNP and NPN sensors, the anode of the first diode D1 is connected to the input end of the first optocoupler isolation chip U1, and the cathode of the first diode D1 is connected to one end of the first resistor R1. Due to the unidirectional conductivity of the first diode D1, when the PNP sensor detects current and the signal interface 2 is short-connected to the power interface 1, the voltage of the signal interface 2 is equal to the power supply voltage of the first power supply VCC1, and the first diode D1 can prevent the current from flowing into the input end of the first optocoupler isolation chip U1 through the first resistor R1, thereby ensuring that the first optocoupler isolation chip U1 is in a non-working state.

[0063] It can be understood that when the sensor does not detect a signal and the signal interface 2 is left floating, the voltage at the signal interface 2 can be calculated by the following formula (1):

[0064]

[0065] Among them, V s is the voltage at the signal interface; VCC1 is the power supply voltage of the first power supply; V U1 is the driving voltage drop when the input end of the first optical coupling isolation chip is in working state; V U2 is the driving voltage drop when the input end of the second optical coupler isolation chip is in working state; V D1 is the forward voltage of the first diode.

[0066] Specifically, as an optional embodiment, the power supply voltage of the first power supply VCC1 is different from the power supply voltage of the second power supply VCC2.

[0067] In the embodiment of the present application, the first power supply VCC1 and the second power supply VCC2 can be power supplies with different power supply voltages. Since the first optocoupler isolation chip U1 and the second optocoupler isolation chip U2 have good isolation functions, the signal output subcircuit can be protected from the influence of the sensor detection subcircuit, and the level conversion function can also be realized.

[0068] Specifically, as an optional embodiment, the input end of the first optocoupler isolation chip U1 includes a positive pin 4 and a negative pin 5, and the output end of the first optocoupler isolation chip U1 includes an emitter pin 6 and a collector pin 7;

[0069] The positive electrode pin 4 of the first optical coupling isolation chip U1 is connected to the first power supply VCC1, and the negative electrode pin 5 of the first optical coupling isolation chip U1 is connected to the positive electrode of the first diode D1;

[0070] The emitter pin 6 of the first optocoupler isolation chip U1 is connected to the output end of the second optocoupler isolation chip U2 , and the collector pin 7 of the first optocoupler isolation chip U1 is connected to the other end of the third resistor R3 .

[0071] In the embodiments of the present application, Figure 2 As shown, the input end of the first optocoupler isolation chip U1 includes a positive pin 4 and a negative pin 5, and the output end of the first optocoupler isolation chip U1 includes an emitter pin 6 and a collector pin 7. By connecting the positive pin 4 of the first optocoupler isolation chip U1 to the first power supply VCC1 and the negative pin 5 to the positive electrode of the first diode D1, the working state of the first optocoupler isolation chip U1 can be better controlled by the signal state at the sensor signal interface 2, thereby controlling the conduction state between the emitter pin 6 and the collector pin 7 at the output end of the first optocoupler isolation chip U1.

[0072] Specifically, as an optional embodiment, the input end of the second optocoupler isolation chip U2 includes a positive pin 8 and a negative pin 9, and the output end of the second optocoupler isolation chip U2 includes an emitter pin 10 and a collector pin 11;

[0073] The positive pin 8 of the second optical coupling isolation chip U2 is connected to the other end of the second resistor R2, and the negative pin 9 of the second optical coupling isolation chip U2 is connected to the first ground point GND1;

[0074] The emitter pin 10 of the second optocoupler isolation chip U2 is connected to the second ground point GND2 , and the collector pin 11 of the second optocoupler isolation chip U2 is connected to the output end of the first optocoupler isolation chip U1 .

[0075] In the embodiments of the present application, Figure 2As shown, the input end of the second optocoupler isolation chip U2 includes a positive pin 8 and a negative pin 9, and the output end of the second optocoupler isolation chip U2 includes an emitter pin 10 and a collector pin 11. By connecting the positive pin 8 of the second optocoupler isolation chip U2 to the other end of the second resistor R2 and the negative pin 9 to the first ground point GND1, the working state of the second optocoupler isolation chip U2 can be better controlled by the signal state at the sensor signal interface 2, thereby controlling the conduction state between the emitter pin 10 and the collector pin 11 at the output end of the second optocoupler isolation chip U2.

[0076] Specifically, as an optional embodiment, the models of the first optocoupler isolation chip U1 and the second optocoupler isolation chip U2 are EL817.

[0077] Specifically, as an optional embodiment, the first power supply VCC1 is a 24V DC power supply.

[0078] In the embodiment of the present application, the positive pole of the 24V DC power supply can be DC 24V, and the negative pole can be DC 0V, which can meet the requirements of various components in the sensor detection subcircuit and ensure the normal operation of each component.

[0079] Specifically, as an optional embodiment, the second power supply VCC2 is a 12V DC power supply.

[0080] In the embodiment of the present application, the positive pole of the 12V DC power supply can be DC 12V, and the negative pole can be DC 0V, which can meet the needs of various components in the signal output subcircuit and ensure the normal operation of each component.

[0081] Specifically, in a possible implementation, an embodiment of the present application further provides a detection device, which includes the above-mentioned interface circuit compatible with PNP and NPN sensors.

[0082] It can be understood that by equipping the detection device with the interface circuit compatible with PNP and NPN sensors provided by the present application, no matter whether the sensor interface is connected to a PNP sensor or an NPN sensor, the signal can be effectively detected and the detection status can be determined by the output level signal.

[0083] An embodiment of the present application provides an interface circuit and detection device that are compatible with PNP and NPN sensors. Two optocoupler isolation chips are arranged in the circuit to detect the signal output by the sensor, and then the output interface signal of the circuit is controlled by the working state of the optocoupler isolation chip. This enables an interface circuit to be compatible with both PNP and NPN sensors, effectively reducing the circuit cost.

[0084] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0085] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein.

[0086] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0087] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.

Claims

1. An interface circuit compatible with PNP and NPN sensors, characterized in that: include: Sensor detection subcircuit, signal output subcircuit; The sensor detection subcircuit includes a sensor interface, a first power supply, a first optical coupling isolation chip, a second optical coupling isolation chip, a first resistor and a second resistor; The sensor interface includes a power interface, a signal interface, and a ground interface; the power interface is connected to the first power supply and the input end of the first optical coupling isolation chip; The input end of the first optical coupler isolation chip is connected to one end of the first resistor; the other end of the first resistor and one end of the second resistor are both connected to the signal interface; the other end of the second resistor is connected to the input end of the second optical coupler isolation chip; The input end of the second optical coupling isolation chip and the ground interface are both connected to the first ground point; The signal output subcircuit includes a second power supply, a third resistor, a first optical coupling isolation chip, a second optical coupling isolation chip and an output interface; The second power supply is connected to one end of the third resistor; the other end of the third resistor is connected to the output end of the first optical coupling isolation chip and the output interface; The output end of the first optocoupler isolation chip is connected to the output end of the second optocoupler isolation chip; the output end of the second optocoupler isolation chip is connected to a second ground point.

2. The interface circuit compatible with PNP and NPN sensors according to claim 1, characterized in that: The interface circuit compatible with PNP and NPN sensors also includes: a first diode; The anode of the first diode is connected to the input end of the first optocoupler isolation chip; the cathode of the first diode is connected to one end of the first resistor.

3. The interface circuit compatible with PNP and NPN sensors according to claim 1, characterized in that: A power supply voltage of the first power supply is different from a power supply voltage of the second power supply.

4. The interface circuit compatible with PNP and NPN sensors according to claim 2, characterized in that: The input end of the first optical coupling isolation chip includes a positive pin and a negative pin, and the output end of the first optical coupling isolation chip includes an emitter pin and a collector pin; The positive pin of the first optical coupling isolation chip is connected to the first power supply, and the negative pin of the first optical coupling isolation chip is connected to the positive electrode of the first diode; The emitter pin of the first optocoupler isolation chip is connected to the output end of the second optocoupler isolation chip, and the collector pin of the first optocoupler isolation chip is connected to the other end of the third resistor.

5. The interface circuit compatible with PNP and NPN sensors according to claim 2, characterized in that: The input end of the second optical coupler isolation chip includes a positive pin and a negative pin, and the output end of the second optical coupler isolation chip includes an emitter pin and a collector pin; The positive pin of the second optical coupling isolation chip is connected to the other end of the second resistor, and the negative pin of the second optical coupling isolation chip is connected to the first grounding point; The emitter pin of the second optocoupler isolation chip is connected to the second ground point, and the collector pin of the second optocoupler isolation chip is connected to the output end of the first optocoupler isolation chip.

6. The interface circuit compatible with PNP and NPN sensors according to claim 1, characterized in that: The model of the first optocoupler isolation chip and the second optocoupler isolation chip is EL817.

7. The interface circuit compatible with PNP and NPN sensors according to claim 1, characterized in that: The first power supply is a 24V DC power supply.

8. The interface circuit compatible with PNP and NPN sensors according to claim 1, characterized in that: The second power supply is a 12V DC power supply.

9. A detection device, characterized in that: include: An interface circuit compatible with PNP and NPN sensors as described in any one of claims 1 to 8.