Hi there,
I want to use two npn nc inductive sensors in an arduino project. They get 12v power, which i dont want on the arduino. How should i wire this? I have been hitting google hard, but no conclusive solution. I saw resistors, optocouplers, etc. Whats the best way to do this?
Thanks
Willem
What does the documentation for your sensors show? We can't see it from here.
Don't be surprised if it does not work well at 5V.
Basically you are asking how to connect this widget to that thing. Post a link to technical information on the sensor, without that we can only guess. If we are wrong something will get damaged. I would assume that it is an open collector output needing a pull up resistor but if not it would probably fry the input port on the Arduino (which one are you using?).
The output of an NPN sensor is basically an NPN transistor switch to sensor ground.
Measure output voltage of the sensor with a voltmeter with sensor power connected to 12volt.
You should measure nothing on the sensor output (both activated or not).
If so, then you can safely connect it to an Arduino pin.
Because an NPN sensor output is only a switch to ground, YOU have to provide pull up.
If the sensor is near the Arduino, then internal pull up on the pin could be enough.
pinMode(sensorPin, INPUT_PULLUP);
Leo..
Npn nc 5-36v is all i know.
Thats why i give them 12v. 5 is the minimum, i dont like to use minimal values.
What does “ if the sensor is near the arduino” mean? Is there a max distance or cable length i can use?
With longer wires (noise pickup) you can (should also) add external pull up.
Which could mean a 1k resistor between Arduino pin and MCU supply (5volt?).
For electrically noisy environments (false triggering) you could also add a 100n ceramic cap between pin and ground.
Leo..
The NPN output can accept voltages less than 5V. Power the sensor with 12V, and connect all the GNDs. The NPN output goes to an Arduino input pin, with a pullup resistor to Arduino Vcc.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.