Understanding PNP vs NPN for Sensors and Devices
You are bound to encounter two terms associated with sensors and some loads: ‘PNP’ and ‘NPN’. You must understand the relationship between the field devices and the control modules in order to choose and install components properly when needed.
Every control system needs some sort of connection to the environment and conditions in the physical process around it. These devices are most commonly called ‘I/O’ devices for inputs and outputs. Identifying the correct wiring of a device is crucial for the success of the system in both initial wiring as well as maintenance and replacement.
Two terms are associated with sensors and some loads, these terms being ‘PNP’ and ‘NPN’. The concept is closely related to modules which can be listed as Sourcing or Sinking, and you must understand the relationship between the two in order to replace components properly when needed.
Side note: the science of the diode junction construction that gives NPN and PNP their respective names is not the objective of this article. Here we only wish to address their application in control systems.
Inputs - NPN vs PNP Sensors
The only devices that are limited in compatibility are those with diode or transistor construction, as noted previously. That means that mechanical N.O. and N.C. buttons and switches can be used with either style of input. Indicator lamps and most coil load devices can be used with either style of output. This is good news because you do not ever need to examine a pushbutton to learn its NPN or PNP polarity - it has none.
These buttons can be installed upstream between power and the PLC (power side switching - more common), or they can be installed downstream between the PLC and ground (ground side switching - less common).
For DC 3-wire sensors, two types exist. This makes sense considering the two types of wiring for the input modules with which those sensors will interface.
Start with the summary:
Sinking input modules require PNP sensors.
Sourcing input modules require NPN sensors.
PNP and NPN refer to the transistor types providing the output voltage. The main difference between these two transistors is the direction of current. In the PNP sensor configuration, the wire providing the output signal will supply positive outgoing current when energized. This is exactly what the sinking input modules require to function properly.
Sensor polarities are not always labeled directly on the device, but wiring diagrams are usually found on the body somewhere. A PNP is recognized by the label attached to the signal wire. It will indicate a + voltage, either with a direct + notation, or with the ‘load’ shown as connecting to the - line. If the sensor provides the + signal, then the input module must provide the opposite negative connection. The diagrams below show a couple of alternative examples of the PNP sensor wiring diagram.
Figure 1. PNP sensor wiring diagram as found in a datasheet.
Figure 2. PNP sensor wiring diagram directly printed on the back of a sensor.
The NPN sensor will provide a direct path to receive current from the output signal wire directly to the negative power supply terminal when energized.
The wiring label for the NPN scheme shows a load device connected to both the supply + as well as to the sensor. This should illustrate the constant positive supply from the input module, allowing the sensor to provide the path to the negative supply. The diagram below shows an NPN wiring schematic.
Figure 3. NPN sensor wiring diagram as found in a datasheet.
One tricky concept regarding sensors is that it would seem that these two sensors are simply the opposite of each other. The voltage simply seems to swap between energized and de-energized. This is not the case. Current will only flow when energized, and it will only flow in one direction for each sensor.
This means that you cannot connect a PNP sensor to a sourcing input and expect a simple reversal of on/off states. It will simply not work at all.
When the PNP sensor is energized, it will provide a positive voltage to the input module, but the sourcing module is providing the same positive voltage back against it, so no current will flow at all.
When the sensor is de-energized, the transistor allows no flow of current in either direction, so no current will flow at all.
As you can see, this sensor will simply never energize the input. But the good news is that it will not damage the input, so if you make this mistake, it may cause the machine to not operate correctly, but you didn’t cause extra damage to the module or the sensor.
Load Devices - NPN vs PNP Output
Nearly all load devices can actually be used with either sourcing or sinking outputs, since both modules allow the completion of a circuit from + to -. It is more rare to encounter outputs restricted to either PNP or NPN, but it can be seen on some light towers and other devices, so it’s still important to understand the relationship.
Consider a large solenoid valve or relay with diode protection. The input connections on the valve will be clearly identified with its own + and - polarity to allow proper use of the diode.
If used with a typical ‘sourcing’ output, the power supply + will be connected directly to the common terminal of the output module. The output terminal will then supply that positive voltage to the positive side of the coil. The negative side of the coil returns the current directly to power supply -. This means that the load has been connected in ‘sinking’ configuration. If the load device was transistor based, this would be an NPN load.
Figure 4. Sourcing output module with a sinking load (in the case of an NPN load device)
Now consider the same coil paired with a ‘sinking’ output module. In this case, the output module is connected with the common terminal directly to the power supply -. Therefore, the positive voltage must be provided by the valve. The + side of the valve connects directly to the power supply +, and the - of the valve goes to the output terminal. Since the load is providing the positive voltage, it is wired in ‘sourcing’ configuration. Compared to the previous example, this load device would be PNP if it were transistor based.
Figure 5. Sinking output module with a sourcing load (in the case of a PNP load device)
If you work with sensors and field devices in a control system, you are guaranteed to encounter this challenging concept of PNP and NPN, but with some practice and familiarity, it turns into a simple concept of electricity - flowing current to complete a circuit.