I am attempting to create a robot that will sort aluminum from steel automatically via an arduino. The code is essentially: if steel, do X, if aluminum, then do Y.

I am using an analog inductive proximity sensor (NPN) made by IFM (product page here).

I have managed to read values from the sensor with analogRead, but the values for aluminum and steel are exactly the same (around 165). I am using the arduino's native INPUT_PULLUP function since the sensor is sinking.

I am using a 27 volt power source (3x 9 volt batteries) sent through a voltage regulator set to output 25 volts.

How can discrimination be achieved? is this even possible with the current hardware? I was lead to believe that this was possible, but I am not very experienced.


EDIT: I purchased this sensor believing that it was an analog sensor, but it is not.

  • \$\begingroup\$ Steel will increase inductance and non ferrous metals like copper and aluminium decrease inductance .So it is possible. \$\endgroup\$
    – Autistic
    Nov 17, 2017 at 9:55
  • \$\begingroup\$ According to the sensor info card (ifm.com/mounting/1D2226UK.pdf) it seems, that this sensor does not provide analog output, only binary signal: "Output function Normally open: object within the active zone > output is switched." Are you sure, shis sensor provides analog output signal? \$\endgroup\$
    – Eugene K
    Nov 17, 2017 at 10:10

2 Answers 2


enter image description here

Figure 1. IFS258 proximity switch wiring diagram.

I am using an analog inductive proximity sensor (NPN) ...

NPN means that there is an NPN transistor on the output. The transistor will either be off (below sensing threshold) or on (above sensing threshold). There is no analog reading available from that switch. It is not suitable for your application.

enter image description here

Figure 2. Sensing range for various materials relative to a reference target.

If you have a look at the switch Info Card they give the sensing range for various materials versus a reference target. You can see that for Al it is about 35% relative to the reference (most likely steel - check for yourself).

This gives you some hope for your application if your robot can measure the distance at which the material is sensed by moving the sensor or target from full contact with the sensor back to where the sensor turns off.

These sensors are intended for industrial applications and generally used to detect that a tool or mechanism is "in-position" or not. The sensing range in these applications gives a measure of the clearance required between the sensor face and the part being detected. A typical sensor might have a 4 mm range on steel but from Figure 2 we can see that we would need to move to 4 x 0.35 = 1.4 mm to sense an aluminium target.

Be aware that some sensors require a metal-free zone around the head while others can work when flush with a metal surface. The datasheet should have all this information.


You're not using an analogue output device, it has a NPN switch output, 'detection' or 'no detection', so it's digital output. Incidentally, with its wide input voltage range of 10-30v, you'd be quite well served by 2 series 9 volt batteries and no regulator.

You would be better off with an inductance meter, which could be as simple as a coil driven by an AC current, and measuring the voltage across it. That has the great advantage that magnetic materials will increase the inductance, and non-ferrous like copper and aluminium will decrease it, by looking like a shorted turn. Stainless steel gives it a problem, the slightly ferrous increase often being cancelled out by the slightly conductive decrease.

Commercial food metal detectors use the sample to unbalance a bridge made from one transmitter coil, and two oppositely placed, oppositely phased detector coils, but this would probably not suit your sample geometry.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.