* Z:\home\khalils\Downloads\files\data\raw_asc\59fc06c2d3f7_sense_amp.asc
* Generated by LTspice 26.0.1 for Windows.
* .tran 70u
* VREF control
* Temp compensation\nfor sense output
* Temp pre-compensation\nfor comparator threshold voltage
* Comparator
* Buffer (emitter follower \nwith saturation protection)
* Output inverter
* Output threshold setting\n(to ensure emitter follower can turn output off)
* I think the second stage should be a complementer design, \nthat should allow for closer-to-zero bias output to sense_out
R17 V_REF 0 3k
R3 N025 N027 600
Q6 N003 N011 N015 0 2N3904
Q13 0 V_REF N002 0 2N3906
R24 V+ N001 1m
Q10 VCC N007 N016 0 2N3904
VINB INB 0 0
Q11 OUT1 N017 N010 0 2N3906
Q5 N001 N018 N012 0 2N3904
Q8 N001 N003 SENSE_OUT 0 2N3904
D2 N007 VCC BAT54
Q14 N023 N023 N026 0 2N3904
R30 N009 N008 100
R22 N017 N016 1k
R2 N021 N022 56
Q15 N001 SENSE_OUT N008 0 2N3904
R7 N015 N019 70
R1 N020 N022 56
R19 N001 V_REF 1.3k
R20 N013 0 2k
D1 N013 N009 BAT54
R14 N005 N006 1k
R6 N026 N027 300
R5 N012 N027 6.8k
R23 N007 N013 1k
R16 N001 N023 2k
R9 N019 N024 1k
R13 N005 N018 1k
D4 OUT1 N017 BAT54
R27 N010 0 100
R10 SENSE_OUT 0 5k
R29 N008 0 1k
R25 N016 0 200
Q9 N001 N004 SENSE_OUT 0 2N3904
VINA INA 0 PWL file=ampl_train.pwl
Q3 N022 N023 N025 0 2N3904
I1 N024 N027 9m
D3 VCC N010 1N914
R26 OUT1 0 100
Q18 N013 N009 N002 0 2N3906
R4 N011 N027 6.8k
Q4 N001 N006 N011 0 2N3904
R12 N001 N004 1.2k
Q7 N004 N012 N014 0 2N3904
R11 N001 N003 1.2k
R15 N001 N005 1.7k
VN 0 V- 12
VP1 VCC 0 3.3
VP V+ 0 12
R8 N014 N019 70
R18 N001 N002 1k
Q2 N018 INB N021 0 2N3904
R28 N027 V- 1m
Q1 N006 INA N020 0 2N3904
.model D D
.lib C:\users\khalils\AppData\Local\LTspice\lib\cmp\standard.dio
.model NPN NPN
.model PNP PNP
.lib C:\users\khalils\AppData\Local\LTspice\lib\cmp\standard.bjt
.dc VINA -100m 100m 0.1m
.step temp -25 125 25
.backanno
.end

* LTspice schematic (.asc):
Version 4.1
SHEET 1 4868 1080
WIRE -224 -1328 -272 -1328
WIRE -176 -1328 -224 -1328
WIRE -64 -1328 -112 -1328
WIRE -32 -1328 -64 -1328
WIRE 144 -1328 64 -1328
WIRE 368 -1328 144 -1328
WIRE 608 -1328 560 -1328
WIRE 656 -1328 608 -1328
WIRE 304 -1264 240 -1264
WIRE 368 -1264 304 -1264
WIRE -272 -1200 -272 -1328
WIRE -112 -1200 -112 -1328
WIRE 64 -1200 64 -1328
WIRE 240 -1200 240 -1264
WIRE 560 -1200 560 -1328
WIRE 128 -688 80 -688
WIRE 176 -688 128 -688
WIRE 352 -688 256 -688
WIRE 688 -688 352 -688
WIRE 768 -688 688 -688
WIRE 832 -688 768 -688
WIRE 944 -688 832 -688
WIRE 1040 -688 944 -688
WIRE 1200 -688 1040 -688
WIRE 1344 -688 1200 -688
WIRE 1680 -688 1344 -688
WIRE 1856 -688 1680 -688
WIRE 2096 -688 1856 -688
WIRE 2096 -672 2096 -688
WIRE 1856 -640 1856 -688
WIRE 352 -592 352 -688
WIRE 944 -592 944 -688
WIRE 1344 -592 1344 -688
WIRE 2096 -576 2096 -592
WIRE 2464 -576 2096 -576
WIRE 3280 -576 3008 -576
WIRE 3408 -576 3280 -576
WIRE 2096 -512 2096 -576
WIRE 832 -464 832 -688
WIRE 1856 -464 1856 -560
WIRE 2032 -464 1856 -464
WIRE 1040 -448 1040 -688
WIRE 1200 -448 1200 -688
WIRE 944 -400 944 -512
WIRE 976 -400 944 -400
WIRE 1344 -400 1344 -512
WIRE 1344 -400 1264 -400
WIRE 352 -384 352 -512
WIRE 352 -384 240 -384
WIRE 432 -384 352 -384
WIRE 240 -336 240 -384
WIRE 432 -336 432 -384
WIRE 1680 -336 1680 -688
WIRE 1040 -320 1040 -352
WIRE 1120 -320 1040 -320
WIRE 1200 -320 1200 -352
WIRE 1200 -320 1120 -320
WIRE 3408 -304 3408 -576
WIRE 1120 -288 1120 -320
WIRE 1456 -288 1120 -288
WIRE 1616 -288 1456 -288
WIRE 688 -256 688 -688
WIRE 1120 -240 1120 -288
WIRE 240 -208 240 -256
WIRE 624 -208 240 -208
WIRE 2464 -192 2464 -576
WIRE 944 -176 944 -400
WIRE 1344 -176 1344 -400
WIRE 2896 -160 2864 -160
WIRE 3008 -160 3008 -576
WIRE 3008 -160 2960 -160
WIRE 1680 -144 1680 -240
WIRE 2256 -144 1680 -144
WIRE 2368 -144 2336 -144
WIRE 2400 -144 2368 -144
WIRE 3408 -144 3408 -240
WIRE 3408 -144 3216 -144
WIRE 688 -128 688 -160
WIRE 880 -128 688 -128
WIRE 1504 -128 1408 -128
WIRE 3008 -112 3008 -160
WIRE 2368 -64 2368 -144
WIRE 2384 -64 2368 -64
WIRE 2464 -64 2464 -96
WIRE 2464 -64 2448 -64
WIRE 2592 -64 2464 -64
WIRE 2864 -64 2864 -160
WIRE 2864 -64 2672 -64
WIRE 2944 -64 2864 -64
WIRE 1120 -48 1120 -160
WIRE 3408 -48 3408 -144
WIRE 768 -32 768 -688
WIRE 1344 -16 1344 -80
WIRE 944 0 944 -80
WIRE 3008 0 3008 -16
WIRE 3104 0 3008 0
WIRE 3280 0 3184 0
WIRE 3344 0 3280 0
WIRE 432 16 432 -256
WIRE 704 16 432 16
WIRE 1856 96 1856 -464
WIRE 3280 96 3280 0
WIRE 3296 96 3280 96
WIRE 3408 96 3408 48
WIRE 3408 96 3360 96
WIRE 240 112 240 -208
WIRE 432 112 432 16
WIRE 1680 112 1680 -144
WIRE 944 144 944 80
WIRE 1136 144 944 144
WIRE 1344 144 1344 64
WIRE 1344 144 1136 144
WIRE -144 160 -192 160
WIRE 176 160 -144 160
WIRE 592 160 496 160
WIRE 768 192 768 64
WIRE 1504 192 1504 -128
WIRE 1504 192 768 192
WIRE 3408 192 3408 96
WIRE 3488 192 3408 192
WIRE 3568 192 3488 192
WIRE 1856 208 1856 96
WIRE 3216 240 3216 -144
WIRE 240 256 240 208
WIRE 432 256 432 208
WIRE 1136 256 1136 144
WIRE 2464 256 2464 -64
WIRE 3408 256 3408 192
WIRE 3008 304 3008 0
WIRE 240 400 240 336
WIRE 352 400 240 400
WIRE 432 400 432 336
WIRE 432 400 352 400
WIRE 1680 400 1680 192
WIRE 1856 400 1856 288
WIRE 2096 400 2096 -416
WIRE 2464 400 2464 336
WIRE 3008 416 3008 384
WIRE 3216 416 3216 320
WIRE 3408 416 3408 336
WIRE -144 432 -192 432
WIRE 592 432 592 160
WIRE 592 432 -144 432
WIRE 352 496 352 400
WIRE 496 544 416 544
WIRE 608 544 496 544
WIRE 832 544 832 -384
WIRE 832 544 608 544
WIRE 1136 544 1136 336
WIRE 496 624 496 544
WIRE 608 672 608 544
WIRE 608 672 560 672
WIRE 688 704 688 -128
WIRE 768 704 768 192
WIRE 352 736 352 592
WIRE 496 800 496 720
WIRE 112 928 80 928
WIRE 160 928 112 928
WIRE 352 928 352 816
WIRE 352 928 240 928
WIRE 496 928 496 880
WIRE 496 928 352 928
WIRE 688 928 688 784
WIRE 688 928 496 928
WIRE 768 928 768 784
WIRE 768 928 688 928
WIRE 1136 928 1136 624
WIRE 1136 928 768 928
WIRE 1680 928 1136 928
RECTANGLE Normal 1952 -512 1776 -672 2
SYMBOL res 2080 -688 R0
SYMATTR InstName R18
SYMATTR Value 1k
SYMBOL res 2992 288 R0
SYMATTR InstName R25
SYMATTR Value 200
SYMBOL res 224 -352 R0
SYMATTR InstName R14
SYMATTR Value 1k
SYMBOL res 928 -608 R0
SYMATTR InstName R11
SYMATTR Value 1.2k
SYMBOL res 224 240 R0
SYMATTR InstName R1
SYMATTR Value 56
SYMBOL res 480 784 R0
SYMATTR InstName R6
SYMATTR Value 300
SYMBOL res 1840 -656 R0
SYMATTR InstName R19
SYMATTR Value 1.3k
SYMBOL current 1136 544 R0
SYMATTR InstName I1
SYMATTR Value 9m
SYMBOL pnp 2400 -96 M180
SYMATTR InstName Q18
SYMATTR Value 2N3906
SYMBOL res 2352 -160 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R30
SYMATTR Value 100
SYMBOL res 1328 -608 R0
SYMATTR InstName R12
SYMATTR Value 1.2k
SYMBOL res 336 -608 R0
SYMATTR InstName R15
SYMATTR Value 1.7k
SYMBOL res 3200 224 R0
SYMATTR InstName R27
SYMATTR Value 100
SYMBOL npn 1408 -176 M0
SYMATTR InstName Q7
SYMATTR Value 2N3904
SYMBOL res 160 -672 R270
WINDOW 0 32 56 VTop 2
WINDOW 3 0 56 VBottom 2
SYMATTR InstName R24
SYMATTR Value 1m
SYMBOL res 928 -16 R0
SYMATTR InstName R7
SYMATTR Value 70
SYMBOL res 336 720 R0
SYMATTR InstName R3
SYMATTR Value 600
SYMBOL voltage 240 -1216 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName VINB
SYMATTR Value 0
SYMBOL res 1664 96 R0
SYMATTR InstName R29
SYMATTR Value 1k
SYMBOL res 2448 240 R0
SYMATTR InstName R20
SYMATTR Value 2k
SYMBOL npn 1264 -448 M0
SYMATTR InstName Q9
SYMATTR Value 2N3904
SYMBOL npn 704 -32 R0
SYMATTR InstName Q5
SYMATTR Value 2N3904
SYMBOL res 1120 240 R0
SYMATTR InstName R9
SYMATTR Value 1k
SYMBOL res 3392 240 R0
SYMATTR InstName R26
SYMATTR Value 100
SYMBOL res 816 -480 R0
SYMATTR InstName R16
SYMATTR Value 2k
SYMBOL npn 496 112 M0
SYMATTR InstName Q2
SYMATTR Value 2N3904
SYMBOL schottky 2448 -80 R90
WINDOW 0 0 32 VBottom 2
WINDOW 3 32 32 VTop 2
SYMATTR InstName D1
SYMATTR Value BAT54
SYMATTR Description Diode
SYMATTR Type diode
SYMBOL schottky 3360 112 M270
WINDOW 0 32 32 VTop 2
WINDOW 3 0 32 VBottom 2
SYMATTR InstName D4
SYMATTR Value BAT54
SYMATTR Description Diode
SYMATTR Type diode
SYMBOL diode 3392 -304 R0
SYMATTR InstName D3
SYMATTR Value 1N914
SYMBOL res 3200 -16 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R22
SYMATTR Value 1k
SYMBOL npn 176 112 R0
SYMATTR InstName Q1
SYMATTR Value 2N3904
SYMBOL npn 416 496 M0
SYMATTR InstName Q3
SYMATTR Value 2N3904
SYMBOL res 1328 -32 R0
SYMATTR InstName R8
SYMATTR Value 70
SYMBOL npn 2944 -112 R0
SYMATTR InstName Q10
SYMATTR Value 2N3904
SYMBOL diode 2896 -144 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 0 32 VBottom 2
SYMATTR InstName D2
SYMATTR Value BAT54
SYMATTR Description Diode
SYMATTR Type diode
SYMBOL res 1840 192 R0
SYMATTR InstName R17
SYMATTR Value 3k
SYMBOL res 416 240 R0
SYMATTR InstName R2
SYMATTR Value 56
SYMBOL npn 560 624 M0
SYMATTR InstName Q14
SYMATTR Value 2N3904
SYMBOL voltage -112 -1104 R180
WINDOW 0 24 96 Left 2
WINDOW 3 24 16 Left 2
SYMATTR InstName VN
SYMATTR Value 12
SYMBOL npn 624 -256 R0
SYMATTR InstName Q4
SYMATTR Value 2N3904
SYMBOL res 672 688 R0
SYMATTR InstName R4
SYMATTR Value 6.8k
SYMBOL voltage 560 -1216 R0
SYMATTR InstName VP1
SYMATTR Value 3.3
SYMBOL res 1104 -256 R0
SYMATTR InstName R10
SYMATTR Value 5k
SYMBOL res 2688 -80 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R23
SYMATTR Value 1k
SYMBOL npn 976 -448 R0
SYMATTR InstName Q8
SYMATTR Value 2N3904
SYMBOL npn 1616 -336 R0
SYMATTR InstName Q15
SYMATTR Value 2N3904
SYMBOL npn 880 -176 R0
SYMATTR InstName Q6
SYMATTR Value 2N3904
SYMBOL res 752 688 R0
SYMATTR InstName R5
SYMATTR Value 6.8k
SYMBOL voltage 64 -1216 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName VINA
SYMATTR Value PWL file=ampl_train.pwl
SYMBOL pnp 3344 48 M180
SYMATTR InstName Q11
SYMATTR Value 2N3906
SYMBOL res 416 -352 R0
SYMATTR InstName R13
SYMATTR Value 1k
SYMBOL voltage -272 -1216 R0
SYMATTR InstName VP
SYMATTR Value 12
SYMBOL pnp 2032 -416 M180
SYMATTR InstName Q13
SYMATTR Value 2N3906
SYMBOL res 256 912 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R28
SYMATTR Value 1m
FLAG 1456 -288 SENSE_OUT
FLAG -144 160 INA
FLAG -144 432 INB
FLAG 128 -688 V+
FLAG 112 928 V-
FLAG -272 -1120 0
FLAG 64 -1120 0
FLAG -112 -1120 0
FLAG 240 -1120 0
FLAG -224 -1328 V+
FLAG -64 -1328 V-
FLAG 144 -1328 INA
FLAG 304 -1264 INB
FLAG 1120 -48 0
FLAG 1856 96 V_REF
FLAG 3488 192 OUT1
FLAG 560 -1120 0
FLAG 608 -1328 VCC
FLAG 2464 400 0
FLAG 3008 416 0
FLAG 3280 -576 VCC
FLAG 3408 416 0
FLAG 1856 400 0
FLAG 2096 400 0
FLAG 3216 416 0
FLAG 1680 400 0
TEXT -304 976 Left 2 ;.tran 70u
TEXT -304 1008 Left 2 !.dc VINA -100m 100m 0.1m
TEXT -232 1064 Left 2 !.step temp -25 125 25
TEXT 1784 -720 Left 2 ;VREF control
TEXT 1440 -384 Left 2 ;Temp compensation\nfor sense output
TEXT 2120 -400 Left 2 ;Temp pre-compensation\nfor comparator threshold voltage
TEXT 2488 -208 Left 2 ;Comparator
TEXT 2680 -8 Left 2 ;Buffer (emitter follower \nwith saturation protection)
TEXT 3424 -96 Left 2 ;Output inverter
TEXT 3440 -272 Left 2 ;Output threshold setting\n(to ensure emitter follower can turn output off)
TEXT 856 -272 Left 2 ;I think the second stage should be a complementer design, \nthat should allow for closer-to-zero bias output to sense_out