What is the difference between PNP and NPN when describing 3 wire connection of a sensor?

Most industrial proximity sensors  (inductive, capacitive, ultrasonic and photo electric) are solid state.

The term solid state refers to the type of components used within the sensor. Solid state electronic components such as transistors are used to switch the output of the sensor upon detection of an object.

Two specific types of 3 wire sensors are available; PNP and NPN. The difference is a result of the internal circuit design and type of transistors used.

A key point to observe is that PNP and NPN has nothing to do with whether the sensor is normally open (N/O) or normally closed (N/C), i.e. a PNP sensor may be either N/O or N/C as can an NPN be either N/O or N/C.

Why two types?

The selection of a PNP sensor verses an NPN sensor is determined by the nature of the circuit the device is to be used in. When used in a traditional relay type control circuit, it is normally possible to use either the PNP or the NPN type of sensor as shown below. PNP sensors tend to be more commonly used.
Traditional relay type control circuit;

Use with a programmable logic controller (PLC).

When selecting a sensor to be used with a PLC, it is very important that the sensor matches the type of PLC input card to be used.
Two types of input cards exist, those that ‘sink’  current (also known as positive logic) and those that ‘source’ current (also known as negative logic). It is worth mentioning, that whilst the terms sinking / sourcing and positive / negative logic are well known in some industries, they are not always commonly used terms. It is therefore important to identify the type of sensor to be used with the PLC card based on the PLC manufacturer’s documentation and / or wiring diagrams.

Most common in Europe is the ‘sinking’ type of input, these will be used with the PNP sensor as shown below. Less common nowadays are input cards that ‘source’, these were popular in Asia and require the NPN type of sensor in order to operate correctly. Many modern PLC input cards can be configured and wired to be either ‘sinking’ or ‘sourcing’  although it will usually necessitate all inputs on a particular input card being configured the same.


Actual connection bellow:

PNP and NPN connection to plc

Source: 3 wired PNP vs NPN sensors
PLC wiring