Arduino Metal Detector

Last Updated on March 16, 2024

Metal detectors are ensures our safety in many ways and also this metal detection technique can be used in many application or process oriented projects. In this article Arduino metal detector circuit is composed with proximity detector IC CS209A. It is a bipolar monolithic integrated circuit and best suitable to metal detection & proximity sensing applications.

How Metal Detector Works?

The above illustration is enough to make you understand about the operations of metal detectors. The basic magnetic flux reflection and LC Inductance change or some times pulse induction or back emf produced in the sensing coil is detected by the circuit and the difference signal is separated and amplified enough then if there is any difference the Alert indicator circuit will be triggered.

Metal detector coil gets oscillation signal from internal oscillator circuit, in terms of Inductance it can be mathematically stated as [L = (μ0 * N² * A) / l  ].

Arduino Metal Detector wiring

The Sensor coil 100μH is made as 40mm in diameter and 50 turns by 0.4 mm insulated copper wire and there is no need for core inside the coil. Here the IC CS209A provides two outputs as Out1 from pin 4 (which is normally High) and Out2 from pin 5 (whis is normally Low), you can use any one or both with Arduino, here the example Arduino sketch utilizes the Out 1 only.

Arduino metal detector code

//Arduino Metal Detector project 
//Proximity Detector CS209A is used for metal detection
//Writen date 22/2/2018 at 5.53pm

//declare Arduino Pins
const int vinHi = 0; 
const int vinLo = 1;
const int ledG = 11;
const int ledR = 10;
const int Buz = 13;

//variable to detect state change
int metalState = 0;

 //declare Arduino Pin Mode
void setup() {
  pinMode(vinHi, INPUT);
  pinMode(vinLo, INPUT);
  pinMode(ledG, OUTPUT);
  pinMode(ledR, OUTPUT);
  pinMode(Buz, OUTPUT);


void loop() {
  metalState = digitalRead(vinHi); // Read the proximity detector signal

  if (metalState == HIGH) // No Metal detected
      digitalWrite(ledG, HIGH);
      digitalWrite(ledR, LOW);
      digitalWrite(Buz, LOW); 
     else {                // Metal detected 
      digitalWrite(ledG, LOW);
      digitalWrite(ledR, HIGH);
      digitalWrite(Buz, HIGH);

   delay (3000); // Wait for 3 Sec.

After uploading the code connect separate 9V battery to provide power to both arduino and metal detector circuit. After completing the wiring if there is no metal near sensor coil the Green side LED will glow, if you bring metal near to coil the Red LED will glow and buzzer makes noise.

Proximity Detector IC CS209A pin Configuration

This CS209A IC available in 8 pin package and also in 14 pin package, refer datasheet for more.

2 thoughts on “Arduino Metal Detector

Leave a Reply

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