Intro: Tales From the Chip: LM386 Audio Amplifier
Audio is one of the most entertaining, time-consuming and (eventually) wallet-draining ways of learning about and falling in love with electronics. Reproducing, recording and amplifying audio gets you up close and personal with the electrons rocketing through your circuits.
Which brings us to what is in my mind the best kickoff point in learning about audio electronics - amplification. If you have access to an old speaker and an audio source (such as your phone or MP3 player) you can easily start building low cost circuits that have immediate results - music blasting into the airwaves.
It used to be that audio amplification depended on large numbers of discrete components or power-hungry vacuum tubes to get decent sound from a source to a speaker. Like everywhere else, integrated circuits have made the barrier to entry much lower, letting us use any number of op-amps designed specifically for audio. These ICs are collectively called audio amplifier ICs, amplifier chips or chip amps. Typically they require few external components, can be prototyped with simple circuit designs and require less current than their discrete and tube counterparts.
Which brings us to the venerable LM386 by Texas Instruments. This bad boy has been with us since 1983, and can still be found in low power, battery driven applications all around the world. And being...
- easy to power (using a single supply)
- low heat (no heatsink required)
- available in the prototyping-friendly DIP package
...means it's much loved by the DIY audio community and a terrific place to start experimenting with chip amps. Also, you can pick one up for around $0.50 USD :) Here we'll learn about the chip and build a simple circuit to put it to work. Let's take a look.
Step 1: LM386 101
A good place to start is the official datasheet (PDF) where you can get all the technical information you need. But I'll go over the basics here.
The LM386 is an operational amplifier than has been specifically designed for use in audio applications... which means its performance is based on the assumption that it will be driving speakers. At least at some point. However it can, like most other basic audio amplifier chips, be used as a regular op-amp as well.
It has a default gain of 20x - meaning it will multiply the voltage it receives on the input by 20 times, passing this through to the output. The gain value can be adjusted if needed.
1, 8 - Gain
Pins 1 and 8 are used to adjust the gain level from the default 20x using specific values of connected capacitors.
2 - Negative Input
3 - Positive Input
These are the standard op-amp inputs. Typically in a simple LM386 circuit, the negative input will be tied to ground while the positive input will receive the audio signal from the source.
4 - GND
5 - Vout
Pin 5 is the op-amp output, in our case the amplified signal which we send on to the speaker.
6 - Vs
The Voltage Supply pin receives the power required to operate the amplifier.
7 - Bypass
This pin provides direct access to the signal input, primarily used to remove power supply noise (preventing noise from being amplified).
The LM386N ("N" signifying the preferred DIP package for our purposes) comes in 4 flavours: LM386N-1, -2, -3 and -4. The "3" and "4" versions have slightly higher output power, with the "4" version more so given its ability to handle more input voltage (at the cost of a higher minimum voltage requirement). For the rest of this article I'll refer to the LM386N-1, as it's the chip I had laying around and represents the most basic of the variants.
Supply Voltage (Vcc):
The chip requires a minimum of 4V to operate, with a maximum of 12V.
The LM386 was primarily designed for a 4Ω speaker load, but is rated for 8Ω and 32Ω loads as well.
Under ideal conditions, 0.2% total harmonic distortion (THD) when driven with 6V of power into an 8Ω speaker at low power ratings, and up to ~10% THD closer to maximum power.
Under ideal conditions you can expect about ~700mW of clean output power, or 0.7W.
Step 2: What, Less Than One Watt?
Despite the marketing hysteria surrounding power output for speakers and amplifiers, you'd be surprised how loud 1W of output power can be. While you won't get deep, booming bass, 1W of clean power is more than enough to drive small desktop computer speakers and many mobile audio applications. And in the world of headphones (where the speakers are right next to your eardrums) you're talking a couple dozen milliwatts of power needed to crank up the volume. Here's a useful, myth-busting rule to remember:
Doubling output power gains you 3dB of acoustic power.
Which means the difference between 50W and 100W is 3dB.
The difference between 100W and 200W... 3dB.
500W and 1000W? Still only 3dB!
So you hit diminishing returns pretty quickly, and get comparatively little increase in perceived volume as you go up the power scale.
Side note: The relationship between dB, power and sound pressure is complicated, but essentially you'd need to quadruple the amplifier power to double the sound pressure, which equates into varying levels of loudness depending on the listener. See these great articles to understand more:
In fact some of the most celebrated integrated and power amplifiers (such as the legendary NAD 3020) were capable of delivering "only" 20W into 8Ω speakers, which by today's standards isn't something the marketing suits would be happy to advertise. But the fact remains that after basic power requirements have been met to drive a specific set of speakers at an ideal volume, factors such as frequency response, total harmonic distortion and transparency are far more important than raw power.
Step 3: A Simple Circuit
Building a basic functional circuit for the LM386 is dead easy. The schematic is a mono amplifier, so if you wanted to amplify a stereo signal you'd need two of these circuits (one for each channel and each speaker).
1. We need to supply an audio signal to the +Input of the amplifier (pin 3). The audio signal also needs its own path to GND. In addition, a high value resistor between the signal input and GND (10KΩ in the schematic) acts as a pull-down resistor that drives the input to ground when a source isn't connected. Without this resistor, you'll get a loud buzz/hum if your music player isn't hooked up.
2. Pins 1 and 8 have been left open, as we're using the default gain of 20x.
3. A 100uf capacitor is placed between the bypass pin (7) and GND, in order to prevent some power supply noise from being amplified.
4. The -Input and GND pins (2, 4) are connected to... GND :)
5. The power source is fed into pin 6, along with a 100uf decoupling capacitor in parallel to GND to filter out low-frequency noise.
6. Finally, the output from pin 5 is fed into the speaker, with two more capacitors paralleled to GND: a 0.1uf (100nf) cap to filter out high frequency noise, and a 1000uf supply capacitor for filtering and smoothing.
Step 4: Build It!
To build the circuit, you'll need:
☐ 1 x LM386N DIP8 IC
☐ A standard 400-hole ("half size") breadboard
☐ 1 x 0.1uf ceramic cap
☐ 2 x 100uf electrolytic cap
☐ 1 x 1000uf electrolytic cap
☐ 1 x 10KΩ carbon / metal film resistor
☐ Jumper cables
☐ A ~9-12V DC power source (a 9V battery will do fine!)
☐ A 3.5mm headphone socket and 3.5mm audio cable
☐ A cheap, 4Ω or 8Ω speaker and speaker hookup wire
Step 5: Test It!
Plug in an old 4 or 8Ω speaker (one you don't mind risking!) and an audio source and slowly turn up the volume. Experiment with different styles of music and see if you can detect any clipping or noise, especially at higher volumes. I found clipping was reached at about 80% volume on my iPhone, but by then it was already louder than comfortable average listening.
- Try the circuit with and without the various filtering capacitors and see what differences you can hear.
- Unplug the audio cable and remove the 10K pulldown resistor to appreciate what that bad boy is doing for you.
- Turn down the volume and try add a 10uf ceramic capacitor between pin 1 and 8 to increase the gain from 20x to 200x.
Experiment, and listen! But when in doubt, keep the volume low and turn it up later.
Using a small collection of audio test equipment I've put together, I got the following results while driving an 8Ω dummy load:
- With a 1kHz sine wave, a maximum input of 120mV RMS before clipping
- Around 2.38V RMS on the output
- ... meaning our gain of 20x was pretty much spot on (2380mv / 120mv = 19.83x)
- 707mW of output power, which significantly exceeded the rated output. But to be fair I was pushing it harder than recommended.
Running the circuit through a spectrum analyser for the whole 20Hz to 20kHz audio spectrum got a total of -35dBc average, or 1.7% THD (total harmonic distortion). Not audiophile by any stretch of the imagination, but for a $2 audio circuit on a cheap breadboard, with lightweight cables and unshielded inputs... not too shabby! We'll leave the 0.0001% distortion for future circuits :)
Step 6: Where to From Here?
If you like the idea of experimenting with chip amps of higher power, better noise ratings and in more demanding applications, your next steps could be:
The LM1875 - an excellent 20W mono audio amplifier that also relies on few external components, although some cooling will be required. Datasheet
The TDA2050 - a 32-35W mono chip that's heading into "audiophile" territory. Don't let that scare you away. You'll need a decent heatsink, some extra external caps and resistors and a little patience. But this baby is capable of some serious performance. Datasheet
And of course...
The LM3886, the most widely respected hifi grade DIY-friendly audio chip there is. Vanishingly low distortion, high power (35-50W) and loads of built in protection mechanisms. Get a fat heatsink! Datasheet
I'll put up new Tales From The Chip articles on these little guys soon, and other audio related Instructables in the near future.
Runner Up in the
Audio Contest 2017