* Z:\home\khalils\Downloads\files\data\raw_asc\3ca7182a26d3_Final_Interface.asc
* Generated by LTspice 26.0.1 for Windows.
* 5v to 3.3v - Only one mosfet but inverting \nDigital Ciruit (3x this ciruit) 1 for each load
* Busbar Voltage Ciruit - ADC
* Busbar Current Ciruit - ADC\nSilumation doesn't scale with these resistors but works in real life.
* PWM Ciruit for Mains Capacity\nScales between 0 and 10V depending on Duty Cycle
* Library below included based on ModelFile attribute of instance XU1 (C:\users\khalils\AppData\Local\LTspice\lib\sym\OpAmps\UniversalOpAmp.asy)
D5 0 N008 D
D3 0 0 D
D7 0 0 D
R3 N001 0 220
R5 N009 0 27
R4 N005 0 2.2k
D4 0 N005 D
M5 N006 N007 0 0 NMOS
C1 N003 0 10n
V1 +10v 0 10V
D1 0 N004 D
R1 N003 N002 33k
C3 N009 0 4.7n
C2 N005 0 4.7n
V3 +5v 0 5V
R6 N009 0 1
D6 N008 N009 D
R7 N009 0 1
V2 N004 0 SINE(0 4 50)
D8 0 N009 D
XU1 N003 N001 +10v 0 #1_1 level1 Avol=1Meg GBW=10Meg Vos=0 En=0 Enk=0 In=0 Ink=0 Rin=500Meg ;pnba In+)In-)V+)V-)OUT
R2 #1_1 N001 470
VFast_PWM N002 0 PULSE(0 3.3 0 10n 10n 5u 0.08u)
R15 +3.3v N006 100k
V4 N008 0 SINE(0 10 50)
D2 N004 N005 D
V7 N007 0 PULSE(0 5 0 10n 10n 500m 1 5)
V5 +3.3v 0 3.3V
.model D D
.lib C:\users\khalils\AppData\Local\LTspice\lib\cmp\standard.dio
.model NMOS NMOS
.model PMOS PMOS
.lib C:\users\khalils\AppData\Local\LTspice\lib\cmp\standard.mos
.tran 1s
.lib UniversalOpAmp1.lib
.backanno
.end

* LTspice schematic (.asc):
Version 4
SHEET 1 880 680
WIRE -42960 -32672 -43008 -32672
WIRE -42832 -32672 -42880 -32672
WIRE -44800 -32512 -44896 -32512
WIRE -43008 -32512 -43008 -32672
WIRE -42944 -32512 -43008 -32512
WIRE -42832 -32496 -42832 -32672
WIRE -42832 -32496 -42880 -32496
WIRE -42784 -32496 -42832 -32496
WIRE -43264 -32480 -43376 -32480
WIRE -43088 -32480 -43184 -32480
WIRE -42944 -32480 -43088 -32480
WIRE -43008 -32464 -43008 -32512
WIRE -44896 -32448 -44896 -32512
WIRE -43088 -32432 -43088 -32480
WIRE -43376 -32400 -43376 -32480
WIRE -43008 -32368 -43008 -32384
WIRE -44848 -32288 -44896 -32288
WIRE -44800 -32288 -44848 -32288
WIRE -44896 -32240 -44896 -32288
WIRE -43904 -32192 -44464 -32192
WIRE -42592 -32144 -42592 -32176
WIRE -44848 -32096 -44896 -32096
WIRE -44800 -32096 -44848 -32096
WIRE -44016 -32048 -44112 -32048
WIRE -43904 -32048 -43904 -32192
WIRE -43904 -32048 -43952 -32048
WIRE -43856 -32048 -43904 -32048
WIRE -43760 -32048 -43792 -32048
WIRE -42592 -32048 -42592 -32064
WIRE -42464 -32048 -42592 -32048
WIRE -44896 -32032 -44896 -32096
WIRE -44464 -32032 -44464 -32192
WIRE -42592 -32032 -42592 -32048
WIRE -43760 -31984 -43760 -32048
WIRE -43568 -31984 -43760 -31984
WIRE -43376 -31984 -43568 -31984
WIRE -43232 -31984 -43376 -31984
WIRE -44112 -31968 -44112 -32048
WIRE -44112 -31968 -44192 -31968
WIRE -43568 -31952 -43568 -31984
WIRE -43376 -31952 -43376 -31984
WIRE -42640 -31952 -42784 -31952
WIRE -42464 -31936 -42464 -32048
WIRE -42352 -31936 -42464 -31936
WIRE -44112 -31920 -44112 -31968
WIRE -44032 -31920 -44112 -31920
WIRE -43920 -31920 -43968 -31920
WIRE -43856 -31920 -43920 -31920
WIRE -43760 -31920 -43760 -31984
WIRE -43760 -31920 -43792 -31920
WIRE -42784 -31904 -42784 -31952
WIRE -44464 -31856 -44464 -31952
WIRE -44240 -31856 -44464 -31856
WIRE -43920 -31856 -43920 -31920
WIRE -43920 -31856 -44240 -31856
WIRE -44192 -31808 -44192 -31968
WIRE -43568 -31808 -43568 -31872
WIRE -43568 -31808 -44192 -31808
WIRE -43504 -31808 -43568 -31808
WIRE -43376 -31808 -43376 -31888
WIRE -43376 -31808 -43504 -31808
WIRE -44240 -31760 -44240 -31856
WIRE -43504 -31744 -43504 -31808
WIRE -43920 -31520 -44480 -31520
WIRE -44032 -31376 -44128 -31376
WIRE -43920 -31376 -43920 -31520
WIRE -43920 -31376 -43968 -31376
WIRE -43872 -31376 -43920 -31376
WIRE -43776 -31376 -43808 -31376
WIRE -44480 -31360 -44480 -31520
WIRE -43776 -31312 -43776 -31376
WIRE -43664 -31312 -43776 -31312
WIRE -43584 -31312 -43664 -31312
WIRE -43472 -31312 -43584 -31312
WIRE -43392 -31312 -43472 -31312
WIRE -43248 -31312 -43392 -31312
WIRE -44128 -31296 -44128 -31376
WIRE -44128 -31296 -44208 -31296
WIRE -43584 -31280 -43584 -31312
WIRE -43392 -31280 -43392 -31312
WIRE -43664 -31264 -43664 -31312
WIRE -43472 -31264 -43472 -31312
WIRE -44128 -31248 -44128 -31296
WIRE -44048 -31248 -44128 -31248
WIRE -43936 -31248 -43984 -31248
WIRE -43872 -31248 -43936 -31248
WIRE -43776 -31248 -43776 -31312
WIRE -43776 -31248 -43808 -31248
WIRE -44480 -31184 -44480 -31280
WIRE -44256 -31184 -44480 -31184
WIRE -43936 -31184 -43936 -31248
WIRE -43936 -31184 -44256 -31184
WIRE -44208 -31136 -44208 -31296
WIRE -43664 -31136 -43664 -31184
WIRE -43664 -31136 -44208 -31136
WIRE -43584 -31136 -43584 -31200
WIRE -43584 -31136 -43664 -31136
WIRE -43520 -31136 -43584 -31136
WIRE -43472 -31136 -43472 -31184
WIRE -43472 -31136 -43520 -31136
WIRE -43392 -31136 -43392 -31216
WIRE -43392 -31136 -43472 -31136
WIRE -44256 -31088 -44256 -31184
WIRE -43520 -31072 -43520 -31136
WIRE 32 0 32 -16
WIRE 64 0 32 0
WIRE 64 16 64 0
SYMBOL res -43024 -32480 R0
SYMATTR InstName R3
SYMATTR Value 220
SYMBOL diode -43856 -32032 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 0 32 VBottom 2
SYMATTR InstName D2
SYMBOL voltage -42784 -31920 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V7
SYMATTR Value PULSE(0 5 0 10n 10n 500m 1 5)
SYMBOL voltage -44464 -32048 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V2
SYMATTR Value SINE(0 4 50)
SYMBOL res -43168 -32496 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R1
SYMATTR Value 33k
SYMBOL cap -43392 -31952 R0
SYMATTR InstName C2
SYMATTR Value 4.7n
SYMBOL voltage -43376 -32416 R0
WINDOW 3 492 96 Right 2
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR Value PULSE(0 3.3 0 10n 10n 5u 0.08u)
SYMATTR InstName Fast_PWM
SYMBOL diode -43872 -31360 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 0 32 VBottom 2
SYMATTR InstName D6
SYMBOL diode -44032 -31904 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 0 32 VBottom 2
SYMATTR InstName D3
SYMBOL nmos -42640 -32032 R0
SYMATTR InstName M5
SYMBOL diode -44016 -32032 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 0 32 VBottom 2
SYMATTR InstName D1
SYMBOL diode -43872 -31232 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 0 32 VBottom 2
SYMATTR InstName D8
SYMBOL voltage -44896 -32464 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V5
SYMATTR Value 3.3V
SYMBOL cap -43104 -32432 R0
SYMATTR InstName C1
SYMATTR Value 10n
SYMBOL diode -43856 -31904 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 0 32 VBottom 2
SYMATTR InstName D4
SYMBOL voltage -44480 -31376 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V4
SYMATTR Value SINE(0 10 50)
SYMBOL diode -44032 -31360 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 0 32 VBottom 2
SYMATTR InstName D5
SYMBOL res -43600 -31296 R0
SYMATTR InstName R5
SYMATTR Value 27
SYMBOL res -42864 -32688 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 47 58 VTop 2
SYMATTR InstName R2
SYMATTR Value 470
SYMBOL voltage -44896 -32048 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V3
SYMATTR Value 5V
SYMBOL voltage -44896 -32256 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V1
SYMATTR Value 10V
SYMBOL res -43488 -31280 R0
SYMATTR InstName R7
SYMATTR Value 1
SYMBOL diode -44048 -31232 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 0 32 VBottom 2
SYMATTR InstName D7
SYMBOL res -42608 -32160 R0
SYMATTR InstName R15
SYMATTR Value 100k
SYMBOL cap -43408 -31280 R0
SYMATTR InstName C3
SYMATTR Value 4.7n
SYMBOL OpAmps\\UniversalOpAmp -42912 -32496 R0
SYMATTR InstName U1
SYMBOL res -43584 -31968 R0
SYMATTR InstName R4
SYMATTR Value 2.2k
SYMBOL res -43680 -31280 R0
SYMATTR InstName R6
SYMATTR Value 1
FLAG -43376 -32320 0
FLAG -43088 -32368 0
FLAG -44896 -32160 0
FLAG -44896 -31952 0
FLAG -44848 -32288 +10v
FLAG -44848 -32096 +5v
FLAG -43008 -32368 0
FLAG -42912 -32528 +10v
FLAG -42912 -32464 0
FLAG -42784 -32496 #1_1
FLAG -44896 -32368 0
FLAG -44800 -32512 +3.3v
FLAG -42784 -31824 0
FLAG -42592 -31936 0
FLAG -42592 -32176 +3.3v
FLAG -44240 -31760 0
FLAG -43504 -31744 0
FLAG -44256 -31088 0
FLAG -43520 -31072 0
TEXT -45192 -32136 Left 2 !.tran 1s
TEXT -42920 -31728 Left 2 ;5v to 3.3v - Only one mosfet but inverting \nDigital Ciruit (3x this ciruit) 1 for each load
TEXT -44472 -31616 Left 2 ;Busbar Voltage Ciruit - ADC
TEXT -44488 -30944 Left 2 ;Busbar Current Ciruit - ADC\nSilumation doesn't scale with these resistors but works in real life.
TEXT -43312 -32776 Left 2 ;PWM Ciruit for Mains Capacity\nScales between 0 and 10V depending on Duty Cycle