NPN vs PNP Sensor Outputs: A Practical Wiring Guide for PLC Inputs

An NPN sensor and a PNP sensor do the same job and are not interchangeable. Both switch a transistor, but one switches the negative rail and the other switches the positive rail. Connect the wrong one to a PLC input card and the input either never turns on or turns on permanently. This guide covers the wiring rules, the two-wire exceptions, and the resistor fix when a mismatch is unavoidable.

Three-wire sensors: what the colours mean

Almost every industrial three-wire sensor follows the same convention:

  • Brown: positive supply, typically 10 to 30 VDC.
  • Blue: 0 V.
  • Black: switched output.

What the black wire does depends on the output type. A PNP output connects the black wire to brown (positive) when the sensor is active, so current flows out of the sensor into the load. This is called sourcing. An NPN output connects the black wire to blue (0 V) when active, so current flows from the load into the sensor. This is called sinking.

Match the sensor to the PLC input common

The PLC input card has a common terminal, and that common decides everything:

  • Sinking input card (common tied to 0 V): the card expects a positive voltage on the input terminal. Use a PNP sensor.
  • Sourcing input card (common tied to +24 V): the card expects the input terminal pulled to 0 V. Use an NPN sensor.

Some cards are configurable per channel and accept both; most fixed cards do not. If the input LED stays on with no target present, the polarity is wrong. If it never comes on and the sensor LED does, the polarity is wrong the other way.

Two-wire sensors are a different animal

A two-wire AC or DC sensor is wired in series with the load. In the off state it must pass a small leakage current to keep its own electronics alive, typically 0.5 to 2 mA. That leakage is enough to hold a high-impedance PLC input on, which looks like a stuck sensor. Datasheets list a minimum load current and a maximum leakage current for exactly this reason; if the PLC input impedance is too high, a bleeder resistor across the input brings the voltage down.

Two-wire sensors also drop a few volts across themselves when on (typically 1.5 to 3 V). At 24 V that is fine; at 12 V it can eat the margin on a long cable run.

The mismatch fix: a pull-up or pull-down resistor

When a PNP sensor must feed a sourcing input, or an NPN sensor must feed a sinking input, a resistor can translate the level. Example: an NPN sensor (sinks to 0 V when active) feeding a sinking card that expects a positive voltage.

Connect a resistor from the sensor output to +24 V. With the sensor off, the resistor pulls the input to 24 V. When the sensor turns on, it sinks the resistor current and the input falls to about 0 V, which the card reads as off. Choose the resistor so the sensor can sink the current comfortably: 10 kiloohm gives 2.4 mA at 24 V, well within any sensor rating. 4.7 kiloohm gives about 5 mA and switches faster on long cables. Do not go below 2.2 kiloohm without checking the sensor output current limit.

The resistor dissipates about 58 mW at 10 kiloohm and 24 V, so a 0.25 W part is enough. Mount it at the PLC terminal, not at the sensor, so the cable carries the low-impedance signal.

Analog outputs: match the input, not just the range

Three analog output types dominate:

  • 0 to 10 V: easy to read, sensitive to voltage drop on long cables and to ground offsets.
  • 4 to 20 mA: immune to cable resistance within the loop budget, and the 4 mA live zero distinguishes a broken wire from a genuine zero reading.
  • Ratiometric: output scales with supply voltage; only usable with a controller that shares the same supply reference.

A 4 to 20 mA sensor needs the loop to stay within its compliance voltage. Add up the sense resistor, cable resistance and any isolator burden, then confirm the result is below the sensor maximum. A 250 ohm sense resistor at 20 mA develops 5 V, which is convenient for a 0 to 5 V input card but leaves only 19 V of a 24 V supply for everything else.

Commissioning checklist

  • Sensor output type (PNP/NPN, NO/NC) recorded on the drawing, not just the part number.
  • PLC input common verified with a meter before wiring.
  • Two-wire sensors checked for leakage and minimum load current.
  • Resistor translation only where a card cannot be reconfigured; value and wattage noted.
  • Analog loop budget calculated end to end, including isolators.
  • Shield grounded at one end only, and kept clear of motor cables.

Getting the polarity right at the drawing stage removes a whole category of commissioning calls. Browse modules for sensor and interface boards, and electronic components for the resistors and optocouplers used in level translation.

Technical articles

View all articles →

← Back to all articles