Thursday, May 1, 2014

How to Create an Audio Amplifier with the LM386 OP AMP

This post isn't really anything Arduino related, but still a really cool project. I created an audio amplifier that you can connect to your iPod or whatever else you play music with and listen to it on a speaker.

In it's current state it's mono, but by adding a second speaker and second operational amplifier you can easily turn this into a stereo sound system.

I would highly recommend looking at the data sheet before building this. It shows you typical applications and other notes you would need if you were to design this from scratch. LM386 Datasheet

The parts needed for this are:
LM386 OP AMP x1
100uF Capacitor x1 [C2]
10uF Capacitor x1 [C1]
10 Ohm resistor x1 [R2]
1K Ohm resistor x1 [R1]
9 Volt Battery x1
10K ohm Potentiometer x1 [R6]
Speaker x1 (for mono)
9 Volt Battery snap x1
Audio Jack x1


The schematic for this is pretty simple, and fun to make. I think it's kinda nice making something that doesn't involve programming or micro controllers. I created the schematic using Eagle.


You can change the gain by adding a capacitor between pins 1 and 8. You can make the gain variable if you put a resistor in series with it. You can see that I did this at labels C1 and R1. I would reccomend you add a potentiometer instead of the resistor R1 so you can change the gain on the spot. If you don't put anything between pins 1 and 8, the built in 1.35K ohm resistor would set a gain of 20dB.

Capacitor C2 is used to help reduce noise to the speaker. It helps to remove constant DC voltage and only allows the audio waves to pass through.

If you wanted to make this stereo, you would need to repeat the circuit to be the same, except you would share the potentiometer that controls the gain between the two, and connect their grounds together. Inside of an audio cable there are 3 wires. Black for Ground, and the two other colors are for each audio channel. Connect one channel to one of the OP AMPS, and the other channel to the second one.

The next step is to solder this onto perfboard and put it in a nice enclosure. 

Here are some pictures of the one I made breadboarded up. 






Now here's some pictures of it being used with an oscilloscope so you can actually see the gain. 
It's hard to see the original signal a little bit but it's the bright small wave in the very center. The outside wave is actually the smaller signal amplified. Looks like it's amplifying very well! The gain might be set a little too high though, you can see in some spots how instead of a nice sinusoidal wave we get flatness at the top. That's because it's amplifying too much and is exceeding the OP AMPS power limits. This could be solved by using a 12 volt battery or greater compared to our 9 volt battery.

And here's just another view.

I hope you guys enjoyed this little project! My next couple of posts are going to be Intro to Arduino tutorials that I'm going to use for a school club I'm teaching. Those should be done fairly soon!