|
A common feature in most of the electronic devices we use - cell phones, PDAs, notebooks, handheld media players, game systems, etc. - is the provision for connecting external accessories. Such electronic devices usually include a single 3- or 4-connector jack, which can be a stereo headphone jack, a mono headphone jack with microphone input and hook switch, or a stereo headphone jack with microphone/hook-switch combination.
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.
Headset detection
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.
|