I am attempting to connect an inductive proximity sensor to my 3D printer. The sensor I'm using is a Zhongde PL-08N2 sensor, which is an NPN output NC (Normally Closed) sensor. As I understand it, this sensor has an open collector output, and I am powering it with 24v. When powered up, the sensor's indicator light is normally on, and turns off when metal is placed near the sensor (which I believe indicates normal, correct operation).
The board I am connecting this sensor to is an SKR 1.3 controller board, which operates at 3.3v (though the digital inputs are 5v tolerant) and has a 10K pullup on the board for all the endstop connectors:
Of course, I cannot allow the 24v from the sensor to be applied to the input pin, so I used a reverse-biased diode as described at the bottom of this page:
This did not, however, work for me. The board shows that the sensor is always triggered, whether or not any metal is near the sensor. I believe that may be because the setup in that link is an NPN output NO (Normally Open) sensor, and my sensor is NC.
When I have used this type of sensor before, I used a resistor divider to set the sensor output to an appropriate level, but in that case, there was no hardware pullup on the control board I used. Given that pullup, I do not know how to calculate an appropriate resistor divider for this sensor.
How can I connect this sensor to get the appropriate (3.3v/5v) logic output?