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

April 16, 2024, 03:00:24 PM

Login with username, password and session length

Recent Posts

 

LTSpice sim?

Started by bill0287, June 21, 2023, 09:42:19 PM

Previous topic - Next topic

bill0287

Has anyone built this ("The Honey AMP") in LTSpice? I put it together and I am getting some really odd looking wave forms. Wondering if anyone else has seen this.


Tassieviking

There are no stupid questions.
There are only stupid mistakes.

g1

Quote from: Tassieviking on June 23, 2023, 05:20:44 AMBuilt what exactly ???
I wondered the same thing.  Then I noticed this is in the 'Honey Amp' section.   :)

joecool85

Quote from: bill0287 on June 21, 2023, 09:42:19 PMHas anyone built this ("The Honey AMP") in LTSpice? I put it together and I am getting some really odd looking wave forms. Wondering if anyone else has seen this.



I've been meaning to share this for months and hadn't gotten around to it.  Paul Marossy has actually done just that!  Check out the fourth video here: https://www.ssguitar.com/index.php?topic=5258
Life is what you make it.
Still rockin' the Dean Markley K-20X
thatraymond.com

Paul Marossy

I experienced the same thing. Your LTSpice sim will only be as good as your LM386 model. Almost all of the ones you find on the internet are all hosed up. I actually had to draw up the schematic of the LM386 per the data sheet to get waveforms that look anything like what I would expect to see. Me and a few others worked on this model quite a bit last year when I was doing my ebow resurrection/reverse engineering project. It's about the best possible model with the info that we can obtain. There might be a couple of other components in the IC chip that aren't on the schematic but I don't think it's really an issue for the vast majority of applications.

You can save these files via a word processor & rename/save with the appropriate extension and give it a try.

SUB file:
* LM386
*
* Rob S, V1, 2022/12/14
* Does this behaviour show up on the real device?:
* For negative inputs on the NI-input we see
* an inversion on the negative swing.
* Tweaking the gain stage current source helps
* However the primary issue is the NI-input
* buffer will remove base drive from the voltage gain
* stage under large -ve input (say < -0.75V)
* An external workaround is to add a 4k7 resistor
* in series with the NI-input.
*
* Rob S, V2, 2022/12/23
* A fix is to add 220 ohm series base resistors
* to Q3 and Q4.
*
*
* Is = 4.6mA @ Vs=9V
*
***********************************
* IC pins:   DIP8 package order
* Pins: 1 GAIN, 2 INM, 3 INP, 4 GND,
* 5 OUT, 6 VS, 7 BYP, 8 GAIN
.subckt lm386 1 2 3 4 5 6 7 8
***********************************

* input emitter-follower buffers
q1 4 2 11 pn
r1 2 4 50k
q2 4 3 15 pn
r2 3 4 50k

* Base resistors to prevent output inversion
* with strong -ve INP inputs
R33 11 33 220
R34 15 34 220

* differential input stage
q3 13 33 12 pn
q4 14 34 1 pn

* diff amp tail resistors
r3 6 7 15k
r4 7 12 15k

* feedback resistors
r5 12 8 150
r6 8 1 1.35k
r7 1 5 15k

* input stage current mirror
q5 13 13 4 np
q6 14 13 4 np

* voltage gain stage & rolloff cap
q7 18 14 4 np
*c1 18 14 15pf
* 35pF (match -3dB) to 50pF (match 10dB @ 1MHz)
c1 18 14 35p

* Current source for gain stage
* Approx 1.7mA @ Vs=9V
* *** Even with RE added, this source dependency on Vs
* is too high to match the Is vs Vs spec in the datasheet.
* (Also, could derive bias current from through 15k input
*  biasing like LM380.)
R21 21 4  50k
q21 21 21 6 pn
q22 16 21 22 pn 20
R22 6 22  10

* bias diodes
* Set to 2.55mA @ Vs=9V
q11 16 16 17 np 100
q12 17 17 18 np 100

* output stage
q8 6 16 5 np 100
q9 19 18 5 pn
q10 5 19 4 np 100

* Need to rejig with Nc = 1
* generic transistor models generated
* with MicroSim's PARTs utility, using
* default parameters except Bf:
.model np NPN(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=100n
+ Tf=1n Itf=1 Xtf=0 Vtf=10)

.model pn PNP(Is=10f Xti=3 Eg=1.11 Vaf=100
+ Bf=100 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=100n
+ Tf=1n Itf=1 Xtf=0 Vtf=10)

.ends

ASY file:
Version 4
SymbolType BLOCK
LINE Normal -48 -63 -48 64
LINE Normal 78 0 -48 -63
LINE Normal -48 64 78 0
LINE Normal -48 -32 -80 -32
LINE Normal -49 32 -80 32
LINE Normal -16 -80 -16 -48
LINE Normal 32 -48 32 -23
LINE Normal -16 79 -16 47
LINE Normal 32 48 32 24
LINE Normal 96 0 78 0
TEXT -64 -40 Left 1 +
TEXT -62 25 Left 1 -
TEXT -42 31 Left 1 3
TEXT -41 -31 Left 1 2
TEXT -9 -53 Left 0 BYP
TEXT -20 -35 Left 1 8
TEXT 27 -13 Left 1 7
TEXT 37 -27 Left 0 Vs
TEXT -12 54 Left 0 GND
TEXT 37 30 Left 0 GND
TEXT -11 32 Left 1 4
TEXT 11 21 Left 1 5
TEXT 52 0 Left 1 6
TEXT -35 -2 Left 1 LM380
PIN -80 -32 NONE 8
PINATTR PinName 2
PINATTR SpiceOrder 2
PIN -80 32 NONE 8
PINATTR PinName 3
PINATTR SpiceOrder 3
PIN -16 80 NONE 8
PINATTR PinName 4
PINATTR SpiceOrder 4
PIN 96 0 NONE 8
PINATTR PinName 6
PINATTR SpiceOrder 6
PIN 32 -48 NONE 8
PINATTR PinName 7
PINATTR SpiceOrder 7
PIN -16 -80 NONE 8
PINATTR PinName 8
PINATTR SpiceOrder 8
PIN 32 48 NONE 8
PINATTR PinName 5
PINATTR SpiceOrder 5

ASC file:
Version 4
SHEET 1 3792 680
WIRE 592 -896 -160 -896
WIRE 816 -896 592 -896
WIRE 1824 -896 816 -896
WIRE 1904 -896 1824 -896
WIRE 1936 -896 1904 -896
WIRE 816 -848 816 -896
WIRE 1824 -800 1824 -896
WIRE 2192 -800 2192 -848
WIRE 1264 -752 1040 -752
WIRE 1760 -752 1264 -752
WIRE -160 -720 -160 -896
WIRE 592 -720 592 -896
WIRE 816 -720 816 -768
WIRE 2192 -688 2192 -720
WIRE 752 -672 656 -672
WIRE 1264 -672 1264 -752
WIRE 1264 -672 1136 -672
WIRE 1264 -640 1264 -672
WIRE -288 -592 -400 -592
WIRE -160 -592 -160 -640
WIRE -160 -592 -288 -592
WIRE 1136 -592 1136 -672
WIRE 1200 -592 1136 -592
WIRE 816 -576 816 -624
WIRE 1040 -576 1040 -752
WIRE 1040 -576 816 -576
WIRE 592 -560 592 -624
WIRE -160 -544 -160 -592
WIRE 112 -544 48 -544
WIRE 240 -544 176 -544
WIRE 1264 -528 1264 -544
WIRE 1264 -528 1136 -528
WIRE 1264 -496 1264 -528
WIRE 1136 -448 1136 -528
WIRE 1200 -448 1136 -448
WIRE 1216 -448 1200 -448
WIRE 592 -432 592 -480
WIRE -160 -336 -160 -464
WIRE -80 -336 -160 -336
WIRE 48 -336 48 -544
WIRE 48 -336 0 -336
WIRE 96 -336 48 -336
WIRE 240 -336 240 -544
WIRE 240 -336 176 -336
WIRE 336 -336 240 -336
WIRE 560 -336 336 -336
WIRE 1824 -336 1824 -704
WIRE 1824 -336 640 -336
WIRE 1920 -336 1824 -336
WIRE 2000 -336 1920 -336
WIRE 2112 -336 2064 -336
WIRE 2176 -336 2112 -336
WIRE -160 -256 -160 -336
WIRE 336 -256 336 -336
WIRE 1824 -224 1824 -336
WIRE 1824 -224 1600 -224
WIRE -384 -208 -464 -208
WIRE -224 -208 -304 -208
WIRE 464 -208 400 -208
WIRE 640 -208 544 -208
WIRE 2176 -208 2176 -336
WIRE -464 -144 -464 -208
WIRE 640 -144 640 -208
WIRE 1600 -144 1600 -224
WIRE -624 -96 -752 -96
WIRE -528 -96 -624 -96
WIRE 816 -96 704 -96
WIRE 896 -96 816 -96
WIRE 976 -96 896 -96
WIRE 1264 -96 1264 -400
WIRE 1536 -96 1264 -96
WIRE 2176 -48 2176 -128
WIRE 816 -32 816 -96
WIRE -160 -16 -160 -160
WIRE -32 -16 -160 -16
WIRE -1392 0 -1488 0
WIRE -1296 0 -1392 0
WIRE -1152 0 -1232 0
WIRE -912 0 -1072 0
WIRE 1120 16 1072 16
WIRE 1264 16 1264 -96
WIRE 1264 16 1184 16
WIRE 336 32 336 -160
WIRE 416 32 336 32
WIRE -1488 64 -1488 0
WIRE -624 64 -624 -96
WIRE -160 80 -160 -16
WIRE 336 80 336 32
WIRE 1264 80 1264 16
WIRE 1824 80 1824 -224
WIRE -32 128 -32 -16
WIRE -32 128 -96 128
WIRE 272 128 -32 128
WIRE 416 128 416 32
WIRE 1072 128 1072 16
WIRE 1072 128 416 128
WIRE 1200 128 1072 128
WIRE 1600 128 1600 -48
WIRE 1760 128 1600 128
WIRE -1488 240 -1488 144
WIRE -624 288 -624 144
WIRE -464 288 -464 -48
WIRE -464 288 -624 288
WIRE -160 288 -160 176
WIRE -160 288 -464 288
WIRE 336 288 336 176
WIRE 336 288 -160 288
WIRE 640 288 640 -48
WIRE 640 288 336 288
WIRE 816 288 816 48
WIRE 816 288 640 288
WIRE 1264 288 1264 176
WIRE 1264 288 816 288
WIRE 1824 288 1824 176
WIRE 1824 288 1264 288
WIRE 1888 288 1824 288
WIRE -912 400 -912 0
WIRE 976 400 976 -96
WIRE 976 400 -912 400
FLAG 48 -544 8
IOPIN 48 -544 Out
FLAG 240 -544 1
IOPIN 240 -544 In
FLAG -400 -592 VBYP
FLAG 1936 -896 VS
FLAG -624 -96 VM
FLAG -1488 240 0
FLAG 816 -96 3
IOPIN 816 -96 In
FLAG -1392 0 VI
FLAG 896 -96 VP
FLAG 592 -432 0
FLAG 1824 -336 5
FLAG 2176 -48 0
FLAG 1920 -336 VOUT
FLAG 2112 -336 VO
FLAG 2192 -688 0
FLAG 2192 -848 VS
FLAG -288 -592 7
FLAG -752 -96 2
FLAG 1904 -896 6
FLAG 1888 288 4
IOPIN 1888 288 BiDir
SYMBOL pnp -528 -144 R0
SYMATTR InstName Q1
SYMATTR Value PN
SYMBOL pnp -224 -256 R0
SYMATTR InstName Q3
SYMATTR Value PN
SYMBOL res -640 48 R0
SYMATTR InstName R1
SYMATTR Value 50K
SYMBOL npn -96 80 M0
SYMATTR InstName Q5
SYMATTR Value NP
SYMBOL res 16 -352 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R5
SYMATTR Value 150
SYMBOL res 192 -352 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R6
SYMATTR Value 1.35K
SYMBOL npn 272 80 R0
SYMATTR InstName Q6
SYMATTR Value NP
SYMBOL pnp 400 -160 R180
SYMATTR InstName Q4
SYMATTR Value PN
SYMBOL pnp 704 -48 R180
SYMATTR InstName Q2
SYMATTR Value PN
SYMBOL res 800 -48 R0
SYMATTR InstName R2
SYMATTR Value 50K
SYMBOL res 656 -352 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R7
SYMATTR Value 15K
SYMBOL npn 1200 80 R0
SYMATTR InstName Q7
SYMATTR Value NP
SYMBOL res -176 -560 R0
SYMATTR InstName R4
SYMATTR Value 15K
SYMBOL res -176 -736 R0
SYMATTR InstName R3
SYMATTR Value 15K
SYMBOL npn 1760 -800 R0
SYMATTR InstName Q8
SYMATTR Value NP AREA=100
SYMBOL pnp 1536 -48 M180
SYMATTR InstName Q9
SYMATTR Value PN
SYMBOL npn 1760 80 R0
SYMATTR InstName Q10
SYMATTR Value NP AREA=100
SYMBOL voltage -1488 48 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V2
SYMATTR Value SINE(0 1 2.59K)
SYMBOL cap -1232 -16 R90
WINDOW 0 0 32 VBottom 2
WINDOW 3 32 32 VTop 2
SYMATTR InstName C31
SYMATTR Value 1µF
SYMBOL res -1056 -16 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R31
SYMATTR Value 4.7K
SYMBOL cap 112 -528 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 0 32 VBottom 2
SYMATTR InstName C30
SYMATTR Value 10µF
SYMBOL cap 1184 0 R90
WINDOW 0 0 32 VBottom 2
WINDOW 3 32 32 VTop 2
SYMATTR InstName C1
SYMATTR Value 35pF
SYMBOL pnp 656 -624 R180
SYMATTR InstName Q21
SYMATTR Value PN
SYMBOL res 576 -576 R0
SYMATTR InstName R21
SYMATTR Value 50K
SYMBOL pnp 752 -624 M180
SYMATTR InstName Q22
SYMATTR Value PN AREA=20
SYMBOL res 800 -864 R0
SYMATTR InstName R8
SYMATTR Value 10
SYMBOL npn 1200 -640 R0
SYMATTR InstName Q11
SYMATTR Value NP AREA=100
SYMBOL npn 1200 -496 R0
SYMATTR InstName Q12
SYMATTR Value NP AREA=100
SYMBOL cap 2064 -352 R90
WINDOW 0 0 32 VBottom 2
WINDOW 3 32 32 VTop 2
SYMATTR InstName C32
SYMATTR Value 220µF
SYMBOL res 2160 -224 R0
SYMATTR InstName R32
SYMATTR Value 79
SYMBOL voltage 2192 -816 R0
SYMATTR InstName V1
SYMATTR Value 9
SYMBOL res -288 -224 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R33
SYMATTR Value 220
SYMBOL res 560 -224 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R34
SYMATTR Value 220
TEXT -1480 -504 Left 2 !.model np NPN(Is=10f Xti=3 Eg=1.11 Vaf=100\n+ Bf=200 Ise=0 Ne=1.5 Ikf=0 Nk=.5 Xtb=1.5 Var=100\n+ Br=1 Isc=0 Nc=2 Ikr=0 Rc=0 Cjc=2p Mjc=.3333\n+ Vjc=.75 Fc=.5 Cje=5p Mje=.3333 Vje=.75 Tr=100n\n+ Tf=1n Itf=1 Xtf=0 Vtf=10)
TEXT -1480 -320 Left 2 !.model PN PNP(Is=10f Xti=3 Eg=1.11 Vaf=100\n+ Bf=100 Ise=0 Ne=1.5 Ikf=0 Nk=.5 Xtb=1.5 Var=100\n+ Br=1 Isc=0 Nc=2 Ikr=0 Rc=0 Cjc=2p Mjc=.3333\n+ Vjc=.75 Fc=.5 Cje=5p Mje=.3333 Vje=.75 Tr=100n\n+ Tf=1n Itf=1 Xtf=0 Vtf=10)
TEXT -112 -1104 Left 2 !.step param Rbb LIST 10k 30k 100k
TEXT -112 -1040 Left 2 ;Adding RE=10 ohm, helps reduce Ic dependcy on Vs but it's still not good enough.\nAs shown, 50k + 10 ohm gives Ic=1.65mA with VS=9V\nIt's possible Q21 is biased via R3, like the LM380
TEXT 1864 -656 Left 2 ;2.5mA bias at 9V
TEXT 1368 368 Left 2 ;35pF matches -3dB\n100pf matches 100dB @ 1MHz
TEXT -1464 -600 Left 2 ;Nc=2 is likely to be a long way off
TEXT 2392 32 Left 2 !;ac dec 300 10 1MEG
TEXT 2392 72 Left 2 !.tran 0 0.3 0.2 10u
TEXT 2400 112 Left 2 !.op
TEXT 2384 -880 Left 2 ;* "Inversion" Problem\n \n- under strong overload on the V+ input\nthe negative output swing inverts\n- High bias current on gain stage\ncurrent source makes this worse\n*** Actual Cause?\nMost obvious cause seems to be\na removal of base drive from the \nvoltage gain transistor when Vin < 0.75V,\n...and that's caused by Q2, Q4\n \n* Fix For Inversion:\n-drop Isource to ~ 1.6mA (Rbb=50k) to \nlargely remove problem.\nPositive drive OK but not much margin.
TEXT 2368 80 Left 2 ;*
TEXT -120 480 Left 2 ;Pins: 1 GAIN, 2 INM, 3 INP, 4 GND, 5 OUT, 6 VS, 7 BYP, 8 GAIN
TEXT 2384 -376 Left 2 ;* Work-around if inversion is real:\n-adding about 4.7K in series with \nthe V+ input Input reduces this effect.\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n \n* Improvements?:\n- are there input protection diodes missing?\n- reduce dependcy of voltage gain current source\non Vs (This also affects output bias dependcy\non Vs)\n- fix Nc=2 on transistors
TEXT 3024 -880 Left 2 ;LM386 Model\nRob S. Rev 1.0 2022/12/14\n \n* Output Bias Point\n \nOutput: Vs/2 + vbe\n \n* Output Swiing\n \n9V, 8 ohm\noutput is about 3V pk,\n+ ve side clips first.\neg. clips at +3V, -ve swing -3.2V\nclip top has a falling slope\n \n9V 4 ohm\nfrom datasheet about 3.5V p-p\n \n* Current Draw\n \nDS Is: 3.5mA to 4.8mV over 4V to 12V\n      1.3mA change 4.1mA @ 8V\n \nSim: At Vs=9V total current is = 4.6mA\n \n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - \n \nIf I add RE=10 ohm to the current source transistor\nthe biasing of the gain stage varies about 1.7mA\nWe need enough current there to drive the o/p Qs.\n \nWith this mod o/p/ biases to 2.5mA @ 9V\n(4V to 12V= > 1.3mA to 3.18mA)\nStill too much to change.\nChange due to voltage amp current source varying.
TEXT -1488 -352 Left 2 ;*
TEXT -104 -1152 Left 2 !.lib Lm386-RS1.sub

joecool85

Thanks Paul, this should help!  I have to say that I'm surprised there isn't a solid LM386 model out there already though - it's such an old and popular chip, used in so many DIY projects.
Life is what you make it.
Still rockin' the Dean Markley K-20X
thatraymond.com

smadin

Late to this party, but I figured I'd chime in that I also ended up finding I had to make my own LM386 model from the data sheet. I expect Paul's is more correct than mine, so I'm excited to compare them.

joecool85

Quote from: smadin on June 27, 2023, 06:12:26 PMLate to this party, but I figured I'd chime in that I also ended up finding I had to make my own LM386 model from the data sheet. I expect Paul's is more correct than mine, so I'm excited to compare them.

Certainly let us know what you find!
Life is what you make it.
Still rockin' the Dean Markley K-20X
thatraymond.com