I am trying to use a 12V inductive proximity sensor (IFRM 08P1701/S35L) to read rpm on a gear wheel using and Arduino Uno and an Adafruit datalogger. It is a 3 lead sensor PNP NO (+ve, gnd, signal) and the ground lead needs to be connected to the signal lead by a resistor according to the datasheet attached.
I am not sure how to get it working due to the 12V.
I have tried a few different ways. One way I tried was to connect a 12V battery to the arduino using a barrel jack and connect the +ve lead of the sensor to Vin, the ground to ground and the signal to digital pin 2 while also connecting it to ground using a 1k resistor.
This read the rpm but every few times it wrote to the SD card all I got was hieroglyphics and I assumed this had to do with the 12v.
I then tried to implement a transistor (2N3904) using a circuit like the one attached. For the ground in cable I attached the signal and ground from the sensor using a 1k resistor again. I also used a 1k resistor for R1 and a 10K for R2. The Arduino input was Digital pin 2 so I could use interrupts.
For this all I got out was 0 rpm so I assume it was not getting any signal.
Are the resistor values wrong? Can I not use this circuit with this sensor or am I doing something obvious that is wrong?
I have tested the code for the arduino using a square wave input from an oscilloscope so I am pretty sure this works.
Any help would be very much appreciated.
Level_shifting_4_arduino.pdf (28.8 KB)
IFRM06-08 Hall effect.pdf (76.8 KB)