Detecting 10-30vdc sensor input with Arduino?

I wanting to a sensor change of state with my Arduino. Typically I use 10-30vdc proximity sensors in my line of work, as the stand up to a lot of abuse out on the shop floor. These sensors are the 3 wire current sinking NPN type and are used to power a small load (<100ma) such as a reed relay. Rather than pull in a relay and read the contacts closing, I'd much prefer just to read the change of state, if this is possible. The other day, I hooked the blue (0v) and black (load) leads up to my DMM with it set of DC volts and was able to either a reading of .6 volts or sort of a floating read that didn't make a lot of sense. I will be using an external power source for the sensor.

Link to sensor wiring .pdf:

http://info.bannersalesforce.com/xpedio/groups/public/documents/literature/31100_24.pdf

Any thoughts on this?

Thanks,
Cris

Try hooking up the brown lead to 12V and re-do your DMM test. Does it still float or does it read 12V? What about if the sensor triggers, does it read near 0V?

If so you can hook it up to your Arduino pretty easily. Something like this is a good start:

You may have to enable the pull-up resistor on the digital input to get a high reading.

--
The Quick Shield: breakout all 28 pins to quick-connect terminals

Sounds like they are open-collector outputs - if definitely so then you can wire them direct and enable the pullups - but the protection circuit above is a good idea if not sure (it would protect against wiring faults with the sensor too...

RuggedCircuits and MarkT,

Thank you both for answering. Here is what I did today: This time using an analog VOM I hooked up my fiber optic sensor unit like this, battery +12v to brown sensor lead, black sensor lead (load) to VOM "+" input, blue sensor lead to both VOM "-" input and battery "-". With this set up, the meter indicates 0 volts when sensor is not triggered, and 6.2 volts with sensor triggered. So, I'm guessing I can read in an analog input of some sort to see the voltage rise. RuggedCircuits, will your proposed diagram accomplish this, I'm noting the digital input?

Cris

Yes, I believe the proposed diagram will do it. The 6.2V is kind of strange but nothing to be concerned about I don't think.

--
The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, speaker, microphone, light sensor, potentiometer, pushbuttons

How about a simple voltage divider? You could use either ADC or set up the divider so it pulls it down to arduino logic levels (anywhere from 3 to 5 volts max should be fine).

RuggedCircuits,
The 6.2 vdc is exactly 1/2 the voltage of the battery I was using to power the sensor.

wyager,
I could build a simple resistive divider using a couple of 100 ohm resistors and get voltage down as you suggested.

Thanks all,
Cris

Hey chris,
that might pull to much current. I would recommend 1K or even 10k resistors instead.