Arduino metal detector?

Okay, let me clarify my choice for a pulse induction type of detector.

There are basically 3 types of metal detectors:

  • The BFO detector. Advantage: simple design, works by detuning an oscillator when a metal object is nearing the coil. Major drawback: bad recovery depth because of the high frequency used (around 100 kHz).
  • The VLF or induction balance detector. Advantage: deep recovery (up to 30 cm) with a small coil. Typically uses a frequency between 5 and 15 kHz. Can discriminate between different kinds of metal. Disadvantage: complex electronics, designing and constructing the search coil is hard.
  • The pulse induction detector. Advantage: simple search coil, easy integration of a microprocessor and deep recovery. Major disadvantage: hard to discriminate between different kind of metals, this is where the challenge lies.

The pulse induction detector sends out a short pulses into the ground, thereby magnetizing any metals. The induced current inside the metal is measured by the same coil which sends out the pulse.

@Mark: your explanation of the diagram sounds right to me.

I came to know that PI technology uses -
1 a pulse to coil to form the magnetism in coil and the the object to be checked.
2 an opposite pulse to make the magnetism in the coil to die
3 then measuring of the amplitude of magnetism in the object by the same coil.

if so and i am not mistaken,
an analog write in some positive value,then an analog write in same value in negetive.now an analog read will give the system working.

i am a newbie,so pls help me.
:slight_smile: :slight_smile:

Hello myfaithnka,

I think it can be much simpler than this. You can use a digital output to create a pulse. The pulse will drive a high power transistor or fet which is connected to the coil. This transistor is powered from some external power source because we need a strong pulse. After the pulse is switched off, we wait a while and amplify the resulting signal with an opamp. This signal is digitized and connected to a digital input.

I came across the chance metal detector, it is a russian design and uses an ATMEGA8. Circuit diagram attached.

I have made a couple of metal detector circuits controlled by the Arduino

The simplest one is a self oscillating circuit that I adapted from a BFO circuit

The outputs are run to pins 2 and 3 and the pulses counted

#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
//LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

//  LiquidCrystal lcd(2, 3, 6, 7, 8, 9);
  LiquidCrystal lcd(10, 4, 6, 7, 8, 9);


volatile unsigned int ref_coil_count;
volatile unsigned int sensor_coil_count;

void setup() {

  attachInterrupt( 0, ref_coil, RISING );
  attachInterrupt( 1, sensor_coil, RISING );



  // set up the LCD's number of rows and columns: 
  lcd.begin(16, 2);
  
  // Print a splash screen to the LCD.
  lcd.print("detector Test");
  lcd.setCursor(0, 1);
  lcd.print("      v1.0      ");
  delay(2000);
}

void loop() {
  int offset;
  long ref_count;
  long sensor_count;
  ref_coil_count = 0;
  sensor_coil_count = 0;
  delay(1000); 
  ref_count = ref_coil_count;
  sensor_count = sensor_coil_count;
  offset = analogRead(A0)-512;

  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("R ");
  lcd.print(ref_count);
  lcd.print(" S ");
  lcd.print(sensor_count);



  lcd.setCursor(0,1);
  lcd.print("V ");
  lcd.print((sensor_count - ref_count)-offset );
  delay(50);

}

void ref_coil()
{
  ref_coil_count++;
}

void sensor_coil()
{
  sensor_coil_count++;
}

I was using a 10k pot to adjust the balance between the coils via the analog in.

The next one that I have built (but not with the intent of using is as a metal detector) is this one

It's an LC meter but by it's nature is actually a pulse induction detector.

Because the presence of metal objects in the coils area of influence the coils inductance changes and this shows up as a change in the pulse width detected by the Arduino.

Thanks for sharing, I have also built the LC meter. It works very well.

On the howstuffworks website there is a good explanation of pulse induction detectors. We need to look at the decay of the coils pulse. This will indicate what kind of metal is buried.

I'm going over the schematic and thinking you could free up your ADCs and PWMs if you used an i2c connection for the LCD. Of course I didn't see any C code to help figure out what he's doing though.

ellisgl:
I'm going over the schematic and thinking you could free up your ADCs and PWMs if you used an i2c connection for the LCD. Of course I didn't see any C code to help figure out what he's doing though.

Which one are you talking about?

The Chance schematic. I'm looking over some Stuart 1 and 2 schematics right now.
http://sjeffroy.free.fr/DetectPI/detectpi.html

http://www.geotech1.com/forums/showthread.php?t=8152&page=2

Oh Ok :slight_smile:

The stuart detectors won't discriminate between different metals. I have built the first version a while back. The Chance detector uses a ATMega8 to investigate the decaying coil voltage. From this we can deduct what type of metal is under the coil. You don't want to dig for iron!

joop:
The stuart detectors won't discriminate between different metals. I have built the first version a while back. The Chance detector uses a ATMega8 to investigate the decaying coil voltage. From this we can deduct what type of metal is under the coil. You don't want to dig for iron!

Are you sure about that? Digging up a nice old cannon would be worth it. =)

yeah, but digging for rusted nails isn't fun when you want to find a nice old coin.

Yeah that would suck.


This russian project on PIC12F629 controller. Maybe use Arduino ?

This my test schema

long t_1 = 0; // ?????????? ??? ???????? ???????? ?????? ????????? ? ???
long t_2 = 0; // ?????????? ??? ???????? ???????? ?????? ????????? ? ???

float L = 0; // ??????????? ???????? ??????? ???????
int A=0; //?????????? ?? ?????????? ?????

void setup()
{
pinMode(13, OUTPUT); // ????????? ?????? 13 ?? ?????
Serial.begin(9600); // ????? ?????????? ? COM-????
}

void loop()
{
// ???? ???????? ???????? ???? ????? ????????
digitalWrite(13, LOW);
while (analogRead (0) != 0 )
{
}

digitalWrite(13, HIGH); // +5? ????? ?? ????? 13
t_1 = micros(); // ?????? ???????? ?? ?????? ?????? ????????? ? ???
A=analogRead (0);

while ( A > 250 ) // ?????? ???? ???????? ????? ?????????? ?? ????? ????? ??? ????
{
A=analogRead (0);
}
t_2 = micros(); // ?????? ???????? ?? ?????? ?????? ????????? ? ???

L = sqrt(float(t_2 - t_1)); // ?????????? ????????????? L.

Serial.println(L); // ????? ??????? ?? ?????
}

G'day guys! Any update on the results of your tests?

I've recently had a play with building a metal detector using an Arduino. First I tried a PI detector inspired by http://www.miymd.com/index.php/projects/tpimd/. That design uses an ATtiny for the receiver, which can do very accurate timing of the decay signal because the ATtiny has a 64MHz fast perhipheral clock. Unfortunately, the Arduino does not have the fast clock, so the timing resolution is 4 times worse. Also, the only mosfets I had available had a Vds rating of 60V, whereas the FQPF7N65C in the original has a breakdown voltage of 650V. So I had to use a shorter pulse and in consequence a lower pulse amplitude. Both of these factors meant that the sensitivity of the detector was poor.

I then tried an induction balance detector. I used timer 1 to generate a 62.5kHz signal, and fed this to timer 2 to generate a 7.8125kHz square wave. I tuned the Tx coil to this frequency using a parallel capacitor, and fed the square wave to the coil/capacitor via a 2.2K resistor, to get a nice 7.8kHz sine wave across the coil. I tuned the receive coil using a another parallel capacitor, and amplified it using an LM358 configured as a bandpass amplifier. Originally I used 2 stages of amplification, but 1 turned out to be sufficient (gain = 50). The output goes into the Arduino ADC, which is set to start a conversion on each cycle of the 62.5kHz signal (I ran the ADC clock at 1MHz and accepted 8-bit accuracy). So the ADC takes 8 readings per cycle, which the code accumulates into 4 bins over around 8000 samples. A little bit of processing improves the sensitivity and cancels the 3rd harmonic, calculates the amplitude measured at 4 points in the cycle, and the phase between the received and transmitted signals.

In summary, the Arduino is used as the transmit signal generator and 4 phase sensitive detectors. This arrangement turned out to be extremely sensitive. As with all induction balance detectors, coil balance is very critical. I also trimmed out the stray capacitance between transmitter and receiver. My original experiments used a double-D coil, but I'm planning to make up concentric coils + bucking coil because I think that will be easier to keep stable.

I summary, using an Arduino as a PI detector requires some extra electronics on the receiving side (maybe a pulse gate and an integrator feeding the ADC would be sufficient); but it makes a good IB detector if you amplify the received signal before passing it to the ADC.

dc42:
I then tried an induction balance detector. I used timer 1 to generate a 62.5kHz signal, and fed this to timer 2 to generate a 7.8125kHz square wave. I tuned the Tx coil to this frequency using a parallel capacitor, and fed the square wave to the coil/capacitor via a 2.2K resistor, to get a nice 7.8kHz sine wave across the coil. I tuned the receive coil using a another parallel capacitor, and amplified it using an LM358 configured as a bandpass amplifier. Originally I used 2 stages of amplification, but 1 turned out to be sufficient (gain = 50). The output goes into the Arduino ADC, which is set to start a conversion on each cycle of the 62.5kHz signal (I ran the ADC clock at 1MHz and accepted 8-bit accuracy). So the ADC takes 8 readings per cycle, which the code accumulates into 4 bins over around 8000 samples. A little bit of processing improves the sensitivity and cancels the 3rd harmonic, calculates the amplitude measured at 4 points in the cycle, and the phase between the received and transmitted signals.

Sounds really awesome :astonished:. I am also interested to build metal detector using arduino but my understanding about microcontroller timing is not so good. Can You share schematic and code?

I would favor a balanced coil metal detector, as you get both amplitude and phase to aid in discrimination what is under the coils. Looks like dc42 has proven the concept.

So, dc42, you are sampling 8 times per cycle, over 1000 cycles? At the same 8 points in the cycle, or are you collecting slightly different times so as to result in 8000 samples per cycle?

Interesting.... this one would be simple to implement in an Arduino:
http://www.docstoc.com/docs/150574517/Matchless-Metal-Locator-(Detector)---By-Thomas-Scarborough-(Silicon-Chip---June-2002)-7S---Geotech