I made some mistakes . My active ground mixer circuit is single ended so it clips the negative side of the input signal, resulting in horrible distortion. Because I tried to split the timer mono output into two channels without using buffers, I'm getting leakage across channels. My headphone detection circuit triggered the NMI interrupt. But the digital pot works like a charm.
These problems are fixable. But I still worry about power, cost and performance. The low power op-amps I'm using in my mixer circuit are expensive (averaging near $4.00) and I'll need more of them to solve the leakage problem. I'm also not sure how they will do driving headphones - typical practice is to use big capacitors for headphone outputs and a proper headphone amplifier, and I don't know how my circuit will perform there. The discrete components also take up a lot of board real estate and also begin to add to the cost (e.g. the digital potentiometer is ~$0.40).
I get the sense this problem has been solved before....like, in every cellphone and MP3 player out there...and so I look online and find the world of inexpensive audio codec/mixer chips.
- Low-power stereo line-level audio pass-through so someone could leave the device plugged into their system all of the time without draining the battery too much. In general, low power with ability to shut off parts when not needed.
- Headphone/line output so it behaves just like a cellphone/mp3 player
- Line input/mixer with volume control so that the loudness of the alerts/sounds
- Inexpensive - less than $4-5 total cost (as that was what my current circuit was costing me)
Audio codecs include:
- Line in and microphone (digital and analog) inputs
- Digital inputs with DACs (generally I2S but a bunch of others as well)
- Mixing/passthrough/volume circuitry
- DSP circuitry (for equalization, usually)
- Line out/headphone/speaker outputs
The ones I'm concerned with here are aimed at the cellphone/portable music player market and so also have smaller footprint, power management features (e.g. being able to turn on/shut off analog and digital sections) and lower price points.
A glance at TI's website reveals a bewildering array of chips aimed at many verticals and price points. A designer can find a super-simple phone voice/speaker/earpiece (~$3.00 in quantity) to low power stereo chips with mic inputs and amplifiers aimed at cellphones (~$5.00) to 6-8 channel input/output chip ($7.10) designed for home theater and automotive. The variations tend to be around
- Number of inputs - many have multiple microphones and line level inputs, stereo and mono
- Speaker amplifier/no speaker amplifier, headphone amplifier ('capless' design seems to be a big deal)
- High-end vs low end digital chains (e.g. 24 bit audio/192KHz with a lot of DSP).
I also noticed non-codec chips that met my design criteria. In the Stereo Audio Subsystem portion of TI's site there are also chips without digital inputs (e.g. mainly mixing) and lower price points - e.g. the LM49251 (~$1.57 in quantity). This seems to be an older design inherited from National Semiconductor and widely available from many suppliers.
I initially went with the TI LM49251 since I already had DAC worked out and mainly needed a low power analog bypass, volume control and mixer - it also included speaker output and a microphone/bias circuit. After figuring out the wiring and building a schematic with it, I was disappointed to find, however, that is it only available in 0.5mm BGA - which would require 3mil traces on the PCB, beyond the capabilities of the cheap/quick fab services I was using.
- Maxim MAX98XXX. The MAX9867/MAX9880 ($1.30-1.70) - are stereo low power codecs with line/mic in, DAC, and headphone outputs. Distinguishing features are ability to support two digital microphones, an auxiliary ADC to measure battery voltage and jack detection. The sibling MAX980XX chips include Class D speaker amplifiers.
- Freescale SGTL5000 (also $1.30-1.70) - does not include the digital microphones, auxiliary ADC or jack detection. Has a lower analog pass-through current, however (3.4mA vs 5mA).