Pages: 1 [2]   Go Down
Author Topic: How to wire up LM386 amp for audio?  (Read 7341 times)
0 Members and 1 Guest are viewing this topic.
Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 331
Posts: 16540
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here is a great site for audio electronics fundamentals and projects. It's Hi-Fi orientated but has great articles on fundamentals and his projects are well explained and are a great learning experience even if you don't build any of his circuits. Take your time looking around as there are lots of different sections and topics covered and can take quite awhile to see it all.

http://sound.westhost.com/index.html

Lefty
Logged

CO, USA
Offline Offline
God Member
*****
Karma: 4
Posts: 710
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here is a great site for audio electronics fundamentals and projects. It's Hi-Fi orientated but has great articles on fundamentals and his projects are well explained and are a great learning experience even if you don't build any of his circuits. Take your time looking around as there are lots of different sections and topics covered and can take quite awhile to see it all.

http://sound.westhost.com/index.html

Lefty

Quote
Not all have been built and verified, but with those that have not this is not an issue, since they cannot help but work.

Heh. Reminds me of Donald Knuth.

Also, bookmarked for educational purposes, and because a headphone amp is on my list.
« Last Edit: October 22, 2011, 11:36:38 pm by justjed » Logged

... it is poor civic hygiene to install technologies that could someday
facilitate a police state. -- Bruce Schneier

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 441
Posts: 23834
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I think good results can be obtained by wiring the part per the Applicatin Hints on the datasheet as well.

Having a picture of the chip with no indication of what the pins are is not helpful.


* LM386_speaker_amp.jpg (111.47 KB, 960x720 - viewed 45 times.)
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

SW Scotland
Offline Offline
Edison Member
*
Karma: 13
Posts: 1318
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Your next step is to ensure the signal you feed into the amplifier is a good signal. 
Amplifiers are a bit like software programmes   -   rubbish in = rubbish out.
There's no point in playing with filters until you establish that you are feeding a clean signal into the unit.
Logged

0
Offline Offline
Edison Member
*
Karma: 7
Posts: 1221
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the replies guys! =)

however.. if I knew how to do the quick term suggestions you are giving.. I wouldnt need to be here on an help forum (looking for help/guidance)

@Crossroads-

I guess I dont understand your post?

in my diagram.. all pins 'are' labled.... can you not see them?  everything is labeled.. (except a missing 'to GND' lable)



**now if you are saying I should wire it up DIFFERENTLY.. please say so or point out how.. just implying so doesnt offer my much 'real direction to solve/fix anything.  but Im unclear as to what it is you are proposing?  (except post a schematic?)



@jackrae -

I understand what your saying.. but wouldnt have any clue on HOW to go about what it is you are suggesting?

So if trying to play with filters to fine tune the noise/sound is jumping the gun.. how do I go about doing as you suggest? (making sure its a good signal?) or if its not.. making it a 'better' signal!??

Thanks  =)
Logged


Offline Offline
Edison Member
*
Karma: 57
Posts: 2191
Now, More Than Ever
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think that all you can really do is minimise distortion, you should avoid "overdriving" (clipping.)  You may have a portable radio and with fresh batteries at low and medium volumes it's OK, but when you really turn it up it starts sounding crummy - some of that's distortion, over-amplification, and some of it is just exposing certain limitations of the amplifier.

This sort of electronic sound, derived from a noise generator or noise generation techniques, isn't instrument-quality.  It sounds pretty nifty at low volumes, but there's a threshold whereat all of the faults can be appreciated. 

Anyway, the LM386 datasheet shows a X50 example.  It still uses the 10uF but with a 1200Ω resistor between it and pin1.  There is also a "bypass" capacitor that can be connected between pin7 and GND.  They don't give much guidance, text and example values from 0.1 - 10uF.
"When using the LM386 with higher gains (bypassing the 1.35 kΩ resistor between pins 1 and 8 ) it is necessary to bypass the unused input, preventing degradation of gain and possible instabilities. This is done with a 0.1 µF capacitor or a short to ground depending on the dc source resistance on the driven input."

Post Edit -- bonk inadvertent smiley
« Last Edit: October 23, 2011, 11:16:09 am by runaway_pancake » Logged

"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"

CO, USA
Offline Offline
God Member
*****
Karma: 4
Posts: 710
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

in my diagram.. all pins 'are' labled.... can you not see them?  everything is labeled.. (except a missing 'to GND' lable)

He means functional labels, such as GND, SIGNAL, GAIN, etc.
Logged

... it is poor civic hygiene to install technologies that could someday
facilitate a police state. -- Bruce Schneier

0
Offline Offline
Edison Member
*
Karma: 7
Posts: 1221
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@justjed-

ahh..thanks.  I suppose that WOULD help people follow the diagram easier.  (I can make changes...np)

here is updated diagram...



showing a legend for PIN-OUT on the lm386 and the 10uF cap added for GAIN

@runaway_pancake-

some of it makes sense.. like over-driving.. makes the audio go 'crap' (clipping/distortion)

Im trying tp understand what it is I shoudl do from your comments..

1.) add a 1.2k resistor to the 10uF cap I added to the GAIN... yes?   (does it matter what side I put it on? +  or - side of the cap?)

2.) add a 0.1uF cap to pin 7 (bypass pin) to GND...


correct?


anyone care to help educate me about how to define or figure out anything about the signal BEFORE it goes to the amp/LM386?
was a comment about signal integrity BEFORE it goes there..  but I wouldnt have any clue on that.


a quick background on the sound INPUT (SND out from the PIC chip)..

I am using a PIC24FJ chip.. flashed with an API of some sorts to let noobs write generic code based on the API/instruction set.. (this 'code goes on .txt file on SD card..which is then loaded into the PIC chip upon powering it up)..

this is not mine.. I have no control over it..

however it has an EASY API to use..for doing simple things like PWM and playing audio..etc..  ( a very simple and generic platform)..

the PIC chip itself.. (somehow)  outputs Audio on its set pin(s)... this is what I am trying to use/tap so I can output to a speaker..etc..

anyways.. thanks you guys for the replies so far.. and understanding that not everyone has the skill sets you may have become accustomed to!  =)



Logged


Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 441
Posts: 23834
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I was thinking more of posting a schematic.  This is much easier to see what is happening electrically.



* LM386amp.jpg (49.57 KB, 960x720 - viewed 54 times.)
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Offline Offline
Edison Member
*
Karma: 57
Posts: 2191
Now, More Than Ever
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

1.) add a 1.2k resistor to the 10uF cap I added to the GAIN... yes?   (does it matter what side I put it on? +  or - side of the cap?)
I don't think it matters, but they show it between pin1 and Cap+, Cap- going to pin8.

2.) add a 0.1uF cap to pin 7 (bypass pin) to GND...
"Experiment for value", try various cap values, one lead to pin7 and the other to GND.  If it has a good effect then use it, if it makes things worse or has no effect then lose it.
Logged

"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"

0
Offline Offline
Edison Member
*
Karma: 7
Posts: 1221
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi guys--


@crossroads-

I understand.. but schematics like that take some people time to understand or learn.  (especially symbols, and how wiring can be followed/traced)..etc

which is why I asked/posted for an image/diagram.. vs schematic.

I understand 'better get used to reading schematics if you want to be in this hobby'...(yadda yadda)..  (those kinda statements dont do much in HELPING one learn or be better) the OP can usually only give the resources knowledge he has. =)

for me thats a image/diagram of how I have things wired.



@runaway_pancake-

That I will try that, test different values and see what I 'see' (hear) =)


Anyone care to tackle the comment made previously about the signal out of/from the PIC chip? since it was mentioned that all this other stuff means nothing if that source signal is no good?


thanks!
Logged


Offline Offline
Edison Member
*
Karma: 57
Posts: 2191
Now, More Than Ever
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Anyone care to tackle the comment made previously about the signal out of/from the PIC chip? since it was mentioned that all this other stuff means nothing if that source signal is no good?
Well, I did.  It's not that it's "no good", just that it is what it is.  If it's clipped/over-amplified that's a matter you can take steps to address, but beyond that, you cannot transform square waves and pulses into pure sine waves. 
What is the sound quality compared to your other amp (better/same/worse)?  (If it's like the one I'm thinking it is, that's LM386-based, too.)
Maybe give that input capacitor (ac-coupling cap), the one between the source and the pot, a go.
Logged

"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"

0
Offline Offline
Edison Member
*
Karma: 7
Posts: 1221
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hmm.. good question..

I suppose the RadioShack amplified speaker isnt 'that great' either..  but only at low/mid volume at best.

I have no idea what that amp is based of. (LM386 or other)..


ok so what left for me to play with/eperiemnt with is:

1.) add a 1.2k resistor to the 10uF cap I added to the GAIN

2.) add a 0.1uF cap to pin 7 (bypass pin) to GND... (and play with values from there) (if I have that that value) smiley-cry

3.) add a 10uF 'ac-coupling capacitor' between the source and the pot..

I'll give those all a go.

thanks

Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 42
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

Just tappin into this topic though it's very old.

I've been reading these posts because I'm working with the lm386-n3 for some 8 ohm 0.5w speakers.
I have 3 amplifiers made with this IC going out to each their own speaker. The sound source comes from a fireface 400 sound interface, with a dedicated output for each amplifier/speaker.

I tried using wall sockets (12 v dc) together with some 5v regulators, but this gave me incredible amounts of noise. It was like the speakers were acting like antennas. I read somewhere that the wire on the input of the lm386 should be as short as possible, but my wires are pretty long - going from the sound interface to the amplifier (around 2 meters). Can this be source for the picking up of noise and unwanted stuff?

And one thing that is a bit unclear to me regarding grounding:
My signal ground (the outer layer of cobber in my coaxial cables): should this ground share the same ground as the voltage source (battery or wall socket)? In the datasheet of the lm386 it doesn't say anything about that. It just says "Vs +" and not where the "-" goes.

I guess it SHOULD be connected to the same ground, because i get a much higher signal when doing so.
Anyway, the ground is just a 0 reference (as far as I know) so I don't see why there should be different types of ground.

Regarding the input pot (10k) - would it be OK to use a 220k pot, eg? I mean, it can just be turned down to the appropriate amount of restistance, no?

Are there any good tips on avoiding these "picking up stuff" in the amps? It seems my amps, although they are built in almost the same way and with the same components, act differently. Some are sometimes extremely sensitive and sometimes they work fine.

Any knowledge will be  much appreciated.

Thanks,

Søren
Logged

Lacey, Washington, USA
Offline Offline
Edison Member
*
Karma: 37
Posts: 1755
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You should start your own thread, your problems are entirely different.

If you are using this one simply because you are also using an LM386, imagine every thread being in one because they all use Arduinos, regardless of the problem.
Logged

Steve Greenfield AE7HD
CET Consumer Electronics and Computer

Pages: 1 [2]   Go Up
Jump to: