A Simple Arduino Metal Detector


In the early-days of metal-detecting, a simple type of metal-detector called a BFO (Beat Frequency Oscillator) detector was commonly used. It doesn’t work as well as more modern designs, but it’s quick, and easy, to build, and you may find it good enough for beach-combing for coins or rings.

A BFO detector traditionally consists of two inductor/capacitor oscillators. The first oscillator resonates using the search coil as an inductor.  While the second oscillator uses a separate inductor, and is tuned to the same frequency as the first. We’ll call the oscillators ‘search’ and ‘reference’.

The audio output of a BFO detector is derived by taking the difference in frequency between the search and reference oscillators.  When no metal is near the search coil, the frequency difference between the two is zero, so you don’t hear anything.

Bringing a piece of metal the search coil, changes the inductance, and hence the resonant frequency of the search oscillator. Now the difference between the reference and search oscillator is no longer zero, it could be 300hz, for example, so you hear a tone.

In this design, rather than use the traditional reference oscillator, we use an Arduino to measure the frequency of the search oscillator and when the Arduino detects a frequency change,  it can turn on a LED, or a buzzer, to indicate that a metal object has been detected.


This circuit is a simple Colpitts oscillator with the resonant circuit comprised of C2, C3 and SEARCH_COIL.  This oscillator will have a frequency of approximately 260khz. ( Colpitts calculator )

The peak amplitude of this oscillator can be too high for the Arduino to measure, and if we connected it directly, would cause damage to the micro-controller.  Zener diode D1 is used to limit the voltage on the Arduino pin to a safe 4.3V.  C5 and R4 ensures the output of the oscillator is referenced to ground.

The Search Coil

Any coil with an inductance around 200-400uH should work, and you should try and keep the resistance fairly low.

This will give you a frequency around 200-400 khz, which falls within a range the arduino can handle.

Keep in mind that larger coils will detect larger objects deeper in the ground, but small coils will be better for small items, coins, rings, and the like.

You can use this table as a guide:

Size Shape Turns Wire size Inductance Resistance
Ø 120 mm Round 36 Ø 0.40 mm / 0.14 mm2 405 µH 1.9 Ohm
Ø 150 mm Round 31 Ø 0.40 mm / 0.14 mm2 394 µH 2.0 Ohm
Ø 175 mm Round 28 Ø 0.40 mm / 0.14 mm2 387 µH 2.1 Ohm
Ø 200 mm Round 26 Ø 0.40 mm / 0.14 mm2 406 µH 2.2 Ohm
Ø 250 mm Round 22 Ø 0.40 mm / 0.14 mm2 380 µH 2.3 Ohm
Ø 300 mm Round 20 Ø 0.50 mm / 0.20 mm2 390 µH 1.6 Ohm
Ø 400 mm Round 17 Ø 0.50 mm / 0.20 mm2 396 µH 1.8 Ohm
Ø 500 mm Round 15 Ø 0.50 mm / 0.20 mm2 400 µH 2.0 Ohm
1.0 x 1.0 m Square 10 Ø 0.66 mm / 0.34 mm2 406 µH 2.0 Ohm
1.4 x 1.4 m Square 8 Ø 0.66 mm / 0.34 mm2 387 µH 2.2 Ohm
1.8 x 1.8 m Square 7 Ø 0.80 mm / 0.50 mm2 398 µH 1.7 Ohm


At a high level, the code in this design performs the following steps:

  1. At startup, count how many pulses occur in 100 milliseconds, store this as baseline.
  2. In the main loop:
  3. Count how many pulses occurred in 100 milliseconds, store this as count.
  4. If count has changed from the baseline in turn on a LED.

We also perform the following steps in the main loop which slowly adapt the baseline to the present conditions:

  1.  If count is greater than baseline, increment baseline.
  2. If count is less than baseline, decrement baseline.

Luckily for us, we can use the FreqCount library to count the number of pulses in an interval, leaving the rest of the code relatively simple.

You can download the source code for this project here: Download Code


As mentioned in the introduction this detector doesn’t work particularly well, but it may be useful for some tasks,  the simplicity of the circuit means there’s not much time investment in building it. It could perhaps find use for beach-combing, stud-finding, finding cables or pipes behind dry-wall, or other ‘light’ uses.


Some Hints

Oscillator Voltage

If you have an oscilloscope handy, it may be worth checking the voltage at the collector of the transistor. You should see a fairly clean sine-wave at around 1.5X the supply voltage.

If the voltage is too high, the wave-form will be clipped, and you should reduce the capacitance of C1 a little to reduce the oscillator’s gain. If the voltage is too low, you should increase C1 a little.

Arduino Pins

Which pins you can use to measure frequency changes for each type of Arduino, I used a nano, you’ll have to read the FreqCount library documentation to determine which pins you should use for yours.

Arduino Input Voltage

For the Arduino to count the pulses from the search oscillator, the voltage at the Arduino pin needs to go above and below 3V.  If you find the voltage is too low, you can increase the capacitance of C5, or the resistance of R4 a little bit.  By the same token, you could also reduce C5 if too much current is flowing through the protection zener D1.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s