How to make a good step attenuator?
Briefly about dB
The dB (decibel) are used to measure/compare the relative power of signal. The name is coming from A. G. Bell. As we know, our ear is very sensible with high dynamic range and has approximately a logarithmical characteristic. For this reason are widely used in audio technique. Below I present briefly the basics of dB:
Definition
- Two power ratio in dB:
and
Because P = U2/R (where U is the effective value):
We can recognize: 10 dB correspond to 10:1 power ratio, and this is the only one point, where the "dB" corresponding to power ratio.
Example: if the power is decreased with 50%, the result is -3 dB.
- If we are using same resistors (R2 = R1) the voltage ration in dB is:
and
That formula have a stand alone life, sometime are presented as definition of dB, which is not correct, just if R2 = R1. Sometime is used in cases, where both resistors are highly different (like amplification factor of operational amplifiers, where the input impedance is far from output impedance!). That can be accepted, if we don’t consider the power amplification of the analyzed system.
Example: if the voltage is two times higher, that means +6 dB.
Step attenuators
In general the log potentiometers used in many amplifiers could (over years) suffer from the following problems:
- Channel tracking might differ from 10% to up to 20%, with discrete resistor values it is possible (especially when measuring and matching before use) to get both channels within 1 - 2% over the full range - for that reason was introduced the BALANCE knob to compensate the sound level differencies between channels.
- Cracking and popping due to wear of the carbon/cermet resistor elements.
- With dual-mono setup it is nearly impossible to get both channels in the same position (same gain).
In the following sections it is described how to design your own attenuator, and how to calculate the resistor values.
Things to take into account when building your own volume control with a stepped attenuator are :
- What is the design of the next stage of the amplifier we're feeding the attenuator output into?
- What is the output impedance of the CD-player, tuner or phono amplifier feeding into the attenuator?
- What is input impedance we want to create for the input of our amplifier?
- How many steps do you need?
- What are the steps in dB we want for Volume control: logarithmic or a particular curve based on our preferred volume levels?
- What type of switch do we have: Make-before-break (=shorting) of break-before-make (non Shorting)?
- Is there a ground resistor from the input pin of the amp to ground (mostly used to give the amp a DC reference point), then we should take this resistor into account as it is a parallel resistor between wiper and ground and influences both impedance and gain (inverted amp).
Basic Principle
There are several ways to build a volume control for an amplifier, although all methods described below are based on a variation of the voltage divider. The basic circuit looks like this:
According to Ohms law:
The gain of the attenuator switch is defined as:
The gain in dB is therefore:
And as we know the formulas for calculating the gain we can also work in the reverse direction and calculate resistor values for a given gain of the attenuator (which will mostly be negative e.g. -20 dB).
For a given input impedance Ri of voltage divider, what would be the resistor values for Ra and Rb that would make up a gain of X dB?
A=10(X/20)=Vout/Vin=Rb/(Ra+Rb) and Ri=Ra+Rb therefore:
Series Attenuator
The series type consists of a chain of resistors connected between signal source and ground forming a constant input impedance. The wiper takes position between any adjacent pair of resistors and forms a classic voltage divider with all resistors from that position to the signal and all resistors from that position to ground. For the series attenuator you need a certain number-step switch with only one deck.
The series attenuator has a big advantage: Only a simple switch with one deck of certain number of positions is necessary, and only same number of resistors per channel are used. The simple construction makes it less prone to failure. The disadvantage is that at most positions of the switch there are more than one resistor in the path to the signal source and also more than 1 resistor to ground.
For the input voltage:
The output voltage at the wiper of the switch (the wiper in position pos):
The gain of attenuation is defined as:
Series attenuator with ground resistor
A common variation of the series attenuator is the attenuator with shunt resistor (signal to ground). The reason for such a shunt resistor is normally to provide a defined impedance to ground to the amplifier input. Common reasons for presence of such a resistor are:
- There is an audio capacitor between the line input (with it's attenuator) and the input of the Opamp to protect the amplifier from DC offsets. The resistor provides a DC ground reference for the Opamp input. Can be considered the cut-off frequency of the capacitor and ground resistor!
- The attenuator is of the break-before-make type and therefore between switch positions there is a moment where the ground reference is not present. A permanent resistor between the wiper and ground will provide such an impedance at all time.
- The amp is used as a power-amp only and in order to protect the speakers when disconnecting the pre-amp the resistor provides a reference to ground.
The figure explains the principle: Rg is used to provide an impedance to ground and influences the attenuator (Ra and Rb for a certain position). When designing an attenuator for such environment it is good to remember that the effective input impedance of the amplifier at the signal input terminals will vary over the range of the attenuator.
As a result, care must be taken to select the right values for the resistors in the attenuator so that the impedance of the amplifier as seen by the source will not deviate too much from the desired values.
If the cut-off frequency of C and Rg is low, that means the impedance of capacitor can be neglected, we can consider Rb is in parallel with Rg.
The Inverted Amplifier Design
For inverted designs we must use different resistors values for the same dB steps regarding non-inverted setup. The reason is as follows:
· The gain of an inverted design is determined by the feedback resistor and the effective impedance found on the inverted input of the operational amplifier. And here lies the source of the problem. The attenuator is in series with this resistor on the inverted input and therefore part of the gain loop as well. Moreover, the output Z of the source device (CD-player, preamp, phono preamp) is also in series and plays a role in the gain calculation, especially when using tubes on the input.
· Important is to recognize that the attenuator itself still behaves exactly in either setup, and that the effective attenuation measured between input and output of the attenuator is independent from the amplifier architecture chosen. However, in an inverted setup the total attenuation/amplification of the amplifier is influenced by the attenuator itself and therefore we deal with it.
The following figure illustrates the issue described above. Clearly is shown how the input resistor Ri is in series with the effective impedance of the attenuator and the output impedance of the connected source equipment (CD-player or other preamp). The attenuator is modeled with Ra and Rb: On any given position of the wiper, Ra defines the sum of all resistance to signal and Rb the sum of all resistance to ground (Ra + Rb = constant).
In the schematic was omitted other components such as the input cap, as these were not necessary for an understanding of the issue. The gain of the operational amplifier is therefore determined as follows:
The resulting voltage Vi as function of Vx:
The gain for the total circuit:
Therefore the calculation method used for non-inverted designs does not work a 100% for non-inverted designs and that calculating the optimum gain requires even more calculus. Well, let's first see what role each component plays in the equations.
In order to make a rotary attenuator switch for inverted mode amplifiers, we need to find the resistor values for any given attenuation step between two switch positions. After all, it's nice to be able to calculate the attenuation for a given resistor setting, but rather we would like to work the other way around. For example: If we want a gain of -50dB on step 2, what resistor values for Ra and Rb do belong to that setting.
At position pos the value in dB is X, and , and .
The value for a step in db at position pos is:
and Ra=Rtot-Rb.
With those values we can calculate resistors for every steps.
Ladder Attenuator
The rotary switch makes two connections at a time, connecting on one side to the signal in and to the other side to ground. The wipers are both connected to the signal out that is fed to the next amplifying stage. For the Ladder type you need a switch with two decks.
The ladder type of attenuator has a big advantage over the series version: Only one resistor is in the signal path and there is always one resistor to ground. The voltage divider always consists of two resistors Ra (to signal input) and Rb (to ground) and the wiper connects the two to the output of the attenuator.
The ladder attenuator therefore in fact contains certain number of voltage regulators, which makes it the most elegant (and expensive) solution for volume control.
Resistor 12b may be omitted and replaced by a short to ground if the volume needs to be really 0 in the lowest position.
Because have 2 contacts, if is possible, the ground-resistor can be connected first, after the signal resistor – to avoid high signal levels during switching.
Shunt Regulation
The shunt type is a mix of the ladder and the series version and offers in most of its range the advantages of both. The shunt type is not usable in all amplifier designs, because between switch positions there is a moment where the shunt resistor is not present, and the maximum signal will be on output (can destroy the speakers!).
The advantages of the shunt regulator are in principle the same as for the ladder: Only two resistors (except in position 1) are in the signal path. The disadvantage of this design is that the input impedance is not flat but is a value of Ra + Rbx and thus changes with every value of x. For tube pre amps special care must be taken that the input impedance still is high enough for the tube pre amp.
In most cases resistor number 11 will be replaced with a hardware to ground so that there is no signal on the output in the lowest volume position. However, with a 12-step attenuator its a choice to use position 12 for very soft music and not completely shut off the amp.
Practical realisation
Above presented ideeas are just theoretical things - in reality you can meet several problems, like how to avoid extreme sounlevels which can appear during swithing "process", because all mechanical parts have tolerances. What does it mean? If contact a are made contact before b, the signal level will be defined by serial input resistor and amplifiers input impedance, that means nearly the maximum signal level will be received by amplifier.
A practical idea can be see on the next figure:
S1a breake the signal during swithing. For that reason on the output the maximum signal level will defined by Rna-Rnb resistive divider circuit. If the mechanical contact are not perfect, the sound for a short time can desappear, but after will have the preadjusted level setted by Rna-Rnb. That principle can be applied for all above presented step-attenuators.