What is the difference between PNP and NPN?
PNP and NPN are the two output types of electronic switching sensors: a PNP sensor switches the positive supply (+24 V DC) to the controller input (sourcing), while an NPN sensor switches the input to 0 V (sinking). The names come from the transistor in the sensor’s output stage. For a working connection, the sensor type must match the input card of the PLC: a PNP sensor needs a sinking input, an NPN sensor a sourcing input. PNP is the standard in Europe, whereas NPN is far more common in Japan and much of Asia.
🧠 How does a PNP or NPN output work?
A bipolar transistor consists of three layers of semiconductor material, arranged P-N-P or N-P-N. Inside a sensor it acts as an electronic switch with no moving parts and no contact wear.
- PNP (sourcing) — the transistor sits between +24 V (brown wire) and the signal wire. When the sensor detects a target, it supplies current to the input, which is referenced to 0 V on the card. Measured against 0 V, you see roughly the supply voltage.
- NPN (sinking) — the transistor sits between the signal wire and 0 V (blue wire). On detection, the sensor pulls the input down to 0 V, and current flows out of the input through the sensor to the negative rail. The card’s common terminal is then tied to +24 V.
German documentation, for instance from Siemens, calls PNP P-schaltend with a matching P-lesend input, and NPN M-schaltend with an M-lesend input (M stands for Masse, or ground).
🔄 How do PNP and NPN compare at a glance?
| Characteristic | PNP | NPN |
|---|---|---|
| Switches | +24 V to the load | Load to 0 V |
| Sensor term | Sourcing | Sinking |
| Matching PLC input | Sinking input (common at 0 V) | Sourcing input (common at +24 V) |
| Active signal | About +24 V at the input | About 0 V at the input |
| Signal wire shorted to 0 V | Reads as “off” | Reads as “on” |
| Common in | Europe, increasingly the US | Japan and Asia, older US machines |
What confuses many engineers is that suppliers sometimes name input cards after the sensor type (“PNP card”) and sometimes after the card’s own current behaviour (“sink input”). A Siemens card described as “sink input (PNP, P-reading)” is therefore exactly the one you want for PNP sensors.
📏 Which voltage levels does IEC 61131-2 define?
The standard IEC 61131-2, currently in its fourth edition from 2017, defines when a 24 V DC input reads a 0 or a 1. That is what allows sensors and cards from different manufacturers to work together. It specifies three types of current-sinking inputs:
| Type | Signal 0 | Signal 1 | Current at 1 | Suitable for |
|---|---|---|---|---|
| Type 1 | −3 to 15 V | 15 to 30 V | 2–15 mA | Mechanical contacts, 3-wire sensors |
| Type 2 | −3 to 11 V | 11 to 30 V | 6–30 mA | 2-wire sensors, higher consumption |
| Type 3 | −3 to 11 V | 11 to 30 V | 2–15 mA | 2- and 3-wire sensors, low consumption |
Above 5 V, an input only counts as 0 while the input current stays small (at most 0.5 mA for Type 1); between that limit and signal 1 lies a transition region. Type 3 has become the default for modern I/O modules: it draws less power, dissipates less heat in the control cabinet and allows high channel densities. Type 1 inputs are unsuitable for 2-wire electronic sensors, because the sensor’s residual current can exceed that limit and produce an unreliable signal.
🎨 How do you wire 2-, 3- and 4-wire sensors?
The wire colours of proximity switches are fixed in IEC 60947-5-2, and an M12 connector adds fixed pin numbers:
| Colour | Code | M12 pin | Function |
|---|---|---|---|
| Brown | BN | 1 | +24 V DC supply |
| White | WH | 2 | Second output (often NC) or diagnostics |
| Blue | BU | 3 | 0 V |
| Black | BK | 4 | Switching output (often NO) |
- 3-wire — by far the most common: brown to +24 V, blue to 0 V, black to the PLC input. With PNP the black wire goes to +24 V on detection; with NPN it is pulled to 0 V.
- 2-wire — the sensor sits in series with the input, just like a switch. A small residual current always flows to power the sensor electronics, which is why you need a Type 2 or Type 3 input.
- 4-wire — adds a white wire. Typically a complementary version with both an NO and an NC output, or a sensor with a second switching point.
NO or NC? A normally open output switches on when a target is detected; a normally closed output drops out instead. NC has the advantage that a broken wire becomes visible, as the signal disappears just as it would on detection. For genuine safety functions, however, use certified components such as a light curtain and a safety PLC rather than a standard proximity switch.
⚠️ What happens if you mix up PNP and NPN?
Connect a PNP sensor to a sourcing input (common at +24 V) and the sensor puts +24 V onto a terminal that is already referenced to +24 V. There is no potential difference, so the input never reads “1”. Conversely, an NPN sensor on a sinking input pulls the input to 0 V when its reference is already 0 V. The outcome is the same either way: the LED on the sensor lights up, but the PLC sees nothing.
Usually nothing is damaged, but you lose time during commissioning. Remedies are a sensor of the correct type, a signal converter or an interposing relay, or a card with a switchable common. A pull-up resistor sometimes works, but it inverts the logic and is error-prone.
🔧 How do you connect a proximity sensor to a PLC, step by step?
- Identify the input type — check the card’s datasheet: sink or source, and which IEC 61131-2 type. An ET 200SP DI 8x24VDC ST from the SIMATIC range, for example, is a sinking input for PNP sensors that complies with both Type 1 and Type 3. The on-board inputs of an S7-1200 are Type 1 and can be wired as sink or source via the 1M common terminal.
- Choose the sensor — for a European installation, a 3-wire PNP NO sensor with an M12 connector is the default. When buying from a Japanese brand, explicitly order the PNP variant.
- Wire to the colour code — brown to +24 V, blue to 0 V (the same 0 V as the card’s common), black to the input terminal.
- Check with a multimeter — for PNP, measure between black and blue: about 24 V on detection, about 0 V without. For NPN, measure between brown and black.
- Check the LEDs — green usually indicates power, yellow the switching state. If the sensor LED is lit but the card’s LED is not, the fault lies in the wiring or the type.
- Test in software — monitor the input online in TIA Portal and adjust the input delay if needed (configurable from 0.05 to 20 ms on the ET 200SP).
🌐 Is IO-Link the successor to PNP and NPN?
IO-Link was standardised as IEC 61131-9 in 2013 and uses the same unshielded 3-wire M12 cabling, up to 20 metres. On pin 4 (C/Q), an IO-Link port operates in two modes. In SIO mode the port behaves as an ordinary switching input to IEC 61131-2, and an IO-Link sensor then typically delivers a PNP or push-pull signal; on many sensors the output type can be set via IO-Link. In communication mode, master and device exchange digital data at 4.8, 38.4 or 230.4 kbaud: process values, parameters and diagnostics. The question “PNP or NPN?” thus moves into software configuration, and sensors become part of the network of industrial automation.
❓ Frequently asked questions
Which is better, PNP or NPN?
Neither PNP nor NPN is technically better; both are equally reliable. In Europe PNP is the norm, so spare parts and I/O cards are geared towards it. Choose the type that matches the input cards and the standard of your installation.
How can I tell whether a sensor is PNP or NPN?
Whether a sensor is PNP or NPN is shown on its label, in the order code or in the datasheet, usually with a wiring diagram. Without documentation, use a multimeter with the sensor connected to an input or load: a PNP sensor shows voltage between black and blue on detection, an NPN sensor between brown and black.
Can I connect an NPN sensor to a PNP input card?
An NPN sensor will not work directly on a sinking (PNP) input card, because both switch towards 0 V and no current flows. You then need a signal converter, an interposing relay or a PLC card with a switchable common. The simplest fix is a sensor of the correct PNP type.
What do sinking and sourcing mean?
Sourcing means a device supplies current from the positive rail, as a PNP sensor does; sinking means a device takes current towards 0 V, as an NPN sensor or a PNP input card does. A sourcing device is always paired with a sinking counterpart.
Why is PNP the standard in Europe?
PNP became the European standard because European sensor makers and PLC suppliers standardised on it. A practical advantage of PNP is that a short circuit from the signal wire to 0 V or earth reads as “off” rather than producing an unintended signal.
Is an IO-Link sensor PNP or NPN?
An IO-Link sensor in SIO mode behaves as an ordinary switching sensor, typically with a PNP or push-pull output, and therefore fits a standard 24 V input. Only when the sensor runs on an IO-Link master in communication mode are process values and parameters exchanged digitally.
📌 In summary
A PNP sensor switches +24 V to the PLC input (sourcing) and needs a sinking input card; an NPN sensor switches to 0 V (sinking) and needs a sourcing card. Always check the input type and its IEC 61131-2 input type before ordering sensors, follow the brown-blue-black colour code, and choose IO-Link for new installations wherever possible.
