Arduino Based Pulse Induction Detector
Arduino Based Pulse Induction Detector
by JorBi
The Idea
Having build some metal detectors in the past with varying results I wanted to explore the capabilities of the
Arduino in that direction.
There are some good examples of how to build metal detectors with the Arduino, some here as instructables. But
when looking at them, they normally require either quite some external components for the analog signal treatment
or the sensitivity is quite low.
When thinking about metal detectors, the main topic is how to sense the slight changes of voltage in signals
related to the search coil. These changes are normally very small. The most obvious approach would be in using
the analog inputs of the ATmega328. But looking at the specifications there are two basic problems: they are
(often) to slow and the resolution is (in most cases) to low.
At the other hand, the Arduino is running at 16MHz and has quite some timing capabilities i. e. a resolution of
0.0625µS if using clock speed. So instead of using the analog input for sensing, the simplest way of sensing small
dynamic changes in voltage is to compare the change in voltage drop over time at a fixed reference voltage.
For this purpose the ATmega328 has the neat feature of an internal comparator between D6 an D7. This
comparator is able to trigger an interrupt, enabling precise event handling. Leaving beside the neatly coded timing
routines like millis() and micos() and going into the internal timer of the ATmega328 with much higher resolution,
the Arduino is a great basis for metal detecting approaches.
So from a source code view, a good start would be to program the internal comparator for „change“ in polarity of
the inputs and use an internal counter with the highest speed possible for change in timing of the changes.
Of course this idea in not entirely new. The main part of this code can be found elsewhere. A good implementation
such an aproach for a microcontroller found for on TPIMD - Tiny Pulse Induction Metal Detector home page.
The idea is to use the Arduino as a Pulse Induction (bottom of the drawing)
detector, like in TPIMD, as the timing idea of the
decay curve seems to work pretty well. The problem This positive curve can than be used via the
with Pulse Induction detectors is, that they normally comparator to detect the point of time where the
need to different voltage to work. One voltage to decay voltage „crosses“ a reference voltage. In case
power the coil and a separate voltage to deal with the of treasures near to the coil, the decay curve changes
decay curve. These two voltage sources make pulse and the point of time crossing the reference voltage
induction detectors always a bit complicated. changes. This change can than be detected.
Looking at the voltage of the coil in a PI detector, the After some experimenting the following circuit proved
resulting curve can be devided in two different stages. to work.
The first stage is the pulse itself powering the coil and
building up the magnetic field (1). The second stage The circuit consists of an Arduino Nano module. This
the is voltage decay curve, starting with a voltage module drives two MOSFET transistors powering the
peak, then ajusting fast to the "no-power" voltage of coil (at SV3) via D10. When the pulse at D10 ends,
the coil (2). The problem is, that the coil changes its both MOSFETs isolate the coilfrom 12V and GND.
polarity after the pulse. Is the pulse positive (Var 1. in The saved energy in the coil bleeds out through R2
the attached picture) the decay-curve is negative. Is (220 Ohms). At the same time R1 (560 Ohms)
the pulse negative, the decay curve will be positive connects the former positive side of the coil tho GND.
(Var 2. in the attached picture) This changes the negative decay curve at R5 (330
Ohms) to a positive curve. The diodes protect the
To solve this basic problem, the coil needs to be input pin of the Arduino.
„flipped over“ electronically after the pulse. In this
case the pulse can be positive and the decay curve R7 is a voltage devider at about 0.04V. At the
can be positive as well. moment the decay curve at D7 gets more negative
than the 0.04 at D6 an interrupt is triggert and the
To achieve this, the coil must be isolated from Vcc duration after the end of the pulse is saved.
and GND after the pulse. At this moment, there is
only a current flowing through a damping resistor. In case of metal near to the coil, the decay curve lasts
This isolated system of coil and damping resistor can longer, and the time between the end of the pulse and
than be „oriented“ to whatever reference voltage. the interrupt gets longer.
This, in theory will create the combined positive curve
Building the detector is quite easy. This can be done Vcc – 5V (at the Arduino pin, not the supply
either on a breadboard (sticking to the original circuit) voltage!!!)
or by soldering the parts on a PCB.
GND – GND
The D13 LED on the Arduino Nano board is used as
an indication for metal SCL – A5
As for soldering I do not really like double sided high- 3. the supply voltage for the voltage-divider at D6 is
tech PCB, so I modified the circuit to fit on a on sided given by a HIGH level signal at D8
PCB.
4. driver pin for the MOSFETs was changed.
Following modifications were made:
This way a single sided PCB could be created which
1. the diodes were left out. can be soldered on universal PCBs. Using this circuit
you will having a working PI detector with only 8-10
2. the gates of the MOSFETs got a resistor of 10 external components (depending if the OLED display
Ohm and/or a speaker is used).
If the detector is build properly and the program is For my setup (coil: 18 turns @ 20cm) the stable value
written to the Arduino, the easiest (if not the only) way is around 630-650. Once set, press the reset button,
of setting the unit up is to use an OLED display. The the unit re-calibrates and all tree values should be in
display is attached to 5V, GND, A4, A5. The display a same range again. If metal is now brought to coil,
should show „calibrating“ after the unit is powered up. the LED on the Arduino-Board (D13) should light up.
After some seconds it should say „calibration done“ An attached speaker gives some clicking noises
and three numbers should be shown on the display. (there some room for improvement in the
programming there).
The first number is the „reference value“ identified
during calibration. The second value is the last To prevent high expectations:
measured value and the third value a a mean-value of
the last 32 measurements. The detector does detect some stuff, but it stays a
very simple and limited detector.
These three values should be more or less the same
(in my test-cases under 1000). The middle value To give an impression of the capabilities, a did some
should be more or less stable. reference detections with different other detectors.
Looking at the results, it is still quite impressive for a
To start the initial set up, there should be no metal detector with only 8 external parts but not matching
near to the coil. professional detectors.
Now the voltage divider (trim potentiometer) should Looking at the circuit and the program, there is a lot of
be trimmed so that the lower two values should be set room for improvement. The values of the resistors
to a maximum while still giving stable reading. There were found by experience, the pulse time of 250ms
is a critical setting, where the middle value starts was chosen randomly, the coil parameters as well. If
giving weird readings. Turn back the trimmer to obtain you have ideas for improvements, I would be more
stable values again. than happy to discuss them.
It might happen, that the display freezes. Just press Have fun!
the reset button and start over.
1. Pirat
Pulse
Induction
Arduino Based Pulse Induction Detector - Flip Coil: Page 7
Induction
Detector
Download
http://www.instructables.com/ORIG/FO8/ZOMB/J86HTGET/FO8ZOMBJ86HTGET.ino
…
The second value shows the actual delay value of the 1 -> 18 turns @ 200mm
decay curve. This value is normally not that
interesting, but is needed to the initial setup of the 2 -> 25 turns @ 100mm
detector.
3 -> 48 turns @ 100mm
The program now allows for multiple pulse durations
in a sequence (means of experimenting / improving Interestingly all coils worked pretty well, with almost
the performance). I did not achieve any break the same performance (20ct coin at 40-50mm in air).
through. So default is set to one pulse duration. This might be a quite subjective observation.
Thanks for hinting me. That's rather unfortunate, as the description and the circuit was quite nice. I
changed the decription and gave a hint to an alternative way finding the circuit.
No worries