Hi,
I'm trying to connect PNP inductive sensor pepperl+fuchs NJ5-18GM50-E2-V1 to 5V microcontroller for reading its state. I made following connection to protect the input as the sensor will be supplied with +24VDC and micro 5VDC. However I'm seeing 2,5V in the UC input when sensor is not sensing and not 0,5V of the Vf of diode. If I connect the +24 directly to pin 4 removing the sensor it works as I was expecting. Eg. no supply, uC input 0,5V and 24V supply uC input 5V. I don't understand why it wont work with the sensor. Could someone explain what's wrong?
I could also use voltage divider for the input but I'd see this is safer.
Thank you in advance.