Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

How to build a metal detector using an inductive proximity sensor with Arduino

By Usman ali Butt April 12, 2021

In this tutorial, you’ll learn how to build a do-it-yourself (DIY) metal detector using a proximity sensor with Arduino. Many similar projects use a coil and transistor, but it’s possible to use a proximity sensor instead of a coil. You’ll simply notice a difference in the range and power consumption.

The range of proximity sensor is, typically, much shorter than coil (think millimeters versus a few centimeters — though a coil’s range depends on its diameter). In terms of power, a proximity sensor consumes less power than a coil. After all, a greater range requires greater power.

Both sensors use a coil to detect objects (metal, plastic, ferrous, etc.). A standalone coil, however, requires manual calculations for the sensitivity, components (including capacitance, inductance, and resistance), and the achievable range. This is a time-consuming task that requires in-depth knowledge of electronics and physics.

Proximity sensors are available in three main types: inductive, capacitive, and photoelectric.

  • Inductive and capacitive proximity sensors use an electric and magnetic field to detect an object. With inductive sensors, an external object increases the voltage whenever it’s within the range of the sensor’s electromagnetic field. This object must be metal, however, so it can be magnetized.
  • A capacitive sensor can detect the presence or absence of virtually any object, regardless of material. Essentially, the sensor and the object act like a capacitor, storing charge, and this charge is what the sensor uses to denote the object.
  • A photoelectric proximity sensor is similar to Arduino’s ultrasonic kit. Ultrasonic waves or a laser are used to detect an object based on reflection.   

Now, let’s build a metal detector using a proximity sensor that can sense ferrous and non-ferrous objects by using both inductive and capacitive proximity sensors.

Circuit diagram
The inductive sensor is connected to Arduino UNO’s digital pin#8. This sensor’s output is a fixed voltage signal.

The capacitive sensor’s output is connected to Arduino UNO’s analog pin#A0. This sensor has a knob that can be rotated (using a small screw), which sets its sensitivity level.

When the sensor’s sensitivity is combined with an object of non-conductive material, it builds capacitance. The difference in the capacitance between the sensor and that of the object is reflected in the output. So, the analog pin is used to distinguish the two objects.  

A small 5-volt buzzer is also required for this project. It’s connected with Arduino’s digital pin#5 using a transistor in between to limit the current flow. We used the digital pin as a pulse width modulated (PWM) pin.

As a result, the buzzer noise level now depends on the PWM’s duty cycle and frequency. This is done so as to properly distinguish the sound of the object.

Project code
First, define the inductive sensor and the buzzer pin. (The Arduino analog pins can be used without the need to define them.) In the set-up function, the inductive sensor pin should be declared as the input and the buzzer pin as the output. Arduino’s serial monitor is setup at 9600bps.

In the loop function, if the inductive sensor “finds” an object, the buzzer’s alarm will trigger with a high-pitched sound.

The capacitance value is read and, if greater than 50, the buzzer’s alarm will sound.

The “greater than 50” is just an example. From the data sheet, it’s possible to read the capacitive of the proximity sensor and an object and include it as part of the Arduino code.

The analog write function divides the capacitance value by four because the analog write function accepts values of no greater than 255. Arduino’s analog pin can read a maximum of 1023(10-bit ADC). So, the capacitance variable value never exceeds 1023 (1023/4 = 255).

A visual depiction of how to identify the object/medium by using a capacitive sensor is below. (Source: Data sheet.)

Now, let’s DIY! Where to buy the parts?

  • Arduino UNO
  • Inductive proximity sensor
  • Capacitive proximity sensor
  • Buzzer
  • Transistor

 

You may also like:


  • Insight – Learn the workings of a capacitive touch sensor

  • What are the main types of proximity sensors?

  • Analyzing different proximity sensor technologies

  • What is Sensor?

Filed Under: Microcontroller Projects
Tagged With: Arduino
 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: Internet of Things
Explore practical strategies for minimizing attack surfaces, managing memory efficiently, and securing firmware. Download now to ensure your IoT implementations remain secure, efficient, and future-ready.

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions

  • Voltage mode pushpull is a nonsense SMPS?
  • Input impedance matching network
  • High Side current sensing
  • The comparison of different Tcl script checkers
  • Reducing "shoot-through" in offline Full Bridge SMPS?

RSS Electro-Tech-Online.com Discussions

  • Back to the old BASIC days
  • Parts required for a personal project
  • PIC KIT 3 not able to program dsPIC
  • Failure of polypropylene motor-run capacitors
  • Siemens large industrial PLC parts

Featured – RPi Python Programming (27 Part)

  • RPi Python Programming 21: The SIM900A AT commands
  • RPi Python Programming 22: Calls & SMS using a SIM900A GSM-GPRS modem
  • RPi Python Programming 23: Interfacing a NEO-6MV2 GPS module with Raspberry Pi
  • RPi Python Programming 24: I2C explained
  • RPi Python Programming 25 – Synchronous serial communication in Raspberry Pi using I2C protocol
  • RPi Python Programming 26 – Interfacing ADXL345 accelerometer sensor with Raspberry Pi

Recent Articles

  • What is AWS IoT Core and when should you use it?
  • AC-DC power supply extends voltage range to 800 V DC
  • Infineon’s inductive sensor integrates coil system driver, signal conditioning circuits and DSP
  • Arm Cortex-M23 MCU delivers 87.5 µA/MHz active mode
  • STMicroelectronics releases automotive amplifiers with in-play open-load detection

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe