![]() |
![]() |
![]() |
|
|
|||||||
| Electronic Projects Design/Ideas/Reviews Are you building an electronic project or want to? Maybe you need some assistance? Come and submit your electronic questions here and let our experienced members find a solution. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
I am designing a little audio amplifier for a electronics course, and I was thinking of using a LM386. Unfortunately we are required to use LTSpice. My lab TA found this Spice model which I would like to pass along, although I have not been able to get it to work in LTSpice. Any help would be appreciated!
I have the file below as "LM386.sub" under my LTC\SwCADIII\lib\cmp directory. I made a simple schematic using "opamp2" renamed to "U1, LM386". I have the directive ".lib lm386.sub". Then I get this error: ------ Spice Error Too few parameters for subcircuit type "lm386" (instance:xu1) ---cut-here---- * 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*.subc kt 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 15 * 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----------- |
|
|
|
|
|
|
(permalink) |
|
Lemmi go see if I can get that to work.
__________________
"Because I be what I be. I would tell you what you want to know if I
could, mum, but I be a cat, and no cat anywhere ever gave anyone a straight answer, har har." |
|
|
|
|
|
|
(permalink) |
|
I could get this to simulate fine after I created a quick and dirty 8 node symbol, I didn't test for sub circuit functionality though. Do you know what kind of symbol this subcircuit is supposed to be mapped to? It's definitly not an opamp. If you don't know how to create your own symbols (it's really very simple look it up in the help files) I'd be happy to upload a generic symbol that could be used with the subcircuit model. Again though I have no idea if the subcircuit itself simulation is any good I didn't want to spend the time to make a circuit for it.
Thanks for the subcircuit by the way, I'm going to have to play around with this (doesn't everyone want to build a Lm386 amp?
__________________
"Because I be what I be. I would tell you what you want to know if I
could, mum, but I be a cat, and no cat anywhere ever gave anyone a straight answer, har har." Last edited by Sceadwian; 15th April 2007 at 07:09 PM. |
|
|
|
|
|
|
(permalink) |
|
Great! I have no experience with Spice models, so this is a relief to me. As far as a symbol does triangle with 8 leads seems fine with me. This is what they have in the datasheet:
![]() |
|
|
|
|
|
|
(permalink) |
|
Attached is a zip file, which contains a symbol that will work with the lm386.sub put it in the swcadIII/lib/sym directory and restart SWcad, you should be able to load it then in the components section. Right click on it, give it the Prefix X and the "Value" lm386 and make sure you .include the lm386.sub file. It's mapped just like the dip package you refrenced. Quick and dirty doesn't look like much only took me a minute to make. Edit the symbol file and look at it, it's pretty simple. Let me know if it works.
__________________
"Because I be what I be. I would tell you what you want to know if I
could, mum, but I be a cat, and no cat anywhere ever gave anyone a straight answer, har har." |
|
|
|
|
|
|
(permalink) |
|
Once I had the lm386.sub in the sub directory it worked fine. Thanks alot!
I wonder if the model is accurate, or perhaps I did not understand something about the lm386; it seems to have an +8V offset. Rather than using a +Vs and -Vs, this chip uses +Vs and GND. I think the model is treating GND like -Vs or something weird like that. ![]() |
|
|
|
|
|
|
(permalink) |
|
It was probably meant to have a decoupling capacitor on the output. Put a capacitor in series with Vout, and a 10 meg resistor to ground on the other side so the simulator has a refrence to ground. Larger capacitor values will increase bass responce.
__________________
"Because I be what I be. I would tell you what you want to know if I
could, mum, but I be a cat, and no cat anywhere ever gave anyone a straight answer, har har." Last edited by Sceadwian; 16th April 2007 at 07:20 AM. |
|
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Latest |
| Configurable opamp model for Spice | Optikon | General Electronics Chat | 0 | 1st February 2007 05:55 PM |
| Spice model LM386 | habbott | General Electronics Chat | 5 | 10th August 2006 05:46 PM |
| Need LM317 model for SIMetrix (Spice model?) | dinofx | Electronic Projects Design/Ideas/Reviews | 8 | 10th January 2006 09:06 PM |
| LM317 Spice Model? | adamthole | General Electronics Chat | 5 | 20th October 2005 12:12 AM |
| Simple LM386 Amp Help | mod_critical | Electronic Projects Design/Ideas/Reviews | 5 | 24th May 2003 01:53 AM |