Electronics-Related.com
Forums

LM386 & Spice

Started by Unknown April 19, 2015
On Sunday, 19 April 2015 13:08:19 UTC+1, tabb...@gmail.com  wrote:
> I need to sim an LM386 amp to see what decoupling caps are neded for stability on end of life batteries. Is there a Spice model for this anywhere? My LTSpice seems to lack any of the IC models I'm likely to use. > > > NT
Hi, You may be interested to try an improved LM386 spice model that is available in the free, online EasyEDA suite here: http://easyeda.com/project_view_Demonstrating-the-EasyEDA-LM386-spice-subckt-model_pgoiAgM4m.htm You can copy the subcircuit by following the instructions in the schematic. The LM386EE/NJM386EE spice subcircuit model offers improved modelling of output voltage self-centring, typical quiescent and input bias currents and unloaded bandwidth. Output swing is however still a little optimistic with < 8 Ohm load resistances but given the accurate output centring, less so that the original Dilatush model and the later LTspice implementation. The reason for this output optimism is unclear. To help improve the model in this area, if anyone is willing to share scope traces of the LM386 output voltage driving into clipping with loads of between 4 - 16 Ohms, please contact me. :)
On Wed, 17 Jun 2015 08:28:04 -0700 (PDT), andyfierman@gmail.com wrote:

>On Sunday, 19 April 2015 13:08:19 UTC+1, tabb...@gmail.com wrote: >> I need to sim an LM386 amp to see what decoupling caps are neded for stability on end of life batteries. Is there a Spice model for this anywhere? My LTSpice seems to lack any of the IC models I'm likely to use. >> >> >> NT > > >Hi, > >You may be interested to try an improved LM386 spice model that is available in the free, online EasyEDA suite here: > >http://easyeda.com/project_view_Demonstrating-the-EasyEDA-LM386-spice-subckt-model_pgoiAgM4m.htm > >You can copy the subcircuit by following the instructions in the schematic. >
[snip] How? I can't see a way to copy the subcircuit, only ways to simulate it with easyeda. ...Jim Thompson -- | James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: skypeanalog | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.
On Wed, 17 Jun 2015 08:49:06 -0700, Jim Thompson
<To-Email-Use-The-Envelope-Icon@On-My-Web-Site.com> wrote:

>On Wed, 17 Jun 2015 08:28:04 -0700 (PDT), andyfierman@gmail.com wrote: > >>On Sunday, 19 April 2015 13:08:19 UTC+1, tabb...@gmail.com wrote: >>> I need to sim an LM386 amp to see what decoupling caps are neded for stability on end of life batteries. Is there a Spice model for this anywhere? My LTSpice seems to lack any of the IC models I'm likely to use. >>> >>> >>> NT >> >> >>Hi, >> >>You may be interested to try an improved LM386 spice model that is available in the free, online EasyEDA suite here: >> >>http://easyeda.com/project_view_Demonstrating-the-EasyEDA-LM386-spice-subckt-model_pgoiAgM4m.htm >> >>You can copy the subcircuit by following the instructions in the schematic. >> >[snip] > >How? I can't see a way to copy the subcircuit, only ways to simulate >it with easyeda. > > ...Jim Thompson
Methinks andyfierman@gmail.com is just pimping for EasyEDA. I can find no retrievable subcircuit declaration there. ...Jim Thompson -- | James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: skypeanalog | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.
On Monday, April 20, 2015 at 2:17:20 PM UTC-7, Glenn wrote:
> On 20/04/15 18.21, Tim Wescott wrote: > > On Sun, 19 Apr 2015 05:08:15 -0700, tabbypurr wrote: > > > >> I need to sim an LM386 amp to see what decoupling caps are neded for > >> stability on end of life batteries.
> > Wow -- is that still being used in new production, or is it just used when > > people are reading old project magazines?
> Some time I looked for a LM386 replacement - found this: > > TDA7052A DIL8 1W 7mA , 8 ohm bridged 4.5-max.18V
Maybe it's time to look at the modern cruftsmanlike audio amps: <http://www.digikey.com/product-detail/en/PAM8403DR-H/PAM8403DR-HDI-ND/4033372> There's PCBs with this chip, for sale at under $1 on eBay... and it may have other interesting uses (like making HF triangle waves for diode/capacitor multiplier HV supplies).
On Saturday, 20 June 2015 05:49:36 UTC+1, whit3rd  wrote:
> On Monday, April 20, 2015 at 2:17:20 PM UTC-7, Glenn wrote: > > On 20/04/15 18.21, Tim Wescott wrote: > > > On Sun, 19 Apr 2015 05:08:15 -0700, tabbypurr wrote: > > > > > >> I need to sim an LM386 amp to see what decoupling caps are neded for > > >> stability on end of life batteries. > > > > Wow -- is that still being used in new production, or is it just used when > > > people are reading old project magazines? > > > Some time I looked for a LM386 replacement - found this: > > > > TDA7052A DIL8 1W 7mA , 8 ohm bridged 4.5-max.18V > > Maybe it's time to look at the modern cruftsmanlike audio amps: > > <http://www.digikey.com/product-detail/en/PAM8403DR-H/PAM8403DR-HDI-ND/4033372> > > There's PCBs with this chip, for sale at under $1 on eBay... and it may have > other interesting uses (like making HF triangle waves for diode/capacitor multiplier > HV supplies).
If you're into ebay buying there's another PAM amp delivering 1+1 watt class D, and its supplied asssembled AND delivered direct from China for 65p = $1! NT
Hi Jim,

Since I posted to this forum, the EasyEDA website has been updated so 

(i) you now have to register to run the simulation in that particular project and (ii) therefore, the instructions in the schematic are a bit misleading now.

However, if you register and then go to:

https://easyeda.com/example/Demonstrating_the_EasyEDA_LM386_spice_subckt_model-pgoiAgM4m

and then click on the green "Open in Editor" button on the upper right of the window, this will open the project in the EasyEDA Editor window.

(The button is actually this link:

https://easyeda.com/example/Demonstrating_the_EasyEDA_LM386_spice_subckt_model-pgoiAgM4m)

If you then click on the tab labelled "Demonstrating the EasyEDA LM386 spice subckt model" you will be able to run the example.

Alternatively, here is a link to the file which you can run in "Anonymous mode" for which you do not need to register:

https://easyeda.com/editor#id=KI0UbtLFX

Just do Ctrl+R to run it.


Either way, tThe instructions in that example explain quite clearly two ways to download the netlist:

"To view the netlist (including the LM386EE subckt), do:
 
   Green Man > Simulation Results... > Download netlist
 
or:
 
   Super Menu > Miscellaneous > Netlist for Document > Spice..."

However for the avoidance of doubt - and despite your rather ungracious comment - here is a simple copy of the netlist:

**********************************************
**********************************************
* LM386/NJM386 spice subckt model. 
*
* Developed for EasyEDA by:
*    signality.co.uk
* 
* Subckt based on the schematic shown in the 
* NJM386 datasheet:
*   http://www.njr.com/semicon/PDF/NJM386_E.pdf
* Specifications based on the above and:
*   http://www.ti.com/lit/ds/symlink/lm386.pdf
*
* Gain accuracy, output voltage self-centring, 
* typical quiescent and input bias currents 
* and unloaded bandwidth are modelled. 
*
* Output swing is optimistic with < 8 Ohm load 
* resistances. The reason for this is unclear.
* If anyone has scope traces of the LM386 output 
* voltage driving into clipping with loads of 
* between 4 - 16 Ohms please contact: 
*   support@easyeda.com
*
* Last edited 150611
**********************************************
*
* IC pins:       2   3   7   1   8   5   6   4
*                |   |   |   |   |   |   |   |
.subckt LM386EE inn inp byp  g1  g8 out  vs gnd
*
.param
+ Rbval = 28.25k
+ Re1val = 100
+ Re2val = 1k
+ Re3val = 4
+ Rcval = 10
**
* Input stage
Q1 0 INN q1e 0 PNP1
R1 INN 0 50k
Q2 0 INP q2e 0 PNP1
R2 INP 0 50k
Q3 0 q1e q4e 0 PNP1
Q4 q4c q1e q4e 0 PNP1
Q5 0 q2e q6e 0 PNP1
Q6 q15b q2e q6e 0 PNP1
**
* Input stage current mirror
Q7 q4c q4c 0 0 NPN
Q8 q15b q4c 0 0 NPN
**
* Input bias curent and gain setting resistors
R3 q4e q1e {Rbval}
R4 g0 q4e {Re1val}
R5 q2e q6e {Rbval}
R6 G1 q6e {Re1val}
R7 G8 g0 150
R8 G1 G8 1.35k
R9 OUT G1 15k
R10 BYP g0 15k
R11 q10c BYP 15k
**
* Tail and PNP emitter follower current mirror
Q9 0 q10c q10b 0 PNP1
Q10 q10c q10b VS 0 PNP1
Q11 q11c q10b VS 0 PNP1
Q12 q12c q10b VS 0 PNP1
** 
* Emitter follower buffers and 
* quiescent current control
Q13 0 q4c q11c 0 PNP2
Q14 q18b q11c q14e 0 NPN
R12 q14e 0 {Re2val}
Q15 0 q15b q12c 0 PNP2
Q16 q18b q12c q17b 0 NPN
**
* Voltage gain stage
Q17 q23b q17b 0 0 NPN
C2 q23b 0 1p
**
* Crossover distortion/quiescent current mirror.
Q18 q18b q18b VS 0 PNP2
Q19 comp q18b VS 0 PNP2
Q20 q25b q18b VS 0 PNP2
**
* Crossover drop diodes and compensation cap.
Q21 comp comp q22b 0 NPN 5
C1 comp q15b 15p
R13 q25b comp {Rcval}
Q22 q25b q22b q23b 0 NPN 5
**
* Push-pull output stage with Sziklai pair.
Q23 q24b q23b q23e 0 PNP2
Q24 q23e q24b 0 0 NPN 100
R14 OUT q23e {Re3val}
Q25 VS q25b q25e 0 NPN 100
R15 q25e OUT {Re3val}
**
* Models
.model NPN NPN(IS=1E-14 VAF=100 BF=400 IKF=0.4 
+ XTB=1.5 BR=4 CJC=1E-12 ITF=1 VTF=2 XTF=3)
.model PNP1 PNP(IS=1E-14 VAF=100 BF=100 IKF=0.4 
+ XTB=1.5 BR=4 CJC=1E-12 ITF=1 VTF=2 XTF=3)
.model PNP2 PNP(IS=1E-14 VAF=100 BF=200 IKF=0.4 
 +XTB=1.5 BR=4 CJC=1E-12 ITF=1 VTF=2 XTF=3)
*
.ends LM386EE
**********************************************
**********************************************

:)

   Andy

> >>Hi, > >> > >>You may be interested to try an improved LM386 spice model that is available in the free, online EasyEDA suite here: > >> > >>http://easyeda.com/project_view_Demonstrating-the-EasyEDA-LM386-spice-subckt-model_pgoiAgM4m.htm > >> > >>You can copy the subcircuit by following the instructions in the schematic. > >> > >[snip] > > > >How? I can't see a way to copy the subcircuit, only ways to simulate > >it with easyeda. > > > > ...Jim Thompson > > Methinks andyfierman@gmail.com is just pimping for EasyEDA. I can > find no retrievable subcircuit declaration there. > > ...Jim Thompson > -- > | James E.Thompson | mens | > | Analog Innovations | et | > | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | > | San Tan Valley, AZ 85142 Skype: skypeanalog | | > | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | > | E-mail Icon at http://www.analog-innovations.com | 1962 | > > I love to cook with wine. Sometimes I even put it in the food.
tabbypurr@gmail.com wrote:
> On Monday, 20 April 2015 18:08:11 UTC+1, bitrex wrote: >> Jim Thompson <To-Email-Use-The-Envelope-Icon@On-My-Web-Site.com> >> Wrote in message: >> > On Sun, 19 Apr 2015 05:08:15 -0700 (PDT), nt wrote: >> > >> >>I need to sim an LM386 amp to see what decoupling caps are neded >> >>for stability on end of life batteries. Is there a Spice model for >> >>this anywhere? My LTSpice seems to lack any of the IC models I'm >> >>likely to use. >> >> >> >> >> >>NT >> > >> > Untested, so I don't know its quality... >> > >> > <http://www.electro-tech-online.com/threads/lm386-model-in-ltspice.29096/> >> >> I believe the Yahoo LTSpice users group has an improved model and >> subcircuit drawing for the LM386, I will look... > > thank you both. I now have to learn what to .name these files and where > to put them, and wh at else I need to do. And where the 'spice' folder > is - most apps seems to turn up in multiple locations on this debian > based system. I'll go look for a FAQ.
My followup's probably too late for the OP. That said, my current project uses a LM386. Allow me to followup for posterity's sake. Dr. Wickert at UCCS generously makes the requisite LM386 LTSpice symbol (.asy) and subcircuit data (.lib) files available to the public. Wickert's .lib file seems almost identical to Jim's. You can download Wickert's LM386 archive in zipped format at: http://www.eas.uccs.edu/~mwickert/ece3001/lecture_notes/LM386_support_files.zip The zipped archive contains the following files: lm386.asy Symbol file. Just drop it into your project folder to use it. LM386.lib Subcircuit data file. Just drop it into your project folder. lm386.pdf Datasheet. headphone_amp.asc A sample LTSpice circuit that uses the LM386. Thank you, -- Don Kuenz KB7RPU
On Wed, 15 Feb 2017 03:33:23 -0000 (UTC), Don Kuenz <g@crcomp.net>
wrote:

> >tabbypurr@gmail.com wrote: >> On Monday, 20 April 2015 18:08:11 UTC+1, bitrex wrote: >>> Jim Thompson <To-Email-Use-The-Envelope-Icon@On-My-Web-Site.com> >>> Wrote in message: >>> > On Sun, 19 Apr 2015 05:08:15 -0700 (PDT), nt wrote: >>> > >>> >>I need to sim an LM386 amp to see what decoupling caps are neded >>> >>for stability on end of life batteries. Is there a Spice model for >>> >>this anywhere? My LTSpice seems to lack any of the IC models I'm >>> >>likely to use. >>> >> >>> >> >>> >>NT >>> > >>> > Untested, so I don't know its quality... >>> > >>> > <http://www.electro-tech-online.com/threads/lm386-model-in-ltspice.29096/> >>> >>> I believe the Yahoo LTSpice users group has an improved model and >>> subcircuit drawing for the LM386, I will look... >> >> thank you both. I now have to learn what to .name these files and where >> to put them, and wh at else I need to do. And where the 'spice' folder >> is - most apps seems to turn up in multiple locations on this debian >> based system. I'll go look for a FAQ. > >My followup's probably too late for the OP. That said, my current >project uses a LM386. Allow me to followup for posterity's sake. > >Dr. Wickert at UCCS generously makes the requisite LM386 LTSpice >symbol (.asy) and subcircuit data (.lib) files available to the public. >Wickert's .lib file seems almost identical to Jim's. You can download >Wickert's LM386 archive in zipped format at: > >http://www.eas.uccs.edu/~mwickert/ece3001/lecture_notes/LM386_support_files.zip > >The zipped archive contains the following files: > >lm386.asy > Symbol file. Just drop it into your project folder to use it. > >LM386.lib > Subcircuit data file. Just drop it into your project folder. > >lm386.pdf > Datasheet. > >headphone_amp.asc > A sample LTSpice circuit that uses the LM386. > >Thank you,
Things like power supply decoupling subtleties are unlikely to be modeled accurately. -- John Larkin Highland Technology, Inc lunatic fringe electronics
On Wednesday, 15 February 2017 03:35:19 UTC, Don Kuenz  wrote:

> My followup's probably too late for the OP. That said, my current > project uses a LM386. Allow me to followup for posterity's sake. > > Dr. Wickert at UCCS generously makes the requisite LM386 LTSpice > symbol (.asy) and subcircuit data (.lib) files available to the public. > Wickert's .lib file seems almost identical to Jim's. You can download > Wickert's LM386 archive in zipped format at: > > http://www.eas.uccs.edu/~mwickert/ece3001/lecture_notes/LM386_support_files.zip > > The zipped archive contains the following files: > > lm386.asy > Symbol file. Just drop it into your project folder to use it. > > LM386.lib > Subcircuit data file. Just drop it into your project folder. > > lm386.pdf > Datasheet. > > headphone_amp.asc > A sample LTSpice circuit that uses the LM386. > > Thank you,
thanks, it may prove useful in future. NT