How to Calculate LM386 gain?

Discussion in 'Homework Help' started by disney_snoopy, Mar 5, 2009.

  1. disney_snoopy

    disney_snoopy Thread Starter Member

    Joined:
    Feb 19, 2009
    28
    0
    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.
     
    #1
  2. thatoneguy

    thatoneguy AAC Fanatic!

    Joined:
    Feb 19, 2009
    6,356
    712
    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).
     
    #2
  3. disney_snoopy

    disney_snoopy Thread Starter Member

    Joined:
    Feb 19, 2009
    28
    0
    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...
     
    #3
  4. disney_snoopy

    disney_snoopy Thread Starter Member

    Joined:
    Feb 19, 2009
    28
    0
    [​IMG]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: Mar 5, 2009
    #4
  5. disney_snoopy

    disney_snoopy Thread Starter Member

    Joined:
    Feb 19, 2009
    28
    0
    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?
     
    #5
  6. thatoneguy

    thatoneguy AAC Fanatic!

    Joined:
    Feb 19, 2009
    6,356
    712
    Are you measuring a waveform with an oscilloscope, or are you getting the voltage from a multimeter measurement of DC levels?
     
    #6
  7. Audioguru

    Audioguru New Member

    Joined:
    Dec 20, 2007
    9,411
    886
    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.
     
    #7
  8. disney_snoopy

    disney_snoopy Thread Starter Member

    Joined:
    Feb 19, 2009
    28
    0
    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...
     
    #8
  9. Audioguru

    Audioguru New Member

    Joined:
    Dec 20, 2007
    9,411
    886
    The input and output volts of an audio amplifier are AC, not DC.
     
    #9
  10. thatoneguy

    thatoneguy AAC Fanatic!

    Joined:
    Feb 19, 2009
    6,356
    712
    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.
     
    #10
  11. disney_snoopy

    disney_snoopy Thread Starter Member

    Joined:
    Feb 19, 2009
    28
    0
    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.
     
    #11
  12. thatoneguy

    thatoneguy AAC Fanatic!

    Joined:
    Feb 19, 2009
    6,356
    712
    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.
     
    #12
  13. Audioguru

    Audioguru New Member

    Joined:
    Dec 20, 2007
    9,411
    886
    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.
     
    #13
  14. thatoneguy

    thatoneguy AAC Fanatic!

    Joined:
    Feb 19, 2009
    6,356
    712
    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:.

    [​IMG]
     
    #14
  15. Audioguru

    Audioguru New Member

    Joined:
    Dec 20, 2007
    9,411
    886
    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.
     
    #15
  16. thatoneguy

    thatoneguy AAC Fanatic!

    Joined:
    Feb 19, 2009
    6,356
    712
    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?

    Code ( (Unknown Language)):
    1.  
    2.  
    3. ##################  Model Data Report  ##################
    4.  
    5. **************** Operational Amplifier **********************
    6. *                                                           *
    7. *              O* LM386 subcircuit model follows:
    8. ************************************original* IC pins:     2   3   7   1   8   5   6   4
    9. * IC pins:     1   2   3   4   5   6   7   8
    10. *              |   |   |   |   |   |   |   |
    11. .subckt LM386  g1  inn inp gnd out  vs byp g8
    12. ************************************original*.subckt LM386 inn inp byp  g1  g8 out  vs gnd
    13.  
    14. * input emitter-follower buffers:
    15.  
    16. q1 gnd inn 10011 ddpnp
    17. r1 inn gnd 50k
    18. q2 gnd inp 10012 ddpnp
    19. r2 inp gnd 50k
    20.  
    21. * differential input stage, gain-setting
    22. * resistors, and internal feedback resistor:
    23.  
    24. q3 10013 10011 10008 ddpnp
    25. q4 10014 10012 g1 ddpnp
    26. r3 vs byp 15k
    27. r4 byp 10008 15k
    28. r5 10008 g8 150
    29. r6 g8 g1 1.35k
    30. r7 g1 out 15k
    31.  
    32. * input stage current mirror:
    33.  
    34. q5 10013 10013 gnd ddnpn
    35. q6 10014 10013 gnd ddnpn
    36.  
    37. * voltage gain stage & rolloff cap:
    38.  
    39. q7 10017 10014 gnd ddnpn
    40. c1 10014 10017 15pf
    41.  
    42. * current mirror source for gain stage:
    43.  
    44. i1 10002 vs dc 5m
    45. q8 10004 10002 vs ddpnp
    46. q9 10002 10002 vs ddpnp
    47.  
    48. * Sziklai-connected push-pull output stage:
    49.  
    50. q10 10018 10017 out ddpnp
    51. q11 10004 10004 10009 ddnpn 100
    52. q12 10009 10009 10017 ddnpn 100
    53. q13 vs 10004 out ddnpn 100
    54. q14 out 10018 gnd ddnpn 100
    55.  
    56. * generic transistor models generated
    57. * with MicroSim's PARTs utility, using
    58. * default parameters except Bf:
    59.  
    60. .model ddnpn NPN(Is=10f Xti=3 Eg=1.11 Vaf=100
    61. + Bf=400 Ise=0 Ne=1.5 Ikf=0 Nk=.5 Xtb=1.5 Var=100
    62. + Br=1 Isc=0 Nc=2 Ikr=0 Rc=0 Cjc=2p Mjc=.3333
    63. + Vjc=.75 Fc=.5 Cje=5p Mje=.3333 Vje=.75 Tr=10n
    64. + Tf=1n Itf=1 Xtf=0 Vtf=10)
    65.  
    66. .model ddpnp PNP(Is=10f Xti=3 Eg=1.11 Vaf=100
    67. + Bf=200 Ise=0 Ne=1.5 Ikf=0 Nk=.5 Xtb=1.5 Var=100
    68. + Br=1 Isc=0 Nc=2 Ikr=0 Rc=0 Cjc=2p Mjc=.3333
    69. + Vjc=.75 Fc=.5 Cje=5p Mje=.3333 Vje=.75 Tr=10n
    70. + Tf=1n Itf=1 Xtf=0 Vtf=10)
    71.  
    72. .ends
    73. *----------end of subcircuit model-----------perational Amplifier Model                  *
    74. *            Interactive Image Technologies                 *
    75. *          SPICE MODEL MAKER TOOL  Version 1.1              *
    76. *                 All Rights Reserved                       *
    77. *                                                           *
    78. *************************************************************
    79.  
    80. * Date: Tuesday, March 10, 2009
    81. * Model Name generic_uA741
    82.  
    83. * INPUT VALUES:
    84.  
    85. * Page 1
    86.  
    87. * General
    88. * Model Name   generic_uA741
    89. * Identifier               0
    90.  
    91. * Input
    92. * Input Capacitance                = 1.400e+000 pF
    93. * Input Offset Current                = 2.000e+001 nA
    94. * Input Bias Current                = 8.000e+001 nA
    95. * Input Offset Voltage                = 1.000e+000 mV
    96. * Common-mode Input Resistance            = 2.000e+000 GOhm
    97. * Differential-mode Input Resistance        = 2.000e+000 MOhm
    98. * Common-mode Rejection Ratio            = 9.000e+001 dB
    99. * Voltage Gain                    = 1.060e+002 dB
    100.  
    101. * Page 2
    102. * Gain-frequency curve poles and Zero
    103. * Pole 1                        = 5.000e+000 Hz
    104. * Pole 2                        = 2.000e+000 MHz
    105. * Pole 3                        = 2.000e+001 MHz
    106. * Pole 4                        = 1.000e+002 MHz
    107. * Zero 3                        = 5.000e+000 MHz
    108.  
    109. * Page 3
    110.  
    111. * Output
    112. * Slew Rate (non-inverting mode)             = 5.000e-001 V/us
    113. * Slew Rate (inverting mode)             = 5.000e-001 V/us
    114. * Output Resistance                 = 7.500e+001 Ohm
    115. * Maximum Source Output Current             = 2.500e+001 mA
    116. * Maximum Sink Output Current             = 2.500e+001 mA
    117.  
    118. * OP-AMP Model
    119. .SUBCKT generic_uA741 1 5 9 11 14
    120. * terminal 1: invert input
    121. * terminal 5: non-invert input
    122. * terminal 9: positive power source
    123. * terminal 11: negative power source
    124. * terminal 14: output
    125. .MODEL DMOD D (N=0.001)
    126. r1 3 0 2.000e+009
    127. r3 3 0 2.000e+009
    128. c3 3 5 1.400e-012
    129. r2 3 5 2.000e+006
    130. vc 3 1 1.000e-003
    131. i1 3 0 9.000e-008
    132. i2 4 0 7.000e-008
    133. r6 13 0 1.000e+003
    134. c2 13 0 7.958e-011
    135. g4 13 0 3 4 1.000e-003
    136. r7 17 18 1.000e+004
    137. c4 17 18 3.183e-012
    138. r8 18 0 3.333e+003
    139. e1 17 0 13 0 4.000e+000
    140. r9 19 0 1.000e+003
    141. c5 19 0 1.592e-012
    142. g5 19 0 3 4 1.000e-003
    143. r4 0 6 1.000e+003
    144. c1 0 7 3.183e-005
    145. vb 6 7 dc=0
    146. g1 0 6 19 0 1.995e+002
    147. g2 0 6 poly(2) 3 0 4 0 0 3.155e-003 3.155e-003
    148. d7 7 9 DMOD
    149. d3 7 8 DMOD
    150. d4 8 9 DMOD
    151. d8 11 7 DMOD
    152. d5 10 7 DMOD
    153. d6 11 10 DMOD
    154. f1 8 9 poly(1) vb -1.592e+001 1
    155. f2 11 10 poly(1) vb -1.592e+001 -1
    156. va 12 14 dc 0
    157. d9 14 15 DMOD
    158. d10 15 9 DMOD
    159. d12 11 16 DMOD
    160. d11 16 14 DMOD
    161. f3 15 9 poly(1) va -2.500e-002 1
    162. f4 11 16 poly(1) va -2.500e-002 -1
    163. g3 0 12 7 0 1.333e-002
    164. r5 0 12 7.500e+001
    165. rshunt1 9 0 1e6
    166. rshunt2 11 0 1e6
    167. .ENDS
    168.  
    169. ============= Model template =================
    170. x%p %tGAININ %tINPUT- %tINPUT+ %tGND %tOUT %tVS+ %tBYPASS %tGAINOUT %m
    171.  
     
    #16
  17. disney_snoopy

    disney_snoopy Thread Starter Member

    Joined:
    Feb 19, 2009
    28
    0
    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?
     
    #17
  18. thatoneguy

    thatoneguy AAC Fanatic!

    Joined:
    Feb 19, 2009
    6,356
    712
    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. ;)
     
    #18
  19. Ron H

    Ron H AAC Fanatic!

    Joined:
    Apr 14, 2005
    7,050
    648
    Here's the model I have. I think it works.:rolleyes:
    Code ( (Unknown Language)):
    1. q1 gnd inn 10011 ddpnp
    2. r1 inn gnd 50k
    3. q2 gnd inp 10012 ddpnp
    4. r2 inp gnd 50k
    5.  
    6.  
    7. * differential input stage, gain-setting
    8. * resistors, and internal feedback resistor:
    9.  
    10.  
    11. q3 10013 10011 10008 ddpnp
    12. q4 10014 10012 g1 ddpnp
    13. r3 vs byp 15k
    14. r4 byp 10008 15k
    15. r5 10008 g8 150
    16. r6 g8 g1 1.35k
    17. r7 g1 out 15k
    18.  
    19.  
    20. * input stage current mirror:
    21.  
    22.  
    23. q5 10013 10013 gnd ddnpn
    24. q6 10014 10013 gnd ddnpn
    25.  
    26.  
    27. * voltage gain stage & rolloff cap:
    28.  
    29.  
    30. q7 10017 10014 gnd ddnpn
    31. c1 10014 10017 15pf
    32.  
    33.  
    34. * current mirror source for gain stage:
    35.  
    36.  
    37. i1 10002 vs dc 5m
    38. q8 10004 10002 vs ddpnp
    39. q9 10002 10002 vs ddpnp
    40.  
    41.  
    42. * Sziklai-connected push-pull output stage:
    43.  
    44.  
    45. q10 10018 10017 out ddpnp
    46. q11 10004 10004 10009 ddnpn 100
    47. q12 10009 10009 10017 ddnpn 100
    48. q13 vs 10004 out ddnpn 100
    49. q14 out 10018 gnd ddnpn 100
    50.  
    51.  
    52. * generic transistor models generated
    53. * with MicroSim's PARTs utility, using
    54. * default parameters except Bf:
    55.  
    56.  
    57. .model ddnpn NPN(Is=10f Xti=3 Eg=1.11 Vaf=100
    58. + Bf=400 Ise=0 Ne=1.5 Ikf=0 Nk=.5 Xtb=1.5 Var=100
    59. + Br=1 Isc=0 Nc=2 Ikr=0 Rc=0 Cjc=2p Mjc=.3333
    60. + Vjc=.75 Fc=.5 Cje=5p Mje=.3333 Vje=.75 Tr=10n
    61. + Tf=1n Itf=1 Xtf=0 Vtf=10)
    62.  
    63.  
    64. .model ddpnp PNP(Is=10f Xti=3 Eg=1.11 Vaf=100
    65. + Bf=200 Ise=0 Ne=1.5 Ikf=0 Nk=.5 Xtb=1.5 Var=100
    66. + Br=1 Isc=0 Nc=2 Ikr=0 Rc=0 Cjc=2p Mjc=.3333
    67. + Vjc=.75 Fc=.5 Cje=5p Mje=.3333 Vje=.75 Tr=10n
    68. + Tf=1n Itf=1 Xtf=0 Vtf=10)
    69.  
    70.  
    71. .ends
    72. *----------end of subcircuit model-----------
    73.  
    74.  
    75.  
     
    #19
  20. disney_snoopy

    disney_snoopy Thread Starter Member

    Joined:
    Feb 19, 2009
    28
    0
    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).
     
    #20
Loading...