Go Down

Topic: Using a 12V inductive proximity sensor (IFRM 08P1701/S35L) to read RPM (Read 1 time) previous topic - next topic

allelectricev

Hi Everyone,
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.

Magician

Do you have a voltmeter, to check voltage on loading resistor 1K?
I think, value of resistor may be too high, so voltage stay above 0.7V all the time when you using transistor. Options: decrease resistor (take care of power dissipation) or insert zener diode in series with base of the transistor, 3 - 8 V anything in between

allelectricev

I have checked on the oscilloscope and it looks like the side of the resistor connected to the transistor is always at 0.7V whether it is detecting or not.
I don't have a diode so I will try a different resistor. Would 100 be OK? I am pretty new at the electronics side of things!

allelectricev

I changed R1 to 100 ohms and got smoke coming from somewhere so i'm pretty sure that I might have fried the transistor from that.

Hooligan123

Once you have replaced the transistor, if that was where the smoke came from, measure at the collector.  When the prox is on you should see a logic low, when it is off you should have a logic high.

When you first connected the signal to the digital pin 2 you likely applied near 12V to the pin when the prox was on, so if the test is ok then the digital pin might not be ok anymore.

allelectricev

I have used a 4N33 optocoupler instead of the transistor.
I have measured at pin 5 which is the collector on the optocoupler and I am getting 600mV whether the sensor is detecting or not. I assume thats what you mean by prox. It was about the same as well when I measured earlier on the transistor before I replaced it except that was about 700mV.

Hooligan123

That would mean that the optocoupler is on, you should see 5V if when the prox is off. ( Yes, prox = proximity sensor :) )  Do you still have the 1k resistor from the sensor output to ground?  If so, try removing that.

Unfortunately I can't open your pdf documents, I get a message that the file is corrupt.

allelectricev

I finally got it working :)
It turns out that I was using the positive wire as the positive input to the circuit when it should have been the signal wire.
Looking at the datasheet it said that the signal wire should be connected through the load to the ground wire as it is pnp. I thought the load was a resistor but the load is actually the arduino!
SO i changed around the positive and signal wire from the sensor and its finally working!

Go Up