Electronic – Wiring proximity sensors to parallel port inputs

npnsensor

I have a couple of proximity sensors that came without documentation. I'm planning to use them as home sensors for a CNC router.

The label says that they're NPN sensors, 6-36 VDC, 200mA. There are three wires, which I understand to be +V (brown), -V (blue) and output (black). My expectation was that, since these are NPN, they would be current current sinking, and that there would be no electrical connection between brown and black. What I found was that if I apply +V to brown, I get +V on black, with a resistance of 10K Ohms. It seems like there's an internal pull-up resistor between +V and output. As expected, if the sensor comes within 2mm of metal, output is connected to -V (with 10 Ohms resistance). Am I interpreting this correctly?

Any recommendations on the simplest safe way to wire these sensors up to a parallel port input? Although the label says 6-36V, they seem to work with as little as 4V, though obviously that's out of spec. I had been expecting to supply my own pull-up resistor between output and +5V.

Best Answer

It sounds like you are correct about the low side NPN and pullup resistor inside the sensor unit. You can make the output any lower voltage you want with the addition of a single resistor:

The resistor inside the sensor (R1) and a resistor you add (R2) form a voltage divider. The output high level will be V+ attenuated by the voltage divider:

\$ V_{OUT} = V_+ \times \dfrac{R2}{R1+R2} \$

In the example shown, the output will be 5V when high. The impedance of the OUT line will be the parallel combination of R1 and R2, which is 5 kΩ in this example.

You could also replace R2 with a 5 V zener if V+ might vary. However, my experience with sensors in general unless they explicitly say otherwise is that they can be surprisingly susceptible to power variations. I would at least filter V+, preferably regulate it.