Can I build a working metal detector from what's in my junk box?
To make the experience fit your profile, pick a username and tell us what interests you.
As mentioned in the last post, I have some ideas about improvements to the circuit. I haven't tried any of these out (and won't be able to in the immediate future since school's starting again), I wanted to write them down anyway.
I think that there are three areas for possible improvement:
I'm not going to go to deep here, basically BFO detectors aren't a super good way of making a metal detector, and if I was going to build a metal detector 'for real' I'd order parts so that I could build a different architecture. @mircemk has a number of metal detector projects posted that use non-BFO architectures, and seem to achieve better results than what I was able to get. If you need a better metal detector start looking there.
I didn't try to optimize the coil design at all while I was building. I think if one knew more about coil design one could probably come up with a better design, but I don't so there's not much for me to comment on here.
( I did try to get the master oscillator frequency as low as possible, since it felt like a lower frequency should 'go farther into the ground' but I wasn't able to get the colpitts oscillator working at frequencies below ~120 kHz with the parts that I had on hand, and I don't actually know if lower freq is better.)
that leaves only one area for improvement on which I can comment. As a refresher; here's the circuit I went with:
The sense oscillator and BFO designs actually both worked reasonably well in isolation. The only issue is that when the 555 timer shares power rails with the colpitts oscillator the two oscillators tend to couple when the sense oscillator drifts to a frequency near the beat frequency. This is a problem since it means that minimum difference frequency generated by the mixer is limited to how close you can bring the two oscillators without them coupling. In practice this means that the operator hears a pretty high pitched whistle, small variations in which are hard to discern. I think if you could get the oscillator frequencies closer (thereby making the whistle pitch lower) it would be easier to discern small variation, essentially making the detector 'more sensitive'.
I'm not entirely sure how one would go about decoupling the two circuits however. Decoupling caps on the 555 certainly help, but the circuits still couple a bit. I think that moving the circuits farther apart, and possibly trying to separate ground connections/planes might improve coupling a little as well.
Barring better layout I think you could perhaps just run the two oscillators on different batteries, but then getting the sense signal across to the other power domain could be a bit difficult...
The other obvious area for improvement is the FET mixer. I didn't really design this circuit, so much as just stick stuff into a breadboard until things worked enough. Eventually I did end up spending an afternoon messing around in LTspice, and came up with the following as an improvement for the mixer:
A quick FFT gives us an idea of how poorly my initial design works:
Basically it seems like the newer mixer design could provide a higher level output, which would likely result in the operator being more able to discern...Read more »
I built the metal detector with the intention of using it to find a surveyor's pin in the bush near my parents cabin, so did we find the pin?
found some (iron rich?) rocks that set off the metal detector though.
We were unable to find the surveyor's pin for a couple reasons:
We know for sure that there is a metal stake driven into the ground on one corner of the property, supposedly put there by a surveyor, since we've found that stake previously. As a result we assumed that there would be a surveyor's pin on all of the corners of the property. However, after an unsuccessful search for it we did a bit more research, and it seems like pins are only placed if the property owners request a survey for and no pins were placed when the government initially surveyed the land as we had assumed. Therefore, it seems like there is a pin in the opposite corner of the property since the far neighbour must have done a survey at some point and driven a stake then. Since the property line that's under dispute is between us and the near neighbour it seems like there's probably never been an official survey, and there is likely no pin to look for.
Additionally, the ground near were the corner is supposed to be according to the government maps of the area is pretty rocky, and as a result its probably not possible drive a steel peg into the ground there anyway. In talking to some other people afterwards I've also heard that surveyors can sometimes use naturally occurring landmarks (such as large identifiable rocks) instead of a pin, so its possible that even if a survey had been carried out there wouldn't be a pin left.
So while my failure to find a metal object that doesn't exists isn't entirely my fault, I think that there is still a lesson to be learned here which is: make sure the solution you've come up with is actually a solution to the problem at hand...
Taking electronics outside is always way more of a challenge than I think its going to be, batteries run out faster than I think they will, things that felt light inside start to feel pretty heavy after 15 minutes of walking around, displays are hard to read in sunlight, wires get knocked loose, and on and on and on...
Metal detecting is apparently no exception. First of all, hiking with the detector turned out to be a lot more work than I thought it was going to be. I figured that since it was lighter than my backpacking backpack it should be easy to hike with. What I didn't realize was how often I'd use my hands for balance on uneven ground, and how much carrying something that's delicate and awkwardly shaped effects that. As a result just hiking with the metal detector was a more challenging than I'd anticipated.
The other big problem is that it turns out to be sort of difficult to swing something around in a forest because you keep hitting trees (revolutionary I know). I think if I cared less about just whacking the detector coil into things it wouldn't be so bad, but I spent a lot of time being careful not to smack things since I was worried that I'd break some part of the metal detector. I think this problem could probably be mitigated by a more robust mechanical design, but hey, I used what I had on hand.
For being built over a couple of evenings out of random junk, with basically no plan in mind, and no prior experience building metal detectors I think that the metal detector work surprisingly well. Unfortunately, 'working surprisingly well for something made from literal garbage'...Read more »
Once I had the electronics built and in a box I needed a frame to hold them all. The major requirements were:
I had a broom handle, some pvc pipe and fitings, and a handle from an old drill lying around and they seemed like they'd work for the handle/frame. Rather than explaining how everything fits together here's a pic of the assembled frame:
To attach the sense coil to the end of the pvc pipe I needed a way to join the HDPE drywall bucket lid to the pvc pipe, at a useful angle. To mount the lid at an angle I built a bracket thing out of some pvc faux-wood trim (available at home-depot if you don't all ready have it laying around), which is neat because you can work it like wood, but it glues to pvc pipe with normal plumbing glue. Here's a picture of the bracket thing before I glued it together:
the above two images should give a good idea of how it fits together.
Finally to attach the sense coil, I used a couple of plastic bolts from a toilet seat. This let me bolt the HDPE lid (blue) to the pvc (white) without gluing, or using metal fasteners right in the middle of the sense coil.
That's it for the build, so, did it work?
There are two major issues with the circuit (and a bunch of minor issues):
ideally the frequency of the BFO and the sense oscillator would be completely independent, however, the two circuits are built close together and share a ground node, and so some amount of coupling is inevitable.
This coupling is mitigated by the decoupling capacitors on the 555 timer's power rails, but as you can see in the fig above, the sense oscillator does still lock onto the BFO when the frequency difference is small. This is a problem since it means that the frequency difference between the BFO and the sense oscillator can't be minimized arbitrarily, and since it's easier to hear an e.g. 10% variation in audio frequency when the tone is low pitch than when its high pitch this effectively means that the operator's ability to discriminate between a hit and a miss is diminished.
This is pretty dumb, but basically the way that volume control is implemented is by changing the size of a voltage divider that feeds the amp. This changes how the mixer is loaded, which in turn causes the mixer products to shift in frequency by a couple hundred Hz, which effectively means that adjusting the volume also throws the device out of tune. In practice this isn't too annoying to deal with, since it just means that you have to set the volume first, and then tune the device, but it sure is sloppy design work.
Here's the device's circuit in all its ugliness:
The sense oscillator is a garden variety Colpitt's oscillator, based around a 2n3904. With the component values above, and the coil I wound it oscillates at a frequency of approximately 136 kHz. The coil in the tank circuit is the device's primary sensor, and was constructed by winding magnet wire around the edge of a drywall bucket lid. The magnet wire was salvaged from an old fluorescent lamp ballast, which are apparently just giant inductors.
To make the coil I pried apart the lamp ballast, hack sawed the core apart, dug out the magnet wire, and then wound ~27 turns around the drywall bucket lid. No idea what gauge the wire is, but the finished coil has a resistance of 8 ohms, so its pretty low Q. the diameter of the coil/bucket lid is approximately 307mm.
some picture of the lamp ballast and coil:
The BFO is a simple 555 timer astable circuit. It includes a diode across pins 7 and 6 to equalize the charge and discharge cycles so that the output is a square(ish)wave. I also have a potentiometer connected to pin 5, which provides a bias voltage to the threshold comparator. This potentiometer is the device's tune knob. Basically by adjusting the BFO frequency one can set the output tone that is heard in the earphones. With the values in the circuit above I was able to get the BFO to go from ~119 to 150 kHz, which allows the operator to get the BFO frequency on either side of the sense oscillator frequency. This means that the operator can tune the device such that metal is detected as either a lowering pitch or an increasing pitch, depending on if the BFO freq is above or below the sense freq.
Note the decoupling capacitors on the 555. These need to be placed as close to the 555 as possible, and are responsible for stopping the BFO from coupling to the sense oscillator. Without these capacitors I found that the BFO would overwhelm the sense oscillator and the sens oscillator would just end up oscillating at whatever frequency the BFO was running at, which completely stops the circuit from working.
The mixer is easily the worst part of the design. Rather than going with a proper design I just kludged stuff together on my breadboard until I got the output I wanted on the scope screen. Don't build this circuit, or at least do some spice sims first to try and get some better component values.
The basic idea is that the BFO (which is a square wave) gates the sense oscillator (which is a sinewave), and this produces a harmonic at |f_BFO - f_sense|. The attenuation resistors were hacked in last minute to try and stop the audio amplifier from producing an earshatteringly loud noise, and I definitely should have just adjusted the amp gain rather than attenuate my input signal but I did this in a hurry.
The trim pot is there because I didn't want to work out bias network values, and instead I just aligned the circuit by checking the mixer product on my scope and spinning the trimmer until the signal reached a maximum.
The amp is literally the reference circuit for the LM386, but with some component value substitutions based on what I had on hand. Instead of building a proper LPF I just pretended that the LM386/headphones/my ears, would filter out the higher order harmonics enough. This 'works' but the output signal is still pretty awful to listen too. Again the name of the game here is fast and bad, and this is that.
After a bit of reading online I determined that there were a few different types of metal detector:
There are a lot of terrible explanations of how the different types of metal detectors work, and there are a lot of simple "science kit" circuits out there, most of the best explained projects I found were here on hackaday.io. I kinda just read as much as I could, and experimented with the parts that I had to get a feel for the different technologies. Here's brief summary of what I found:
These use some black magic to work, and seem well beyond the limits of the stuff in my parts bin/the time I had, since they usually seem to require a microcontroller and I didn't want to spend a lot of time writing code, or trying to build someone else's project. I didn't even try to experiment with a PI detector.
These seem simple enough, and there are circuits out there that people claim work, such as this frustratingly simple 555 timer based design https://blog.circuits4you.com/2015/07/metal-detector-circuit.html.
The basic description is that the transmit coil is connected to an oscillator, and that the receive coil is connected to an amplifier/pulse detector. The complicated part is that the coils are some how arranged (with the aid of shielding) such that the RX coil is only weakly coupled to the TX coil when no metal is present, when metal is nearby the RX coil couples more strongly to the TX coil and a signal is detected.
The difficult part is arranging the coils such that RX is mostly shielded from TX. For all my experimentation I could not find an arrangement that worked. I could either get complete coupling between the coils, in which case the circuit was basically a transformer and not sensitive to metal, or I could get absolutely no coupling and no sensitivity to metal at all.
eventually I gave up on getting an IB detector to work as well, which leaves us with the final option:
A BFO detector works by setting up a harmonic oscillator (e.g. Colpitts) such that the sense coil is part of the tank circuit. Thus when metal is brought nearby the sense coil the inductance of the sense coil changes, which in turn changes the resonant frequency of the oscillator.
The main oscillator is then mixed with another local (Beat Frequency) oscillator that is tuned to nearly the same frequency as the sense oscillator, the slight difference in frequency between the sense oscillator and the BFO is down shifted into the audio spectrum, where it is heard as a constant tone.
When nearby metal detunes the sense oscillator the relative difference between the BFO and the sense oscillator changes, which results in the frequency of the mixer product changing, which is heard as a shift in pitch of the tone in the earphones.
A block diagram and frequency spectrum:
This is the simplest type of metal detector (and probably also the worst), and the stuff in my parts bin was conducive to this design, so that's what I ended up going with.
In the next log I'll show the circuit I came up with
Become a member to follow this project and never miss any updates