* Z:\tmp\asc_dec_bjh7r6w2\0d6bbf677ed1_CCCV_Battery_Charger_dec0.asc
* Generated by LTspice 26.0.1 for Windows.
XU4 N012 N007 DAD_5V 0 N008 level2 Avol=1Meg GBW=10Meg Slew=10Meg Ilimit=25m Rail=0 Vos=0 En=0 Enk=0 In=0 Ink=0 Rin=500Meg ;pnba In+)In-)V+)V-)OUT
Roff N005 N004 220
V3 N006 0 1m
R3 0 N011 4.7k
R10 0 N013 100k
XU5 N014 N009 N001 LT1117 ;pnba ADJ)OUT)IN
D1 N003 V_battery D
R13 N012 DAD_5V 4.7k
D2 N010 V_battery D
Q3 N002 N002 N001 0 PNP
VBattery V_battery 0 EXP(3.0 4.2 2m 5m 25m 0.005)
.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
* Library below included based on ModelFile attribute of instance XU5 (C:\users\khalils\AppData\Local\LTspice\lib\sym\PowerProducts\LT1117.asy)
.lib LT1117.lib
* Library below included based on ModelFile attribute of instance XU4 (C:\users\khalils\AppData\Local\LTspice\lib\sym\OpAmps\UniversalOpAmp2.asy)
.lib UniversalOpAmp2.lib
.backanno
.end

* LTspice schematic (.asc):
Version 4
SHEET 1 4020 1620
WIRE -80 -32 -272 -32
WIRE 320 -32 -80 -32
WIRE -80 64 -80 -32
WIRE 128 112 -16 112
WIRE 256 112 128 112
WIRE -80 192 -80 160
WIRE 128 192 128 112
WIRE 128 192 -80 192
WIRE 752 208 320 208
WIRE -80 224 -80 192
WIRE 1568 272 1568 208
WIRE -80 352 -80 304
WIRE 752 352 752 208
WIRE 752 368 752 352
WIRE 1264 448 1264 -16
WIRE 1280 448 1264 448
WIRE 1424 448 1424 192
WIRE 1424 448 1360 448
WIRE 1504 448 1424 448
WIRE 1424 496 1424 448
WIRE 752 560 752 416
WIRE 752 560 240 560
WIRE 1216 560 752 560
WIRE 240 608 240 560
WIRE 1216 720 1216 560
WIRE 1328 720 1216 720
WIRE 1424 720 1328 720
WIRE 1664 896 1424 896
WIRE 1424 928 1424 896
WIRE 2672 960 2672 928
WIRE 2352 976 2352 736
WIRE 2352 976 2272 976
WIRE 2640 976 2352 976
WIRE 2880 992 2704 992
WIRE -272 1008 -272 -32
WIRE -208 1008 -272 1008
WIRE 96 1008 48 1008
WIRE 128 1008 96 1008
WIRE 240 1008 240 672
WIRE 864 1008 640 1008
WIRE 2640 1008 2576 1008
WIRE 2672 1040 2672 1024
WIRE 1424 1056 1424 1008
WIRE 1520 1056 1424 1056
WIRE 1664 1056 1520 1056
WIRE 2432 1072 2400 1072
WIRE 2576 1072 2576 1008
WIRE 2576 1072 2512 1072
WIRE 1328 1088 1328 720
WIRE 1360 1088 1328 1088
WIRE 1424 1088 1360 1088
WIRE 2576 1104 2576 1072
WIRE 1424 1120 1424 1088
WIRE 96 1184 96 1008
WIRE 2112 1200 2112 1056
WIRE 2576 1232 2576 1184
WIRE 1424 1248 1424 1200
WIRE -80 1296 -80 1104
WIRE 2112 1312 2112 1280
SYMBOL OpAmps\\UniversalOpamp2 2672 992 R0
SYMATTR InstName U4
SYMBOL res 1376 432 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName Roff
SYMATTR Value 220
SYMBOL voltage 1424 912 R180
WINDOW 0 24 96 Left 2
WINDOW 3 24 16 Left 2
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V3
SYMATTR Value 1m
SYMBOL res 960 992 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R3
SYMATTR Value 4.7k
SYMBOL res 2128 1296 R180
WINDOW 0 36 76 Left 2
WINDOW 3 36 40 Left 2
SYMATTR InstName R10
SYMATTR Value 100k
SYMBOL PowerProducts\\LT1117 -80 1008 R0
SYMATTR InstName U5
SYMBOL diode 736 352 R0
SYMATTR InstName D1
SYMBOL res 2528 1056 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R13
SYMATTR Value 4.7k
SYMBOL diode 256 672 R180
WINDOW 0 24 64 Left 2
WINDOW 3 24 0 Left 2
SYMATTR InstName D2
SYMBOL pnp -16 160 R180
SYMATTR InstName Q3
SYMBOL voltage 1424 1104 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName Battery
SYMATTR Value EXP(3.0 4.2 2m 5m 25m 0.005)
FLAG 1568 272 0
FLAG 1424 576 0
FLAG -80 352 V_schmitt
FLAG 2112 1312 0
FLAG 2400 1072 DAD_5V
FLAG 2576 1232 0
FLAG 2672 1040 0
FLAG 2672 928 DAD_5V
FLAG 1424 1248 0
FLAG 1360 1088 V_battery
FLAG 1424 816 0
FLAG 1520 1056 0
FLAG 944 1008 0