PNP vs NPN sensors: wiring and PLC inputs
PNP and NPN describe which side of the output transistor the load sits on. Get it wrong and the sensor works perfectly but the PLC never sees it - here is how to tell them apart before you order.
A photoelectric sensor with the right range, the right housing and the right price arrives, gets mounted, gets wired, and does nothing. The LED on the sensor blinks when a pallet passes. The PLC input does not change. Nine times out of ten the sensor is PNP and the input card expects NPN.
The two terms describe the output stage, not the sensing principle. Any sensor - inductive, photoelectric, capacitive, magnetic - can be built with either.
What the transistor actually does
Both types switch a transistor, and in both cases the load is in series with it. The difference is which side of the transistor connects to the positive supply.
- PNP (sourcing, positive switching). The emitter connects to +24 V. When the sensor activates, the transistor conducts and pulls the output up to +24 V. The load's other end goes to 0 V.
- NPN (sinking, negative switching). The emitter connects to 0 V. When the sensor activates, the transistor conducts and pulls the output down to 0 V. The load's other end goes to +24 V.
The confusion comes from naming the sensor after the transistor rather than after what it does to the signal. A PNP sensor gives you a positive voltage on the output wire; an NPN sensor gives you a path to ground. That is the whole difference.
Three-wire colour code
Almost every three-wire sensor follows the same colours, and they are worth memorising:
| Wire | Function |
|---|---|
| Brown | +24 V (L+) |
| Blue | 0 V (M) |
| Black | Switching output |
| White (4-wire) | Second output, usually complementary (NO/NC pair) |
If brown and blue are swapped, most sensors are reverse-polarity protected and simply will not work. Some are not, and that is the end of the sensor.
Matching the sensor to the PLC input
PLC input cards are described as sinking or sourcing, and the terminology is from the card's point of view - which is the opposite of the sensor's:
- A sinking input accepts a positive voltage and sinks current to 0 V. It needs a PNP sensor.
- A sourcing input expects the sensor to pull the input down to 0 V. It needs an NPN sensor.
This inversion is the single most common wiring mistake in machine building. The practical rule: if the input common is 0 V, use PNP. If the input common is +24 V, use NPN.
Most modern European PLC and I/O module families are PNP-first, because a short to ground on a PNP input is a safe fault (input reads 0, machine stops) whereas a short on an NPN input reads as permanently active. That safety argument is why PNP dominates in Europe and why Japanese and American machinery often arrives with NPN.
The two-wire trap
Two-wire sensors sit in series with the load and have no separate supply. They work by drawing a small leakage current - typically 0.5 to 1.7 mA - while in the off state, to keep their internal electronics alive.
That leakage flows through the PLC input. If the input's off-state current threshold is above the sensor's leakage, the input stays off and everything is fine. If the input is a low-current type, or if several two-wire sensors share a common return, the leakage adds up and the input reads permanently on. The symptom is an input that never goes false, and the fix is either a bleeder resistor across the input or a three-wire sensor.
How to tell them apart on a running machine
With the sensor powered and the target absent:
- Measure from the black wire to 0 V. ~24 V present means PNP.
- Measure from the black wire to +24 V. ~24 V present means NPN.
- If both read 0 V, the sensor is off in both directions - check the supply before concluding anything.
With the target present, the reading should invert. A PNP output that sits at 12 V under load is not a PNP output any more: it is a shorted transistor or a supply that sags.
Mixing the two in one panel
Sometimes you inherit a machine with both. Three options, in order of preference:
- Reconfigure the input card. Many cards have a common terminal you can move from 0 V to +24 V, which flips the whole bank from sinking to sourcing. One screw, no extra parts.
- Fit an interface relay. A small terminal block relay converts either type. It costs a few euros per channel and adds 5-10 ms, which matters on a safety circuit and does not matter on a position feedback.
- Keep a stock of both variants. Sensors with the same body and range are usually available in PNP and NPN versions at the same price. Ordering both and labelling the spares bin is cheaper than an unplanned stop.
Where this shows up in spare parts
Position and limit sensing on older machines is the usual place to find NPN: position switches and microswitches on imported equipment, magnetic and inductive sensors on Japanese lines. When replacing, the mechanical housing and the sensing distance are the easy part. Check the output type before anything else - it is the one specification that stops the machine from running while every other number matches.
The practical checklist for any sensor replacement:
- Output type: PNP or NPN (and number of wires)
- Output function: normally open or normally closed
- Supply range: 10-30 V DC is standard, but check for 5 V or AC types
- Switching current: enough for the load, or use a relay
- Connection: M8, M12, cable, or terminal chamber
Get the first two right and the sensor works. Get them wrong and everything looks correct on the bench.
References in this catalogue
Actual catalogue entries behind the selection rules above — follow a reference for full specifications, packaging and current availability.
| Reference | Description | MOQ |
|---|---|---|
| PIZZATO · Position switch9,628 references | ||
| FC 301 | Position switch with short plunger | 1 |
| FL 1834 | Position switch with revolving lever | 1 |
| PIZZATO · Microswitch506 references | ||
| MF 01 | Microswitch with pin plunger | 1 |
| MK H11D10-T6 | Microswitch with threaded pushbutton | 1 |
| Schneider Electric · I/O module269 references | ||
| 170ADM35010 | discrete I/O module Modicon Momentum - 16 I/O solid state | 1 |
| TCSXCN1M1F5E | TM7 daisy chain bus cable - straight - M12B male-female - 5m | 1 |
| Schneider Electric · Power supply16 references | ||
| ABL1REM24025 | Spindle motor 230/24V 2.5A ABL1REM24025 | 1 |
| ABL2K03B | Option for ABL2_K big L type Install | 1 |
Parts covered in this article
References for the components discussed above, by manufacturer: