Quick Answer

NPN (sinking): Brown → +24 V, Blue → 0 V, Black (output) → PLC input. PLC input common → +24 V. Output pulls to 0 V when active.
PNP (sourcing): Brown → +24 V, Blue → 0 V, Black (output) → PLC input. PLC input common → 0 V. Output drives to +24 V when active.
Match the sensor output type to the PLC input type: NPN sensor → sinking (NPN) PLC input; PNP sensor → sourcing (PNP) PLC input.

NPN vs PNP: The Core Difference

The terms NPN and PNP describe the transistor type used in the proximity sensor's output stage, which determines how the output switches relative to the power supply:

The same rules apply to the special-environment series: the high-pressure inductive proximity sensors (SGI-HP, rated up to 1000 bar for hydraulic cylinders) and the high-temperature inductive proximity sensors (SGI-HT, +120 °C / +150 °C) are both ordered with an NPN or PNP 3-wire output (2-wire versions are also available) and are wired to the PLC input card exactly as shown below. For sensors with a continuous signal instead of a switching output, see analog 4-20 mA vs 0-10 V proximity output.

PropertyNPN (Sinking)PNP (Sourcing)
Output when activePulls output to 0 V (GND)Drives output to +Vcc (+24 V)
Current flowCurrent sinks INTO the sensorCurrent sources OUT from the sensor
PLC input typeNPN / Sinking input (common = +24 V)PNP / Sourcing input (common = 0 V)
Geographic standardJapan, Asia, some NAEurope, North America
Wire colours (IEC 60947-5-2)BN=+Vcc, BU=0V, BK=outputBN=+Vcc, BU=0V, BK=output

The wire colours are identical — the difference is only in how the output transistor switches, and therefore how the PLC input common must be connected. The output stage is independent of the sensing principle, so inductive, capacitive and photoelectric sensors are all offered as NPN or PNP; the sensing principles are compared in types of proximity sensors.

Wiring an NPN 3-Wire Proximity Sensor

An NPN (sinking) proximity sensor has an open-collector NPN transistor output. When the sensor detects an object, the transistor turns ON and the Black output wire is pulled DOWN to 0 V. The load (PLC input, relay coil, or indicator lamp) connects between the Black wire and +24 V.

// NPN 3-Wire Proximity Sensor to PLC — Wiring Diagram Power Supply: +24 V DC ──────────────────────────┐ │ Sensor: BROWN (BN) ──── +Vcc (24V) │ BLUE (BU) ──── 0V (GND) │ BLACK (BK) ──── PLC INPUT TERMINAL │ │ PLC: INPUT TERMINAL ← Black (BK) │ INPUT COMMON ──────────────────────────────┘ ↑ PLC input common must connect to +24 V for NPN sinking inputs // Active (object detected): BK wire = 0 V → PLC input = LOW = active // Inactive (no object): BK wire = open → PLC input = +24 V = inactive
⚠ Critical: NPN PLC Input Common
  • For NPN sensors, the PLC input COMMON must be wired to +24 V (not to 0 V).
  • This is the single most common wiring mistake — connecting PLC common to 0 V with an NPN sensor results in no signal or inverted logic.
  • Check your PLC manual: NPN inputs are also labelled "Sink" or "Current Sink" on the terminal block.

Wiring a PNP 3-Wire Proximity Sensor

A PNP (sourcing) proximity sensor has an open-collector PNP transistor output. When the sensor detects an object, the transistor turns ON and the Black output wire is driven UP to +24 V. The load connects between the Black wire and 0 V.

// PNP 3-Wire Proximity Sensor to PLC — Wiring Diagram Power Supply: 0 V (GND) ─────────────────────────┐ │ Sensor: BROWN (BN) ──── +Vcc (24V) │ BLUE (BU) ──── 0V (GND) │ BLACK (BK) ──── PLC INPUT TERMINAL │ │ PLC: INPUT TERMINAL ← Black (BK) │ INPUT COMMON ──────────────────────────────┘ ↑ PLC input common must connect to 0 V for PNP sourcing inputs // Active (object detected): BK wire = +24 V → PLC input = HIGH = active // Inactive (no object): BK wire = open → PLC input = 0 V = inactive

NO vs NC Output: Normally Open and Normally Closed

Both NPN and PNP sensors can have Normally Open (NO) or Normally Closed (NC) output logic. This is independent of the NPN/PNP transistor type:

Output TypeNo Object in RangeObject DetectedTypical Use
NO (Normally Open)Output OFFOutput ONObject detection, counting, position sensing
NC (Normally Closed)Output ONOutput OFFSafety circuits, wire-break detection (fail-safe)

A 4-wire sensor provides both NO and NC outputs simultaneously on separate wires (Brown, Blue, Black, White), allowing both logic functions from one sensor without wiring two sensors. On connector versions the NC output sits on pin 2 (white) of the M12 plug; see M12 connector pinout for sensors.

Standard Wire Colour Code (IEC 60947-5-2)

WireColourFunction
3-wire sensorsBrown (BN)+Vcc (positive supply, typically +24 V DC)
Blue (BU)0 V (negative supply / ground)
Black (BK)Output signal (switching output)
4-wire sensorsBrown (BN)+Vcc
Blue (BU)0 V
Black (BK)Output 1 (NO)
White (WH)Output 2 (NC)

How do you wire a 3-wire proximity sensor?

Wire a 3-wire DC proximity sensor with three connections: brown (BN) to +24 V, blue (BU) to 0 V and black (BK) to the PLC input terminal. The only NPN/PNP difference is the PLC input common: tie it to +24 V for an NPN (sinking) sensor and to 0 V for a PNP (sourcing) sensor.

3-wire wiring in one line

Brown = +V (10–30 V DC on SGI-GP 3-wire models), blue = 0 V, black = switching output; NPN switches black to 0 V, PNP switches black to +24 V.

  • The supply wiring (brown and blue) is the same for NPN and PNP sensors.
  • The PLC input common decides which output type works: +24 V common for NPN, 0 V common for PNP.
  • The output code in the SEGMENsensor part number tells you the type: NA / NB = NPN, PA / PB = PNP.

How it works

  1. Brown and blue power the oscillator and switching electronics inside the sensor.
  2. When a metal target enters the sensing distance, the output transistor turns on.
  3. The black wire then sinks (NPN) or sources (PNP) the input current, and the PLC input changes state.
NPN 3-wire proximity sensor wiring diagram: brown to +24 V, blue to 0 V, black output to a sinking PLC input with common at +24 V
Illustration: NPN (sinking) 3-wire sensor. The PLC input sits between +24 V and the black wire, so the input common goes to +24 V.
PNP 3-wire proximity sensor wiring diagram: brown to +24 V, blue to 0 V, black output to a sourcing PLC input with common at 0 V
Illustration: PNP (sourcing) 3-wire sensor. The PLC input sits between the black wire and 0 V, so the input common goes to 0 V.

Step-by-step: wiring a 3-wire sensor to a PLC

StepActionWhat to check
1Switch off and isolate the 24 V DC supply.No voltage between the supply terminals.
2Read the output code on the sensor label or part number (NA / NB = NPN, PA / PB = PNP) and the PLC input type (sinking or sourcing).NPN sensor with a sinking input; PNP sensor with a sourcing input.
3Connect brown (BN) to +24 V.Supply within the rated range: 10–30 V DC for standard SGI-GP 3-wire models.
4Connect blue (BU) to 0 V.Same 0 V as the PLC input card.
5Connect black (BK) to the PLC input terminal.One sensor per input terminal.
6Wire the PLC input common: +24 V for NPN, 0 V for PNP.Common polarity matches the sensor output type.
7Power up and move a steel target into the sensing distance (for example 4 mm for the SGI-GP12S-040 flush M12 model).The sensor LED and the PLC input LED change state together.

2-wire vs 3-wire proximity sensors: which should you choose?

Choose a 3-wire sensor for new PLC designs, because separate supply and output wires make NPN or PNP selection explicit and keep the input signal clean. Choose a DC 2-wire sensor mainly when replacing a 2-wire limit switch on existing cabling. The 2-wire sensor is wired in series with the load and draws its own supply through it.

Property3-wire DC (NPN / PNP)2-wire DC
WiresBrown +V, blue 0 V, black outputTwo wires in series with the load (brown and blue)
SEGMENsensor supply (SGI-GP)10–30 V DC (V36: 5–36 V DC, V55: 10–55 V DC)10–60 V DC
Output codesNA / NB / NC (NPN), PA / PB / PC (PNP)DA (NO) / DB (NC)
Off stateOutput transistor off; the input sees no current from the sensorA small leakage current keeps the sensor powered; check it stays below the PLC input's off-current limit
On stateOutput follows the supply railA residual voltage drop across the sensor; check the PLC input still reads ON
Typical useNew machines, PLC input cards, fast countingRetrofits of 2-wire switches, reduced cabling

For more on the sensing principle behind both versions, see how an inductive proximity sensor works; to decide between metal-only and non-metal detection, see inductive vs capacitive proximity sensors. Typical housings for these wiring cases are the M12 flush inductive proximity sensor and the M18 inductive proximity sensor.

Download the one-page datasheet (PDF)

The SEGMENsensor inductive proximity sensor datasheet lists the published housing sizes, sensing distances, output options, supply voltage and ordering information. No registration required.

Inductive proximity switches on an automatic assembly line at the SEGMENsensor factory in Shenzhen
Proximity switch automatic assembly at the SEGMENsensor factory in Shenzhen. Qualification samples (1–5 pcs) ship in 5–7 working days; production lead time and MOQ are confirmed with the quotation.

Which SEGMENsensor Proximity Sensor Fits Your NPN or PNP Wiring?

SEGMENsensor inductive proximity sensors carry the output type in the part number, so each wiring case above maps to one order code. In the published part-number tables, NA is NPN NO, NB is NPN NC, NC is NPN NO + NC, PA is PNP NO, PB is PNP NC, PC is PNP NO + NC, and DA / DB are DC 2-wire NO / NC. The M12 examples below are taken from those tables.

Wiring case in this articleOutput codeSEGMENsensor example (M12)Sensing distanceSupplySeries page
NPN 3-wire, NO, to a sinking PLC input (common +24 V)NASGI-GP12S-040NA-Q4 (flush, M12 connector)4 mm10–30 V DCM12 flush SGI-GP
PNP 3-wire, NO, to a sourcing PLC input (common 0 V)PASGI-GP12S-040PA-Q4 (flush, M12 connector)4 mm10–30 V DCM12 flush SGI-GP
NC output for fail-safe or wire-break detectionNB / PBSGI-GP12S-040NB-Q4 / SGI-GP12S-040PB-Q44 mm10–30 V DCM12 flush SGI-GP
4-wire sensor with NO and NC outputsNC / PCSGI-GP12S-040NC-Q4 / SGI-GP12S-040PC-Q44 mm10–30 V DCM12 flush SGI-GP
DC 2-wire sensor in series with the PLC inputDA / DBSGI-GP12S-040DA-Q4 / SGI-GP12S-040DB-Q44 mm10–60 V DCSGI-GP inductive series
Same NPN or PNP wiring, sensor in pressurized hydraulic oil (500 bar, M12)NA / PASGI-HP12S-015NA-C2-L43 / SGI-HP12S-015PA-Q4-L691.5 mm10–30 V DCSGI-HP high-pressure
Same NPN or PNP wiring, ambient −25 to +150 °CNA / PASGI-HT12S-020NA-C2-T150 / SGI-HT12S-020PA-C2-T1502 mm10–30 V DCSGI-HT high-temperature

SGI-GP 3-wire models are also listed for 5–36 V DC (V36 code) and 10–55 V DC (V55 code), and the same output codes run across 6.5 mm, M8, M12, M18 and M30 housings. To get a quotation, send the PLC input type (sinking or sourcing), NO or NC logic, housing size and flush or non-flush mounting, sensing distance, supply voltage, cable or connector, operating temperature or pressure, and estimated annual volume. Qualification samples of 1–5 pcs ship in 5–7 working days; production lead time and MOQ are confirmed with the quotation.

Frequently Asked Questions

Standards & Further Reading

An NPN sensor pulls the output DOWN to 0 V when active (current sinking). A PNP sensor drives the output UP to +24 V when active (current sourcing). NPN is standard in Japan and Asia; PNP is standard in Europe and North America. Match the sensor output type to the PLC input type: NPN sensor → PLC NPN sinking input; PNP sensor → PLC PNP sourcing input.

Connect Brown to +24 V, Blue to 0 V, Black (output) to the PLC input terminal. Connect the PLC input's common terminal to +24 V (not 0 V — this is the key difference for NPN sinking inputs). When the sensor detects an object, the Black wire pulls to 0 V, which the PLC reads as an active input.

Connect Brown to +24 V, Blue to 0 V, Black (output) to the PLC input terminal. Connect the PLC input's common terminal to 0 V. When the sensor detects an object, the Black wire is driven to +24 V, which the PLC reads as a HIGH active input.

NO (Normally Open) means the output is OFF when no object is detected, and switches ON when an object is in range. NC (Normally Closed) is the opposite: ON with no object, OFF when an object is detected. NO is used for object detection and counting; NC is used for safety circuits where a broken wire should trigger an alarm (fail-safe wiring).

Not directly. Use a PNP-to-NPN converter relay module, replace the sensor with the correct NPN output type, or use a sensor with selectable NPN/PNP output. Always match sensor output type to PLC input type for correct operation.

Per IEC 60947-5-2: Brown (BN) = +Vcc (+24 V), Blue (BU) = 0 V ground, Black (BK) = switching output. For 4-wire sensors: Brown = +Vcc, Blue = 0 V, Black = output 1 (NO), White = output 2 (NC). This colour code is used by SEGMENsensor and most European and Asian manufacturers.

Standard 3-wire DC proximity sensors drive cable runs up to 200–300 metres with shielded cable (0.34 mm² or larger). For longer runs or noisy environments near VFDs, use shielded cable with the shield grounded at one end. Verify that voltage drop on the Brown (+Vcc) wire does not drop below the sensor's minimum supply voltage for runs over 100 m.

Read the two letters after the sensing distance in the part number: NA is NPN NO and PA is PNP NO. An M12 flush sensor with 4 mm sensing distance and an M12 connector is SGI-GP12S-040NA-Q4 for a sinking (NPN) PLC input or SGI-GP12S-040PA-Q4 for a sourcing (PNP) PLC input. NB and PB are the NC versions; all four run on 10–30 V DC.

A 3-wire sensor has separate supply wires (brown +V, blue 0 V) and a black output, so it is ordered as NPN or PNP to suit the PLC input. A 2-wire sensor is wired in series with the load and draws its supply through it, so its off-state leakage current and on-state voltage drop must suit the PLC input. SEGMENsensor SGI-GP 3-wire models run on 10–30 V DC and DC 2-wire models on 10–60 V DC.

With the PLC input connected and power on, move a steel target into the sensing distance. The sensor LED and the PLC input LED should change state together. With a multimeter, a PNP output measured to blue reads close to the supply voltage when the target is present; an NPN output measured to blue reads close to 0 V when the target is present.

The most common cause is a mismatch between the sensor output and the PLC input common: an NPN sensor needs the common at +24 V and a PNP sensor needs it at 0 V. Check the output code on the label (NA / NB = NPN, PA / PB = PNP), the common wiring and that the black wire lands on the correct input terminal.