This is only a preview of the May 2018 issue of Silicon Chip. You can view 35 of the 104 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Items relevant to "800W (+) Uninterruptible Power Supply (UPS)":
Items relevant to "Multi-use Frequency Switch":
Items relevant to "LTspice Simulation: Analysing/Optimising Audio Circuits":
Articles in this series:
Items relevant to "USB Port Protector – just in case!":
Items relevant to "12V Battery Balancer":
Items relevant to "El Cheapo Modules 16: 35-4400MHz frequency generator":
Articles in this series:
Purchase a printed copy of this issue for $10.00. |
Y
Using Analysing and
optimising
audio circuits
by Simulation
Part IV
by Nicholas Vinen
We concluded our last tutorial (September 2017) saying that
our next LTSpice tutorial would cover simulating op amps and
audio circuits. It has been a while coming . . . but here it is!
S
imulating audio circuits can be
useful for a number of reasons, including:
• optimising filter component values
for the desired roll-off point and
minimal passband ripple
• characterising complex and/or cascaded filter responses – corner frequency, roll-off rates, out-of-band
attenuation, bandwidth limitations, etc
• optimising amplifier circuits for stability, bandwidth, etc
• measuring frequency response and
headroom
• checking expected circuit operation
• verify DC operating conditions
• checking that component voltages,
currents, dissipation and heating
are within safe operating limits
This article will cover most of the
above tasks and the circuits and techniques presented here can be applied
to the remainder (and others we haven’t
mentioned).
Filter optimisation
There are dozens of different kinds
of filters that you might use in an audio
circuit, including low-pass, high-pass,
band-pass and notch types from simple passive (RC, LC) filters to complex
multi-pole active filters or resonant
passive filters.
The characteristics of the most simple
RC filters can be calculated quite easily, using well-known formulas such as
f (-3dB) = √(2π x R x C) to determine the
corner frequency for an RC high-pass
or low-pass filter. But as soon as you
start working with multi-pole filters or
multiple cascaded RC filters, the calculations become much more difficult.
Luckily, simulating such circuits is
simple and will quickly give you gain
and phase plots.
For example, let’s say that we have
two cascaded RC low-pass filters with
a buffer stage between them. And say
they use identical components, so they
have the same -3dB corner frequencies and 6dB/octave roll-off. We can
use 1kΩ resistors and 1nF capacitors
to keep it simple.
So we expect the resulting combination to have a 12dB/octave roll-off
but the -3dB frequency of a single filter (159kHz) is now the -6dB point of
Fig.1: a simple secondorder RC low-pass filter
drawn up in LTspice,
using ideal buffer E1 to
isolate the stages. We
can then compare its
performance to more
typical second-order
filter circuits to see
their pros and cons.
siliconchip.com.au
Celebrating 30 Years
the combined filter. So what is the new
-3dB point?
Simulating it
Rather than using an op amp model as the buffer stage between the two
filters, we’ll use a unity-gain voltagecontrolled voltage source. This has
the benefit of being simpler to use
(no need to wire up supply rails etc),
infinite bandwidth, no distortion and
no noise.
To set up this simulation, we create
a new schematic sheet in LTspice and
add and wire up the components as
shown in Fig.1. Refer to the earlier articles in this series for details on how
to do this. See www.siliconchip.com.
au/Article/10677
We already introduced the voltagecontrolled voltage source, in this case,
component E1. You need to right-click
on it and set the “Value” field to 1 so
that it operates at unity gain. For the
voltage source, right-click on it and
click on the “Advanced” button to
show all the fields, then set the “AC
Amplitude” field to 1V (under “Small
signal AC analysis”).
We label the input and output nets
using the “Label Net” button in the toolbar, for easier analysis later. Finally, select the Simulate -> Run menu option
and then switch to the AC Analysis tab
and set the type of sweep to Octave, the
number of points per octave to 10, start
frequency to 10Hz and stop frequency
to 10MegHz (other options would be
valid but let’s stick with these for now).
Do not set the stop frequency to
May 2018 43
Fig.2: Bode plots showing the
frequency and phase response for the
intermediate and output notes of the
Fig.1 circuit. We can then use cursors
to determine their -3dB points and
calculate the roll-off rates.
10MHz, since this will be interpreted
as 10mHz!
Having run the simulation, click
on the output node and a plot similar
to that shown in Fig.2 should appear
(we’ve also clicked on the junction of
C1 and R1 to compare the response of
a single stage). The output response is
shown in green and the green dotted
line is the output phase. The intermediate response is shown in blue. As you
would expect, the combined response
has a steeper roll-off.
Now, to determine the -3dB point,
click on the “V(output)” label at top
and cursors appear, along with the
box shown at lower right, which contains additional information. Drag the
horizontal cursor to the right until the
Mag: reading in the box is very close to
-3dB and then you will see the corner
frequency at left, which is just above
100kHz. Phase and group delay readings are also shown.
Comparing other multi-pole
filter arrangements
The problem with cascading two RC
filters with a buffer in between to produce a two-pole filter, is that the resulting output impedance pf the cascaded
filter is relatively high. But it is possible to build a two-pole filter around
a single buffer/gain stage and obtain a
very low output impedance. Two common approaches to this are Sallen-Key
and Multiple-Feedback filters.
An excellent website for designing
such a filter is at: siliconchip.com.au/
link/aajq
One of the biggest problems with
designing this type of filter to achieve
a specific response is that you inevitably need components with unrealistic values, such as 4.39kΩ or 1.42nF.
With some tweaking, you may arrive
44
Silicon Chip
at component values which are close
to what’s actually available.
But that leaves us with two questions: how much does the deviation
from ideal values affect the filter response, and which of the two filters
topologies is best? LTspice can help us
answer both these questions.
For this exercise, let’s aim to build a
realistic filter with the same -3dB point
and roll-off as we determined above
with our naive attempt, ie, 102.375kHz
and 12dB/octave respectively.
At the website above, we set the
filter order to 2, cutoff frequency to
102.38kHz and experimented with the
“Desired Rx” value until we got realistic looking values below. This was
with a “Desired Rx” value of 2.4kΩ.
We then drew up both resulting filter
circuits in LTspice, as shown in Fig.3.
There are several important points
to note about this circuit we’ve drawn
up. Firstly, we have chosen to use
LT1464 op amps as these have 1MHz
bandwidth and this will provide a
good demonstration of how op amp
bandwidth effects filter behaviour.
Also, we have used the Net Label
tool to label the supply rails of each
op amp V+ and V- and we then added two extra stacked voltage sources,
V2 and V3, both set to 5V DC with the
junction connected to ground. By labelling the top and bottom V+ and Vas well, we’re providing ±5V supply
rails for each op amp without cluttering up the schematic.
The output of the “naive” filter has
been re-labelled out1 so that we can
label the two new filter outputs out2
and out3, for easy comparison. (In case
you can’t immediately see out2 and
out3, they are just above U2 and U3).
U2 is used for the Sallen-Key second-order filter which uses two resistors and two capacitors, all with
different values, while the MultipleFeedback second-order filter is based
around U3 and it uses three equal-value resistors plus two capacitors.
The Multiple-Feedback filter is an
inverting type while the Sallen-Key
is non-inverting; this may be imortant in some applications. While we
were able to use equal-value resistors
in the Multiple-Feedback filter, that
isn’t guaranteed to always be the case.
Note that the output of the two new
filters is taken from the output pin of
an op amp, so the impedance is low
and can be fed into another filter network. You would need an extra op amp
buffer for the naive filter to achieve the
same result.
Now since these are all second-order
low-pass filters with the same corner
Fig.3: here we’re simulating three low-pass filter circuits drawn using op amp
models, all with a -3dB point of 100kHz.
Celebrating 30 Years
siliconchip.com.au
if we needed to). So it ends up attenuating the signal even further.
Another couple of things to note:
both of the new filters give less attenuation of the signal below the -3dB point,
ie, they roll-off more quickly which is
good if you’re going for a “brick wall”
type response. And the use of a real
op amp has actually pushed the naive filter -3dB point slightly higher,
to around 110kHz, which is why the
curves don’t all meet at one point.
Higher bandwidth op amps
Fig.4: the resulting frequency response plots of the three filter circuits shown in
Fig.3 (green=out1, blue=out2, red=out3). While the graphed lines may seem light
here, they are quite visible on-screen.
frequency, you would expect the results to be very similar but you might
be surprised.
Comparing filter responses
We now run the same AC analysis as
before but this time, after clicking on
the out1, out2 and out3 nets to plot the
response, we right-click on the phase
axis at right and click the “Don’t plot
phase” button to de-clutter the resulting Bode plot.
We’ve expanded the plot to fill the
window for increased clarity and the
result is shown in Fig.4. The naive
filter response is shown in green, Sallen-Key in blue and Multiple-Feedback in red.
The most surprising aspect to this
plot is that while both the additional
filters have a much faster roll-off above
the ~100kHz -3dB point, above 1MHz
(the -3dB bandwidth of the op amps),
the naive filter actually provides superior attenuation.
And as shown the Sallen-Key filter
does a particularly poor job at higher
frequencies, with a peak at around
-15dB attenuation at 1.8MHz and it’s
not much better at higher frequencies either.
This is because capacitor C4 couples some of the signal from the input straight to the op amp’s output
and its limited bandwidth means that
it isn’t able to prevent that coupled
signal from feeding through. (To explain, there is no extra open-loop gain
at higher frequencies and that means
that negative feedback cannot act to
provide a low output impedance).
The Multiple-Feedback filter does
a better job because capacitor C5 is
siliconchip.com.au
a smaller value and there are two resistors, R5 and R7, in series before it,
plus C6 will shunt much of the feedthrough signal to ground. Even so, you
can see that the slope of the red trace
changes slightly around 1MHz to be
more flat, allowing the blue trace of the
naive filter to “catch up” to it at 1MHz.
That’s because the naive filter starts
with a completely passive RC filter
which rejects at least some portion
of the signal regardless of the op amp
bandwidth. And the op amp’s limited bandwidth actually helps us here,
since there’s no path for the signal to
“feed through” it (ignoring parasitic
PCB capacitance, which we aren’t simulating here although we could add it
So how does this change if we use a
higher bandwidth op amp? That’s easy
to test; simply delete U1-U3 and replace them with LT1357s which have
a gain-bandwidth product of 25MHz.
Then re-run the simulation. The result
is shown in Fig.5.
All three curves now meet at the design -3dB point of 102.375kHz and it’s
clear that the Multiple-Feedback filter
now gives the best performance, with
much less effect on frequencies below
100kHz than the naive filter, a much
quicker roll-off above this point and
very little change in its rate of attenuation up to 10MHz; just a slight change
in the rate of attenuation, which reaches -75dB at 10MHz.
By comparison, the Sallen-Key filter
gives virtually identical performance
up to 1.4MHz but it reaches a maximum attenuation of -50dB at 2.2MHz,
above which is attenuation factor actually falls, giving -40dB at 10MHz. Its
Fig.5: the same
frequency response
plots as shown in
Fig.4 but this time,
with 25MHz op
amps, giving better
results. You can see
that the Sallen-Key
filter is still less
than ideal but its
rebound has been
pushed to a higher
frequency.
Fig.6: a similar plot
to Fig.5 but this
time up to 100MHz,
so we can see how
the filters behave
between 10MHz
and 100MHz.
Celebrating 30 Years
May 2018 45
Fig.7: a simplified hifi audio amplifier circuit simulated using components available in the libraries supplied with LTspice.
curve crosses the naive filter for a second time at 2.73MHz, with the naive
filter continuing to provide attenuation,
reaching -72dB at 10MHz.
If we go back to the schematic,
right-click on the simulation command (which starts with “.ac”) and
change the finish frequency to 100MHz
(“100MegHz”), we get the plot shown
in Fig.6.
This shows that the Sallen-Key bode
plot has a peak of -31dB at 35MHz,
above which it again begins to slowly
roll off. By comparison, the MultipleFeedback filter does continue to increase its attenuation at higher frequencies although at a reduced rate.
The naive filter overtakes it at
15MHz, where both reach -78.5dB.
The Multiple-Feedback filter reaches
-100dB at 100MHz while the Naive filter is at -132dB by 100MHz.
Simulating an amplifier with
discrete components
Our article on Amplifier Stability
and Compensation in the July 2011
issue gave fairly detailed information
on using SPICE to simulate an amplifier and test it for stability under difficult conditions, for example, when it
is driven into clipping.
Rather than go back over that, we will
instead build a simple amplifier circuit
in the simulator to analyse the amplifier efficiency, determine the dissipation
in the major components and examine
how power flows from the transformer
through to the loudspeaker load.
We’ve drawn up a minimalistic hifi
Fig.8: the voltage across load resistor RL is shown in
mauve while the dissipation in that resistor (ie, load
power) is in green.
46
Silicon Chip
power amplifier circuit in LTspice and
this is shown in Fig.7. We’ve used only
components from the built-in libraries. The test input signal, a 2.1V peak
sinewave is from V1. This is fed into
the base of PNP transistor Q1, which
forms a differential input pair with
Q2. Q2 is connected to the output via
a 12kΩ/510Ω divider, setting the amplifier gain to 24.5 times.
NPN transistors Q3 and Q4 are the
current mirror load for the input pair
while PNP transistor Q5 is the constant
current source for their emitters. The
differential stage output current flows
from the collector of Q1 to the base
of Q8, the VAS (voltage amplification
stage) transistor which has a 100pF
compensation capacitor, to stabilise
the amplifier.
Fig.9: this shows how the amplifier output voltage plus
the AC and DC supply voltages behave when power is first
applied.
Celebrating 30 Years
siliconchip.com.au
Fig.10: this
demonstrates how
current is drawn
in brief bursts
from the simulated
transformer
secondaries at their
voltage peaks.
Q10 and its two base resistors form
the Vbe multiplier that sets the bias
voltage for the output stage and thus
the quiescent current. The bias resistor
values were determined experimentally and set the output stage quiescent
current to 120mA per transistor pair.
PNP transistor Q9 is the constant current source for the VAS while Q6 controls the base bias for both Q5 and Q9.
The output stage consists of driver
transistors Q11 and Q14 and power
transistors Q12, Q13, Q15 and Q16 (in
Darlington emitter follower configuration). These have 0.1Ω emitter resistors
and there is an RLC filter at the output
to isolate the load (at high frequencies)
and ensure stability. The test load is an
8-ohm resistance, RL.
The power supply consists of sinewave voltage sources V2 and V3 which
represent the two halves of a centretapped transformer secondary (45-045VAC). This is rectified by bridge
rectifier DP1-DP4 and the supply is filtered by a pair of 10,000F capacitors.
Examining power supply
behaviour
Fig.8 shows the output voltage in
mauve. This is a zoomed-in portion of
the simulation output since the waveform is clipped initially as the power
supply filter capacitors charge up. But
if we’re interested in looking at the output power, that muddies the water. As
expected, the output is a sinewave. The
2.1V peak input has been amplified by
the 24.5 times gain to yield peak voltages of just over ±50V.
The green plot is the instantaneous dissipation in the load resistor.
This is plotted by holding down the
ALT key in Windows and then clicking on the load resistor, RL. Control-clicking the green text at the top
(“V(output)*I(RL)”) then yields the integral box shown at lower right. This
reveals that the amplifier is delivering
siliconchip.com.au
around 165W average to the load in
this condition.
The instantaneous dissipation in
RL is 0W when the applied voltage
passes through 0V and rises to a peak
of around 330W at both the positive
and negative sinewave maxima. Note
that this is a sine-squared waveform
which is why there is a 2:1 ratio between peak and RMS power, not the
sqrt(2) ratio you would expect for a
normal sinewave.
Fig.9 shows a “zoomed out” version
of the simulation plot where you can
see the V+ (green) and V- (blue) power
rails initially charging up.
This is unrealistically fast as we
have simulated a transformer with a
zero ohm output impedance; you could
add a small series resistance and/or inductance if you wanted a more realistic simulation of amplifier switch-on.
The mauve waveform once again
shows the amplifier output and you
can see that it is initially clipped by
the low supply rail voltages, especially on negative excursions due to R25
and C11, which form an RC low-pass
filter for the negative rail at the front
end of the amplifier.
These components are important to
prevent supply rail ripple due to the
load current from affecting the input
pair and VAS but they do slow down
the amplifier’s start-up somewhat. And
as shown, they also make the waveform
initially clip asymmetrically.
Normally, this would not be a problem as there would typically be a relay
between the amplifier and the output
terminals with a delayed switch-on to
prevent a thump from the speakers at
power-up.
The red and cyan traces in Fig.9 are
the simulated transformer secondary
waveforms and they show how the
supply rails are pumped up when the
transformer secondary voltages peak
and the rails slowly decay, as the load
current is drawn during the subsequent mains half-cycles. You can also
see how the two halves of the centretapped secondary alternately charge
up the supply rails.
This is shown in more detail in
Fig.10. This time the supply rails are
plotted in blue (V+) and cyan (V-) while
the simulated secondary voltages are
in red and green. Current from voltage
sources V2 and V3, representing the
transformer secondaries, is shown in
grey and mauve.
Ignoring the initial very high current on the first mains half-cycle, the
remaining current pulses are semirealistic and you may be surprised to
see that zero current is drawn from the
transformer most of the time, with brief
peaks to nearly 40A being drawn over
a ~1ms period every 10ms.
Calculating amplifier
efficiency
If we zoom into the plot so that we
remove the initial surge current and
then CTRL-click the I(V2) text at the
top of the window, this gives us an
RMS current of 8.3A.
If we assume a Class-AB amplifier
efficiency of 70%, for 165W output we
need an input power of 235W and with
two 60VAC secondaries, you would
expect 2A [235W ÷ 60V ÷ 2] = drawn
from each supply rail.
Fig.11: averaging
the power
drawn from the
transformer to
calculate the
amplifier input
power, so we
can calculate its
efficiency. The
circuit is shown
larger in Fig.7.
Celebrating 30 Years
May 2018 47
Fig.12: the
instantaneous
dissipation in the
output and driver
transistors. These
can be averaged to
estimate how hot
they will get.
The reason for the discrepancy is the
fact that current is only drawn for such
a short period during the secondary
voltage peaks. This means that I^2R
losses in the transformer, wiring, rectifier etc will all be a lot higher than
you would get with a resistive load on
the transformer.
If you think about it, though, it’s
very rare for a transformer to have a
resistive load. Transformers are mostly
used to drive rectifiers in similar configurations to this. Hence, transformer
ratings tend to be quite conservative
as they have to deal with supplying
such high peak currents with a low
duty cycle.
So does this mean that a huge
amount of power is being wasted in the
transformer? Not really. It just means
the power factor is poor. We can determine the real power drawn from the
“transformer” by labelling the output
(top) of V2 as V2V and the bottom of
V3 as V3V, then re-running the simulation, and plotting the product of current and voltage.
To do this, we right-click on the
resulting plot and selecting “Delete Traces”, then right-click again
and select “Add Trace” and type
in the formula: “I(V2)*V(V2V)”.
Add another trace with the formula
“I(V3)*V(V3V)”. We can then zoom
into a single mains cycle and controlclick the formula at the top of the window to get an average reading. The
result is shown in Fig.11.
You need to be careful when zooming that you get exactly 20ms (or a multiple thereof) on the horizontal axis or
the averaged values will not be correct.
We get a figure of very close to 123W
for both V2 and V3. Thus the total power draw of the circuit is 246W. That
means the actual amplifier efficiency
is 67% [165W ÷ 246W], pretty close
to the 70% that we estimated earlier.
48
Silicon Chip
Determining device
dissipation
We can measure the dissipation in
the output transistors, driver transistors and rectifier diodes by alt-clicking them and then control-clicking
the formula that appears at the top of
the window.
Fig.12 shows the dissipation of one
pair of output transistors in green and
blue and one of the drivers in red. As
you can see, we get a reading of around
17.5W for each of the four main output devices.
Repeating the same exercise gives a
dissipation figure of 2W total for the
two drivers plus 2W in each of the rectifier diodes, for a total (including the
load) of 245W [165W + 17.5W x 4 +
2W x 5], leaving just one watt unaccounted for, most of which turns out
to be due to the 0.1Ω emitter resistors.
So this shows how the simulation
can help you determine efficiency, calculate device dissipation and so on.
It’s a good idea to check dissipation
for the smaller transistors too.
Depending on the current through
each stage, they could potentially be
buys
close to their specified limit as they
would normally be in much smaller
packages than the output transistors.
You could also easily measure the
peak and average current in the output
devices to check that they are within
with each device’s capabilities.
Conclusion
While this article has covered a lot
of ground, there are still many other
audio circuits that we have not discussed and which can benefit from a
SPICE simulation but we don’t have
the space to cover them all.
However, the above should give you
an idea of how to “probe” and measure the simulated circuits. It’s especially helpful for tweaking component types and values to achieve an
optimal result.
For example, you could increase
the amplitude of the input sinewave
to the amplifier and investigate what
happens when the amplifier is driven
into clipping.
You could build a simulated loudspeaker load based on resistors and
inductors and possibly even include
a crossover network, to better explore
how the load’s reactance affects amplifier operation, stability and efficiency.
All the circuits shown in this article
are available for download from the
SILICON CHIP website (in a ZIP package) so feel free to experiment, probe,
tweak and find out for yourself just
how they work and what effect your
changes will have.
After all, you can’t blow anything
up! In fact, why not over-drive things
to destruction just to see what happens? It’s a simulation: you won’t have
to buy any new components!
SC
Linear Technology
More than a year ago, Analog Devices completed the acquisition of Linear Technology (the owners of LTspice).
LTspice is still available as a free download but you can now access it via siliconchip.
com.au/link/aajo
You may find that if you have an older installation of LTspice, the automatic update
feature no longer works because the URL it fetches is no longer valid. We suggest you
download and install the latest version from the above link, which should then be able
to keep itself up-to-date.
One major advantage of the new version is that there are now many Analog Devices
(ADxxxx) parts available to simulate, along with the existing set of Linear Technology
(LTxxxx) parts.
However! We have found the latest version of LTspice (version XVII) to be considerably less stable than the older version that we used (version IV). Hence, you may wish
to keep your old version of the software in case these bugs have not yet been fixed. You
may notice that some of our screen captures are from the earlier version, for this reason.
Celebrating 30 Years
siliconchip.com.au
|