The circuit for this project consists of an LC oscillator with a frequency of around 4 MHz and a PIC microcontroller which can count the oscillations. The inductor is a detector coil, with an inductance that changes slightly in the presence of metal. The PIC's PWM output is connected to a small current buffer amplifier so that the metal detector can be used without being attached to a computer.
The microcontroller is responsible for counting the number of oscillations over a fixed period of time. When audio output is enabled, the firmware automatically calibrates itself - adjusting the expected count, the deviation from which the frequency of the audio output is derived.