On a standard 3-wire DC proximity sensor, brown is +V, blue is 0 V and black is the switched output. Those colors are the same whether the sensor is NPN or PNP. The difference is inside the output stage. A PNP (sourcing) sensor switches its output to +V, so the load goes between the black wire and 0 V. An NPN (sinking) sensor switches its output to 0 V, so the load goes between +V and the black wire.
The short version for PLC work: a PNP sensor needs a sinking input, with the input card’s common tied to 0 V. An NPN sensor needs a sourcing input, with the common tied to +V. Get that pairing wrong and the sensor’s LED will light while the PLC input stays off. On some sensors with a normally closed (NC) output, the output moves to M12 pin 2 (white in a 4-conductor cordset), which is why a 3-conductor cable does not work with them.
Safety first. The sensors covered here run on 10 to 30 V DC, but they share panels with mains, motor and control-transformer wiring. Switch off and lock out the panel before landing or lifting wires, and verify it is dead with a meter. A sensor that changes state can start a machine, so tell the operator before testing on a live machine and keep clear of moving parts. A general-purpose proximity sensor is not a safety device: never use one in place of a safety-rated interlock or light curtain.

The 3-wire color code and pin numbers
Pepperl+Fuchs states in its catalogs that its sensor core colors follow EN 60947-5-2, the IEC/EN standard for proximity switches, and its connection methods reference lists the 3-wire DC normally open layout: brown for plus on connector pin 1, blue for minus on pin 3, black for the output on pin 4. The AutomationDirect PNM series datasheet (12 mm inductive sensors) shows the same scheme and adds where the NC output goes on the connector version.
| Wire color | M12 pin | Function | Same on NPN and PNP? |
|---|---|---|---|
| Brown (BN) | 1 | Supply + (L+) | Yes |
| Blue (BU) | 3 | Supply 0 V (L-) | Yes |
| Black (BK) | 4 | Output, normally open | Yes, but the output switches to a different rail |
| White (WH) | 2 | Output on NC connector models (PNM series); second output on some 4-wire sensors | Check the datasheet |
Two details from the PNM datasheet catch people out. First, the cable versions of its NC sensors still bring the output out on the black wire, while the M12 connector versions put it on pin 2, which is white in a standard 4-conductor cordset. Second, the datasheet warns that a 3-conductor M12 cable will not work with the normally closed units, because a 3-conductor cable has no pin 2. If you swap an NO sensor for an NC one and the input never changes, check the cordset before anything else.
The colors never tell you whether a sensor is NPN or PNP, NO or NC. That is on the label, in the model number, or in the datasheet’s wiring diagram.
NPN vs PNP: where the load goes
- PNP (sourcing, “switched high”). When the sensor turns on, it connects the black wire to +V. The load, such as a PLC input or relay coil, goes from black to 0 V. Banner’s PNP vs NPN explainer describes it as supplying current to the load.
- NPN (sinking, “switched low”). When the sensor turns on, it connects the black wire to 0 V. The load goes from +V to black, and current flows from the supply, through the load, into the sensor.
The PNM datasheet’s wiring diagrams show exactly this: on the NPN models the load sits between brown (L+) and black, and on the PNP models it sits between black and blue (L-). Pepperl+Fuchs uses the same “switched high” and “switched low” wording in its catalogs.
Banner also describes complementary outputs (two output wires, one open while the other is closed) and push-pull outputs with both transistor types on one circuit, which Pepperl+Fuchs notes can switch a load returned to either rail. Those need their own datasheet diagram.
Banner reports that PNP dominates in Europe, NPN in Asia, and US installations use a mix. On an imported machine, do not assume.
Decoding NO, NC, NPN and PNP from a part number
Model codes differ by manufacturer, but the PNM series shows what to look for. Its part numbers carry two letters after the size code:
| Code in PNM part number | Output state | Logic | Load connected between |
|---|---|---|---|
| AN | Normally open | NPN | +V (brown) and black |
| AP | Normally open | PNP | Black and 0 V (blue) |
| CN | Normally closed | NPN | +V and output (black on cable models, pin 2 on M12 models) |
| CP | Normally closed | PNP | Output and 0 V (black on cable models, pin 2 on M12 models) |
For the same series the datasheet lists a 10 to 30 V DC supply, 100 mA maximum load current, a voltage drop under 2.5 V when on, off-state leakage under 50 microamps for 3-wire models, reverse polarity protection, pulsed short-circuit protection, and a yellow LED that lights when the output is energized. Use these as an example of what to look up, not as values for your sensor.
Matching the sensor to a PLC input
AutomationDirect’s sinking and sourcing concepts guide gives the cleanest definitions: sinking provides a path to the supply common (-), and sourcing provides a path to the supply source (+). A circuit only works when one side sources and the other sinks. Its 3-wire examples pair an NPN (current sinking) sensor with a DC sourcing input module, and a PNP (current sourcing) sensor with a DC sinking input module.
| Sensor | PLC input type needed | Input common goes to | IEC term for the input |
|---|---|---|---|
| PNP (sourcing) | Sinking | 0 V (supply -) | Positive logic |
| NPN (sinking) | Sourcing | +24 V (supply +) | Negative logic |
Many PLC input cards are sink/source: the input circuit conducts in either direction, and the polarity of the common decides how the group behaves. The guide adds two rules. Every input that shares a common must be wired the same way, all sinking or all sourcing, so you cannot mix NPN and PNP sensors on one common group. And an AC supply must not be used on a DC sink/source point.
How to wire a 3-wire sensor to a PLC input
- Isolate the panel. Switch off and lock out the 24 V DC supply and any mains feeding the panel, then confirm it is dead.
- Identify the sensor. Read the label or look up the model number: NPN or PNP, NO or NC, supply range and maximum load current.
- Identify the input. Find the input card’s wiring diagram and note whether the group is sinking, sourcing or sink/source, and which terminal is its common.
- Land the supply. Brown to +24 V, blue to 0 V, from the same supply that feeds the input common, or at least with the two supplies’ 0 V connected, so the input current has a return path.
- Land the output. Black (or the NC wire your datasheet names) to the input terminal.
- Set the common. PNP sensor: input common to 0 V. NPN sensor: input common to +24 V.
- Insulate unused conductors. On a 4-wire cordset feeding a 3-wire sensor, do not tie the spare wire to a rail; cap it.
- Power up and test. Present a target. The sensor LED and the PLC input LED should change together.
Testing the sensor with a multimeter
Test the output with its load connected (the PLC input, or a relay coil within the sensor’s load rating). Do not connect the black wire straight to a rail to “see if it switches”; that is a short circuit, even if the sensor has short-circuit protection. Measure with the meter’s black lead on blue (0 V):
| Sensor | Target present (NO model) | No target |
|---|---|---|
| PNP | Output close to supply voltage (supply minus the sensor’s voltage drop) | Output near 0 V |
| NPN | Output near 0 V (no more than the sensor’s voltage drop) | Output pulled up toward +V by the load |
With the PNM figures as an example, a PNP sensor on a 24 V supply should put at least 21.5 V on the load when on (24 V minus the 2.5 V maximum drop). An NC model gives the opposite readings. If the sensor LED changes but the output voltage does not, check the load wiring, then suspect the sensor’s output stage. If neither changes, check the supply at brown and blue first, then the target material and sensing distance.
Troubleshooting: symptom, cause, fix
| Symptom | Likely cause | What to do |
|---|---|---|
| Sensor LED lights, PLC input never turns on | NPN sensor on a sinking input, or PNP on a sourcing input; input common on the wrong rail | Move the common if the card is sink/source and the whole group matches; otherwise fit a sensor of the correct type |
| PLC input on all the time | NC sensor where NO was expected, or the output wire touching a rail | Check the model code for NO/NC; inspect the output wire and terminal |
| NC sensor never changes on an M12 cordset | 3-conductor cable with no pin 2 | Use a 4-conductor cordset, as the PNM datasheet specifies |
| Sensor LED never lights | No supply, reversed supply, or target out of range | Measure brown to blue; check sensing distance and target material against the datasheet |
| Mixed NPN and PNP sensors on one card, some inputs dead | Shared common can only be sinking or sourcing | Split them across input groups with separate commons, or standardize on one type |
| Replacement sensor works on the bench, not in the machine | Bought NPN to replace PNP (or the reverse); same colors hide the difference | Match the original’s output type and NO/NC, not only the size and range |
Without a matching sensor on hand, one workaround is an interposing relay: the sensor drives the relay coil as its load (check the coil current against the sensor’s rating), and a relay contact feeds the PLC input. Our guide to testing a relay with a multimeter covers checking that relay. For the analog side of the same panels, see how a 4-20 mA current loop works, and for the contactors these inputs often control, testing a contactor coil.
Frequently asked questions
Can I tell NPN from PNP by the wire colors?
No. Brown, blue and black mean the same thing on both. The output type is printed on the sensor or encoded in its model number, and the datasheet’s wiring diagram shows which rail the load returns to.
Can I replace an NPN sensor with a PNP one?
Only if you also change the input side: the load has to return to 0 V instead of +V, and the PLC input common has to move from +24 V to 0 V. On a sink/source card that is possible only if every other input on the same common is changed too. Otherwise order the same output type as the original.
What is the white wire on a proximity sensor?
It is usually the conductor on M12 pin 2. On the PNM series it carries the output of the NC connector models; on other 4-wire sensors it can be a second, complementary output. Check the datasheet before using it.
Quick checklist
- Panel isolated and verified dead before any wire is moved.
- Brown to +V, blue to 0 V, output to the input terminal.
- PNP with a sinking input (common to 0 V); NPN with a sourcing input (common to +24 V).
- NO or NC confirmed from the model code, and a 4-conductor cordset for NC connector models.
- Replacement sensor matches the original’s output type, not only its thread size and range.
Call a controls technician when the sensor is part of a machine safety function, when the PLC program has to change to accept a different sensor logic, or when the input card’s wiring diagram does not match what is installed.