How to Calculate LM386 gain?

Thread Starter

disney_snoopy

Joined Feb 19, 2009
28
Hi all,

Can any1 teach me how to calculate the gain=20?
izit the Vin is from the pin3 of the IC's or measure the Vin right after my microphone?

And the Vout is measure from the pin5 or measure at the speaker???

Plz comment on this...

thank you.
 

thatoneguy

Joined Feb 19, 2009
6,359
Gain is controlled between pins 1 and 8, if both are left disconnected, the default gain is 20 (Output voltage is 20x input voltage, or 26dB)

The datasheet has the info on changing the gain, as well as an internal schematic that shows how a capacitor between pins 1 and 8 change the gain, as well as several example circuits.

http://www.datasheetcatalog.com/datasheets_pdf/L/M/3/8/LM386.shtml

The 20x voltage gain is between the Input (pins 2 and 3), and VOUT (pin 5).
 

Thread Starter

disney_snoopy

Joined Feb 19, 2009
28
huh...
i think this website should band this batateam...
As he is sending a porn photo/movie to us... maybe it is a virus in the website...
 

Thread Starter

disney_snoopy

Joined Feb 19, 2009
28
thatoneguy,

but i have a problem in getting this gain.
i measure the pin3=0.6V and pin5=3V(maximum volt i can get)
so my gain=5 instead of 20...

So what should i do le?
 
Last edited by a moderator:

Thread Starter

disney_snoopy

Joined Feb 19, 2009
28
thatoneguy,

i measure pin3=0.6V and pin5=3V(max voltage that i can get)
from here my gain=5 instead of 20
what should i do to solve the problem so that i can get gain=20?
 

thatoneguy

Joined Feb 19, 2009
6,359
Are you measuring a waveform with an oscilloscope, or are you getting the voltage from a multimeter measurement of DC levels?
 

Audioguru

Joined Dec 20, 2007
11,248
Pin 3 is at 0VDC so he must be using a multimeter set to read AC volts.
A multimeter reads the 50Hz or 60Hz mains frequency sine-wave. It is not accurate at higher frequencies with any other waveform.
 

Thread Starter

disney_snoopy

Joined Feb 19, 2009
28
I use multimeter to measure the volt but i set it to DCvolts.
However, i change the setting of multimeter to ACvolts; it gives me 0.045 for Vin while my Vout is 0.9V.
Hence, my gain was accurate to 20.
Is that correct that change the multimeter to ACvolts?
Plz comment...
 

thatoneguy

Joined Feb 19, 2009
6,359
Have you tried connecting a speaker to the circuit?

That's a good test to see if more gain is needed for the input source level.

Multimeter AC Range isn't useful, as you are getting either "mean" or RMS voltage, depending on meter, and usually only at low frequencies, under 200Hz. DC Range won't give you any useful information, since audio is AC, you are only seeing the bias output from a single ended supply.

If you need DC gain, Operational Amplifiers such as the TL082 are designed for high voltage gain, but low current ability, which, among other factors, makes them not very good as an audio power amplifier.
 

Thread Starter

disney_snoopy

Joined Feb 19, 2009
28
ya i do connect speaker after a capacitor of the LM386 output pin5.
but since the case that u said using multimeter ACvolts only measure frequency below 200Hz, then what tools should i use to measure the frequency above 200Hz?

if using oscilloscope, then how to measure???
Can explain more details?

Thank You.
 

thatoneguy

Joined Feb 19, 2009
6,359
Oscilloscope probe from ground to speaker terminal, while driving speaker.

If your power supply is only 6 Volts, attach a 0.25V peak-peak sinewave signal generator to the input. Look at the oscilloscope, you should see a tall sinewave with peak-peak voltage of around 5. If you increase the output of the signal generator above 0.3V, you will notice the sinewave "Flattens out" at the top and bottom, looking more like a square wave in extreme cases.

This is the amplifier clipping, as the gain is increasing the signal extends past what the power rails will allow (0V and 6V).

If you do not have a signal generator, whistle into a microphone from a distance, change distance to change level. This produces a surprisingly useful sine-ish waveform.
 

Audioguru

Joined Dec 20, 2007
11,248
The datasheet for the LM386 shows its output is a max of 4V p-p when its supply is only 6V and the speaker is 8 ohms. then its output power is only 0.25W at a horrible-sounding 10% distortion or a whopping 0.2W at clipping. Flea-power.
 

thatoneguy

Joined Feb 19, 2009
6,359
Granted, the LM386 definitely isn't a "Power Amplifier" as one would normally define it. At the same time, there isn't a simpler to use, stable (term used loosely) IC amplifier to compare with it.

For use as a signal tracer/low power, they are useful. If you require flat response from 10Hz to 30kHz with low THD+N, this isn't the IC you are looking for.

Look at this nice waveform when the output is loaded. Input is in blue.
BTW: That waveform sounds very icky :eek:.

 

Attachments

Audioguru

Joined Dec 20, 2007
11,248
...the LM386...
If you require flat response from 10Hz to 30kHz with low THD+N, this isn't the IC you are looking for.
Oh yeah?
Its frequency response is from almost DC to 300kHz.
Its distortion at clipping is only 0.2%.
Its noise is not bad.

BTW: That waveform sounds very icky :eek:.
Your simulation software sees no supply bypass capacitor. Then of course the waveform is messed up.
 

thatoneguy

Joined Feb 19, 2009
6,359
Oh yeah?
Its frequency response is from almost DC to 300kHz.
Its distortion at clipping is only 0.2%.
Its noise is not bad.


Your simulation software sees no supply bypass capacitor. Then of course the waveform is messed up.
I believe I screwed up the LM386 Model... It didn't exist, and I left some stuff tacked on.

Do you have a correct model for an LM386?

Rich (BB code):
##################  Model Data Report  ##################

**************** Operational Amplifier **********************
*                                                           *
*              O* LM386 subcircuit model follows:
************************************original* IC pins:     2   3   7   1   8   5   6   4
* IC pins:     1   2   3   4   5   6   7   8
*              |   |   |   |   |   |   |   |
.subckt LM386  g1  inn inp gnd out  vs byp g8
************************************original*.subckt LM386 inn inp byp  g1  g8 out  vs gnd

* input emitter-follower buffers:

q1 gnd inn 10011 ddpnp
r1 inn gnd 50k
q2 gnd inp 10012 ddpnp
r2 inp gnd 50k

* differential input stage, gain-setting
* resistors, and internal feedback resistor:

q3 10013 10011 10008 ddpnp
q4 10014 10012 g1 ddpnp
r3 vs byp 15k
r4 byp 10008 15k
r5 10008 g8 150
r6 g8 g1 1.35k
r7 g1 out 15k

* input stage current mirror:

q5 10013 10013 gnd ddnpn
q6 10014 10013 gnd ddnpn

* voltage gain stage & rolloff cap:

q7 10017 10014 gnd ddnpn
c1 10014 10017 15pf

* current mirror source for gain stage:

i1 10002 vs dc 5m
q8 10004 10002 vs ddpnp
q9 10002 10002 vs ddpnp

* Sziklai-connected push-pull output stage:

q10 10018 10017 out ddpnp
q11 10004 10004 10009 ddnpn 100
q12 10009 10009 10017 ddnpn 100
q13 vs 10004 out ddnpn 100
q14 out 10018 gnd ddnpn 100

* generic transistor models generated
* with MicroSim's PARTs utility, using
* default parameters except Bf:

.model ddnpn NPN(Is=10f Xti=3 Eg=1.11 Vaf=100
+ Bf=400 Ise=0 Ne=1.5 Ikf=0 Nk=.5 Xtb=1.5 Var=100
+ Br=1 Isc=0 Nc=2 Ikr=0 Rc=0 Cjc=2p Mjc=.3333
+ Vjc=.75 Fc=.5 Cje=5p Mje=.3333 Vje=.75 Tr=10n
+ Tf=1n Itf=1 Xtf=0 Vtf=10)

.model ddpnp PNP(Is=10f Xti=3 Eg=1.11 Vaf=100
+ Bf=200 Ise=0 Ne=1.5 Ikf=0 Nk=.5 Xtb=1.5 Var=100
+ Br=1 Isc=0 Nc=2 Ikr=0 Rc=0 Cjc=2p Mjc=.3333
+ Vjc=.75 Fc=.5 Cje=5p Mje=.3333 Vje=.75 Tr=10n
+ Tf=1n Itf=1 Xtf=0 Vtf=10)

.ends
*----------end of subcircuit model-----------perational Amplifier Model                  *
*            Interactive Image Technologies                 *
*          SPICE MODEL MAKER TOOL  Version 1.1              *
*                 All Rights Reserved                       *
*                                                           *
*************************************************************

* Date: Tuesday, March 10, 2009
* Model Name generic_uA741 
 
* INPUT VALUES: 
 
* Page 1 
 
* General 
* Model Name   generic_uA741 
* Identifier               0 
 
* Input
* Input Capacitance                = 1.400e+000 pF
* Input Offset Current                = 2.000e+001 nA
* Input Bias Current                = 8.000e+001 nA
* Input Offset Voltage                = 1.000e+000 mV
* Common-mode Input Resistance            = 2.000e+000 GOhm
* Differential-mode Input Resistance        = 2.000e+000 MOhm
* Common-mode Rejection Ratio            = 9.000e+001 dB
* Voltage Gain                    = 1.060e+002 dB
 
* Page 2 
* Gain-frequency curve poles and Zero
* Pole 1                        = 5.000e+000 Hz
* Pole 2                        = 2.000e+000 MHz
* Pole 3                        = 2.000e+001 MHz
* Pole 4                        = 1.000e+002 MHz
* Zero 3                        = 5.000e+000 MHz
 
* Page 3
 
* Output
* Slew Rate (non-inverting mode)             = 5.000e-001 V/us
* Slew Rate (inverting mode)             = 5.000e-001 V/us
* Output Resistance                 = 7.500e+001 Ohm
* Maximum Source Output Current             = 2.500e+001 mA
* Maximum Sink Output Current             = 2.500e+001 mA
 
* OP-AMP Model
.SUBCKT generic_uA741 1 5 9 11 14
* terminal 1: invert input
* terminal 5: non-invert input
* terminal 9: positive power source
* terminal 11: negative power source
* terminal 14: output
.MODEL DMOD D (N=0.001)
r1 3 0 2.000e+009
r3 3 0 2.000e+009
c3 3 5 1.400e-012
r2 3 5 2.000e+006
vc 3 1 1.000e-003 
i1 3 0 9.000e-008
i2 4 0 7.000e-008
r6 13 0 1.000e+003
c2 13 0 7.958e-011
g4 13 0 3 4 1.000e-003
r7 17 18 1.000e+004
c4 17 18 3.183e-012
r8 18 0 3.333e+003
e1 17 0 13 0 4.000e+000
r9 19 0 1.000e+003
c5 19 0 1.592e-012
g5 19 0 3 4 1.000e-003
r4 0 6 1.000e+003
c1 0 7 3.183e-005
vb 6 7 dc=0
g1 0 6 19 0 1.995e+002
g2 0 6 poly(2) 3 0 4 0 0 3.155e-003 3.155e-003
d7 7 9 DMOD
d3 7 8 DMOD
d4 8 9 DMOD
d8 11 7 DMOD
d5 10 7 DMOD
d6 11 10 DMOD
f1 8 9 poly(1) vb -1.592e+001 1
f2 11 10 poly(1) vb -1.592e+001 -1
va 12 14 dc 0
d9 14 15 DMOD
d10 15 9 DMOD
d12 11 16 DMOD
d11 16 14 DMOD
f3 15 9 poly(1) va -2.500e-002 1
f4 11 16 poly(1) va -2.500e-002 -1
g3 0 12 7 0 1.333e-002
r5 0 12 7.500e+001
rshunt1 9 0 1e6
rshunt2 11 0 1e6
.ENDS

============= Model template =================
x%p %tGAININ %tINPUT- %tINPUT+ %tGND %tOUT %tVS+ %tBYPASS %tGAINOUT %m
 

Thread Starter

disney_snoopy

Joined Feb 19, 2009
28
sigh... i read it late... i was in college but i forgotten to bring my circuit to college... will test it tomolo.

by the way, maybe i know what software simulation that have the LM386 and is download free?
 

thatoneguy

Joined Feb 19, 2009
6,359
You can get LTSpice or a variety of other SPICE like programs for free on the net.

I believe the one from orcad.com is used by a few people here.

As far as the LM386 Model, I found a couple variants on the net, but they aren't working so good, as you can see above...

I'm sure somebody here has a proper model for one. ;)
 

Ron H

Joined Apr 14, 2005
7,063
You can get LTSpice or a variety of other SPICE like programs for free on the net.

I believe the one from orcad.com is used by a few people here.

As far as the LM386 Model, I found a couple variants on the net, but they aren't working so good, as you can see above...

I'm sure somebody here has a proper model for one. ;)
Here's the model I have. I think it works.:rolleyes:
Rich (BB code):
q1 gnd inn 10011 ddpnp 
r1 inn gnd 50k 
q2 gnd inp 10012 ddpnp 
r2 inp gnd 50k 


* differential input stage, gain-setting 
* resistors, and internal feedback resistor: 


q3 10013 10011 10008 ddpnp 
q4 10014 10012 g1 ddpnp 
r3 vs byp 15k 
r4 byp 10008 15k 
r5 10008 g8 150 
r6 g8 g1 1.35k 
r7 g1 out 15k 


* input stage current mirror: 


q5 10013 10013 gnd ddnpn 
q6 10014 10013 gnd ddnpn 


* voltage gain stage & rolloff cap: 


q7 10017 10014 gnd ddnpn 
c1 10014 10017 15pf 


* current mirror source for gain stage: 


i1 10002 vs dc 5m 
q8 10004 10002 vs ddpnp 
q9 10002 10002 vs ddpnp 


* Sziklai-connected push-pull output stage: 


q10 10018 10017 out ddpnp 
q11 10004 10004 10009 ddnpn 100 
q12 10009 10009 10017 ddnpn 100 
q13 vs 10004 out ddnpn 100 
q14 out 10018 gnd ddnpn 100 


* generic transistor models generated 
* with MicroSim's PARTs utility, using 
* default parameters except Bf: 


.model ddnpn NPN(Is=10f Xti=3 Eg=1.11 Vaf=100 
+ Bf=400 Ise=0 Ne=1.5 Ikf=0 Nk=.5 Xtb=1.5 Var=100 
+ Br=1 Isc=0 Nc=2 Ikr=0 Rc=0 Cjc=2p Mjc=.3333 
+ Vjc=.75 Fc=.5 Cje=5p Mje=.3333 Vje=.75 Tr=10n 
+ Tf=1n Itf=1 Xtf=0 Vtf=10) 


.model ddpnp PNP(Is=10f Xti=3 Eg=1.11 Vaf=100 
+ Bf=200 Ise=0 Ne=1.5 Ikf=0 Nk=.5 Xtb=1.5 Var=100 
+ Br=1 Isc=0 Nc=2 Ikr=0 Rc=0 Cjc=2p Mjc=.3333 
+ Vjc=.75 Fc=.5 Cje=5p Mje=.3333 Vje=.75 Tr=10n 
+ Tf=1n Itf=1 Xtf=0 Vtf=10) 


.ends 
*----------end of subcircuit model-----------
 

Thread Starter

disney_snoopy

Joined Feb 19, 2009
28
Hi Thatoneguy,

I have replace the sine wave generator from the microphone and my probe was connect to the speaker. And i plug in the 0.25V from sine wave generator. However, my output was 3.02V from the oscilloscope instead of 5V that u said. Another point is my supply voltage is 6V from 4 AA battery.

Can u tell me why my gain is only 15 compare than what u said gain=20(5V at output).
 
Top