A standard NPN sensor wiring diagram uses three wires: brown for +V (typically 12โ24 V[1]ย DC), blue for 0 V (ground), and black for the switched output. The sensor operates as a sinking device, connecting the load to 0 V when activatedโso the load wires between +V and the black output, never black directly to +V. Reversing brown and blue can destroy an unprotected sensor in seconds, and NPN sensors require a PLC input card set to “sourcing,” with the input common tied to +24 V DC.
How does NPN “sinking” differ from PNP “sourcing”? Which PLC input card do you need? How do you wire it to a relay or PLC without a short? And what mistakes burn out the sensor?
Quick Takeaways
- Brown wire is +V (12โ24 V DC), blue is 0 V, black is output.
- NPN sensors sink current, switching the load to ground, not +V.
- Set your PLC input card to “sourcing” with common tied to +24 V.
- Wire the load between +V and black outputโnever black to +V.
- Reversing brown and blue can destroy an unprotected sensor in seconds.
What’s an NPN proximity sensor and how does its output actually switch?
An NPN proximity sensor spots a target and then pulls its signal wire down to 0 V, which is ground, instead of pushing any voltage out. Control references group NPN 3-wire sensors asย “sinking” devices, meaning they give you a negative switching path to work with. Once you get this single fact right, every wiring choice below basically falls into place on its own.
Inside the sensor there is a transistor set up in what people call an open-collector arrangement. “Open-collector” essentially means the transistor’s output leg connects to nothing by itself, so it just floats there. When a target shows up, the transistor switches on and links the black output wire straight over to the blue 0 V wire.
Why is an NPN output called “active-low”?
The output drops LOW, meaning near 0 V, when the sensor is active, and that is where the phrase “active-low” actually comes from. With no target sitting in front of it, the black wire stays open and reads close to the supply voltage. Detect a target, though, and it falls to ground. This is why an NPN sensor doesn’t really “output a signal” so much as it removes the block to ground.
That behavior tells you where the load has to go. In any NPN sensor wiring diagram, the load, which might be a PLC input, a relay coil, or a lamp, sits between the positive rail, usually +12,24 V DC, and the black wire. The sensor doesn’t feed the load. Instead, it completes the path to 0 V so current can flow through the load. Treating the black wire as if it were a supply output rather than a ground path is what causes most of the miswiring on a first attempt.
How do you tell NPN from PNP before wiring anything?
Grab a multimeter before you trust any label. An NPN sensor’s black output floats near supply voltage when idle, then drops to 0 V once triggered. A PNP output does the opposite: it floats low, then jumps to your supply voltage (+12,24 V DC) when active. This 30-second test confirms polarity and saves you from a shorted supply.
What meter readings prove the wire colors?
Power the sensor first: brown to +24 V, blue to 0 V. Set your multimeter to DC volts. Measure between the black output wire and blue (0 V[3]).
- Idle, no target:ย Black reads near supply voltage or floats (high impedance) โ the internal transistor is off.
- Target present:ย Black drops to roughly 0.2โ0.7 V. That pull-down to ground confirms aย sinking (NPN)ย output. A PNP part would instead rise to about +24 V.
The mnemonic used inย industry guidance on NPN vs PNP sensorsย makes it stick: NPN switches the negative side; PNP switches the positive side. If your reading swings toward 0 V, you’ve an NPN part and can follow a standard NPN sensor wiring diagram.
Can you check it with resistance instead?
Yes, if you can’t power the sensor. Switch to the ohms range. Probe between black and blue, then black and brown. On an NPN device, the black-to-blue path shows a diode-like drop in one probe direction. Trust the powered voltage test over resistance, the live reading removes any doubt from an ambiguous datasheet.

Which wire is which on a 3-wire NPN sensor?
On a standard 3-wire NPN sensor, the brown wire is +V, meaning the positive power supply. The blue wire is 0 V, which is the ground connection. The black wire is the switched signal output that does the actual work. Get all three connected to the right places and the sensor runs fine, but swap any two and you can destroy it in under a second.
The brown wire carries power into the sensor. Most 3-wire NPN units accept a 6 to 36 V DC range, and 24 V DC is the usual industrial standard. You want to match the brown wire’s voltage to your external power supply exactly. If you feed 36 V into a part that is only rated for 24 V, you essentially burn out the internal transistor inside it.
Why does the load connect between V+ and the black wire?
The load, which is basically whatever device you want the sensor to control, connects between +V and the black wire because an NPN sensor only switches the negative side of the circuit. When the target the sensor is watching for shows up, the internal transistor links the black wire to 0 V[4]. That completes the circuit and pulls current through the load. Wire the load this way and it sees the full supply voltage the moment the sensor turns on.
- Brown โ +V:ย connects to the positive rail, which runs 6โ36 V DC and is typically 24 V
- Blue โ 0V:ย connects to the ground of the power supply
- Black โ output:ย feeds the load, and the load’s other terminal goes to +V
Here is the mistake that ruins the part. If you swap brown and blue, you tie +V straight to ground right through the sensor. That creates a dead short, which draws unlimited current and instantly kills the device. Any correctย NPN sensor wiring diagramย puts brown on the positive side and blue on 0 V, and never the other way around. It really pays to double-check the connections with a meter before you apply power.
How do you wire an NPN sensor to a PLC sinking vs sourcing input?
An NPN sensor needs aย sourcingย PLC input card, one where the input common (COM) ties to +24 V DC. Because an NPN output pulls its terminal down to 0 V when it becomes active,ย automation referencesย classify NPN as a sinking device that has to pair with a sourcing input. And if you wire it to a sinking card instead, the PLC simply never sees the signal at all.
Why does a sinking input (COM at 0V) never trigger the PLC?
A sinking input card ties its COM to 0 V and expects the sensor to push +24 V into each input terminal. An NPN sensor can’t do that, though, because it only pulls the terminal down to 0 V. So both the input terminal and COM end up sitting at 0 V[5]ย together. When there is no voltage difference, there is no current flowing, and the input stays off no matter how many times the target passes in front of the sensor.
What’s the terminal-by-terminal connection for a sourcing input?
This is the correct NPN sensor wiring diagram for a PLC:
- Brown wire:ย goes to the +24 V DC power rail (the sensor supply)
- Blue wire:ย goes to 0 V (the power supply ground)
- Black output wire:ย goes to a single PLC input terminal (for example, I0.0)
- PLC input COM:ย tied to +24 V DC
Here is the current path that happens when the target arrives: +24 V leaves the COM, flows through the input’s internal circuit, exits the input terminal, travels through the sensor’s black wire, and then the transistor sinks it down to 0 V. That completed loop is what switches the input on.

How do you wire an NPN sensor to a relay with a flyback diode?
Wire the relay coil between +V and the sensor’s black output: the brown wire feeds +12,24 V to the coil’s high side, and the black wire sinks the coil’s low side to 0 V when the sensor triggers. Add a flyback diode across the coil. This is the standard sinkingย NPN sensor wiring diagramย where the load sits between the positive rail and the switched output.
โ ๏ธย Common mistake:ย Wiring the black output wire directly to +24 V, expecting the sensor to “push” voltage to the load. This happens because NPN sensors sink currentโthey switch the load to ground (0 V), not to +V. Connecting black to +V shorts the output transistor and can destroy the sensor in seconds. The fix: wire the load between +V and the black output.
Where does the flyback diode go, and which way does it face?
Place the diode directly across the two coil terminals, wired in reverse, cathode (the striped band) to the +V side, anode to the black-wire side. It stays off during normal operation and only conducts when the coil turns off.
Use a diode rated above the coil voltage. Aย 1N4001ย handles 50 V[6]ย and 1 A, fine for a 24 V relay coil. For faster switching, a fast-recovery type like theย 1N4148ย works on small signal relays.
What happens without a flyback diode?
When the coil de-energizes, its collapsing magnetic field produces a voltage spike that can exceed 300 V on a 24 V coil, many times the supply. That spike hits the sensor’s output transistor, whose rating often tops out near 30,36 V (seeย flyback diode principles). Without the diode clamping it, the transistor punches through and fails, often after just a few hundred switching cycles.
How do you connect an NPN sensor to an Arduino or microcontroller safely?
Add a pull-up resistor between the sensor’s black output wire and the MCU’s logic voltage, then read the pin as inverted: LOW means triggered. An NPN sensor uses an open-collector output that only pulls to 0 V when active. Without a pull-up, the pin floats and reads random noise.
Here is why. When idle, an NPN output is open (disconnected), just like theย open-collectorย behavior described in electronics references. A floating GPIO pin drifts and gives false readings. A pull-up resistor between the black wire and 3.3 V or 5 V holds the pin HIGH until the sensor fires.
Pick 4.7 kฮฉ to 10 kฮฉ. On 5 V with a 4.7 kฮฉ resistor, idle current stays near 1 mA (5 V รท 4700 ฮฉ). That’s plenty stiff against noise but light on the sensor’s transistor. Use Arduino’s built-inย INPUT_PULLUPย mode to skip an external part entirely.
The logic reads inverted:
- No target: transistor open, pull-up wins, pin = HIGH.
- Target detected: transistor pulls to 0 V, pin = LOW.
Voltage is the real danger. Most NPN sensors run on 12,24 V[7]ย DC, but a 5 V Arduino pin dies above 5.5 V. Never tie the black wire straight to a GPIO. When the sensor supply is 24 V, the open-collector output can float up toward 24 V through your pull-up.
Fix it two ways. Pull up to the MCU voltage (3.3 V or 5 V), not to 24 V, then the pin never exceeds logic level.
Or use a voltage divider: a 10 kฮฉ/2.2 kฮฉ pair drops 24 V to about 4.3 V. For clean isolation, add an optocoupler so the 24 Vย side and MCU share no ground.
This mirrors the sinking scheme shown in any correct NPN sensor wiring diagram.
Which wiring mistake matches each target device?
Each target device fails in its own signature way. Reversed COM on a PLC leaves inputs permanently OFF; a missing flyback diode on a relay kills the sensor’s output transistor within weeks; feeding 24 V into a 5 V microcontroller pin fries it instantly; and swapped brown/blue leads mean the sensor never powers up. Diagnose by the symptom, not the wire.
The PLC error is the sneakiest. Because NPN sensors areย classified as sinking devicesย that need a sourcing input module, a COM tied to 0 V instead of +24 V produces zero response even though the sensor’s LED lights fine. That mismatch fools many technicians into replacing a healthy sensor.
| Target device | Miswiring fault | Symptom you observe |
|---|---|---|
| PLC input | COM tied to 0V (sinking card) | Sensor LED lights, PLC input stays OFF |
| Relay coil | No flyback diode across coil | Erratic switching, sensor dies in weeks |
| Microcontroller | 24V black wire into 5V pin | GPIO pin dead, magic smoke |
| Any load | Brown/blue swapped | No power, sensor never activates |
The relay case deserves respect: a collapsing coil field can spike above 300 V, exceeding the output transistor’s 30 V rating many times over. Read the pin voltage before touching an MCU, the black output should measure 0 Vย when active, never the full 24 V rail. That single check on your NPN sensor wiring diagram prevents the most expensive mistake here.
How do you troubleshoot an NPN sensor that isn’t switching?
Grab a multimeter and keep the circuit powered. First confirm 24 V DC between brown and blue. Then probe the black output wire: it should sit near V+ when untriggered and drop close to 0 V when a target is present. If black never moves, the sensor, the load, or the input wiring is at fault.
What voltage should the black wire show?
On a properly wired NPN sensor with a working load, the black wire reads roughly V+ minus the load drop when idle, then falls to under 1 V when triggered. If black stays pinned at V+ even with a target present, the transistor never switched. If it sits at 0 V permanently, the output is shorted or the target is stuck in range. Remember the load lives between +V and black, per any standardย NPN sensor wiring diagram, measuring black with no load connected can give a false floating reading.
Which fault matches which symptom?
| Symptom | Likely cause |
|---|---|
| No 24V brown-to-blue | Blown supply fuse or reversed power leads |
| Black stuck at V+, target present | Dead sensor transistor or wrong sense range |
| Black stuck at 0V always | Shorted output or target permanently detected |
| Sensor LED on but PLC ignores it | Sinking sensor on a sinking input card |
The last row is the sneakiest. NPN sensors are sinking devices and require a sourcing input, tying the input common to +24 V DC perย control automation references. Miswire that common and the LED still lights while the PLC reads nothing.
Frequently asked questions about NPN sensor wiring
Quick answers to the questions that trip up most builders when they read an NPN sensor wiring diagram. Each one comes from a real failure mode, not theory. The supply voltage range printed on the sensor body (usually 10,30 V DC) is your first safety check perย automation control references.
Can an NPN sensor drive a PNP input directly?
No. An NPN output pulls its wire down to 0 V[10], but a PNP input expects a positive signal. Connect them directly and the input never triggers. You need a relay or a small pull-up circuit to flip the logic.
Do you need an external resistor for a PLC?
Usually not. Most PLC input cards have a built-in bias resistor, so the black output ties straight to the terminal. You only add a pull-up when feeding raw logic chips like an Arduino pin.
What voltage kills the sensor?
Feeding brown above the rated 30 V DC ceiling cooks the internal transistor. Even 36 V for a moment can punch through. Match your supply to the printed range before powering up.
Can two NPN sensors share one input?
Wire them in parallel to the same input and either one triggers it (OR logic). Both black wires go to the same terminal. But you lose the ability to tell which sensor fired.
How do 4-wire NPN sensors differ from 3-wire?
A 4-wire adds a second output: one normally-open, one normally-closed. Same brown and blue supply, two black-family signal wires instead of one.
Wiring an NPN sensor correctly the first time
Wire an NPN sensor right by remembering one rule: an NPN output sinks current to 0 V, so it must feed a sourcing input that expects a pull to ground. Control references classifyย NPN 3-wire sensors as sinking devicesย that need sourcing input modules. Break that pairing and the sensor either never triggers or shorts the supply.
Run through this checklist before you power the load:
- Confirm polarity:ย Meter the sensor first. Black floats when idle and drops to 0 V when a target is present. Brown is +V, blue is 0 V.
- Protect the output:ย Add a flyback diode across any relay coil, and a pull-up resistor when feeding a 3.3 V or 5 V microcontroller. NPN outputs stall around 100โ200 mA, so keep the load under that.
- Match the COM:ย Tie the PLC input common to +24 V DC for an NPN sensor. Mixing NPN and PNP on the same common can short the power supply.
The single biggest safeguard costs nothing: verify continuity with a multimeterย beforeย applying the load. Power the sensor, trigger it with a metal target, and check that the black wire actually pulls to 0 V. If it does, the wiring is sound. If it floats, you’ve a polarity or supply fault to fix first.
Print the pinout and keep it taped at the bench. A quick glance at your NPN sensor wiring diagram beats guessing every time you swap a device. Get the sink-to-ground rule right, and the rest of the circuit follows.
See also
NPN vs PNP sensor outputs explained for PLC wiring
PNP sensor wiring diagram with simple step by step guide
How does a proximity sensor work and where is it used
Normally open vs normally closed sensor basics and use cases

