I've been working on this problem all night, and I'm not getting anywhere...
I have a NJK-5002A PNP NO hall effect proximity switch... I haven't been able to find a datasheet, THIS is the best I've found.
The problem I'm having is that when it's connected to 12V (brown lead to +12V, Black lead to GND), the blue lead will read a maximum of 900mV open, and 0v closed. I'm looking to use it on the interrupt pin of my arduino, so I need it to be between 3.3V and 5V.
I feel like this might be a job for a pull up resistor, but I haven't been able to figure it out. I also thought a transistor might help... but truth is I don't really know what I'm doing - I'm having a go.
Any suggestions on how I can get this to work? I've exhausted my search avenues, so I've come here for help.
Thanks in advance.
The problem I'm having is that when it's connected to 12V (brown lead to +12V, Black lead to GND), the blue lead will read ...
According to this, which admittedly is not aimed at your actual model but they do use the word "typically", the blue is the -ve power and black is the output.
I would try a 1K pull up to 5V.
It's a PNP version so I would add a pull down to GND
lead will read a maximum of 900mV open, and 0v closed.
That is not suggesting a pull down at all, that suggests a pull up is needed.
True, but that's with it connected the wrong way. According to this Make article and other proximity sensors black is the output, blue GND and brown Vcc.
Thanks guys, Looks like you're right about the leads being wrong. Now the black pulls 0-12V, so I guess I need to pull down. I tried a 1K resistor (between the black lead and the GND), but it dropped to ~1.2V, I tried a few other values (2x1K parallel, 100R, 100K) but I couldn't get the sweet spot between 3.3 and 5V. Has anyone encountered an article which explains how to calculate the value of the resistor? I had a look last night, but I couldn't figure it out...
Also, I found a diagram a while back that used a proximity sensor like this, it appeared to have a combination of resistors between the GND rail and the black lead, as well as resistors between the +12V and the black lead... What's going on here?
Thanks again for your help.
If you connect it to 12V the output while on is 12V. Use a resistor divider to drop it to 5V. 100R is wayyyy to low. Don’t really know the max current but 120mA through the sensor is probably way out of spec and might damage it. But then again, so is connecting it the wrong way…
Divider of 100k and 18k or 22k will do fine