Metal detector with Arduino

February 2, 2019
diy

A metal detector is an electronic device designed to detect the presence of metal objects. It works on the principle of electromagnetic induction. Here's a basic explanation of how a metal detector operates:

  1. Coil or Antenna: The metal detector consists of a coil or antenna, which is typically made of wound wire. This coil is connected to a oscillator circuit.
  2. Oscillator Circuit: The oscillator circuit generates an alternating current (AC) that flows through the coil, producing an electromagnetic field around it. The frequency of the AC generated is usually in the radio frequency (RF) range.
  3. Search Coil and Magnetic Field: When the coil is powered, it creates a magnetic field around it. As the coil is moved over the ground, this magnetic field is projected into the surrounding space.
  4. Metal Object Interaction: When the metal detector's magnetic field encounters a metallic object, it induces a small electric current, known as an eddy current, in the metal. This process is a result of electromagnetic induction.
  5. Eddy Currents and Magnetic Field Disturbance: The eddy currents induced in the metal create their own magnetic fields. These fields interfere with the original magnetic field generated by the coil, causing a disturbance.
  6. Detector Circuit and Alarm: The metal detector is equipped with a detector circuit that analyzes the disturbances in the electromagnetic field caused by the presence of metal. When a significant disturbance is detected, the circuit triggers an alarm or other signaling mechanism to alert the user that metal is nearby. The presence of the eddy currents alters the inductance of the coil. Inductance is a property of a coil that is related to the change in magnetic field when current flows through it. The changing magnetic field due to the eddy currents induces a voltage in the coil.
  7. Discrimination and Sensitivity: Advanced metal detectors often include features such as discrimination and sensitivity controls. Discrimination allows users to filter out certain types of metals, while sensitivity adjustments enable users to set the level at which the detector responds to metal.

Arduino metal detecto

Components Needed:

  • Arduino board (e.g., Arduino Uno)
  • Coil or inductor (e.g., a wire wound into a coil)
  • Transistor (e.g., NPN type)
  • Resistor
  • LED or buzzer for indicating metal detection
  • Power source (battery or power supply)

Basic Steps:

  1. Create the Coil: Wind a wire into a coil. The coil will be the main component responsible for generating and detecting the electromagnetic field.
  2. Connect the Coil to the Arduino: Connect the ends of the coil to the appropriate pins on the Arduino. The coil will be part of an LC circuit, and changes in inductance will be used to detect metal.
  3. Build the LC Circuit: Use a capacitor in parallel with the coil to create an LC (inductance-capacitance) circuit. The resonance frequency of this circuit will be affected by the presence of metal.
  4. Connect the Transistor: Connect the transistor in a way that it amplifies the signal from the LC circuit. The transistor is used to control the LED or buzzer based on the detected metal.
  5. Set Up the Arduino Code: Write Arduino code to read the analog signal from the LC circuit and use it to trigger the transistor, turning on the LED or buzzer when metal is detected.

Here's a very simple example of what the Arduino code might look like:

const int coilPin = A0;   // Analog pin connected to the coil
const int ledPin = 13;    // Digital pin connected to the LED
const int threshold = 500; // Adjust this value based on your setup

void setup() {
  pinMode(ledPin, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  int sensorValue = analogRead(coilPin);

  if (sensorValue > threshold) {
    digitalWrite(ledPin, HIGH);
    Serial.println("Metal detected!");
  } else {
    digitalWrite(ledPin, LOW);
  }
  delay(100);
}

Please note that this is a very basic example, and the sensitivity and accuracy of such a metal detector can be limited. More sophisticated metal detectors use additional features like discrimination to filter out unwanted signals and improve performance.

Picture Picture

Pictures of the project