Using a 12V inductive proximity sensor (IFRM 08P1701/S35L) to read RPM

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)

Have you tried powering the inductive sensor using 5 volts? I’ve only had experience with one of these devices but it was capable of operating from on 6-36 Volts.

I don’t understand “This read the rpm but every few times it wrote to the SD card all I got was hieroglyphics” How do you know you were correctly reading the rpm? If you were correctly reading the rpm, why do you believe that writing hieroglyphics to the SD card is due to the sensor?

Using just the sensor and your oscilloscope, can you observe a sharp square wave from the sensor when measuring the rotating gear wheel? My (again limited) experience has been that positioning of the sensor can be critical.

You were probably looking for answers but all I’ve got are questions.

And for whatever reason, I couldn’t read the data sheet despite trying to download it multiple times. That’s why I don’t know the allowable input voltage range.

Well the voltage supply range for the sensor is 10-30V hence why i chose 12V. I'm not sure why you can't download that datasheet because its just a pdf but here's a link www.clickautomation.com/PDF/items/IFRM06-08.pdf

I'm not fully sure it was reading the correct rpm but as I was moving the wheel at about 1 revolution per second and I got back values of about 60 rpm I assume it was reading correctly when it was working. What I mean by the whole hieroglyphics thing is that it would write to a file the date, time and rpm every second and it would do it OK for a few reading and then give strange symbols instead for a few readings and then go back to giving what I think is the correct values again. Obviously this isn't great for data analysis as I would be missing big chunks of data very few seconds!

Finally got this working! It turned out the positive input should have been the signal wire form the sensor not the positive wire which only connects to the positive 12V terminal.