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.
Attachments
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
22 Comments
1 year ago
Hi Jorbi,
could you please explain why counting the pulses for determination of frequency is not a problem (see 2.) But counting pulses to determine the degree of dampening is a problem (see 1.)?
As you mentioned, the execution of the interrupt code takes about 5us and hence we might miss the next pulse. Why is it only valid for mehtod 1.)
Thanks in advance!!
brandit
Question 3 years ago
can i get code
Question 3 years ago on Step 3
Tell me at the instruction diagram 4700uH (there is a junction є with a capacitor or a throttle)
Answer 3 years ago
Wow, I overlooked that one! Thanks for pointing out. That is a capacitor with 4700µF (4700µH is wrong).
3 years ago
Hi.
Can you please write me down all the components´ function?
Reply 3 years ago
DEar Cyrex44,
I am sorry, but my instructable is about a metal detector. I do understand, that the design is a bit unusual, but with basic electronic knowledge the function of the comonents is easy to understand. If you find it difficult to unterstand, please have a look at some great instructables explaning the function of MOSFET, Resistors, coils, Arduinos and LCD displays.
Tip 5 years ago
What if to keep capacitor off using separate fet and to turn it on after impulse is over? Then turn capacitor on when it begins to decay? Seems to me that right now it works like BFO or induction balance because we are analysing frequency phase shift and amplitude. Right now impulse turns into waves and basically it's not pulse induction anymore. If we would analyse just decay it would probably make sense. Capacitor should help stretch decay.
Let me know your thoughts.
Reply 5 years ago
That this design is indeed BFO-ish came to my mind aswell after my last reply. But, a BFO design with a pretty strong magnetic field to start with. When leaving the the capacitor, then you would be talking about a standard PI detector. As the standard PI-detectors do have the problem of the inverted pulse after switching off the FET, you are back to the standard design with a additional supply voltage (e.g. GoldPic), with a decoupling condenser (e. g. Pirat) or to the Flip-Coil design of my other instructable. As I said, I am working on a (hopefully) better version of this LC-Trap design. hopefully soon to come.
...and if building a real PI, capacitance is one of the things you don't like, because it leads to oscillation.
5 years ago
Here is the schematic. Let me know your thoughts.
Thank you
Reply 5 years ago
Hi ArtemM5,
Thanx for the feedback. The general approach looks interesting.
But bringing in the OpAmp the way you are doing is just adding "comparator". The Arduino itself has a comparator itself already. So unless you are using it as an amplifier this would not improve much from my point of view.
In general: The thing I am not entirely sure about is what the underlying working principle of the LC configuration is.
For the general Pulse Induction (PI) detectors, a magnetic field is created, then "deleted" and the coil listens to "slow" eddy-currents near the coil. In the LC-Trap version I assume, that we are not really listening to "slow" eddy currents but rather changes in the inductivity and damping of the coil (which might be due to creating eddy currents in nearby objects or storing more energy in the magnetic field). Therefore I would suspect, that there are in fact 3 measures to increase the sensitivity.
1. Better detection of the of
frequency shift e.g. by higher resolution (measuring the change of inductance). I am working on that topic, but
still no decent code available.
2. Better detection
of the amount of pulses (change in energy/damping characteristics) e.g. by using an OpAmp and counting the pulses at the
end.
3. Bringing in
more power to increase the effects of 1 and 2.
My
current focus (not very focused though) is to find ways to stabilize and
increase the resolution of the frequency shift detection.
Hope this helps.
Joris
Reply 5 years ago
Thanks for the info. I understand it more now. I will keep experimenting.
Thank you,
Art
Tip 5 years ago
Hi JorBi,
I tried to modify the circuit to have hardware part from pirate Pi. Irf840 mosfet driven by 12volts and tl072 to amplify signal. It works but sensitivity about the same. I believe since it has more power the code needs to be tuned and it might work. I'm still trying to understand how the code works and my programming skills are more like beginner. Did you experimented anymore with circuit/code? Anymore updates?
Thank you,
Art
Question 5 years ago
Hi.....vrishali here....sir can I interface such kind of metal detector to my landmine detection robot?
Reply 5 years ago
Hi Vrishali,
thanks for considering this. Yes, in general speaking that would be possible. BUT: The performance of this detector is not state of the art, probably even to be considered as pretty bad. I have some mineclearance background myself and to my experience you would like to have the best detection capabilities possible, expecially with some low metal content mines like the type 72. There have been quite fierce discussions about what would be better: mine infested countryside with the awereness not to go there or cleared area with a single mine undetected. The peope I spoke to who had their leg blown off by a lindmine, definitely would vote for the first.
I would defineitely encourage you to keep on with the mine detection robot, but please chose for the best options as you are dealing with human lifes. If you are iterested, we could follow up on this discussion outside of instrucables.
Regards,
JorBi
Reply 5 years ago
Thanks jorbi for answer .....I just want to use it for my academic project...which is landmine detection robot.... please guide me which PI metal detector should I use and how much centimetres deep underground metal it could detect..... waiting for your reply...
Reply 5 years ago
I would recommend the Pirat or the SurfPI. Depending on the metal content of the mine and the metal in the support structure of the detector, detection depths of 5-20cm are realistic. This is depending on the soil aswel.
Question 5 years 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!
Answer 5 years ago
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
Reply 5 years ago
Ok, last question (sorry!)
what are the voltage ratings on the capacitors?
Reply 5 years ago
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.