This article was also featured in Maxim's Engineering Journal
, vol. 65 (PDF, 756kB).
A similar article appeared in Audio DesignLine
, November 2008.
A common feature in most of the electronic devices used today (cell phones, PDAs, notebooks, handheld media players, game systems, etc.) is the provision for connecting external accessories. The devices, therefore, include dedicated logic circuitry not merely to detect the presence of an accessory, but to identify its type so the internal control circuitry can adjust accordingly.
Adding circuits to implement the autodetection/selection function can increase a system's power budget, and that is a problem. As designers, we need to minimize the power budget to ensure that the systems deliver the "greenest" possible solution with the smallest footprint. To that end, tiny, ultra-low-power comparators such as the MAX9060 series offer the best solution in the semiconductor market. These comparators are key to helping designers stay within their power-consumption budget.
Hardwiring Detects the Presence of a Jack
We begin with a quick review of the basics of automatic jack detection.
Consider a typical headphone-socket circuit (Figure 1
). Connecting a pullup resistor to the detect pin, as shown here, generates a signal to indicate the presence of a headphone or other external device. In a typical connection, the detect pin is disconnected if an external device is inserted.
The output signal is pulled high when no jack is present and pulled low when the jack is inserted. This detect signal is routed to a microcontroller port, which can then autoswitch the audio signal between a loud speaker (headphone absent) and the headphone speakers (headphone present).
A simple transistor can buffer the detect signal before it reaches the microcontroller input. The transistor also provides any level translation necessary for interfacing with the controller. In space-constrained applications like cell phones and PDAs, a small transistor packaged no larger than a couple of millimeters is preferred. Buffering and level translation can also be implemented with low-cost, low-power comparators in ultra-small packages. Members of the MAX9060 family, for example, come in 1mm × 1mm chip-scale packages and consume just 1µA of current.
Figure 1. An automatic jack-detection circuit.
The audio socket in Figure 1 is designed to handle the popular three-conductor audio plug. This plug connects either to a stereo headphone or a mono headset with microphone. You can easily differentiate between the stereo and mono-plus-microphone headset by using the circuits discussed below. These circuits leverage the fact that headphone resistance is low (usually 8Ω, 16Ω, or 32Ω) and that microphone resistance is high (600Ω to 10kΩ).
A brief introduction to the common audio jack and the electret microphone is helpful in understanding these circuits. In a three-conductor audio jack (Figure 2
), the "tip" carries the left-channel audio for a stereo headphone or the microphone connection for a mono headset with microphone. For stereo headphones, "ring" connects to the right channel and "sleeve" to ground. For a mono headset with microphone, ring connects to the input audio channel for the mono microphone and sleeve connects to ground.
Figure 2. A three-conductor audio jack.
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. An 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 interfacing with the subsequent amplifier. Thus, the electret microphone's low cost, small size, and good sensitivity make it a good choice for applications like 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 operating conditions. A 2.2kΩ load resistor with 3V supply drawing 100µA, for example, develops a bias voltage of 2.78V. 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
. Here a 2.2kΩ RMIC-BIAS
resistor connects to a low-noise reference voltage from the audio controller (VMIC-REF
). When an audio jack is inserted, this VMIC-REF
voltage is applied through RMIC-BIAS
to the tip-to-ground resistance (not shown), thus producing the voltage VDETECT
at the noninverting 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, the headset type is detected by monitoring VDETECT
with a comparator.
Figure 4. A comparator circuit used for headset detection.
Assuming that the microcontroller's reference voltage (VMIC-REF
) is 3V as shown, a 32Ω headphone load produces 43mV at VDETECT
. A constant 500µA microphone load, however, 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 microcontroller port demand logic levels above 0.7 × VCC
and below 0.3 × VCC
, then the input logic for a controller operating with a 3.3V supply should be above 2.3V and below 1V.
A 1.9V level generated by a 500µA microphone load does not 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 a logic low 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 input. 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 comparator in Figure 4 is just 1mm × 1mm and draws a maximum supply current of only 1µA. Its strong immunity to cell-phone frequencies provides highly reliable operation. The comparator also has internal hysteresis and low-input bias currents. These features make it an excellent choice for headset detection in battery-operated, space- and power-sensitive applications like cell phones, portable media players, and notebook computers.
Most hands-free headsets include a switch, usually known as a hook switch, that accepts and ends calls; provides the MUTE/HOLD function; and holds an ongoing call while receiving a second call. The microcontroller controlling the headset needs to detect the status of the hook switch and the presence of the headset. The jack (hence the headset) can be detected automatically (Figure 1). A signal for the hook-switch status can also be generated.
Status-detection circuitry for the hook switch comprises a 4-connecter stereo headset with microphone and a parallel hook switch (Figure 5
). (A mono headset is similar, but has a 3-pin connector.) In both headset types the tip is connected to the microphone in parallel with the hook switch. As shown, the hook switch presents a low resistance when pressed, and a high microphone resistance when open. As with the headset detection explained above, an interface between the headphone-detection voltage and the CMOS inputs of the microcontroller can complicate the circuit design for microphone/hook-switch detection.
Figure 5. Hook-switch detection circuitry using the MAX9063 comparator.
The voltage VDETECT
(Figure 5) is pulled close to ground when the hook switch is pressed, and interpreted as logic 0 by the microcontroller. When the hook switch is open, however, VDETECT
may violate the VIH
spec for the CMOS inputs. Those VDETECT
inputs can vary between 1.24V and 2.78V, depending on the value of RMIC-BIAS
(2.2kΩ in this case) and the type of microphone in the headset.
Thus, a direct interface between the hook switch and the controller is not possible for all microphone types. Instead, a low-power comparator can be used as in Figure 5. Here the reference level is set to detect a given type of microphone, while also indicating the status of the hook switch. The comparator output is pulled high when the hook switch is pressed, and pulled low when the switch is open. Again, the MAX9060 series of comparators provides a low-power solution for these hook-switch-detect applications.
The scope shot of Figure 6
is triggered by pressing the hook switch of a mono headset. The setup is identical to that of Figure 5, but a 2.5mm universal headset for cell phones is used for the test. The headset tip has an electret microphone with hook switch and 32Ω speaker connected to its ring. That microphone draws a constant bias current of 212µA when powered with a 3V supply through the 2.2kΩ bias resistor.
Figure 6. These waveforms are taken from an electret microphone with hook switch, controlled by a mono headset and its internal control circuitry. When the hook switch of a mono headphone is pressed, the comparator detects the shorted microphone, thereby allowing its output to be pulled to a logic high.
The DC voltage observed at VDETECT
is 2.52V (Figure 6), which causes the MAX9063's output to assert low. Pressing the hook switch grounds VDETECT
, allowing the output to be pulled high by an external 10kΩ pullup resistor. Thus, the MAX9063 comparator in its tiny 1mm × 1mm CSP package is well suited for detecting hook switches and accessories. The MAX9028 comparator family is also suitable for these applications.
There is a common need for detecting jacks, headsets, and hook switches in portable applications. Dedicated comparators such as the MAX9063 and MAX9028 series devices are ideal for those applications, especially as they occupy very little real estate and consume negligible power. These comparators offer an economical solution for detection circuitry in portable applications.