# A howto on an inductive proximity sensor (IE for RPM)

Maybe this should go in the wiki? Where should I stick it?

So I've been playing with an inductive proximity sensor and got it working with Arduino. I haven't found anything in my searches with Google that reveals much information about using these sensors in arduino.

Seems like the most common way to measure RPM of a wheel or shaft is to attach a magnet and use a hall-effect sensory. Inductive proximity sensors are another way to do this without magnets if you already have something metal, like a sprocket. For this reason they are heavily used in industry, particularly in agricultural machines. My combine harvester has dozens of these sensors on it.

An inductive proximity sensor works by generating a magnetic field (usually using a 12V or 24V power source). When something metal enters the magnetic field, the current flowing through the sensor drops to zero. This is how an inductive proximity sensory signals typically. Current = no metal, no current = metal. So this style of sensor can be used to measure speed (pulses per minute, for example), or simple proximity (the door is closed).

These sensors usually come in 2, 3 and 4 wire varieties. If all you can find is a 3-wire version, it can be wired with an external load resistor and be functionally the same as a 2-wire version. See Inductive Sensor Operating Principles.

The one I'm using currently is a 2-wire version (normally open, not analog) that came from my spare combine parts bin, and it seems the simplest for my purposes. The 2-wire sensors have a built-in transistor and load. The first thing I had to do was figure out the polarity, which was easy to do since there's a nice LED on the back of the sensors (many are this way). For me 12V goes to yellow, ground goes to blue. Since inductive proximity sensors signal using current, not voltage, you have to convert current to voltage. This can be done by placing a resistor between the negative wire (blue in my case) and the ground. This forms a voltage divider with the internal load of the sensor. Now you can measure the voltage across the resistor. When there is no metal in front of the sensor, the voltage across this resistor reads high, and when there is no metal it will read very close to zero. So it's just a matter of choosing a resistor size that divides the voltage appropriately. For my sensor, a 560 ohm resistor worked, giving me a voltage of about 4.7 volts (with a supply voltage of 13.7 volts to the sensor). This divided voltage signal can be fed directly to an arduino pin (common ground of course!). Different sensors may have different internal loads, so you'll have to experiment to find a resistance value yields a voltage not greater than 5 volts.

I'm not sure exactly how the analog version of these sensors work or how to read them.

Here's a little diagram (sorry I don't have a nice png):

``````+12V ----------------- inductive sensor +

grnd ---/\/\/\----+--- inductive sensor -
|
|
arduino pin ------+
``````

These sensors can be bought on E-bay, or any number of places for fairly cheap (\$10-20). I plan to buy one (a fairly large 18-mm one for an agriculture application) from http://www.automationdirect.com. About \$20. Of course I could also go to my local local Case IH or New Holland ag dealership and buy them for \$150 a piece. Talk about markup!

Great stuff - could you give me an idea of what sort of range you are getting out of that sensor? I am interested in using them to detect bikes on trails for counting purposes...

Thanks!

This type of sensor only has a detection range in the order of mm. You may have success with a magnetometer.

Weedpharma