Arpit Mehta, Maxim Integrated Products - November 05, 2008
The devices therefore include dedicated logic circuitry - not just to detect the presence of an accessory, but also its type, so the internal control circuitry can adjust accordingly. For that purpose, you can configure a comparator in various ways to provide simple and cost-effective detection of external accessories. Before looking at these comparator-based circuits, we'll quickly review the basics of automatic jack detection.
Hardwiring detects presence of jack
For a typical headphone-socket circuit (Figure 1), connecting a pull-up resistor to the "Detect" pin as shown generates a signal indicating the presence of a headphone or other external device. Normally connected, the Detect pin is disconnected by insertion of the external device.
Figure 1. Automatic jack-detection circuit.
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 port of the microcontroller, which can then auto-switch the audio signal between a loudspeaker (headphone absent) and the headphone speakers (headphone present).
A simple transistor can buffer the Detect signal before it reaches the microcontroller input, and also provide any level translation necessary for interface with the controller. In space-constrained applications like cell phones and PDAs, a small transistor with package 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 instance, come in 1×1mm chip-scale packages.
The audio socket in Figure 1 is designed to handle the popular three-conductor audio plug (Figure 2). This plug connects either to a stereo headphone or a mono headset with microphone. You can easily differentiate between them using the circuits discussed below, which leverage the fact that headphone resistance is low (usually 8Ω, 16Ω, or 32Ω) and microphone resistance is high (600Ω to 10kΩ).
Figure 2. Three-conductor audio jack.
A brief introduction to the common audio jack and the electret microphone is helpful in understanding those circuits. For the three-conductor audio jack, the tip can carry 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 to ground.
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.
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 or call/receives a second call. The microcontroller controlling the headset needs to detect the status of the hook switch as well as the presence of the headset. The jack (hence the headset) can be detected automatically, as illustrated in Figure 1. A signal for the hook-switch status can be generated as explained below.
Status detection circuitry for the hook switch comprises a 4-connecter stereo headset with microphone, and a parallel hook switch (Figure 6). (A mono headset is similar, but has a three-pin connector.) In both cases the tip is connected to the microphone in parallel with the hook switch.
Figure 6. Hook-switch detect circuitry using MAX9063.
As shown, the hook switch presents a low resistance when pressed and a high microphone resistance when open. As for headset detection (explained above), an interface between the headphone-detection voltage and the CMOS inputs of the microcontroller can complicate the circuit design for MIC/hook-switch detection.
The voltage VDETECT (Figure 6) 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. It 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. A comparator can be used as in Figure 6, where you set the reference level to detect a given type of microphone while 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.
The scope shot of Figure 7 is triggered by pressing the hook switch of a mono headset. The setup is identical to that of Figure 6, but a 2.5mm universal headset for cell phones is used for test purposes. 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 7. These waveforms are taken from an electret microphone with hook switch, controlled by a mono headset and its internal control circuitry. When you press the hook switch of a mono headphone, the comparator detects the shorted microphone, allowing its output to be pulled to logic high.
The DC voltage observed at VDETECT is 2.52V (refer to the Figure 7 scope shot), which causes the MAX9063 output to assert low. Pressing the hook switch grounds VDETECT, allowing the MAX9063 output to be pulled high by an external 10kΩ pull-up resistor. Thus, the tiny MAX9063 comparator is well suited for detecting hook switches and accessories. MAX9028 and MAX9030 comparators are also suitable for these applications.
The need for detecting jacks, headsets, and hook switches is common in portable applications. For that purpose, dedicated comparators such as the MAX9063/MAX9028/MAX9030 occupy very little real estate and consume negligible power. They offer an economical solution for detection circuitry in portable applications.
About the author:
Arpit Mehta is a strategic applications engineer for the Multimedia business unit at Maxim Integrated Products, currently responsible for solving technical problems in the op amp, comparator, and current-sense-amplifier product lines. Mehta graduated from San Jose State University with a Masters degree in Electrical Engineering.
Headphone Amplifiers: Choose the right topology for your application
Good design practices that reduce noise corruption in portable audio apps
Headphone amplifier selection criteria for portable audio applications
Driving mobile headphones require attention to new details