Learn & build · Electronics · Part II · Chapter 21

A speaker amplifier: the LM386

Every build so far dealt in levels: on or off, high or low, dark or not. Audio is a signal, a voltage that wiggles above and below zero hundreds of times a second, and that raises a problem the other builds never had: this circuit has only one supply, 0 and 5 V, so where does "below zero" go? This build answers it with the LM386, a small amplifier chip that has driven toy speakers and guitar practice amps for decades, wired exactly as its datasheet's simplest figure shows, and explains every part that figure adds.

Before you start. Speakers, power into ohms and amplifier classes are chapter 16; the RC high-pass and its cutoff are chapter 2 §3 and chapter 8 §1; the volume control is chapter 1's divider; the supply is chapter 18's 5 V rail.

1. The goal and the datasheet's circuit

The goal: a phone's headphone output plays out loud through a small 8 Ω speaker, with a volume knob, from the 5 V rail. The blocks: a volume control, an amplifier, and the speaker. This time the parts come straight from the datasheet: its "LM386 with gain = 20" figure is the minimum circuit, and the first habit of a good designer is to start from it and understand each part before changing anything. Here it is, live, playing a 440 Hz tone (the A above middle C) at half volume.

Hover the chip's output, pin 5, and then the speaker's top: the numbers are wildly different. That difference is the whole chapter.

2. A signal riding on half the supply

With one supply, the output can't go below 0 V, so the LM386 does what every single-supply amplifier does: it parks its output at half the supply, 2.5 V here, and swings up and down around that. The datasheet calls it "self-centering." The music is the wiggle; the 2.5 V is just where it lives. But a speaker connected straight to pin 5 would see the 2.5 V too, all the time. Predict what that does, then toggle the capacitor.

🎯 Challenge: find the largest input that comes out unclipped on 5 V.

Without C1, what happens to the speaker even in silence?

2.5 V / 8 Ω ≈ 0.31 A, every second it's on, and \(I^2R\) ≈ 0.75 W of heat in a coil meant for half a watt of music; the cone, pushed off-center, distorts what it does play. C1 charges to 2.5 V once and then passes only the changes (chapter 2's capacitor blocks DC and passes AC). In the schematic, pick C1 and replace it with a wire to see the speaker's current jump.

On a single supply, a signal rides on a DC level at half the supply; a capacitor in series passes the signal and keeps the DC off whatever comes next.

3. The capacitor sets the bass

C1 and the speaker are chapter 2's RC filter, the other way round: a capacitor in series and a resistance (the 8 Ω coil) to ground make a high-pass. Low notes pass less. The cutoff is \(f_c = 1/(2\pi R C)\), and with R only 8 Ω, C has to be big. Choose C1.

The datasheet draws 250 µF, which isn't a standard value, so this build uses 220 µF. What's the cutoff into an 8 Ω speaker, in hertz?

\(1/(2\pi \times 8 \times 220\,\mu\text{F}) \approx 90\) Hz, against the datasheet's 80 Hz. A small speaker can't make much below 100 Hz anyway, so 220 µF loses nothing you'd hear; on a bigger speaker, 470 µF moves the cutoff to about 42 Hz.

4. The chip: gain, and the input's limit

Two of the eight pins set the gain. Open, the LM386 amplifies 20 times. A 10 µF capacitor between pins 1 and 8 makes it 200; 1.2 kΩ in series with that capacitor, 50. More gain isn't more power, though: the output can only swing so far, about 1.8 V each way on 5 V before it clips (chapter 16), so more gain just means a smaller input already reaches that ceiling.

And the input has its own limit: the datasheet's absolute maximum for pins 2 and 3 is ±0.4 V. A phone's headphone output at full volume can exceed that, which is why the volume pot comes first, before the chip, and why you start with it turned down.

Where it breaks: 325 mW is a promise at 6 V, at 10% distortion

The datasheet's typical output power is 325 mW, into 8 Ω, on a 6 V supply, with the distortion already at 10%: a sine flattened enough to hear. On this build's 5 V, the clean swing is about ±1.8 V, which is \(1.8^2 / (2 \times 8) \approx 0.2\) W (chapter 16's power into ohms). Spec-sheet power figures always come with conditions; read them before comparing two chips.

5. The little network on the output

R1 and C2, 10 Ω and 0.05 µF from pin 5 to ground, appear in every circuit in the LM386's datasheet, with not a word about why. That's common: datasheets show what works and leave the reason to you. At audio frequencies C2 is nearly an open circuit (about 3.4 kΩ at 1 kHz with this build's 47 nF), so the network takes almost none of the music. Far above audio it's nearly a short, and then the amplifier sees at most 10 Ω.

Why would an amplifier need a load far above audio?
  1. The LM386 is a feedback amplifier, and feedback can turn into oscillation (chapter 9: a signal coming back in step, strong enough).
  2. Whether it does depends partly on the load, at the very high frequencies where the chip's own gain is running out.
  3. A speaker is a coil (chapter 16), so its impedance rises with frequency, and its leads add more coil; far above audio, the amplifier is driving almost nothing.
  4. The network holds the load near 10 Ω up there, where the chip's designers assumed a load. Builders call it a Zobel network. Leave it out and many LM386 boards work; some squeal or run hot with a faint oscillation you can't hear but a scope shows. It costs two cheap parts.

6. The breadboard

The datasheet's layout advice applies even on a breadboard: keep everything close to the chip, keep the speaker's wires short, and keep the input away from the output. The input is a few millivolts to a few hundred; the output wires carry hundreds of milliamps. Run them side by side and the amplifier hears its own output, which shows up as hum, howl or motorboating (a slow "putt-putt").

🎯 Challenge: click pin 5's column and find where the speaker's current goes.

7. The shopping list

RefPartWhy this one
U1LM386N-1 (8-pin DIP)4–12 V; gain 20 to 200. The N-4 runs to 18 V.
RV110 kΩ pot, log taperVolume, before the chip.
C1220 µF electrolytic, 16 V+Blocks the 2.5 V; cutoff ≈ 90 Hz into 8 Ω.
R1, C210 Ω ¼ W, 47 nF ceramic (473)The datasheet's output network.
C30.1 µF ceramic + 100 µF electrolyticSupply bypass at pin 6.
LS18 Ω speaker, 0.5 W or moreSmall is fine.
—3.5 mm audio jack or cableTip (left) to RV1, sleeve to ground.
opt.10 µF on pin 7 to groundLess supply hum (the datasheet's bypass pin).

8. Power up and check

9. What's wrong?

A loud hum, louder when you touch the input wire, even with the phone unplugged.

Chapter 13's floating input, at audio: an input connected to nothing picks up the 60 Hz from the room's wiring and your body, and the amplifier faithfully amplifies it 20 times. Check that the pot's ground end really is on ground, and keep the input wire short. Unplugged audio inputs on real amplifiers have a switch in the jack that grounds them.

It plays, but with a slow "putt-putt-putt" at any volume, and the 5 V rail wobbles on the meter.

Every big gulp of current the speaker takes pulls the supply down a little (chapter 5's resistance in the supply and wires); if the input shares that wobbling ground or supply, the wobble is amplified, and it goes round the loop slowly. A bulk capacitor at the chip, and separate ground wires that meet at one point, break the loop.

10. Make it yours

Next: a microcontroller board: an ESP32 reading a sensor and drawing on a little display, over two shared wires, and choosing which of its pins to use.

Previous: Sensor to switch: a dusk light · All chapters: Learn & build.

Last updated