About the wiring analysis of the sensor and PLC

The digital input interface of the PLC is not complicated. In order to improve the anti-interference ability of the PLC, the input interface uses an optocoupler to isolate the transmission of the input signal and the internal processing circuit. Therefore, the signal at the input only drives the internal LED of the optocoupler to be turned on, and is received by the photocoupler of the photocoupler, so that the external input signal can be reliably transmitted.

At present, the PLC digital input port is generally divided into single-ended common point and double-ended input. Because of the difference, the user needs certain distinction and understanding when selecting the external sensor to use the sensor and PLC correctly for the later programming work and system. Stabilize the foundation.

1, the classification of the input type

The digital input terminal of PLC is divided into DC and AC according to the power supply. It is classified into single-ended common input and double-ended input according to the input interface. The single-ended common-point power supply positive is SINK (sink current), single-ended common point connection The negative pole of the power supply is SRCE (source current).




2. Overview of the words

The SINK leakage type is the current flowing from the input terminal, then the input terminal is connected to the negative pole of the power supply, indicating that the photocoupler inside the interface is a single-ended common point for the positive pole of the power supply, and can be connected with the NPN type sensor. The SOURCE source type is the current flowing from the input terminal, then the input terminal is connected to the positive pole of the power supply, indicating that the photocoupler inside the interface is a single-ended common point as the negative pole of the power supply, and can be connected to the PNP type sensor.

The proximity switch and the photoelectric switch have three- and four-wire output points of NPN and PNP output. For the non-detection signal, the NPN proximity switch and the photoelectric switch output are at a high level (for the internal pull-up resistor), when there is a detection signal, the internal The NPN transistor is turned on and the switch output is low. For the non-detection signal, the PNP proximity switch and the <a href="https://www.censtry.com">photoelectric switch</a> output are low (for the internal pull-down resistor), when there is a detection signal, the internal PNP transistor is turned on, and the switch output is high.

The above situation is only for the sensor, which is in a normally open state.

3, according to the power configuration type

(1) DC input circuit

![20190704103924527 (1).jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/454145/3b770cd9-190e-3022-45c1-7280b6dfd1cb.jpeg)



The DC input circuit requires the external input signal component to be a passive dry contact or a DC active contactless switch contact. When the external input component is connected to the positive pole of the power supply, the current passes through R1, the internal coupler of the optocoupler, VD1 (interface indication ) forming a loop to the COM end, the internal receiving tube of the optocoupler receives the signal of the external component conduction, and transmits it to the internal processing; the interface mode for supplying power by the DC power is called a DC input circuit;

The direct current can be supplied from the PLC or an external DC power supply to the external input signal. The role of R2 in the circuit is to bypass the current of the LED inside the optocoupler, ensuring that the optocoupler LED is not turned on by the static leakage current of the two-wire proximity switch.

(2) AC input circuit
![20190704103924527.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/454145/a7c66390-a1cc-bce6-9227-1ff0358b0729.jpeg)



The AC input circuit requires the external input signal component to be a passive dry contact or an AC active contactless switch contact. The distinction between the DC input interface and the DC interface is to add a step-down circuit and a bridge rectifier circuit in front of the photocoupler. After the external components are connected to the AC power, the current is rectified through the bridge through R1 and C2, and becomes the DC current after the step-down. The principle of the subsequent circuit is consistent with the DC.

The AC PLC is mainly suitable for occasions where the relative environment is bad, the wiring technology changes little, and so on; if the proximity switch is used, the AC line is directly replaced by the original line switch.