FoxyPI - Arduino Nano metal detector

Homebrew pulse metal detector on Arduino Nano

Similar projects worth following
FoxyPI - motion/non-motion pulse induction metal detector, built on the Arduino Nano 3.0, with audiovisual indication, setting parameters via the menu and ground balancing.

Principle of pulse induction

With a sharp decrease in the current in the search coil, its magnetic flux also decreases sharply. This phenomenon causes the occurrence of eddy currents in the target, penetrated by this magnetic flux. The resulting eddy currents counteract the reduction of the magnetic flux, which is manifested in a change in the voltage curve on the coil and is noticed by the device.

Assembled metal detector


The appearance of the electronic unit:

1 - LCD screen
2 - LED
3 - piezodynamic
4 - control button
5 - LCD backlight switch
6 - power switch
7 - signal strength indication LEDs
8 - voltmeter switch
9 - voltmeter display

Working principle of metal detector

The signal from the search coil connected to the J2 connector, through the current-limiting resistor R2, is supplied to the diodes D1 and D2 connected in parallel, limiting the signal to ~ 1 V.
Such a weak signal for reliable detection needs to be amplified, for which I used the operational amplifier U1 LM358N, included in the traditional non-inverting amplifier circuit.

To process the signal from the search coil, I use the analog-to-digital converter built into the ATmega microcontroller.
To determine the presence of a target, the sum of a given number of sampled signal levels located at equal intervals from each other is calculated in a time window (evaluation window).
Then the integration of the sequence of obtained total values is performed (the integrator is emulated by software). The signal level at the output of the integrator is analyzed in the static mode of the metal detector.
When the metal detector is in dynamic mode, the integration results additionally pass through a high-pass filter, which is emulated by software.
At the filter output, a signal is obtained that characterizes the dynamics of the received signal.
When the output signal exceeds the threshold (the "zero" level set during balancing), the target is considered detected and an audiovisual indication is realized.

In the metal detector circuit, two "earths" isolated from each other:
analog  - grounding icon

digital  - case icon

ASC file for simulation in LTspice XVII - in Files section.

You can play with the parameters and watch, for example, the voltage on the search coil (1), on the opamp input (2), the current in the coil (3):


HEX and ELF files of current version - in Files section

Metal detector operation
The metal detector works in two modes:    

  • static mode (non-motion mode) (default) - the signal level is taken into account, does not require constant coil movement (can be used both for pinpointing the target location and the main search mode);
  • dynamic mode (motion mode) - the dynamics of the signal changes is taken into account, during the search the coil must be moved above the ground surface

When a metal target object is detected, a sound signal of varying tonality sounds and LEDs light up. The signal changes in accordance with the dynamics (in dynamic mode) or the level (in static mode) of the received pulse.

When the detector is turned on, auto-balancing is performed.
In the process of auto-balancing, the optimal initial delay and duration of the analyzed signal are estimated, and the dynamics of the signal (in dynamic mode) or signal level (in static mode) is evaluated. Also, balancing can be started/stopped during operation by pressing the control button. After the end of the auto-balancing, a short beep sounds and the “zero” value is displayed:

Using the button-controlled menu, you can configure the device parameters:

L - pulse duration (μs)
R - pulse repetition rate (pps)
I - integrator coefficient
F - filter coefficient
S - sound (on / off, ON / OFF)
C - display contrast value

Strong interference to the operation of the metal detector is caused by electronic devices operating in the vicinity!
LCD TV interference:

I will expand the description....

Read more »


ELF file (v3.5)

elf - 129.49 kB - 11/11/2019 at 12:33


hex - 45.70 kB - 11/11/2019 at 12:32



ELF file (v3.4)

elf - 127.83 kB - 09/25/2019 at 16:01


hex - 44.65 kB - 09/25/2019 at 16:01



Adafruit license

plain - 1.42 kB - 09/20/2019 at 14:30


View all 7 files

  • 1 × Arduino Nano R3
  • 1 × LM358N Amplifier and Linear ICs / Operational Amplifiers
  • 1 × UF5408 Discrete Semiconductors / Diodes and Rectifiers
  • 1 × Nokia 5110 LCD display
  • 1 × 1N4148 Discrete Semiconductors / Diodes and Rectifiers

View all 12 components

  • Echo of war

    Alexey Voronin09/15/2020 at 06:31 0 comments

    One of the new finds in the garden with a metal detector FoxyPI (after electrolytic cleaning):

    The thickness of the metal (5.5 mm) and the characteristic shape are an echo of WWII. I calculated the inner diameter, which turned out to be approximately 4.3 cm.

  • GUARD parameter

    Alexey Voronin08/03/2020 at 14:42 0 comments

    Influence of the value of the GUARD parameter on the detection range of the golden ring (L):

    GUARD L, cm

    500 ---> 12

    750 ---> 10

    1000 ---> 8

    1500 ---> 7

    It is possible to decrease it even below 500, but in this case false positives may appear.

  • Find

    Alexey Voronin07/15/2020 at 05:09 0 comments

    An interesting find in the garden with FoxyPI - an unusual chrome detail (photo after electrolytic cleaning):

  • Errors

    Alexey Voronin07/08/2020 at 05:44 0 comments

    Errors that may occur during zeroing:

    ERR 01 - the saturation section was not found in the signal:
         * coil break
         * no pulse generation
         * the signal during zeroing is so strong that the saturation region is shifted beyond the registration window

    ERR 02:
         * the signal during zeroing is strong enough so that the saturation region lasts until the end of the registration window

  • FoxyPI firmware v3.7

    Alexey Voronin07/05/2020 at 19:26 0 comments

    FoxyPI firmware v3.7:


    What's new in version 3.7:

    * small code optimization was performed to increase the stability of the metal detector
    + beep indication for errors ERR 01 and ERR 02 added

  • Service menu

    Alexey Voronin06/30/2020 at 12:39 0 comments

    Service menu in firmware v3.6:

  • Firmware v3.6 is ready!

    Alexey Voronin06/29/2020 at 08:33 0 comments

    FoxyPI firmware v3.6:


    What's new in version 3.6:

    + added the ability to configure the guard interval using the GUARD item of the service menu;

    + added auto-tuning of levels 1 and 2 of the audiovisual indication in static mode;

    + integrated test mode (to activate, after switching on, hold the control button until the graph of the signal curve appears)

  • Firmware v3.6

    Alexey Voronin06/29/2020 at 07:12 0 comments

    FoxyPI with firmware 3.6 - golden ring test:

  • Finds with FoxyPI

    Alexey Voronin06/24/2020 at 13:06 0 comments

    Finds in our garden with FoxyPI (after electrolytic cleaning):

  • Voltmeter

    Alexey Voronin06/18/2020 at 15:03 0 comments

    The double-pole switch with locking in the neutral position and the digital LED voltmeter allow you to determine the voltage of the uC/power battery in any mode of MD operation:

View all 16 project logs

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates