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