Welcome to Solid State Guitar Amp Forum | DIY Guitar Amplifiers. Please login or sign up.

March 28, 2024, 11:58:33 AM

Login with username, password and session length

Recent Posts

 

LM3886 Spice model

Started by teemuk, March 21, 2007, 01:27:21 PM

Previous topic - Next topic

teemuk

I have been cooking up this model for LTspice for a while and finally it's on a beta stage... The current model is based on the equivalent schematic presented in the datasheet and is still missing the undervoltage-, VI-limit-, SPiKe- and overvoltage-protection circuitry presented in AN-898 (http://www.national.com/an/AN/AN-898.pdf). All comments on the model are welcome and will be noted - however, as I currently have other priorities do not expect fixes to emerge soon. Enjoy.

.SUBCKT LM3886 posin negin out posrail negrail mute gndpin
* IN+ IN- OUT VCC VEE MUTE GND
*
* LM3886 spice model by teemuk 21032007 ver.1b
Q1 posrail posin N004 0 NPN
I1 N004 negrail 0.25m
Q2 posrail negin N003 0 NPN
I2 N003 negrail 0.25m
Q3 N011 N003 N010 0 PNP
Q4 N011 N018 N012 0 NPN
R1 N012 negrail 2.2k
I3 N018 negrail 0.1m
Q5 N017 N018 N024 0 NPN
R2 N024 negrail 2.2k
Q6 posrail N011 N018 0 NPN
R3 N009 N010 1.1k
R4 N009 N023 1.1k
Q7 N017 N004 N023 0 PNP
Q8 N017 N013 N016 0 PNP
Q9 N011 N025 N019 0 PNP
R5 N015 N016 4.7k
R6 N015 N019 4.7k
R7 N013 gndpin 10k
D1 N025 gndpin D
D2 gndpin N025 D
R8 out N025 10k
C1 out N017 10p
I4 N026 negrail 1m
Q10 posrail N017 N026 0 NPN
Q11 N030 N026 N031 0 NPN
R9 N031 negrail 800
Q12 N009 N008 N014 0 PNP
Q13 N015 N022 N014 0 PNP
I5 posrail N014 1m
I6 N022 negrail 1m
D3 N021 N022 D
D4 N020 N021 D
R10 posrail N020 1k
D5 N007 N008 D
D6 N006 N007 D
R11 posrail N006 1k
Q14 N008 gndpin N005 0 NPN
R12 N005 N001 1k
D7 N002 mute D
D8 N001 N002 D
D9 N032 N031 D
R13 N034 negrail 150
Q15 out N032 N034 0 NPN
Q16 out N034 N036 0 NPN
R14 N036 negrail 0.45
Q17 N032 N030 out 0 PNP
D10 N029 N030 D
D11 N028 N029 D
D12 N027 N028 D
R15 N033 out 150
Q18 posrail N027 N033 0 NPN
Q19 posrail N033 N035 0 NPN
R16 N035 out 0.45
I7 posrail N027 2.5m
.model D D
.model NPN NPN
.model PNP PNP
.end lm3886

dsmnoisemaker

any idea how to add this to the ltspice library?

J M Fahey

Teemuk, congratulations !!
Impressive work !!
It's way above anything I might "cook", now or on the future.
I hadn't seen it before.

dsmnoisemaker

 ;D this is more than 2 years old..

any guide how to use it with ltspice?
i create a .sub file and how i link it to a symbol?

teemuk

First of all, you need to have a symbol compatible with the pin arrangement of the model. Meaning, the symbol must have 7 pins, and the pin numbering must correspond this:
1:IN+ 2:IN- 3:OUT 4:VCC 5:VEE 6:MUTE 7:GND

Insert the aforementioned symbol / component into the schematic drafting board.

Right click or CTRL + right click the symbol. Change prefix to X, if it isn't already. This instructs SPICE that the model file for this component is external. Type LM3886 to the value property field, now spice will search for a subcircuit named LM3886.

Insert the following spice directive to the drafting board:

.lib filename.sub

where filename corresponds to the filename you have given for the file containing the LM3886 subcircuit model. If this file is not located in the LIB\SUB folder you must also specify a correct directory path for it. Now spice will include all subcircuits contained within filename.sub to your circuit and you can "call" them in the manner discussed earlier.

Done.

---

This model had some issues and it is not perfect. Don't expect it to perform flawlessly. However, it does work better than the very simplified LM3886 model that was the only one available at the time when I made this one.

madqwerty

Hi guys! this is my 1st post here..

Hi Teemuk,
i was web-surfing for finding a LTspice IV model for LM3886, and found your interesting work,
so thank you for sharing :)

i copied your text into LM3886.sub , and LM3886.sub into my C:\Programmi\LTC\LTspiceIV\lib\sub
then i started modifying LT1008.asy (a 7pin OpAmp), obtaining my LM3886.asy, and copied that into C:\Programmi\LTC\LTspiceIV\lib\sym\Opamps
then i wired a simple example, try.LM3886.asc, seems to be correctly working..  8)

i'm so NoooB in using LTspice (every SPICE, saying the truth) and experience a strange behaviour..
look at row 42 of LM3886.asy ("SYMATTR Value2 LM3886")
if i comment this row, i'm able to modify the component parameters, but not to simulate because of the attached error,
if i keep this row uncommented, i can't modify component parameters but i'm able to simulate, no errors happen...

error seem to be related to your model,
but i'm not able to understand the cause of this error,
i'm so rookie with it.. but very curious !  ;)
can you kindly help me understanding where's the problem?

Thank You in advance!
bye,
Marco


teemuk

Try leaving one of the "value" properties empty or removing the attributes altogether using the symbol editor. Then fill in the missing stuff in the schematic editor instead.

madqwerty

Quote from: teemuk on February 24, 2010, 12:50:13 PM
Try leaving one of the "value" properties empty or removing the attributes altogether using the symbol editor. Then fill in the missing stuff in the schematic editor instead.
ok, i'll try,
thanks! :)