In one of the earlier articles, I discussed the design of an audio playback toy. The circuit featured a simple microphone amplifier suitable for recording near-field sounds — that is, capturing clearly-articulated speech of the person holding the device.
Of course, in applications ranging from hearing aids to home automation, it’s often necessary to pick up more distant sounds. This task is trickier than it might appear. As with eyesight, we’re unaware of the staggering dynamic range of our senses; acoustic waves in open space follow the inverse square law, so the speech of a person standing across the room might result in microphone readings 20-50x weaker than if they were standing next to you. In electronic circuits, such microvolt-level signals can be easily drowned out by white noise and radio frequency artifacts.
Techniques such as microphone arrays, parabolic reflectors, and sophisticated digital processing might help work around signal quality issues, but a clean capture is the best starting point. So, let’s have a look at what it’d take to build a good far-field microphone kit.
Understanding microphone sensitivity
Let’s start with a seemingly simple question: how do we measure sound intensity? The usual answer is “in decibels”, but decibels are not units; they’re just awkwardly-spaced divisions on a logarithmic (log-10) scale. A change of +/- 1 dB tells us that the power delivered by something has changed by a factor of 1.26; it doesn’t tell us anything about the nature of the measured phenomenon, and it doesn’t explain the scale’s zero point.
For sound, the actual measurement unit is the pascal (~0.000145 psi). As for “zero decibels”, the value doesn’t correspond to perfect silence, but to a 1 kHz acoustic wave that exerts 20 μPa of pressure; this is roughly the threshold of human hearing. From that origin point, we derive two parallel decibel scales: dB SPL, which measures nominal sound pressure; and dBA, which is frequency-weighed to approximate human hearing — i.e., it tapers off sharply below 200 Hz and above 10 kHz.
The performance of microphones isn’t characterized at the threshold of hearing. The measurement is carried out with a sound pressure wave about 50,000 times stronger, exerting 1 Pa at 1 kHz (“94 dB”). This is roughly comparable to operating a gas-powered lawnmower or standing next to a busy highway. A microphone that exhibits 1 Vrms output swing under such conditions is said to have 0 dBV sensitivity (yep, another dB-denominated scale). In practice, a cheap electret microphone will not get anywhere near that number; a common sensitivity figure is -45 dBV, corresponding to a voltage swing of about 6 mV.
Rock concerts and construction sites aside, most sounds we’d want to capture are not as loud; normal indoor voice is around 40-50 dB, whisper is about 30 dB, and ambient nature sounds hover in the vicinity of 20 dB. The resulting microvolt-level swings can be easily drowned out by shot noise and thermal noise inherent to most microphones. To illustrate, I captured this quick demo:
Microphone’s performance can be grasped by looking at its equivalent input noise (EIN): the loudness of a hypothetical noise source that, if placed next to an idealized microphone, would produce the same amount of hiss as present in the device under test. The EIN value is not always given in the datasheet, but it can be derived from the signal-to-noise (SNR) figure, which is indexed to the aforementioned 94 dBA reference point. The formula is: EIN = 94 dBA - SNR.
After the reference capture, the first microphone used in the video is CMA-6542PF — a $0.50 capsule with an SNR of 60 dBA (EIN = 34 dBA). It is essentially what you end up with if you buy a generic electret mic on the internet. The second capsule — PUI Audio AOM-5024L-HD-R — is an identically-looking part that retails for $3.50 and has an SNR of 80 dBA (EIN = 14 dBA).
If you’re designing a headset or an intercom, the first microphone is an eminently reasonable choice; but in far-field applications, a high-SNR mic makes a dramatic difference, and you should spend an extra buck or two.
Selecting a suitable op-amp
In hi-fi audio applications, microphone amplification is almost always accomplished with an op-amp; the devices offer a good blend of linearity, adjustable gain, predictable frequency response, low part count, and low cost.
Compared to microphones, the choice of an op-amp is not nearly as consequential; as long as you stay away from outdated or patently unsuitable designs, there should be no audible difference between a high-end model that features 3 nV/√Hz noise and 0.0001% total harmonic distortion; or a lower-tier one that barely manages 20 nV/√Hz and 0.01% THD+N.
As discussed in an earlier article on op-amps, unity gain bandwidth of the device is an important constraint: although audible frequencies extend only to 20 kHz or so, the bandwidth must be derated proportionally to the desired amplification. Given the high gain required for microphones, at least 10 MHz is advisable in hi-fi single-stage circuits. Less bandwidth is OK if you’re using multiple amplification stages with lower gains, or if you’re only interested in processing voice commands.
The remaining considerations — supply voltage, output current capacity, rail-to-rail output, or slew rate — are fairly standard and should be chosen with a specific application in mind. The output of about 50 mA should be sufficient for most headphones; about a milliamp is enough to drive “line in” signals for portable audio recorders and desktop PCs.
In this particular instance, I settled on OPA1656 — a rather impressive amplifier package available from Texas Instruments. That said, I selected the chip not just because of its excellent noise or bandwidth specs, but because of its reasonable cost (about $1.25 per op-amp). Another sensible choice in the same ballpark is MAX4232.
Circuit architecture
This section assumes some familiarity with the basics of signal amplification; if you need a refresher, please review this article first.
A good number of hobby microphone amplifier circuits published on the internet are needlessly complicated, often because of their reliance on antiquated parts and outmoded design paradigms. If the microphone can be placed physically close to the amplifier, the simplest design is a single-supply, single-ended transimpedance amplifier — a circuit that essentially converts the current flowing through the microphone directly to output voltage:
The electret microphone can be thought of a sound-controlled current-modulating device: it consists of an electrically-charged diaphragm connected to the gate of a field effect transistor, so its impedance varies in response to sound waves. In this circuit, the current flowing through the microphone can be sourced through the 4.7 kΩ resistor; but alternating currents can also easily flow through the 2.2 µF leg. That capacitor blocks DC, but has a very low AC impedance.
In a steady state, the op-amp reaches an equilibrium at Vout = Vin- = Vin+ = Vdd / 2. Transient changes in FET conductivity upset this equilibrium, inducing momentary currents through the 2.2 µF capacitor and throwing the voltage on the inverting leg of the op-amp out of whack. When that happens, the output of the op-amp swings in the opposite direction — and to restore balance, it needs to swing far enough for the current through the feedback resistor (Rf) to match the current flowing through the input capacitor. In effect, the circuit functions as a current-to-voltage amplifier, with its gain proportional to the value of Rf.
The basic circuit works, but has some limitations. Perhaps the most significant issue is its tendency to amplify mains hum and other electrical interference present at the high-impedance Vin+ leg; this problem becomes more pronounced when higher resistor values are used for the voltage divider to conserve power in battery applications; 100 kΩ would be a lot noisier than 10 kΩ. Either way, the effect can be mitigated by adding a decoupling capacitor on the non-inverting leg.
The use of high-bandwidth op-amps also means that the circuit can pick up and amplify radio frequency interference, which tends to become audible due to accidental nonlinearities in the circuit. Short of using a sequence of lower-bandwidth op-amps configured for lower gains, the simplest solution is to add a lowpass capacitor in parallel with the feedback resistor. The dampening afforded by the capacitor also lessens the likelihood of ringing or self-oscillation — a problem with inverting high-bandwidth op-amp circuits whenever the inverting leg exhibits non-negligible capacitance (although this is a relatively minor concern with electret microphones).
For the feedback capacitor, around 2 to 10 pF is usually a good starting point; values approaching 100 pF will produce a more pronounced lowpass effect, making the audio more muffled. It’s essentially akin to setting “treble” to the lowest possible value on an audio rig, or listening with a cardboard box over your head. A sensible choice for speech — which doesn’t extend much beyond 4 kHz — but maybe not for Mozart or Bach.
The final tweak is the inclusion of a relatively small resistor on the output leg; somewhere around 47 to 100 Ω should be fine in most uses. The resistor limits peak op-amp current, and thus reduces the distortion of the feedback signal when the circuit is hooked up to capacitive or inductive loads:
Further improvements are possible; for example, multi-stage lowpass filters with sharp cutoff, such as MAX291, can be used to further reduce microphone hiss without affecting lower frequencies as much as a beefier feedback capacitor would.
Some microphone circuits also feature an optional highpass filter with a cutoff somewhere around 100-150 Hz. This hurts sound fidelity, but also cuts down on wind noise in outdoor environments.
Ouch! My ears!
With R1 around 470 kΩ and with a high-SNR microphone, the circuit pictured above gives its wielder superhuman hearing: the device can pick up conversations and footsteps in other rooms, and will greatly amplify the sound of your own breathing or body movements; with a parabolic reflector, the results can be even more impressive. On the flip side, the setup is far too easily overdriven by normal sounds; merely tapping your workbench will result in a deafening crack.
The simplest solution to this problem is to replace the feedback resistor with a potentiometer; an adjustment range of about 10 kΩ to 500 kΩ should be enough for most needs. This manual method of gain control works well and is preferred in pro audio, but it can be cumbersome if sound levels keep fluctuating over time. Just as importantly, the approach offers no protection against unanticipated loud noises if you’re monitoring live audio on your headphones. I don’t recommend this, but if you want to give headphones a try, be prepared for pain.
A more sophisticated solution is automatic gain control: a method for monitoring the amplitude of the output signal and then swiftly adjusting the resistance to keep the audio within the desired range. The monitoring part is fairly straightforward; one approach might be:
Whenever the input signal reaches a positive peak, the capacitor is charged through an input resistor and a Schottky diode, causing output voltage to rise; in the absence of peaks higher than the capacitor’s current voltage, the charge is slowly dissipated via the comparatively larger resistor on the right. Resistances and capacitances can be chosen to balance the circuit’s response time.
The second part of an AGC circuit — a voltage-controlled resistor — is a tad trickier to build. Some of the early solutions relied on a lightbulb or an LED placed next to a photoresistor. Another straightforward method was to use a field effect transistor — but you had to stay in the painfully narrow range of voltages where the transistor exhibited marginally tolerable linearity in respect to both Vgs and Vds.
Nowadays, analog techniques have largerly fallen out of favor: it’s more common to employ an ADC-equipped microcontroller to continually sample the output signal, detect overload conditions based on software-defined criteria, and then talk to a device such as MCP4131 — a $0.90 SPI-controlled digital potentiometer that offers a range of 128 resistance settings. In addition to other benefits, the design also permits seamless switching between automatic and manual gain.
A simplified architecture of a digipot-based AGC could be as follows:
In this design, the first half of OPA1656 provides fixed current-to-voltage amplification for the electret microphone, while the second half implements a variable-gain voltage amplifier controlled by the MCU.
The number of parts can be reduced further. For example, there are programmable gain op-amps (PGAs) that combine digipots and amplifiers in a single package. Heck, the latest crop of AVR DB series MCUs packs a pair of PGAs directly on the MCU die — although their specs don’t seem good enough for hi-fi use.
For other electronics articles, please see this index.