NPN and PNP proximity sensors: What are they? How do we connect them with relays? How do we connect them with PLC?
In the vast realm of automation control, proximity sensors are indispensable key components, NPN and PNP proximity sensors stand out with their outstanding performance and wide applicability. Compared to 2-wire proximity switches, 3-wire proximity sensors are more commonly used. They can precisely sense the presence and position changes of objects in a non-contact manner, providing a solid guarantee for the efficient and stable operation of numerous automation equipment and systems. Now, let’s deeply analyze Bedook NPN and PNP proximity sensors, explore their respective characteristics, the significant differences between them, and the wiring connection methods with devices such as relays and PLC in detail.
What is an NPN proximity sensor?
An
NPN proximity sensor is also known as a “negative contact type” or “switch grounding type”. In the working state of the sensor, the output terminal is short-circuited to ground (GND) to form a closed loop. When the sensor senses the target object, the output terminal is connected to ground, and the output signal is usually a low level, close to 0V or ground potential (GND).
What is a PNP proximity sensor?
A
PNP proximity sensor is also called a “positive contact type” or “switch power connection type” proximity sensor. In the working state, the output terminal is connected to the positive pole of the power supply (usually 24V) to form a closed loop. When the sensor senses the target object, the output terminal is connected to the positive pole of the power supply, and the output signal is usually a high level, close to 24V or the power supply voltage (VCC).
The differences between NPN and PNP proximity sensors

Different output level characteristics:
NPN type: The NPN type 3-wire proximity switch has a low-level effective output. When an object enters its detection range, the output terminal is connected to ground (0V), and a low-level signal is output. This is like a “signal receiver”. When the target is detected, it pulls the signal to a low level and “pours” the current into the connected circuit part, so it is also called a “sinking current type” sensor.
PNP type: The PNP type 3-wire proximity switch has a high-level effective output. When an object enters the detection range, the output terminal is connected to the positive voltage of the power supply (such as + 24V), and a high-level signal is output. It is more like a “signal transmitter”. When the target is detected, it can provide a positive voltage signal, “pull” the current out of itself, and supply it to the connected circuit, so it is also called a “sourcing current type” sensor.
Different circuit connection methods:
NPN type: In the circuit connection, the load (such as relay coil, PLC input, etc.) of the NPN type proximity switch is usually connected to the positive pole of the power supply. The positive pole of the power supply is connected to the output terminal of the proximity switch through the load. When the proximity switch operates, the output terminal is grounded, so that the current flows from the positive pole of the power supply through the load and then through the output terminal of the proximity switch to ground to complete the loop.
PNP type: The load of the PNP type proximity switch is generally connected to the negative pole of the power supply. The positive pole of the power supply is connected to the power supply terminal of the proximity switch. When the proximity switch operates, the output terminal is connected to the positive pole of the power supply, and the current flows from the positive pole of the power supply through the output terminal of the proximity switch and then through the load to the negative pole of the power supply to form a loop.
Different preferences in application scenarios:
NPN type: Due to its relatively fast response speed, NPN type proximity switches are often used in application scenarios of high-speed detection, such as rapid counting of products and detection of rapidly passing objects in high-speed automated production lines. They are also widely used in relay circuits, which can quickly transmit low-level signals to relays to achieve rapid circuit switching control.
PNP type: PNP type proximity switches have more advantages in PLC circuit applications. Because if the sensor is damaged and short-circuited to ground, the high-level signal it outputs will not be as prone to false triggering as the NPN type (when the NPN type is short-circuited, it may output a low level all the time, resulting in malfunction). Therefore, it can better prevent false alarm signals and improve the reliability of the system. In some PLC control scenarios with high requirements for signal accuracy and many interference factors, the PNP type is a better choice.
Wiring color codes of NPN/PNP 3-wire proximity switches

As the name suggests, a 3-wire proximity switch has three wires to be connected. Whether it is an NPN type 3-wire proximity sensor or a PNP type 3-wire proximity sensor, the positive power terminal (usually the brown wire) is connected to the positive pole of the power supply (such as + 24V) to provide the power required for the operation of the proximity switch. The negative power terminal (usually the blue wire) is used to connect to the negative pole of the power supply (0V) to form a complete power loop to ensure the normal operation of the proximity switch. The difference is how to connect the output wire / signal wire of the sensor (usually the black wire). (If the wire colors of your sensor are different or the color codes are uncertain, please refer to the data manual of the manufacturer)
How to connect NPN and PNP proximity sensors to relays
Connecting NPN proximity sensors to relays
After connecting the positive and negative power terminals of the NPN proximity sensor, we need to connect the output wire of the NPN sensor to the negative terminal of the relay coil, and the positive terminal of the relay coil is connected to the positive pole of the power supply. In this way, when an object enters the detection range of the NPN proximity sensor, the sensor outputs a low level, that is, the output terminal is connected to ground. At this time, the relay coil forms a loop, and the current flows from the positive pole of the power supply through the relay coil to the output terminal of the sensor (ground), causing the relay to act.
Connecting PNP proximity sensors to relays

After connecting the positive and negative power terminals of the PNP proximity sensor, we need to connect the output wire of the PNP sensor to the positive terminal of the relay coil, and the negative terminal of the relay coil is connected to the negative pole of the power supply. When an object enters the detection range of the PNP proximity sensor, the sensor outputs a high level, that is, the output terminal is connected to the positive pole of the power supply. At this time, the current flows from the positive pole of the power supply through the output terminal of the sensor, through the relay coil to the negative pole of the power supply, forming a loop, thereby causing the relay to act.
Note that in the above examples, they are all NO type proximity sensors. For NC type proximity sensors, their switch actions are opposite.
How to connect NPN and PNP proximity sensors to PLC
In the automation control system,
NPN/PNP proximity sensors are usually connected to PLC (Programmable Logic Controller) to monitor the position and status of objects. Next, I will explain how to connect NPN/PNP proximity sensors to Siemens PLC. (Please be sure to follow the operating procedures and perform the wiring operation after ensuring that the system is powered off to avoid damage to personnel or equipment due to electric shock / short circuit)
Connecting NPN 3-wire proximity sensors to PLC

The output of the NPN type proximity sensor is a low-level signal (grounding), so we need to connect it to the digital input terminal of the PLC, and ensure that the power supply voltage of the PLC input port is compatible with the output of the sensor. The positive pole of the sensor (usually 24V) is connected to the 24V power supply terminal (V+) of the PLC; the output terminal of the sensor is connected to the digital input terminal of the PLC (such as I0.0); the negative pole (ground) of the sensor is connected to the GND terminal of the PLC.
Connecting PNP 3-wire proximity sensors to PLC

The output of the PNP type proximity sensor is a high-level signal (connected to 24V), and it transmits the high-level signal to the input terminal of the PLC. The wiring method of the PNP sensor is slightly different from that of the NPN type. The positive pole of the sensor (usually 24V) is connected to the 24V power supply terminal (V+) of the PLC; the output terminal of the sensor is connected to the digital input terminal of the PLC (such as I0.0); the negative pole (ground) of the sensor is connected to the GND terminal of the PLC.
Note that after completing the hardware wiring, programming configuration of Siemens PLC is required to enable it to correctly identify and respond to the signals of the proximity sensor.
NPN and PNP 3-Wire Proximity Sensors play an important role in the wave of automation with distinct characteristics. Their diverse application scenarios demonstrate their unique value under different control requirements, effectively promoting the automation system towards greater accuracy and reliability. With the continuous innovation of technology, they will surely continue to write brilliance on the automation stage and become a key force in building an intelligent and efficient automation world, helping various industries overcome difficulties and achieve more fruits in the process of automation.
Explore Bedook: Your Trusted Sensor Manufacturer
At Bedook, we specialize in designing, developing, and manufacturing a comprehensive range of proximity sensors and switches. Our extensive product lineup includes:
With over 10,000 detailed product variations and a robust R&D team, we take pride in our ability to meet your unique requirements with tailored solutions and reliable performance.
Whether you’re seeking off-the-shelf products or customized designs, Bedook offers the expertise and production capacity to ensure your satisfaction.
We value your interest in our products and warmly encourage you to send us an inquiry. Let us help you find the perfect sensor solution for your application.
Thank you for considering Bedook—your trusted partner in innovation and quality manufacturing. We look forward to collaborating with you!