Arduino Based Pulse Induction Detector - LC-Trap

1,852

6

6

Published

Introduction: Arduino Based Pulse Induction Detector - LC-Trap

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

He created a simple Pulse Induction detector using the LC-Trap principle. Similar circuits were posted here on Instructable by TechKiwiGadgets. Exept that the Teemo circuit uses the internal comparators of the a PIC microcontroller, thus needing less external components

So I was challenged to use the Arduino instead of a PIC-Controller for this schematic and look how far I can get.

Step 1: Schematic

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

To reduce complexity of the schematics I used D4 and D5 to provide GND (for the 10k Resistor) and 5V (for the 220 Ohm resistor). The pins are set at the start up of the detector.

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 Detector. 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

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

Counting of pulses of the oscillation until it fully decays is one idea.

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.

Each trigger of the interrupt calls for this code:

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.

2. Measuring the frequency

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.

Processing the data.

The initial code based on the loop() calling for a pulse() function to do the timing of the coil. While the results were not bad, I had the urge to improve the timing. In order to do so, I created a fully timer based code, leading to the separate instuctable How to Program an Arduino Based Metal Detector. This instructable explains the timing, data crunching LCD output etc in detail

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.

2. Minimum value approach

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.

To compensate for this, I created a "border" within which value were trustworthy. I. e. when values were more than 35 cycles of timer1 away from the expected value, these values were ignored (explained in detail in the Instructable "How to Program an Arduino Based Metal Detector")

This approach proved to be very stable.

3. The voltage

The original design of Teemo is powered below 5 volts. As my assumptions was “more volts = more power = more sensitivity” I powered the unit in the beginning with 12V. This resulted in heating up of the MOSFET. This heating-up then resulted in a general drift of the measured values, leading to frequent re-balancing of the detector. By decreasing the voltage to 5V the heat generation of the MOSFET could be minimized to a level where almost no drifting of the readings were observed. This made the circuit even simpler, as the on-board voltage regulator of the Arduino was not needed anymore.

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.

Step 3: Final Results

The advantage of the detector is that it discriminates between precious and ferrous material. The disadvantage is, that the sensitivity with this simple schematic is not that good. To compare the performance I used the same references as for the Flip-Coil detector. Probably good for some pinpointing, but most likely disappointing for real searching.

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.

Results were achieved by using the coil with 48 turns @ 100mm.

As always, open for feedback

Share

    Recommendations

    • Clocks Contest

      Clocks Contest
    • Water Contest

      Water Contest
    • Creative Misuse Contest

      Creative Misuse Contest

    6 Discussions

    0
    user
    Piine

    Question 5 months ago

    Thanks for the reply JorBi :)
    It's interesting what you say about the code possibly limiting the depth. When you release the new code it would be nice if you could go into detail as to what you changed / tried and how it helped.

    You also named a lot of builds I have never seen before! Thanks for that.

    When I build your design I definitely plan on experimenting, and will report back with any findings. I like your idea of building simple and good.

    Also, I'm assuming the air distance is in inches? If so, 8.5 to 9 isn't half bad!

    3 more answers

    Hi Piine,
    exchange of thoughts and experience is more than welcome.
    I published a new instructable about the code only yesterday.
    ... unfortaunately the depths are given in cm. So it gives rather pinpointing-ability

    Ok, last question (sorry!)
    what are the voltage ratings on the capacitors?

    Hi Piine,
    don't worry about asking questions, that what it is all about... :-)
    The only relevant condenser is the one in parallel to the coil. I used a MKP type, MKT will work aswell. It is rated 310V.
    I finished my code today with pretty good results. The schematic needs a small update. I will take care of that in the weekend, including a varaint with fast analog read.
    I designed a housing as well, to be included soon too.
    Don't hesistate with further questions.

    Hi there, great tutorial.
    I'm going to give it a go, but admittedly don't have much experience in electronics. I've done a few projects, including making the SurfPI pulse induction kit, but I am still fairly shaky on the subject, and wouldn't know how to tinker with a design.

    I have some questions before I get going:
    1) I notice R2, Q1, and SV2 are missing on the schematics. I'm not trained in reading schematics, is there some reason for this? Am I not seeing these parts?
    2a) Q2 says it is an IRL540, which I found to be a 100V 28Amp MOSFET. My surfPI runs at 11v and uses an IRF9640 which is 200V 11Amp. My question is, could you perhaps get away with more voltage (for more depth) with a different MOSFET?
    2b) Have you seen the Russian FoxyPI? He uses a 500V MOSFET, and has excellent depth. It's a cool build but over my head at this point, unfortunately.
    3) Your detector/object chart: What do the numbers represent?

    Thanks again, looking forward to your reply!

    1 more answer

    Hi Piine,
    Thanks for looking at the design. The missing parts you are pointing out are not needed. The schemativ was created out of an other schematic. So when I deleted the parts, I forgot to renumber the parts.
    For the questions on the MOSFET: There might be the potential to get higher depth by choosing higher supply voltage. I tried 12V, but it resulted in heating of the MOSFET, resulting in major drift of the measured values. So I chose to stick to the 5V to start with. It might be woth experimenting with other voltages and MOSFETS, BUT: the given Arduino code is at its limits. I have been working on a mutch more stable and faster code during the last month planning to publish this in a few day. Choosing higher voltage therefor might not get better results due to the poor code.
    For other PI detectors: yes there are some great other detectors published. My favorite being the GoldPic of Trevor Hill. There is the FoxiPi, surfPI but also the FelezJoo Pi, the Teemo DIY detector and the TPMID. Her on Instructables TechKiwiGadgets published some great designs aswell.
    The geneal problem: either they are complex and good, or simple with limited abilities. I am still trying for the simple and good one.... :-)
    For the detector/object chart: The represents the detection distance (air) for different detectors for different objects.