[ad_1]
Everyone has a chip-of-shame: it’s the part that you know is suboptimal but you keep using it anyway because it just works well enough. Maybe it’s not what you would put into a design that you’re building more than a couple of, but for a quick and dirty lashup, it’s just the ticket. For Hackaday’s [Adam Fabio], that chip is the TIP120 transistor. Truth be told, we have more than one chip of shame, but for audio amplification purposes, it’s the LM386.
The LM386 is an old design, and requires a few supporting passive components to get its best performance, but it’s fundamentally solid. It’s not noise-free and doesn’t run on 3.3 V, but if you can fit a 9 V battery into your project and you need to push a moderate amount of sound out of a speaker, we’ll show you how to get the job done with an LM386.
Stuck in the Past
There are a lot of better audio amplifier chips these days if you’re looking for lower voltages. Cellphones and lithium-ion batteries, along with the overall trend toward lower voltages in gizmos across the board, have pushed chip manufacturers to do more and more with less and less. There are some great amplifier chips out there running on 3.3 V and 5 V instead of 9 V or 12 V.
In particular, there are a number of chips that run in “bridge-tied-load” mode, which means that it drives both sides of the speaker, which makes it louder for a given voltage and removes the necessity for a big output capacitor in the design. This is a win on all fronts.
Because these amplifiers are marketed toward use in tiny devices, the vast majority are in surface-mount technology (SMT) packages. With the exception of making heat dissipation a bit difficult, we’re big fans of smaller parts and not having to drill holes in home-made PCBs. If you’re not down with SMT, you’re going to have to catch up soon. For instance, our other favorite DIP chip amp, the TDA7052, has been end-of-lifed.
So for an SMT PCB design, the LM386 is dead. There are hundreds of few-hundred-milliwatt amplifiers out there that can outperform it. We’ve designed with the TPA321D, for instance, and it runs circles around the LM386, but it’s SMT. Maybe you’d like to point out your favorite grain-of-rice, few-hundred-milliwatt, 8 ohm speaker amplifier in the comments? Anyone want to buy a stick of LM386s off of our hands?
Good, Basic Design
Just kidding! The LM386 has its place — on the breadboard, in the one-off perfboarded circuit, or even free-formed with parts hanging off of it in mid-air. And as the granddaddy of DIP-format amplifiers, it’s not going anywhere. In contrast to other, supposedly superior, amplifier chips, the LM386 is still manufactured after (who knows?!) how many years. And the reason is not just the form-factor. It’s also a very solid design.
In fact, it’s a classic push-pull amplifier. The basic design uses two output transistors, one for the positive half of the voltage waveform and one for the negative half. The problem with the basic design is crossover distortion, which can be reduced by biasing the transistors just into their operating region, or by using an op-amp to provide feedback and push them through the dead zone. The LM386 does both.
If there were no such thing as an LM386, you could take a very nice op-amp for the voltage gain stage and wrap up the output transistors in the op-amp’s feedback loop to handle the current demand. The op-amp will swing the output transistors around like wild to make sure that the output voltage is a scaled-up version of the input voltage, whatever the load on the outside. The better op-amp you use, the better the overall circuit will sound.
That’s exactly what’s going on inside an LM386. The schematic, copied from the datasheet, is a simple differential amplifier (the mess of symmetric transistors on the left-hand side) that takes feedback from the output voltage on the right-hand side between the pull-up and pull-down power transistors. The diodes are there to bias the transistors just into conduction to help minimize crossover distortion. This is called class A/B operation, and depending on the audiophile in question, it’s second only to pure class A for sound quality.
In short, aside from the simplistic differential amplifier, the internals of the LM386 are essentially what you’d build anyway. No wonder it has stood the test of time: it’s a solid, basic design. Unfortunately, that’s not the same as saying that it’s easy to use.
The LM386 in Application
Have a look at the “typical applications” section of the datasheet. What’s missing? The worst omission is decoupling on the power rails, but you were going to include that anyway, right? If you’re running on batteries with low internal resistance and short wires, 0.05 microfarads is fine. If not, decouple with at least 100 microfarads plus a 0.05 – 0.1 microfarad capacitor for noise immunity.
What else is missing? In a few of the examples, they’ve included a “bypass” capacitor on pin 7, but only in a few. Even when they do add it, it’s drawn as if it were optional. It is optional if you don’t mind the amplifier hissing like a mad cat. Otherwise, this is a good place for some capacitance: anywhere from 0.1 to 10 microfarads seems plausible. Another secret trick: grounding pin 7 can be used to mute the amplifier circuit when not in use.
We’ve also noticed, and we’re not alone, that the inverting input seems to be less noisy than the non-inverting. See how the datasheet applications ground the inverting input (pin 2) and put the signal into pin 3? Do exactly the opposite and you’ll reduce your noise floor even further.
An additional circuit is listed as being “with Bass Boost”. This circuit adds highpass-filtered (negative) feedback between the output and pin 1 which damps down some of the high-frequency hiss and adds a lot more to the bass and midrange. Since a common complaint about the LM386 is that it is prone to high-frequency hiss when it’s idling, adding about 5 dB more mid-range signal to that noise is a clear win. It’s especially welcome on the small toy speakers that are usually paired with LM386 circuits.
Finally, there’s the question of the snubber capacitor and resistor on the output (pin 5). In practice, we’ve included this some times, and not other times. We built up a test board with a jumper that puts the snubber in and out of the circuit for this article. We can’t tell the difference. Supposedly, if the amplifier is prone to wild self-oscillations, this should damp it. The datasheet authors wouldn’t add it if it didn’t help with performance or reliability, we just can’t verify which of these two it is.
Not missing in any of the examples is the absolutely massive 250 microfarad output capacitor. You need it, and it needs to be big if you want to pass any bass through it. With an 8 ohm speaker and a 250 microfarad capacitor, you’re still attenuating some of the bass: 1/(2pi250 uF * 8 ohms) = 80 Hz is already reduced by 3 dB and the low E on a bass guitar is another octave down from there. That tiny little speaker is probably not helping either. Use the bass boost circuit for any low end at all.
To recap:
- More decoupling of the power supply: this chip can push peaky power, you need to feed it.
- Bypass pin 7 for noise immunity. Ground it to mute the amp.
- Use the inverting input.
- Use the Bass Boost. Think of it as hiss-reduction.
- The snubber. Do what you think is best. Retrofit if you need it?
- Don’t forget the output capacitor. Bigger is bassier.
The best design we’ve seen on the web? The 9 V battery Ruby guitar amp gets everything right. Because guitar pickups have a very low high output impedance, they also add a JFET preamp. We’d also use the bass boost option, but guitarists like their high-and-janglies and don’t seem to mind hiss.
Our Cold Dead Hands
The LM386 is a well-designed, basic workhorse that does a decent job when its hooves are kept clean and it’s well-fed. Aside from having a slow op-amp stage by today’s standards, it has decent performance. It can also sound horrible if you neglect it.
Because it’s one of the classics, it’ll always be available in through-hole DIP format, so it’s easy to wedge into a breadboard or one-off designs. You’ll never have to worry about it going out of production or costing much more than a quarter. And it runs decently loud off of a 9 V battery, which is pretty convenient to just toss into your project alongside the 3 V that’s powering the logic. Keeping the power and logic supplies separate is always a win.
It’s not a modern chip, though. The modern chips have X times more stuff going on inside. Some of this is to increase audio fidelity by speeding up the op-amp. Some of this extra circuitry helps the chips remain stable even with fewer supporting parts. The killer innovation, and the one that leads us to use a modern chip in anything that’s actually designed instead of just lashed together, is driving the speaker in bridge-tied-load mode. BTL means no output capacitors and is louder to boot — loud enough that a higher voltage for the power amplifier may not be necessary after all, though you’ll still want to decouple the supplies well.
We’re not saying that the LM386 is the best amp of all time: it can be a bit noisy and it’s demanding. But with a little care, it can work out fine. It’s absolutely not our favorite amplifier chip, but we’d miss it if it were gone, and it would make our desert-island IC list unlike other parts of its generation such as the LM741 op-amp or the TIP120 transistors — they are old, but the LM386 is a classic.
[ad_2]
Source link