Audio Gain Control Using Digital Potentiometers

Audio Gain Control Using Digital Potentiometers

Author's Contact Information

Abstract

Digital potentiometers (pots) offer advantages for audio volume (gain) control applications and can replace bulky mechanical pots, especially in handheld portable devices such as MP3 players, PDAs, cell phones, mobile Internet devices, or stereo AM/FM radios. This document describes the types of digital pots available for audio control such as logarithmic taper pots (log pots). It examines several common designs using log taper pots and audio amplifiers, evaluates their advantages and disadvantages, and recommends circuit designs.

A similar version of this article appeared in the January 7, 2002 issue of EE Times magazine.

Introduction

It is now common for portable multimedia equipment to include some sort of stereo audio playback circuitry, perhaps for MP3 or mobile Internet applications. Many specialized ICs are available for these circuits and many use a mechanical potentiometer (pot). This application note will demonstrate that widely available low-power components can be just as effective. The article demonstrates how to achieve a stereo volume control without a mechanical pot.

Traditional Mechanical Pot Design

Historically, audio volume controls used a special kind of potentiometer with a log (or sometimes audio) taper or law (Figure 1). This approach derives from the roughly logarithmic response of the ear to changes in sound pressure levels.

Figure 1. Logarithmic response of the potentiometer to changes in sound pressure levels.

This approach derives from the roughly logarithmic response of the ear to changes in sound pressure levels.

In general, the midpoint of the rotation usually gives around 20dB attenuation of the audio signal, with attenuation rapidly increasing from the midpoint counter-clock wise (CCW). There is finer control over the "louder" settings from the midpoint clock wise (CW).

While this approach works well in practice, there are still several reasons not to use a mechanical pot in a small portable device. The space constraints and reliability issues of a mechanical pot are just two immediate issues. Today a common volume-control interface for modern devices uses up/down buttons in conjunction with some form of host processor. This design provides an inexpensive, useable solution without a bulky mechanical pot.

Stereo (or ganged) rotary pots also have a mechanical tracking issue; mechanical tolerances mean that L-R tracking suffers as the volume is adjusted. Also, the desired transfer function should be considered. Is full attenuation desired? Or rather, can the application use a gain trim control offering perhaps 30dB of adjustment range but no fully off' position? Perhaps you should consider a digital pot?

Design Issues with Digital Pots

Over the past years digital pots have become available and their performance has evolved (Figure 2). These digital devices use resistive ladders and FET switching under digital control to effectively replace mechanical pots in a number of areas. On the surface, using a pair of these ICs would seem a logical solution for stereo volume control, however, there are issues which must first be addressed.

Figure 2. Functional block diagram of the MAX5160 digital pot.

Figure 2. Functional block diagram of the MAX5160 digital pot. digital pot.

The most commonly available digital pots are effectively linear pots, i.e., their resistive increments are equally weighted. A reasonably constant dB-per-step law is desirable in audio volume control, so the design may have to emulate this log behavior in some way. Recall now that we are no longer constrained by the mechanical pot's audio taper.

There is a follow-on issue. While the digital pot steps are usually designed to give equal-value resistive increments, a by-product of the process variation is that the total end-to-end resistance varies widely from part to part, as much as ±30% in some types. This resistance variation must be considered when designing a circuit that requires close matching between two channels using separate digital pots.

Finally, the transitions should be as glitch free as possible, so a make-before-break wiper arrangement should be considered mandatory.

Design Examples

Some design examples follow. There are both gain-trim designs (where the control is applied over a set attenuation range, but not giving full attenuation), and more traditional full CW/off CCW volume controls. These circuit ideas assume a VCC of between 2.7V and 5V and a low-impedance VREF = VCC/2. The IN input signals are from a low-impedance voltage source.


Example 1


The circuit in Figure 3 would seem to give adequate results. Using two MAX5160Ls (assuming that their digital inputs are suitably controlled) around a MAX4252 op amp, the circuit should give evenly tracking gain or attenuation over a nominal ±6dB range. The circuit should work over a VCC range from 2.7V to 5V and have 32 useable gain settings. Even the power-on-reset (POR) state of the MAX5160L gives approximately a unity gain setting.

The drawback to this implementation is the ±25% overall resistance variation of the digital pot. This variation could lead to a wide gain tolerance, especially on the settings at the extremities of resistance, channel-to-channel as well as unit-to-unit. For example, assuming the 50kΩ resistors are ±1%, then the nominal, maximum +6dB setting could vary between limits of:

Av1 = -(50.5kΩ + 62.5kΩ)/49.5kΩ = -2.283V/V or 7.16dB

Av2 = -(49.5kΩ + 37.5kΩ)/50.5kΩ = -1.723V/V or 4.73dB

Figure 3. ±6db stereo gain trim control, 32 gain settings (1 channel shown).

Figure 3. ±6db stereo gain trim control, 32 gain settings (1 channel shown).

This amount of left-right mismatch is easily audible. This circuit can be made to work better by selecting or trimming the support resistors (or selecting the digital pot!) to suit, but this is not feasible in mass production. A design approach must be found which minimizes or eliminates this gain error.


Example 2


The circuit in Figure 4 uses the MAX5160L digital pot in a divider chain. The MAX5160L uses 100kΩ and 50kΩ resistors to supply the MAX4252 with some positive feedback in addition to the usual negative feedback . The gain of this circuit can be shown as:

AV = (1 - KN)/(KP - KN)

Where KN is the negative feedback fraction and KP is the positive feedback fractions. For the example in Figure 4, KN = 100kΩ/(100kΩ + 50kΩ) or 2/3, and KP is variable.

Figure 4. ±6dB stereo gain trim control, 17 gain settings in an improved design.

Figure 4. ±6dB stereo gain trim control, 17 gain settings in an improved design.

When the MAX5160L wiper is positioned at the VREF terminal, the gain of the circuit is -0.5V/V, as there is no positive feedback contribution. When the wiper is at midscale, KP = 0.5 and the gain is now -2V/V. Hence, by using those 17 positions between VREF and midscale, the gain can be varied over a ±6dB range. The 15 unused positions have been a trade-off for repeatability, because the gain value does not depend on the digital-pot resistance tolerance, as did the circuit of Figure 1. The gain tolerance is now only limited by the ±1% 100kΩ/50kΩ resistors and the INL/DNL error of the MAX5160L (±4.6%, max.).

There is an interesting point to note. The limit for stability in this circuit is reached when KP ≥ 2/3, i.e., when the positive feedback fraction meets or exceeds the negative. The host processor controlling the MAX5160L should, therefore, prevent this situation from occurring.


Example 3


The circuit in Figure 5 uses digital pots as an obvious alternative to a traditional approach for volume control. All codes are valid, with settings ranging from 0dB to full attenuation. Table 1 shows the calculated attenuations based on the MAX5160L's 32 steps.

Table 1. Calculated results of Figure 3 circuit
Code Setting Attenuation Code Setting Attenuation
0 0.00 16 -6.31
1 -0.28 17 -6.90
2 -0.58 18 -7.55
3 -0.88 19 -8.24
4 -1.20 20 -9.00
5 -1.53 21 -9.83
6 -1.87 22 -10.74
7 -2.22 23 -11.77
8 -2.59 24 -12.93
9 -2.98 25 -14.26
10 -3.38 26 -15.85
11 -3.81 27 -17.79
12 -4.25 28 -20.28
13 -4.72 29 -23.81
14 -5.22 30 -29.83
15 -5.74 31 Full attenuation

Figure 5. Traditional volume control design (1 channel shown) has drawbacks.

Figure 5. Traditional volume control design (1 channel shown) has drawbacks.

Notice how the attenuation figures are spread. There is less than 6dB total variation over the first 15 codes and less than 1dB over the first four. This is not particularly useful. Interestingly, even when choosing a part with a far larger number of taps, you still only get 6dB variation over half of the codes.

To address this problem one approach selects a subset of the codes available to achieve a reasonably constant dB/step figure. For example, using only those codes highlighted in Table 1 gives roughly 3dB/step up to code 29, allowing 11 settings. This can work well if the digital pot chosen has many tap positions (256 or higher). However, parts with that flexibility are generally more expensive. Given that the majority of the tap positions will not be used (unless, perhaps, when interpolating between volume settings), it would seem more efficient to try and utilize more of the existing taps with a different topology.

Resistively loading the wiper of a linear pot to "bend" the characteristic is an old trick. The load resistor is usually about 1/20th the value of the linear pot resistance. There are two disadvantages of applying this method with a linear' digital pot: the input impedance of the pot is now dependent on gain setting (lowest at maximum volume); and again, the wide tolerance on end-to-end resistance means that L-R tracking suffers at any setting apart from the extremes. Figure 6 shows the idea.

Figure 6. This configuration with a resistive load creates an equivalent fixed-resistor for clarity.

Figure 6. This configuration with a resistive load creates an equivalent fixed-resistor for clarity.


Example 4


The circuit of Figure 7 yields a traditional volume-control characteristic, much like that of Figure 5. However, this design uses a little positive feedback to even out the step sizes to roughly 1.6dB/step over most of its useable range.

An immediate disadvantage of this design is that the negative feedback fraction (KN) has to be 0.5 or higher for this approach to yield usable results (although 0.25 would be the limit of stability). In simple terms, we have already thrown away around half the available codes just so the circuit can operate. However, the remaining 17 codes are all used (no gaps as in the Figure 6 example), as indicated in Table 2 below. The third column lists the delta in step sizes, showing how consistent they are over the majority of the attenuation range. Figure 8 shows the linearizing effect, with gain in dB on the Y-axis plotted against tap number on the X-axis. This data compares favorably with the circuit of Figure 6, where the highlighted values gave roughly 3dB steps and only 11 settings.

Figure 7. This near-constant dB/step topology (1 channel shown) is an improved design.

Figure 7. This near-constant dB/step topology (1 channel shown) is an improved design.

One side effect of this topology with the values shown is that there will be a 6dB boost for the midscale value of the digital pot. This can often be accommodated in the gain structure of the full audio path, where some gain shifting is usually inevitable.

Table 2. Calculated results of Figure 7 circuit
Code Setting Gain (Delta) Code Setting Gain (Delta)
16 6.88 24 -5.60 1.61
17 5.19 1.68 25 -7.32 1.71
18 3.60 1.59 26 -9.17 1.86
19 2.06 1.54 27 -11.25 2.07
20 0.56 1.50 28 -13.65 2.40
21 -0.93 1.50 29 -16.59 2.94
22 -2.44 1.51 30 -20.53 3.94
23 -3.99 1.55 31 -26.95 6.42
32 Fully off

Figure 8. Stereo, cascaded traditional volume control, more = better?

Figure 8. Stereo, cascaded traditional volume control, more = better?


Example 5


The circuit of Figure 9 uses a total of four MAX5160L digital pots to produce a high-resolution, stereo volume control. The number of possible valid codes per channel is greatly increased, giving 32 x 32 or 1024 attenuation codes. Again, the end-to-end resistance tolerance does not have any first-order effect because of the buffering between the two digital pot stages. L-R tracking is only limited by the tap-to-tap matching accuracy. The wiper resistance has little loading effect, as each wiper sees a high-impedance op amp input.

Figure 9. This design uses MAX1560L digital pots to produce high-resolution stereo volume control.

Figure 9. This design uses MAX1560L digital pots to produce high-resolution stereo volume control.

Of the 1024 codes, some give duplicate attenuation values. For example, the first pot is at -6dB and the second is fully up, thus giving -6dB overall. This is the same as first pot fully up and the second at -6dB., Moreover, if either pot is set to full attenuation, any setting on the other pot is irrelevant, all of which leaves something like 348 unique attenuation settings from 0 to -60dB (actually -59.66dB).

To map the codes to an attenuation figure, some sort of simulation or spreadsheet approach would seem appropriate. Figure 10 shows the spread of attenuation obtained, including duplicate values.

Figure 10. Spread of attenuation obtained from the design of Figure 9.

Figure 10. Spread of attenuation obtained from the design of Figure 9.

Figure 10 demonstrates that most of the codes give attenuation values between 0 and -40dB. The delta, or dB step size between each attenuation value, can be plotted in a manner similar to that in Table 2 (Figure 11). This gives a visual indication of the granularity of the steps.

Figure 11. Plot shows the delta in dB of the step size between each attenuation value for the codes generated by the Figure 9 circuit.

Figure 11. Plot shows the delta in dB of the step size between each attenuation value for the codes generated by the Figure 9 circuit.

The granularity of the steps appears very evenly distributed with differences in most of the steps well under 0.5dB, only reaching 1dB at -41.6dB, and with the penultimate 6dB step between -53.6 and -59.6. Repeated codes appear on the graph as zero delta figures. This yields the kind of control range and granularity required in the most exacting audio level controls.

There are, however, limitations to this approach too. Obviously, this circuit has a reasonable control overhead, perhaps using lookup tables to retrieve values and using some kind of ranging algorithm to obtain smooth volume transitions. Unlike the circuit in Figure 4, however, there is no conditional stability situation so any combination of codes is fine. More seriously, variations in the tap-to-tap resistor matching between the first and second digital pots could mean that monotonicity is NOT guaranteed. Using a subset of the codes, hence coarser steps, would be one way of assuring monotonic steps, but this would come at the expense of fine steps.

In theory, while the cascaded circuit of Figure 9 seems to give impressive results on initial investigation, the practical implementation of the circuit can be problematic.

Summary

The circuits of Figures 5 and 6 probably give the best compromise between price, complexity and performance for most situations. Controlled using a 3-wire interface, Maxim also offers the MAX5400/MAX5401 and MAX5402 devices. These digital pots offer 256 taps for those applications needing slightly higher resolution and have a 3-wire protocol available for control.