# How to tell if a proximity sensor is NPN or PNP?

I have a proximity sensor without nameplate. I have done some tests that made me think it is a PNP (normally open).

Is my assumption correct? Is there another method to find out?

Test setup:
Supply sensor brown (24 V), blue (0 V), black is output. Voltmeter is connected with red always on output. The black voltmeter wire is used to test blue and brown.

Note: By "triggered" I mean an object is brought near the sensor and its LED is ON.

Results:

1. Without any load resistor:
• Not triggered: V(black-brown) = -1.5 V; V(black-blue) = 0.04 V
• Triggered: V(black-brown) = -0.7 V; V(black-blue) = 23.4 V
1. Assume PNP: I added a 10k resistor between output and GND
• Not triggered: V(black-brown) = -24 V; V(black-blue) = 0 V
• Triggered: V(black-brown) = -0.6 V; V(black-blue) = 23.4 V
1. Assume NPN: I added a 10 kΩ resistor between output and Vcc
• Not triggered: V(black-brown) = 0.04 V; V(black-blue) = 23.6 V
• Triggered: V(black-brown) = -0.8 V; V(black-blue) = 23.3 V
• That looks like an open-collector/open-drain device of either pnp or p-channel construction, yes. Whether it's a BJT or FET, or even a relay, doesn't ultimately matter though. Commented Jan 16, 2021 at 17:12
• normally open or normally closed ? Commented Jan 16, 2021 at 17:18
• Edit : I have read more about the subject and i seems since the LED is On when an object is in proximity then it is NO . Commented Jan 16, 2021 at 17:26
• Stranger color choice. Did you considered black -24V, brown +24V, blue output? Why 24V, not 12? Commented Jan 16, 2021 at 17:44
• @user263983: The industrial sensor standard for many years has been 24 V DC (nominal - often 12 - 30 V) with brown = +24 V; blue = 0 V; black = output 1; white = output 2 (if required). See How do I wire my industrial sensors?. Commented Jan 16, 2021 at 17:59

If the sensor output is indeed an open collector or drain, and you wish to find out if it's a high-side PNP (or P-channel FET) or a low-side NPN (N-channel FET), then a simple way to discover which, is to connect a resistor potential divider as follows:

simulate this circuit – Schematic created using CircuitLab

A high-side PNP transistor will successfully raise the output very close to +24V when "on" but when the transistor is off the output will remain at the half-way point of +12V. You would see output potentials close to +24V and +12V, depending on the sensor state.

Conversely, if the output device is NPN, it will be able to pull the output potential down very close to zero when "on", but otherwise the output will settle at around +12V. You could expect outputs of about 0V and +12V.

If there is an internal pull-up (or pull-down) resistor already installed inside the sensor, then the 12V midpoint will be offset somewhat, but the big giveaway is how close a "high" output is to the positive supply potential, and how close a low output gets to ground.

Here's how.

Generally, proximity sensors have 'NPN' or 'PNP' open collector outputs.

The sensor in question has 'PNP' output.

I came across a similar question a while back, and created a solution for it.

See here:

Circuit to detect in which port sensor inserted

tl; dr: Tie the output (black wire) to a midpoint voltage divider. A not-triggered sensor output will be at half voltage. Now close the optical path (trigger the sensor):

• If the sensor pulls it up, it's PNP
• If it pulls it down, it's NPN

Here’s the 'universal' circuit that I mentioned:

The linked solution uses a set of comparators to check for each case (PNP, pull high; NPN, pull low) to support either sensor type.

Notice the voltage divider on the sensor output. Instead of comparators, you can use a voltmeter to check for the pull-high or pull-low behavior. Once you've figured it out then choose the resistor connection as appropriate (pull up for NPN, pull down for PNP.)

Optical proximity sensors like this use a phototransistor + LED. When the phototransistor sees the LED light, it 'closes' (turns on).

Whether it's 'normally open' or 'normally closed' depends on the sensor.

• A reflective sensor turns on when the object reflects the beam
• A transmissive sensor turns off when the object blocks the beam

Your description is for a reflective sensor, apparently a PNP one.

It is a PNP. A 10K ohm resistor is almost like an open for most of these current levels meaning that using your voltmeter to check vs using a 10kohm resistor plus a voltmeter might as well be the same.

• That resistor is essential for an open-collector or open-drain output, though. You need to have that to pull the output low when the transistor is off. Commented Jan 16, 2021 at 17:44
• I mean that if you were to put a 10kohm resistor across a 1.5V AA battery it would still read 1.5V across the resistor because of how low the current through it is. 1.5V/10k ohm = 150 micro amps. This is probably similar to the amount of current getting pulled through the voltmeter at 24V. Commented Jan 16, 2021 at 18:12
• You could put your voltmeter in current mode and check then(make sure to swap the leads). In current mode your voltmeter will act as though the leads are close to 0 ohms. Then any difference between BJT or MOSFET internals are eliminated. Or use a smaller resistor, something like 100 ohms. Commented Jan 16, 2021 at 18:22
• "A 10K ohm resistor is almost like an open" . that is not right at all . and the measurements vary with and without resistor . Second thing please donot give wrong advice if you donot know what you are saying , putting 100 ohm ressitor as you said causes the sensor to burn . because the current passing through the Pnp transistor is 24/100= 0.24A , which is more than 10x the current rating of such sensors . Commented Jan 18, 2021 at 10:57
• Was I right, or was I right? It not what was it? Commented Jan 29, 2021 at 5:42