NPN NO Inductive Sensor

Greetings, folks.

What's the easiest way to get this inductive sensor up and running so that an Arduino pin will read as high or low when it's activated. It accepts 6-36V.

Thanks.

Its output is open-collector NPN, normally open, so just connect it to an Arduino pin and use INPUT_PULLUP.
It will read HIGH normally (NPN open), and LOW if it detects a metal object. It wants at least 6V supply which
is a little inconvenient.

If you are paranoid about it not being as described (such as PNP output) which could fry the Arduino, add
a 1N4148 diode or similar on its output, cathode to the sensor, anode to the Arduino pin.

Okay, so three wires come off of it. One to 6V, one to common ground, and the other to my Arduino pin. So the pin goes to ground, not 6V, yeah?

If I wanted to use 3 or 4 of these simultaneously, where any one sensor would trigger the same arduino pin, would I just wire them all in parallel, provided my power is big enough?

You can wire them all in paralel but you’d have no way of telling which sensor trips. But if that’s no problem, it’s fine to do so. I’d still wire a diode to the signal wires of the sensors.

So when no metal is present, the third wire goes to 9V (what I'm powering it with). When metal is present, it goes to 0. So having a pin set to input_pullup and then connecting the wire (which is normally at 9V) to that pin is okay..? It feels wrong.

Then it is not open collector and it is wrong. You could use a voltage divider to step the 9V down to 5V.

Connect brown wire to 6V, blue to GND, connect a 1k resistor between black and blue. What is the voltage across the resistor when the sensor is NOT activated? When it IS activated?
Connect the resistor between brown and black. What is the voltage across the resistor when the sensor is NOT activated? When it IS activated?

Bapstack:
So when no metal is present, the third wire goes to 9V (what I'm powering it with). When metal is present, it goes to 0. So having a pin set to input_pullup and then connecting the wire (which is normally at 9V) to that pin is okay..? It feels wrong.

No, if its NPN open collector, its goes nowhere until the 5V pullup on the Arduino pin lifts it above ground, and
that can't lift it higher than 5V, clearly.

NPN open collector is basically like a push-button to ground.

JCA34F:
Connect brown wire to 6V, blue to GND, connect a 1k resistor between black and blue. What is the voltage across the resistor when the sensor is NOT activated? When it IS activated?

0.81V, 0V

JCA34F:
Connect the resistor between brown and black. What is the voltage across the resistor when the sensor is NOT activated? When it IS activated?

0V, 9V

This should work, pinMode input pin to:

pinMode(inPin, INPUT_PULLUP);

schemeit-project(1).png
Pin will be LOW when sensor is activated, HIGH otherwise.

schemeit-project(1).png

Lets try and make sure of a few details with your sensor. I am sorry if the images are large but I wanted to get the pin out details on the second image. The first image is just a block diagram of what your sensor should be. Typical NPN Open Collector.

Look closely at this next image, does your sensor look like this with these symbols? Note the BN, BK and BU and the small symbols beside them. If this is your sensor then the BN (Brown) is Common, the BK (Black) is the sensor power 6 - 36 volts and the BU (Blue) is the open collector output. This should work as originally suggested using an internal pull up on the Arduino or just using an external 10 K pull up resistor between the Blue and 5.0 volts available from the Arduino.

Ron