Getting clean sound from 9V battery powered audio amp - Page 1
Forum section: electronics / beginners

author: Frankentronics
author_rank: Regular Contributor
timestamp: June 12, 2020, 01:50:35 am
content: Greetings,One of my objectives is to build 9V battery powered guitar practice amps.I've build some that have turned out acceptable, but I want to get deeper into understanding what I'm doing and also being able to build a wide range of different 9V amps.So, I recently bought a scope, am currently putting together a signal generator and today I started experimenting.Today I built a simple LM 386 circuit, straight off of the datasheet.When I feed an audio signal into the circuit, what comes out of the other end is completely distorted. There's so much clipping it's not anywhere close to looking like a sine wave.I took a picture of the scope, showing what goes in and what comes out.Is it even possible to build an audio amplifier, using the LM 386, that would amplify the signal without any clipping?Thanks...

author: themadhippy
author_rank: Super Contributor
timestamp: June 12, 2020, 02:38:22 am
content: which circuit from the data sheet did you use as there are several with different gains.And what sort of level are you inputting to the amp?First thing i'd try is turning the input level doown to see if it improves things

author: floobydust
author_rank: Super Contributor
timestamp: June 12, 2020, 03:18:05 am
content: LM386 is a very old dog. But you will find all the (linear) audio power amplifier IC's have very poor voltage efficiency. There are losses in the IC's output stage. Some parts added bootstrapping to help somewhat, like TBA820M.With a 9V rail, 8 ohms and 10% THD, theLM386gives you 500-700mW for a loss of 3.3-2.3V so ending up with a 6V battery.High efficiency and lower distortion, you would go to discrete transistors or transformers like old radios.Everything has gone Class D because 90% efficiency and you get more power than LM386 at 9V, with only a 3.6V rail!Vox Mini 3 usedTPA2039but quite unreliable and BGA package is disposable, throw the VOX in the garbage or refit a different IC when it fails.SSM2305is MSOP and you can at least work with it.LM4670orPAM8603to consider.You have to chose your system voltage based on the battery pack, or use a boost-converter.

author: Jwillis
author_rank: Super Contributor
timestamp: June 12, 2020, 03:51:23 am
content: If you used the first circuit on the data sheet you will see it has a gain of 20. In perfect opamp , if you put 1 V into the input you get 20V on the output . This goes beyond the supply voltage of 9V by 11V. So you only want to put 400mV max at the input. So as themadhippy said you need to turn down the input .

author: Frankentronics
author_rank: Regular Contributor
timestamp: June 12, 2020, 03:56:41 am
content: Thank you for your quick replies.I know this is an old IC, but I want to experiment with many different options, for my own learning. Also, this is for guitar players and guitar players like to stick to old tech, like tube amps, etc. In fact, for that very reason I am also interested in learning to use FETs, so that I can tell them the transistors in the particular circuit are more like tubes, as opposed to "standard" transistors (meaning BJTs). For that reason I am very much interested in exploring any IC's that have FETs, such as TL071 and TL072. Are there any other FET input Op Amps that I should explore?One reason I started with the 386 is because it's so basic and it doesn't need a split power supply.The circuits I put together were the most basic one, such as these:Both circuits gave me pretty much same results. I also tried adding a 10uF cap from pin 7 and I also increased the .05uF cap all the way to .47uF just to mess around.The signal I used was 2.1Vpp, straight out of my signal generator (that I am still breadboarding). I was trying to dial down the output pot but then I was running into other problems.Here are some photos.The clipping goes away at around 322mVpp, but then I get additional oscillation on the sine wave. In fact, when I dial down the signal, the LM386 circuit seems to somehow corrupt the signal coming from my generator and I can see oscillations on the incoming sine wave. That oscillation is not present when I cut the power to the LM386.

author: Frankentronics
author_rank: Regular Contributor
timestamp: June 12, 2020, 03:58:32 am
content: Quote from: Jwillis on June 12, 2020, 03:51:23 amOh I see. You posted this as I was typing my reply.BTW, what is the pp voltage of a guitar signal?

author: floobydust
author_rank: Super Contributor
timestamp: June 12, 2020, 05:50:14 am
content: The LM386 does tend to oscillate at around 13MHz. This is the RF fuzzies you see on the scope traces if you zoom in. It will sound really distorted and harsh midrange. You need around 2.2uF ceramic/film capacitor located right across its power supply pins to stop this.On a breadboard it can be harder to stop if the grounding is done poorly. The speaker load and PSU and LM386 ground need to connect to a single point. If the speaker ground is in the wrong spot, the circuit can oscillate.The LM386 also loves to pickup AM radio, if you just touch the input and hear AM radio, I add an RC filter at its input.

author: exe
author_rank: Unknown
timestamp: June 12, 2020, 08:02:15 am
content: Quote from: Frankentronics on June 12, 2020, 03:56:41 amIn guitar opamp circuits with feedback, distortion is not a product of "type" of transistors or opamp type. Distortion comes from the feedback loop. Type of opamp (fet/bjt input) mostly affects input bias current and noise, but not to the extent many people expect.I suggest find a good audio engineering book, doing "opamp rolling" will not get you far. Many people just swap opamps without understanding why they get difference in sound (hint: most of the time there is no difference unless opamp starts clipping, oscillating, etc).

author: magic
author_rank: Super Contributor
timestamp: June 12, 2020, 08:06:22 am
content: Beware that there are fake LM386 on auction sites. No idea how compatible with the original they are in terms of quirky behaviors.

author: Frankentronics
author_rank: Regular Contributor
timestamp: June 12, 2020, 03:50:57 pm
content: Wow! I learned more in the last 24 hours than in the past few years building occasional amps. It really makes a difference using a scope and signal generator, not to mention access to this forum and your generous help.To be clear, I actually recently changed my screen name to Frankentronics, but some of you might remember me posting as Adinol.My current setup is still improvised. I recently built my bench power supply and I have a curve tracer and a signal generator still on the breadboard, as you can see in the photo.Quote from: Jwillis on June 12, 2020, 03:51:23 amSo, with the amp powering up from a regulated 9V supply, it outputs about 6Vpp before clipping.When I switch to a 5V regulated supply the clipping occurs around 3Vpp. However, when I switch to a 12V regulated supply the clipping is around 7.74Vpp. I was expecting the clipping to be a bit closer to 12V.Also, the clipping occurs at the positive amplitude first. Why would that be?Quote from: floobydust on June 12, 2020, 05:50:14 amI didn't have a 2.2uF on hand so I used two 1uF caps. But the fuzziness went away already when I plugged in the first 1uF cap. Is there are reason to actually use 2.2uF?I guess the best PCB payout would be to use a through hole LM386 and have an SMD cap right across pins 4 and 6, right under the IC. I Googled "LM386 PCB layout" but I did not find such layout. I wonder why. But I guess I'll just design my own, which is more satisfying, anyway.Quote from: floobydust on June 12, 2020, 05:50:14 amI guess it really makes a difference how one lays out the traces on the PCB. I've seen circuits where several traces all go to a single point. Good to know.Quote from: floobydust on June 12, 2020, 05:50:14 amWould the best solution be to enclose the circuit inside of a grounded metal box?Quote from: exe on June 12, 2020, 08:02:15 amOne thing I want to learn to do is to build a circuit that would compress the amplitudes, rather than clip. But that's later down the line, after I get all the basics right.Quote from: exe on June 12, 2020, 08:02:15 amI want to first focus on building battery powered guitar amps. I want them to have an overdriven sound at room volume, so one can crank it up and not bother neighbors. With that in mind, is there a book that you could recommend that would deal a lot with those issues?Quote from: exe on June 12, 2020, 08:02:15 amI guess I was on the path of "Op Amp" rolling, LOL, but I really want to learn more about how things work, so I know what I'm doing. This is all very interesting.Quote from: magic on June 12, 2020, 08:06:22 amI got all my IC's from Jameco, DigiKey and Mouser. I do know about fakes and to be honest I can't even begin to understand how anyone builds fake ICs. It's not something one can cook up in a kitchen.

author: themadhippy
author_rank: Super Contributor
timestamp: June 12, 2020, 05:06:18 pm
content: Quotewhy not look at it from the other end,You'll find plenty of material on how to avoid distortion in amplifiers,take those ideas and do the opposite.

author: Frankentronics
author_rank: Regular Contributor
timestamp: June 12, 2020, 05:20:52 pm
content: Quote from: themadhippy on June 12, 2020, 05:06:18 pmBut would that result in compression or in clipping?

author: floobydust
author_rank: Super Contributor
timestamp: June 12, 2020, 06:11:05 pm
content: The RF oscillations show up more with increasing output power, you need an 8R or 4R load at full power to check. I found 2.2uF worked, not 0.1uF but go ahead use 1uF. More important to have a place for it when you make a pcb. The IC heats up a lot more if the osc are present.The LM386, loudspeaker and 10R/0.1uF Zobel, best if GND connects to the power supply at one point. The high loudspeaker currents flowing on the bus/trace cause a voltage drop which the LM386 input can see and amplify (oscillate).I always add an RC filter at the LM386 input to stop AM radio and ultrasonics, here I use 4.7k and 1nF for a 34kHz rolloff. You could also just use a few hundred pF cap to GND at the input pin 3. No need for metal shielding but the potentiometer housing is best grounded as they pick up hum when touched.The chinese LM386 kits are under $1... for pcb, IC socket, potentiometer, jack., caps, LED etc. Unbelievable. Maybe some have fake IC's for that price. Note they have a bad pcb layout grounding, no RF bypass cap and I found not worth the hassle to fix them up.For a quiet overdrive sound, you can't rely on the power amp section being overloaded as the distortion source. You need to overdrive a stage upstream of the LM386. Marshall, Fender etc. have volume controls at the middle sections, so you can chose which stage is overdriven. Try add or move around gain controls.

author: Buriedcode
author_rank: Super Contributor
timestamp: June 12, 2020, 06:51:49 pm
content: Quote from: Frankentronics on June 12, 2020, 05:20:52 pmThats what an overdriven sound is really, compression and clippingEdit: I misread your replyYes, ultimately, "distortion" in terms of amplifiers changes the shape of the waveform, often adding harmonics, a common form is clipping where the output stage cannot reach beyond the rails. Compression would occur because as the input signal decays, the output signals amplitude remains the same (clipped) until it falls below what the output stage is capable of.There's a lot involved in creating a "overdriven amp" sound, as its a combination of many factors, imperfect components and systems that just so happen to form a sound that has become popular. Also note, even "clean" guitar amps have distortion - the actual guitar signal is pretty boring/sterile, which is why (electric) guitarists dont' use HIFI amps or plug straight into a mixer.The good news is is the golden age of making your own guitar effects/amps, and there's lots of experiments to try, with different clipping stages, EQ, and clipping existing designs (of which there are hundreds, probably thousands.. all with schematics available). One could spend years trying different things out.I'm sure I've seen an LM386 used in some fuzz designs.

author: Frankentronics
author_rank: Regular Contributor
timestamp: June 12, 2020, 09:06:00 pm
content: Thanks again for your replies.Quote from: floobydust on June 12, 2020, 06:11:05 pmI've been looking at my wave forms either by having an actual 8 Ohm speaker or an 8 Ohm resistor at the output.This brings me to a question. Is connecting an 8 Ohm resistor actually the same as connecting an 8 Ohm speaker? I know one is resistance and the other is impedance, but is is actually the same thing in terms of testing the circuit?Also, I am not clear on you saying to have either an 8R or 4R load. The datasheet says 8 to 16 Ohms. So wouldn't a 4 Ohm speaker (or dummy load) damage the IC?Quote from: floobydust on June 12, 2020, 06:11:05 pmHow much does that 4k7 resistor suppress the incoming signal?Quote from: floobydust on June 12, 2020, 06:11:05 pmI definitely want to make my own PCBs. That's part of the joy of building.Quote from: floobydust on June 12, 2020, 06:11:05 pmIf I understand, the only way to achieve the type of overdriven sound I want is to have a pre-amp with some kind of control, correct?Quote from: Buriedcode on June 12, 2020, 06:51:49 pmTo be clear, you are talking about the "clean" amp setting for an electric guitar, not for an acoustic with a piezo pickup, right?Quote from: Buriedcode on June 12, 2020, 06:51:49 pmIn a way there's too many circuits on the internet and the schematics really don't explain PCB layout, such as, for example, connecting all the grounds to one point. I've experimented with quite a few schematics I found online but without a scope and signal generator it's very limiting to understand what is going on.Just by making these few posts, checking things on the scope and reading your replies I am already enjoying the whole process a lot more than all the copycat breadboarding I've been doing in the past. This is really the way to go, i.e. start at the beginning and learn one step at a time.I very much appreciate all your help.

author: Frankentronics
author_rank: Regular Contributor
timestamp: June 13, 2020, 02:32:57 pm
content: I'm continuing my experiments by building pre-amp circuits form this pagehttp://www.hawestv.com/amp_projects/fet_preamp/fetpreamp2.htm. Some of the circuits are pre-amps, some are attenuators and some are buffers. They all use the MPF102 J-FET.I started at the top of the page and built this one.This is an inverting pre-amp. I have several MPF102 FETs so I tried a few to see if they all perform the same. They all happen to generate some kind of distortion that looks almost like a crossover distortion on the scope.I am having trouble understanding why this is happening.Any ideas?Thanks...

author: Buriedcode
author_rank: Super Contributor
timestamp: June 13, 2020, 02:44:01 pm
content: Quote from: Frankentronics on June 12, 2020, 09:06:00 pmCorrect. A piezo equipped acoustic would have a buffer (that really should be distortion free, just to provide a high impedance input) and just requires amplification, not colour. A "clean" electric guitar amp, like fender twin, or a Roland J120 would still have a relatively high THD even if it doesn't sound like it has any "dirt". This is a combination of the amp, and the speaker, and why a guitar into a clean guitar amp sounds way better than the dry guitar signal "louder".Quote from: Frankentronics on June 12, 2020, 09:06:00 pmI agree. I started electronics by copying guitar pedal circuits and trying them out, having many "clones" without really knowing whats what. Some sites used to ahve quite cool articles breaking down common/famous guitar effects and explaining what each part of the circuit does and why, but its pretty dated (like a 1995 website.. with frames..http://www.geofex.com/) I can't seem to find the specific articles on there any more. It seems that another site also has some breakdown of common pedals:https://www.electrosmash.com/tube-screamer-analysis- there are other analysis under "pedals".As a compliment to actual breadboard testing and scoping (which is ideal, but can be time consuming checking every idea) you could try LTspice to test different kinds of clipping and EQ/filter responses:https://www.analog.com/en/design-center/design-tools-and-calculators/ltspice-simulator.htmlVery handy to see how component values change waveforms or frequency response. If course it can't tell you how something sounds, but thats what breadboard prototypes are for

author: Buriedcode
author_rank: Super Contributor
timestamp: June 13, 2020, 02:47:46 pm
content: Whats the voltage at R2/C1 ? It should be roughly half the supply voltage (so 4 - 6.5V). If its too high then the output can't increase much from the mid point, too low then it can't decrease much, so you end up with asymmetrical waveforms. Not that FET buffer won't hard clip - instead it'll round off the tops, which I have heard is considered "nicer" type of distortion rather than the fuzzy/buzzy sound of a clipping opamp.Edit: Typos...

author: Frankentronics
author_rank: Regular Contributor
timestamp: June 13, 2020, 07:38:39 pm
content: Quote from: Buriedcode on June 13, 2020, 02:47:46 pmThe voltage you are asking about is the voltage measured from ground to drain, correct? I measure 4.39V, when circuit is powered from a 9V regulated supply.The voltage at source (basically across R3) is 1.69V.Quote from: Buriedcode on June 13, 2020, 02:47:46 pmI wonder if you made a typo. Did you mean "Note that..." instead of "Not that..."?But, in any event, I am not getting any clipping at all at the output of the FET circuit. I was hoping to see some soft clipping that I could dial in or out by adding a pot.

author: Buriedcode
author_rank: Super Contributor
timestamp: June 13, 2020, 10:01:42 pm
content: Quote from: Frankentronics on June 13, 2020, 07:38:39 pmCorrect, that looks to be pretty much bang on mid voltageQuote from: Frankentronics on June 13, 2020, 07:38:39 pmYes I meant "note". I often have to edit posts for typos... That buffer should soft clip, but probably asymmetrically - the top half will squish before the bottom half, which is pretty much what your scope shows