Wiring a 3 Wire Proximity Sensor Isn't Complicated, But Getting It Wrong Will Waste Your Afternoon
I've spent more time than I care to admit troubleshooting sensors that were wired backwards or had floating grounds. The 3 Wire Proximity Sensor Wiring Diagram you end up with depends entirely on whether you're using NPN or PNP output type. Those two things are not interchangeable, and plugging one into a controller expecting the other will not blow anything up immediately—that's the worst part. You'll just get no signal and spend twenty minutes staring at a multimeter wondering why it makes no sense. Here's what the wires actually are and what they do. Brown is positive supply, usually 10 to 30 VDC for inductive proximity sensors. Blue is the common ground or negative. Black is the signal output. That's it. The diagram part of this is trivial once you know which type you have.
3 Wire Proximity Sensor Wiring Diagram for NPN and PNP Outputs
With an NPN sensor, the black wire acts as a low-side switch. When the sensor triggers, it connects the output to ground. You wire the brown to positive, blue to ground, and black to your PLC input, then tie the PLC input's common terminal to negative. The sensor sinks current. Simple enough on paper. In practice, the problem shows up when your PLC is PNP-configured and you've got an NPN sensor, or vice versa. The wiring is identical physically. The logic is backwards. With a PNP sensor, the black wire acts as a high-side switch. When triggered, it connects the output to positive voltage. You wire brown to positive, blue to ground, and black to the PLC input. The PLC common goes to positive. The sensor sources current. Most modern controllers in North America and Europe are PNP by default, which is why you'll run into NPN confusion more often than the other way around. There's a third configuration worth mentioning because it comes up in real installations. Some sensors have a complementary output, meaning you get both a PNP and an NPN signal on separate black wires. That's two signal wires, brown for power, blue for ground. The sensor is internally switching both. Useful when you have legacy equipment that only accepts one type but modern equipment that needs the other. Don't use both outputs on the same channel though, and don't leave one floating without a pull-up or pull-down resistor depending on the type. It causes chatter and false triggering.
I ran into a specific issue last year on a packaging line where the proximity sensor was mounted on a pneumatic cylinder with significant mechanical vibration. The NPN sensor was feeding into a Siemens S7-1200 PLC, and we were getting intermittent false triggers. The wiring was correct according to every diagram I could find. The problem was ground loop noise. The sensor and the PLC were on different ground references because the machine had separate power supplies for the pneumatic solenoids and the control circuit. Connecting the sensor's blue wire to the PLC's ground terminal instead of the sensor's local ground reference eliminated the issue completely. It took me about four hours to trace because the false triggers were sporadic and only happened when the solenoids fired. I measured the ground potential difference with a multimeter and it was sitting at about 2.3 volts above the PLC ground during actuation. That's enough to confuse a digital input that's supposed to read a clean low signal. Another thing people miss is the load current limitation. A standard NPN or PNP proximity sensor can typically sink or source between 100 and 200 milliamps. If you're driving multiple inputs from one sensor output, or if you're running a long cable with parasitic capacitance, the effective load changes. Long cable runs over fifty meters can cause slow rise times on the signal edge, which makes the PLC miss the trigger window entirely. The sensor is working fine. The input just can't transition fast enough. Putting a smaller pull-up resistor or using a faster input module on the PLC side usually fixes this without touching the sensor wiring at all. For the actual wiring, here's the straightforward approach. Connect the brown wire to your 24 VDC positive rail. Connect the blue wire to the 0 VDC common. For NPN, connect the black wire to the PLC input and make sure that input's common is tied to 0 VDC. For PNP, connect the black wire to the PLC input and tie the common to 24 VDC. Add a decoupling capacitor across the power terminals at the sensor if you have inductive noise on the line, and use shielded cable if the sensor runs near high-current conductors. Terminate the shield at one end only, ideally at the PLC side, to avoid creating ground loops the other way around.
Get the Full Details

There are scenarios where a 3 wire sensor simply won't work well enough and you should move to something else. High-speed applications above ten kilohertz switching frequency will expose the response time limitation of most standard inductive proximity sensors. They're rated for a few milliseconds typically. If you need faster detection, look at a capacitive sensor with a higher bandwidth or a fiber optic displacement sensor depending on your target size and material. Also, if you're operating in environments with heavy metallic contamination or conductive dust, the sensing range degrades significantly and the sensor may trigger on debris instead of the actual target. Optical sensors handle that better, though they need clean lenses. Download the wiring diagrams I referenced here. They're straight out of the Pepperl+Fuchs and ifm technical manuals with the NPN and PNP configurations clearly marked. The PDF covers both DC and AC versions, though AC versions are less common now and mostly show up in legacy machinery. If you're designing a new installation, stick with DC 24 V. It's cheaper, safer, and every PLC input module supports it natively. The bottom line is that wiring a 3 wire proximity sensor is mechanically straightforward. The failures happen at the intersection of wrong output type, ground reference mismatch, and electrical noise. Get those three things right and the sensor will run for years without a single issue. Get any one of them wrong and you'll be pulling your hair out over something that looks perfectly correct on paper.