Here's how you can configure a comparator in various ways to provide simple and cost-effective detection of external accessories like jacks, headsets, and hook switches in portable applications.
Electret microphones
A typical electret microphone (
Figure 3) has a condenser element whose capacitance varies in response to mechanical vibrations, thereby providing voltage variations proportional to the sound waves. Electret microphones have a permanent, built-in static charge, and therefore require no external power source. They do, however, require a few volts to power an internal preamplifier FET.
Figure 3. Electrical model of an electret microphone.
The electret microphone appears as a constant-current sink that provides very high output impedance. Its high impedance is then converted by the FET preamplifier to the low impedance necessary for interface with the subsequent amplifier. Thus, the electret microphone's low cost, small size, and good sensitivity make it a good choice for applications such as hands-free cell-phone headsets and computer sound cards.
The microphone is biased through a resistor (usually 1kΩ to 10kΩ), and a supply voltage that provides the necessary constant-bias current. This bias current ranges from 100µA to about 800µA, depending on the particular microphone and its manufacturer. The bias resistor is selected according to the applied supply voltage, the desired bias current, and the required sensitivity.
Based on these factors, the necessary bias voltage varies from part to part and with the operating conditions. A 2.2kΩ load resistor with 3V supply, for example, drawing 100µA, develops a bias voltage of 2.78V, yet a similar resistor drawing 800µA under similar conditions develops a bias voltage of 1.24V.
To detect the type of headset connected, refer to Figure 4, in which a 2.2kΩ Mic-bias resistor connects to a low-noise reference voltage from the audio controller (VMIC-REF):
Figure 4. Comparator circuit used for headset detection.
On insertion of an audio jack, this VMIC-REF voltage is applied via the 2.2kΩ RMIC_BIAS resistor to the tip-to-ground resistance (not shown), producing the voltage VDETECT at the non-inverting input of the MAX9063. This resistance can be small for stereo headphones (8Ω, 16Ω, or 32Ω), or high due to the microphone's constant-current sink, which ranges from 100µA to about 800µA according to the type of microphone. Because VDETECT varies with the model of headset plugged in, you can detect the headset type by monitoring VDETECT with a comparator.
Assuming the µC reference voltage (VMIC-REF) to be 3V as shown, a 32Ω headphone load produces 43mV at VDETECT. A constant 500µA microphone load, on the other hand, produces 1.9V. Note that a direct interface for VDETECT can be challenging in most practical cases. Assuming that the CMOS inputs of a typical µC port demand logic levels above 0.7×Vcc and below 0.3×Vcc, the input logic for a controller operating with 3.3V supply should be above 2.3V and below 1V.
A 1.9V level generated by a 500µA microphone load doesn't qualify as a valid logic 1. Microphone bias currents from 100µA to 800µA generate VDETECT levels from 2.78V to 1.24V, and any voltage below 2.3V violates the controller's VIH specification (input high level, assuming 2.2kΩ for RBIAS). To get 2.3V or above, the microphone bias current must be 318µA or less. Otherwise you must change the 2.2kΩ bias-resistor value, which in turn changes the sensitivity point of the microphone. Generating logic lows of 1V and below is easy, because headphones with typical 32Ω loads can easily pull the level close to ground.
To detect the type of headset connected, you therefore feed VDETECT to one input of a comparator and a reference voltage to the other. The comparator's output state then represents the type of headset.
The comparator for this portable headset-detect application should be tiny, and consume little power. The one shown in Figure 4 is just 1×1mm (Figure 5), and draws a maximum supply current of only 1µA.
Figure 5. Size comparison for 1-1mm 4-bump comparator (MAX9063).
Its strong immunity to cell-phone frequencies provides high-reliability operation. It also has internal hysteresis and low input bias currents. These features make it a good choice for headset detection in space-sensitive, battery-operated applications like cell phones, portable media players, and notebook computers.