Sometimes I am amazed by the ingenuity of a circuit.
I had such a moment when I first saw a 1997 application note for the PIC12C series of 8 pin microcontrollers called ‘Using PIC12CXXX as a Sensor Interface for Metal Detection’ by Vladimir Velchev of Bulgaria.
An entry for Microchip’s ‘Designing for Dollars’ competition.
The very clever bit is that Velchev cunningly replaces the microcontroller’s external crystal with a parallel LC tank circuit, where the L is the coil of a metal detector.
This means the processor clock frequency is determined by the coil inductance, which is affected by nearby lumps of metal.
A time reference independent of the clock frequency is provided by charging and discharging a capacitor through a resistor and one of the processor I/O pins – which is switched to be an input to sense charge state.
In operation, a push-button reset causes the CPU to count up for one capacitor period.
This value is stored.
Then it repeatedly re-counts the capacitor period, each time comparing the resulting value with the value stored just after reset.
The difference in values between the first and subsequent counts is related to the metallic environment of the coil and can be used to flash LEDs or operate a sounder.
The operator simply pushes the reset button when ever drift has gone too far, or to directly compare two different search points.
I can no longer find the circuit on Microchip’s website, but Velchev’s PIC design is available here.
Picture – NBP Gold by covilha, under Creative Commons Licence