Questions using Inductive Proximity Sensors

Hi
I am using the Arduino Uno, and I want to detect a metal object at a very short distance (1/16" or even less).

My first questions are,
Is it better to use a NPN or PNP sensor? (I have seen both mentioned)
Second, would I be reading the input from the sensor as digital or analog?

FYI, the sensor that I am planning on using is
LJ12A3-4-Z/BX Inductive Proximity Sensor Switch NPN DC6-36V

I know that the voltage is 6-36VDC, but from what I have read, it should give a workable "detection" voltage even at 5VDC?
Also, I do have 12VDC available (if this would give me a more reliable reading)? Not 100% sure how to wire that and keep my Arduino safe? I think with a zener diode? Also I think I need to have a resistor at the base of the sensor?

Sorry for all the questions, still very new :smiley:

Thanks
Mark

How about using a contact sensor ( limit switch ) set to transfer at ~1/16"

Hi Larry
I have very limited space, it is all I can do to fit a 12mm Prox. in there.
Also, I will be running 6 of these at once.
Thanks for the reply!
Mark

Use a NPN at 12 volts. Connect 10k R to 5v and read digital input.

The NPN will switch to gnd and there is no risk to your Arduino.

12 volts on the sensor is well within working range.

Weedpharma

Great news.
Just to make sure I understand,

The NPN Prox. Sensors has 3 wires,
the (+) ties to my 12VDC+
the (-) ties to ground (both of the power supply and to ground on the Arduino)
the signal wire goes to Arduino digital pin as input, and also to + 5VDC on the Arduino through a 10K resistor (that's the part I am unsure of)?

Also I will be running 6 Prox. Sensors, supplying them with a +12VDC 25A.
I assume I am ok there?
I am also powering the Arduino with +5VDC through the Vin pin.

Thanks so much for your input!
Mark

IMMarkmc:
......
the signal wire goes to Arduino digital pin as input, and also to + 5VDC on the Arduino through a 10K resistor (that's the part I am unsure of)?

Also I will be running 6 Prox. Sensors, supplying them with a +12VDC 25A.

I assume I am ok there?
I am also powering the Arduino with +5VDC through the Vin pin.

Thanks so much for your input!
Mark

Yes, there is a 10k R from 5v to the Digital input to tie it to a high. The output of your sensor when active takes it to a low.

"Supplying them with +12vVDC 25A". You are not supplying them with 25A, you have a supply capable of upto 25A if required.

"Powering them with a +12vVDC 25A power supply" would be correct.

Weedpharma

weedpharma:
Use a NPN at 12 volts. Connect 10k R to 5v and read digital input.

The NPN will switch to gnd and there is no risk to your Arduino.

12 volts on the sensor is well within working range.

Weedpharma

Seconded - I've used this in a CNC machine and its pretty robust, but I added
some 10nF capacitors at the Arduino inputs to filter out noise from other sources
IIRC.

These sensors are pretty cheap on eBay and are much more reliable than
mechanical switches in the face of dust / dirt / liquids. They are very bulky though,
I'd love to find some cheap miniature ones.

Thanks again for all of the help!
I will keep the cap. in mind if I have any noise issues (but I don't think I will in this application).

One last thing I want to be clear on, since I will be using 6 Prox. sensors..will I have six 10K resistors (like in the attached pic, I just put 2 in for the example) or will there just be one going to the 5VDC for all 6 Prox?

Thanks again for the assistance!
Mark

Each input requires its own 10k resistor.

Weedpharma

Thanks Weedpharma !!
I think/hope I am all set. The sensors should be here mid week, can't wait.
Thanks again.
Mark

Is there any reason not to just use the internal pull up resistors in this case?
Mark

Hello, i just wanna ask the arduino code for using this metal proximity sensor
Because i was search in any website always use analog in pin, not digital print
Please kindly help me
*sorry for rip english

IMMarkmc:
I am also powering the Arduino with +5VDC through the Vin pin.

If you are applying 5V from a supply, you feed it to the 5V pin of the UNO.
5V through Vin will apply 5V to the input of the on board 5V regulator and it will output , much less than 5V.
Can you please post a copy of your complete circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Include your 5V and 12V power supplies and label your pinouts please?
Please do not use the Fritzy pictures.
Thanks.. Tom.. :slight_smile:

IMMarkmc:
Is there any reason not to just use the internal pull up resistors in this case?
Mark

Yes, because they are very weak at 30k or more, probably will not be reliable for a signal coming
from off-board.
A low value pull-up like 1k is wise to use for an electrically noisy environment. 10nF as mentioned
above will also help a lot in rejecting noise and allows higher value pull-up to be used for the
same noise-rejecting ability.