Download Favorite
By JorBi
Follow
More by
the author:
While looking for further ideas for a simple Ardino Pulse Induction metal
detector with only one supply voltage I came across the homepage of Teemo:
http://www.digiwood.ee/8-electronic-projects/2-metal-detector-circuit
Step 1: Schematic
2 More Images
The Arduino schematic is a bit more complicated as the Arduino does not allow
to route an internal analog signal to the input of the comparator. This adds two
components for a simple voltage deviderr. This leads to a design with 12
external components (leaving out the speaker and the 16x2 LCD), compared to
9 of the Flip Coil design.
The working principle of the schematic is explained very well on the website of
Teemo. Basically the coil is powered and then switched off. After switching off,
the coil and the condenser in parallel will create a damped oscillation. The
frequency and the decay of the oscillation is influenced by metal in proximity of
the coil. For further details of the circuit see the page of Teemo or of TechKiwi
here on Instructables.
As in the Flip Coil Pulse Induction detector I use the internal comparator and
the possibility to trigger an interrupt to acquire the signal from the coil.
In this case I will get multiple interrupts as the voltage is oscillating around the
reference voltage set at the comparator. At the end of the oscillation, the
voltage at the coil will settle around 5V, but not exactly. I chose a voltage
devider with 200 Ohm and 10k Ohm to obtain a voltage of about 4.9 volts
In this version, I added a speaker connection using the volume controlled multi
tone appraoch as described in How to Program an Arduino Based Metal Detect
or. This allows for differentiating the properties of the target as well as to get a
feeling for the signal strength. The speaker can be connected to the addiononal
5 pin header. The remaining 3 pins of the header will be used for push-buttons
(to be implemented).
Step 2: Programming
3 More Images
Now that the circuit is designed and the prototype is build, it is time to find an
appropriate approach for detecting metal.
1. Counting pulses
If there is metal near to the coil the amount of oscillation decreases. In this case
the reference voltage of the comparator should be set to a level that the last
pulse is barely still measured. So in case something is detected, this pulse
immediately vanishes. This was a bit problematic.
Each wave of the oscillation creates two interrupts. One while going down and
one going back up. To set the reference voltage exactly to the crest of an
oscillation wave, the time between going down and going up should be as short
as possible (see picture). Unfortunately here the overhead of the Arduino
environment creates problems.
ISR(ANALOG_COMP_vect){
Toggle1=Toggle0 // save last value
Toggle0=TCNT1; // get new value
}
This code takes some time (if I remember right, about 78 instruction cycles
witch is about 5 microseconds @ 16MHz). Therefore the minimum detectable
distance between two pulses is exactly the time this code takes, If the time
between two triggers gets shorter (see picture), it will go undetected, as the
code is fully executed prior to detecting a second interrupt
This leads to a loss in sensitivity. At the same time, I noticed, that the damping
of the oscillations is very sensitive to whatever external influences, thus making
this approach in total a bit difficult.
Another way to detect metal is measuring the frequency of the oscillation. This
has a big advantage compared to measuring the damping of the oscillation as
the change in frequency allows for discrimination of the metal. In case there is
ferrous material near the coil, the frequency will slow down, in case there is
precious metal near the coil, the frequency will increase.
The easiest way to measure the frequency is to measure the amount of pulses
after the coils starts oscillating. The period of time between the start and the
last pulse divided by the total amount of measured pulses is the frequency.
Unfortunately the last few oscillations are quite unsymmetrical. As the presence
of metal also influences the decay of the oscillation the last oscillations is even
more unsymmetrical, the readings are difficult to interpret. In the picture this is
show with the crossing 1 to 1’ and 2 to 2’.
A better way is therefore to use some earlier pulses to measure the frequency.
While testing, interestingly I found out that some pulses pulses are more
sensitive than others. Somewhere at 2/3 of the oscillations is a good point to
acquire the data.
1. The LCD
The first approach was to measure 10 pulses and then to show the values on
the LCD. As I found out the I2C data transfer was way too slow, I changed to
code to update only one character per pulse.
To improve the stability of the readings further I wrote a serial output routine to
get a better feeling for the measured data. There it became apparent, that
although most of the readings were somewhat stable, some were not! Some
readings of the “same” oscillation pulse were so far apart that it would wreck
every approach to analyze a shift in frequency.
3. The voltage
For a MOSFET I chose initially the IRL540. This MOSFET is logic level
compatible, but has a maximum voltage rating ov 100V. I was hoping for better
performance changing to a IRL640 with 200V ratings. Unfortunately the results
were the same. So either a IRL540 or an IRL640 will do the job.
LC_interrupt_V05.ino
Download
Here the original design with the PIC controller might be more sensitive as it is
running on 32MHz instead of the 16MHz of the therfor providing a higher
resolution for detecting shifts in frequency.