# NPN NO Inductive Sensor

**URL:** <https://forum.arduino.cc/t/npn-no-inductive-sensor/641493>\
**Category:** General Electronics\
**Created:** [March 10, 2020, 5:32am UTC](https://forum.arduino.cc/t/npn-no-inductive-sensor/641493 "2020-03-10T05:32:15Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bapstack](https://avatars.discourse-cdn.com/v4/letter/b/dec6dc/32.png) [@Bapstack](https://forum.arduino.cc/u/Bapstack)\
**Post date:** [March 10, 2020, 5:32am UTC](https://forum.arduino.cc/t/npn-no-inductive-sensor/641493/1 "2020-03-10T05:32:15Z")

</div>

Greetings, folks.

What's the easiest way to get this [inductive sensor](https://www.amazon.com/gp/aw/d/B07CWRR1JP/ref=ppx_yo_mob_b_track_package_o0_img?ie=UTF8&psc=1) up and running so that an Arduino pin will read as high or low when it's activated. It accepts 6-36V.

Thanks.

---

<div class="post-metadata">

**Author:** ![MarkT](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@MarkT](https://forum.arduino.cc/u/MarkT)\
**Post date:** [March 10, 2020, 12:05pm UTC](https://forum.arduino.cc/t/npn-no-inductive-sensor/641493/2 "2020-03-10T12:05:34Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Bapstack](https://avatars.discourse-cdn.com/v4/letter/b/dec6dc/32.png) [@Bapstack](https://forum.arduino.cc/u/Bapstack)\
**Post date:** [March 10, 2020, 2:44pm UTC](https://forum.arduino.cc/t/npn-no-inductive-sensor/641493/3 "2020-03-10T14:44:47Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Leroy2007](https://avatars.discourse-cdn.com/v4/letter/l/c4cdca/32.png) [@Leroy2007](https://forum.arduino.cc/u/Leroy2007)\
**Post date:** [March 10, 2020, 3:07pm UTC](https://forum.arduino.cc/t/npn-no-inductive-sensor/641493/4 "2020-03-10T15:07:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Bapstack](https://avatars.discourse-cdn.com/v4/letter/b/dec6dc/32.png) [@Bapstack](https://forum.arduino.cc/u/Bapstack)\
**Post date:** [March 12, 2020, 9:25pm UTC](https://forum.arduino.cc/t/npn-no-inductive-sensor/641493/5 "2020-03-12T21:25:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anon57585045](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@anon57585045](https://forum.arduino.cc/u/anon57585045)\
**Post date:** [March 12, 2020, 9:31pm UTC](https://forum.arduino.cc/t/npn-no-inductive-sensor/641493/6 "2020-03-12T21:31:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![JCA34F](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/jca34f/32/340148_2.png) [@JCA34F](https://forum.arduino.cc/u/JCA34F)\
**Post date:** [March 12, 2020, 11:06pm UTC](https://forum.arduino.cc/t/npn-no-inductive-sensor/641493/7 "2020-03-12T23:06:13Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![MarkT](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@MarkT](https://forum.arduino.cc/u/MarkT)\
**Post date:** [March 13, 2020, 12:54am UTC](https://forum.arduino.cc/t/npn-no-inductive-sensor/641493/8 "2020-03-13T00:54:05Z")

</div>

> 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.

---

<div class="post-metadata">

**Author:** ![Bapstack](https://avatars.discourse-cdn.com/v4/letter/b/dec6dc/32.png) [@Bapstack](https://forum.arduino.cc/u/Bapstack)\
**Post date:** [March 13, 2020, 2:36am UTC](https://forum.arduino.cc/t/npn-no-inductive-sensor/641493/9 "2020-03-13T02:36:06Z")

</div>

> 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

---

<div class="post-metadata">

**Author:** ![JCA34F](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/jca34f/32/340148_2.png) [@JCA34F](https://forum.arduino.cc/u/JCA34F)\
**Post date:** [March 13, 2020, 10:44pm UTC](https://forum.arduino.cc/t/npn-no-inductive-sensor/641493/10 "2020-03-13T22:44:49Z")

</div>

This should work, pinMode input pin to:

```cpp
pinMode(inPin, INPUT_PULLUP);

```

![schemeit-project(1).png](https://europe1.discourse-cdn.com/arduino/original/4X/b/a/2/ba20b3ef5311cb56e730a5a71affc038eb47faf8.png)  
Pin will be LOW when sensor is activated, HIGH otherwise.

![schemeit-project(1).png](https://europe1.discourse-cdn.com/arduino/original/4X/b/a/2/ba20b3ef5311cb56e730a5a71affc038eb47faf8.png)

---

<div class="post-metadata">

**Author:** ![Ron\_Blain](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ron_blain/32/1126393_2.png) [@Ron\_Blain](https://forum.arduino.cc/u/Ron_Blain)\
**Post date:** [March 14, 2020, 12:27am UTC](https://forum.arduino.cc/t/npn-no-inductive-sensor/641493/11 "2020-03-14T00:27:19Z")

</div>

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.

 ![](https://europe1.discourse-cdn.com/arduino/original/4X/f/9/c/f9c519251738b2e5db621e52f2ad5a1c9c2379e0.png)

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.

 ![](https://europe1.discourse-cdn.com/arduino/original/4X/d/e/7/de74b700c09457f086d313d957334e84ea90ba63.jpeg)

Ron

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 6, 2021, 2:30am UTC](https://forum.arduino.cc/t/npn-no-inductive-sensor/641493/12 "2021-05-06T02:30:59Z")

</div>

Closed on May 6, 2021, 2:30am UTC


