Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Complete Sensor Guide
      • Engineering Deep Dives
      • AI
      • ARDUINO Compatible Coding
      • Audio Electronics
      • Battery Management
      • Beginners Electronics Series
      • Brainwave
      • Digital electronics (DE)
      • Electric Vehicles
      • EMI/EMC/RFI
      • EVs
      • Hardware Filters
      • IoT tutorials
      • LoRa/LoRaWAN
      • Power Tutorials
      • Protocol
      • Python
      • RPI Python Programming
      • Sensors
      • USB
      • Thermal management
      • Verilog
      • 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
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Tech Terms
    • Webinars & Digital Events
  • Resources
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • White Papers
  • Guest Post Guidelines
  • Advertisers
    • Advertise
    • PR Submissions
    • Eblast Submissions
  • 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 Electro-Tech-Online.com and EDAboard.com forums.



Tell Us What You Think!! Cancel reply

Log in to leave a comment:

Lost your password?

Don't have an account? Register here

Submit a Guest Post

submit a guest post

EE TECH TOOLBOX

“ee
Tech Toolbox: Wide Bandgap Semiconductors
Moving from silicon to GaN or SiC feels like a whole new ballgame, doesn’t it? It isn’t just about faster switching; it’s about managing the layout parasitics and thermal realities that come with that speed. This month’s Tech Toolbox features a curated eBook that tackles these design hurdles head-on.

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 feed: EDABOARD.com Discussions. EDABOARD.com Discussions.

  • What do they connect Y capacitors to in ships?
  • 7555 with no discharge resistor for monostable operation?
  • Odd shape board is expensive
  • Two Educational Electronics Trainer Projects from Algeria – Detailed Project Overview and Seeking Technical Collaboration
  • SurePCBA (Shenzhen) — small-to-volume PCBA, turnkey, transparent BOM

RSS feed: Electro-Tech-Online.com Discussions Electro-Tech-Online.com Discussions

  • Want Thermal Camera with Fixed Thermal Span option
  • Samsung C21RJAN ceramic hob BUZZER got quieter
  • Semi-automatic battery handler
  • PIC code for 2.42" I2C OLED Display?
  • baud rate vs maximum cable length

Featured Tutorials

LoRa and LoRaWAN: A Complete Guide to Wireless Communication

  • Best practices for securing LoRa networks
    Best practices for securing LoRa networks
  • Understanding LoRa architecture: nodes, gateways, and servers
    Understanding LoRa architecture: nodes, gateways, and servers
  • Revolutionizing RF: LoRa applications and advantages
    Revolutionizing RF: LoRa applications and advantages
  • How to build a LoRa gateway using Raspberry Pi
    How to build a LoRa gateway using Raspberry Pi
  • How LoRa enables long-range communication
    How LoRa enables long-range communication
  • How communication works between two LoRa end-node devices
    How communication works between two LoRa end-node devices
More Tutorials >

Recent Articles

  • Nuvoton and Qt Group add MCU HMI support
  • MicroStrain by HBK adds compact inertial sensors
  • Allegro MicroSystems expands 48V adas portfolio
  • SemiQ previews 1700 V SiC module
  • pSemi adds wideband RF switch

EE ENGINEERING TRAINING DAYS

engineering
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • 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 © 2026 Arrowfly 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 Arrowfly
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Complete Sensor Guide
      • Engineering Deep Dives
      • AI
      • ARDUINO Compatible Coding
      • Audio Electronics
      • Battery Management
      • Beginners Electronics Series
      • Brainwave
      • Digital electronics (DE)
      • Electric Vehicles
      • EMI/EMC/RFI
      • EVs
      • Hardware Filters
      • IoT tutorials
      • LoRa/LoRaWAN
      • Power Tutorials
      • Protocol
      • Python
      • RPI Python Programming
      • Sensors
      • USB
      • Thermal management
      • Verilog
      • 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
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Tech Terms
    • Webinars & Digital Events
  • Resources
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • White Papers
  • Guest Post Guidelines
  • Advertisers
    • Advertise
    • PR Submissions
    • Eblast Submissions
  • Subscribe