Maker Pro
Maker Pro

Metal detector linking to Pic problem

wingnut

Aug 9, 2012
255
Joined
Aug 9, 2012
Messages
255
Hi all

I built this simple metal detector found at http://www.talkingelectronics.com/html/MetalDetector.html

It worked fine, based on a Colpitts oscillator principle, but requires an am radio to heterodyne with it to produce audible noise.

I hoped to use a Pic16f677 to read the signal from the oscillator, and have had some success by linking the emitter to the analog input pin of the Pic. I do get a frequency on the Pic, but it seems to vary and drift. Although I can hear from the radio that the metal detector is working, the frequency does not seem to reflect this on the Pic. I can hear the frequency of the oscillator drifting over various frequencies on the radio. I would welcome any suggestions on how to make the circuit more stable or whatever else I might be doing wrong. I always appreciate any and all help which you kind folk provide.

Attached is the circuit diagram. The circuit worked better without the top 1n capacitor in parallel with the coil, so I left this out completely.
 

Attachments

  • Metal_Detector-1cct.gif
    Metal_Detector-1cct.gif
    4.6 KB · Views: 173

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
If you remove the capacitor from across the search coil, the circuit will oscillate at a much higher frequency than it should. The design frequency is 140 kHz according to the description.

The PIC can't sample its analogue input fast enough to capture such a high frequency accurately. You can undersample, but I think your best option would be to amplify the signal and feed it into a timer-capable input.

You could use a timer in the PIC to divide the frequency down, and capture a free-running counter value when the divider overflows. If you set the division so the overflow happens, say, around 10 times per second, you will get a fairly accurate and high-resolution indication of the frequency.

Alternatively, you could feed the signal into an input capture input, and count the number of input captures over a certain time period (timed using an independent counter).

How do you plan to generate an output signal from the PIC? Do you want a tone like you get from a transistor radio?

A common emitter amplifier stage with its input coupled to the emitter of the oscillator via a capacitor and series resistor should give you a clean enough signal to feed into a PIC input pin. What do you think?
 
Top