In the last generation of the Tabata Timer I added an audio pass-through circuit so that someone could plug it into their existing stereo system and have the timer signals mixed into their music, and digital volume control using a MCP4013 digital potentiometer.
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.
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.
My requirements are simple:
- 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)

I started my search ad-hoc, browsing individual datasheets and googling for audio mixers. It turned up a lot of Texas Instruments chips which seemed to have the features that I wanted, and these are called audio codec (for 'coder/decoder', I assume). On the left is a table of the manufacturers in the 'Audio Codec' section of Octopart:
Audio codecs include:
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
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.
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.
After some more searching/filtering on Octopart, a couple of low end codec families popped up - also with basic line-in/mixing/headphone amp low power circuitry, simple digital input sections. They also include capacitorless heaphone outputs and onboard PLLs to generate audio clocks from any clock source, and are available in QFN-style packages from several distributors.
- 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).
After incorporating the chip into the design, I had a smaller board (1.6x1.6 inches, down about a square inch) and lowered the cost of the audio subsystem by about ~$0.50. Not that much of an absolute cost savings. But more importantly, now I have an industry-standard audio subsystem with things like the DAC filtering, headphone amplifier, jack detection all worked out. And I've learned a little about audio codec chips!