Metal Detector

Last spring, I noticed several annoying gaps in the hyacinth patch and I resolved to plant new bulbs to fill those gaps. But bulbs are planted in the fall, when I would have forgotten where the gaps were. Brilliant idea: Stick some ten-inch nails into the gaps and, come the fall, dig up the nails and put bulbs there.

Oops! Come the fall, the nails were really hard to find under all the grass and creeping charlie that had grown all summer. What I needed was a metal detector.

Most metal detectors under $100 are known as BFO (beat frequency oscillator) detectors. They contain two oscillators running at nearly the same frequency. One oscillator's frequency is fixed, while the other one is variable because it is controlled by a large coil that is placed close to the ground. When the coil passes over some metal, its inductance changes — up or down depending on what kind of metal — and that changes the frequency of its oscillator. The outputs of the two oscillators are combined in a mixer circuit, creating two new signals whose frequencies are the sum and the difference of the two inputs. The difference is an audible tone called the "beat note," hence the term BFO.

You tune the detector such that when the large coil is away from any metal, the two oscillators run at exactly the same frequency. Thus, the beat note is an inaudibly low tone. When the coil comes near metal, its frequency changes and the beat note rises in pitch, only to fall again as the coil sweeps past. The pitch is highest when the coil is centered over the metal.

So I set out to build just such a device. The first problem was, I had no way to measure frequencies nor find the value of the frequency-determining coils. That led me to build an inductance meter, described on another page. As a byproduct, the meter can also measure frequency. I expect it to be handy for any number of future projects.

The Arduino Way

Arduino Pro MiniThen, whilst taking a shower — doesn't everybody get their best ideas in the shower? — I realized that the second oscillator is unnecessary. Instead, use a computer, such as the Arduino Pro Mini. This is a $10 version of the popular Arduino Uno, shrunk to fit on a board the size of a quarter.

The beat note described above comes from subtracting two frequencies. With an Arduino, you need only measure one frequency, then subtract a constant — no need to bother with the second frequency. The computed difference controls a tone generator, which happens to be another built-in capability of the Arduino.

In addition, the constant can be re-adjusted from time to time while you are operating the detector. This compensates for temperature changes and other factors that shift the oscillator's base frequency. And, you can revise the software at any time, either to fix a mistake or add a new feature.

Projects always start with a breadboard. Here's mine.
Breadboarding the detector
Click an image to view its enlargement

After the breadboard, the circuit is transferred to a printed-circuit board. Well, a hand-drawn-circuit board; I used Sharpie markers to draw the traces.

Metal detectors are used outdoors, so an enclosure is vital. Plastic boxes are cheap, but metal has its virtues:

Store-boughten metal "experimenter cases" are classy but expensive. Candy tins work just as well, and you probably have several under some dust in the attic or basement. If not, visit a garage sale or two.

Convenient metal case Final circuit layoutThe finished product

For those who are curious, here's the schematic diagram and the Arduino code. As you can see, it's all pretty simple.

The coil is about 50 turns of #28 wire, 12 cm in diameter. (Why 12 cm? That's the size of a case of blank CDs, which I used as a form to wind the wire.) The coil is wrapped in a tin-foil Faraday shield, and the whole mess is stuck to a piece of plexiglas with hot-melt glue. The wand is an old Swiffer mop handle.

Early experiences

The metal detector does work: The beat note changes in the presence of metal. However, it's clear that there's an art to using this thing. For one thing, it doesn't detect just metal; any change in soil properties — moisture, sand-clay ratio, pebbles — affects it.

Still, with a bit of experience and practice, this gadget might actually be useful. I'll find out more when I go hunting for a metal pipe (a support for a removable bird feeder) that I left in the ground a few years ago.

I've already found one possible improvement: Instead of using the calibrate button to set the beat frequency to zero, set it to a medium audio frequency. That way, you can distinguish objects that raise the oscillator frequency (such as non-ferrous metals) from those that lower it. The change is easily made by editing the software and uploading the new program to the Arduino chip.

 

Back to home page