In this illustration we will going to wire the NPN Inductive Proximity Sensor to detect metal or any metal objects, this device also can be used as a metal detector screening when people walking through the entrance to find metal objects.

This metal sensor are inductive sensors. Which means that it induces current when metal is near to it. This sensor is a non-contact electronic sensor that is used detect positions of a metal objects. The sensing sensing range depend on the type of metal being detected. Ferrous Metal, such as iron and steel, allow for a longer sensing range, while nonferrous metal objects such as aluminum, copper, can reduce the sensing range by 60 percent. Since the output of an induction sensor has two possible states, an inductive sensor sometimes referred to as an inductive proximity switch.

This sensor consist an induction loop, electric current generates a magnetic field, which collapses generating a current that falls toward zero from its initial trans when the input electricity stops.

The inductance of the loop changes according to the material inside it and since metals are much more effective conductors that other materials the presence of metal increases the current flowing through the loop. This change can be detected by sensing circuitry which signal pass true to some other device whenever metal is detected.

This device is commonly used in traffic lights, car washes, manufacturing machinery, automated industrial machinery, elevators and building automatons this device is mostly used because can adopt in a rugged and dirt environment.

In this example we will going to used PNP NO 3-WIRE Cylindrical Inductive Proximity Sensor


Detecting Distance: 4mm
Supply Voltage: DC6-36V
Current Output: 300 mA
Response Frequency: 100Hz
Detect Object: Metal
Column Sensor Dia.12mm

Wiring Guide with Arduino MCU


The metal proximity sensor will have three color wire. The blue should be in the ground, brown is on +VCC which should be giving to Arduino + 5v VCC and when you take metal near tot the sensor it induces more current which results in higher voltage. In this case you need to open your serial monitor to see the incoming signal from the analog pin then make a threshold to determine if metal is detected or not.

Generally speaking the Iron/Copper or Metal with good magnetic properties will induce more that 1v when brought nearer to the sensor you need to touch the surface it will start detecting from a distance about 3CM.

Arduino Sketch


Wiring a Metal Detector with NPN Proximity Sensor on Arduino
Tagged on:         

6 thoughts on “Wiring a Metal Detector with NPN Proximity Sensor on Arduino

  • at

    Hi ,
    Thanks for the article, i wanna ask you , this sensor, what is it detects range ?

  • at

    Do you have a full spec sheet for the sensor?

    • at

      The unshielded M18 inductive sensor has a sensing distance of ~10 mm. This sensor has NPN-style, NO+NC contact type output. Widely applied in measuring, Counting, Rpm measuring in mechanism, chemical, paper manufacture light industry, etc.

      Rated Operational Voltage: 24 VDC
      Supply Voltage: 10 to 30 VDC
      Voltage drop: ≤ 2.0 V
      Rated insulation voltage: ≥ 20 MΩ
      Load current capacity(DC/AC): 200 mA
      Off-state current(NPN/PNP): ≤ 15 mA
      Leak current: ≤ 20 µA
      Protection against polarity reversal: YES
      Short circuit protected: YES
      Load capacity: ≤ 1 µF
      Repeated accuracy: ≤ 5%
      Ambient temperature range: -15…+60°C
      Frequency(DC 3/2 wires/AC 2 wires): 800 Hz/ 400 Hz
      Function indication: Red LED Indicator
      IP ratings: IP67
      Housing material: Nickle plated brass
      Material of sensing face: ABS
      Connection: Fly Leads
      No. of wires x gauge: 12 x 0.16 mm
      Standard lenth of cable: 2 m
      Detection distance: 10 mm
      Approvals: CE

  • at

    Great i have done with this, thank you 🙂
    Anyway, Can I know, where 1024 and 100 from? what formula do you use?

    • at

      The ADC on the Arduino is a 10-bit ADC meaning it has the ability to detect 1,024 (210) discrete analog levels, so anlogRead at PinA0~A5 multiply by 100 divided by 1024. (adc*100)/1024 to get the percentage value. 🙂


Leave a Reply

Your email address will not be published. Required fields are marked *