* SPICE netlist
R1 N012 3V3 220
R2 N001 7V4 120
Q1 N006 N012 0 0 BC547B
R3 N007 0 100k
V1 7V4 0 7.4
V2 3V3 0 PULSE(0 3.3 5 0.01 0.01 10)
XU2 N001 N006 N002 N007 PC817 Igain=1m ;pnba A)K)C)E
R4 7V4 N002 220
Q2 N010 N007 N014 0 BC547B
RSkib2 N014 0 1.3
R6 7V4 N010 18
C1 N007 0 1n
R7 N013 3V3 220
R8 N003 7V4 120
Q3 N008 N013 0 0 BC547B
R9 N005 0 100k
R10 7V4 N004 220
Q4 N011 N005 N015 0 BC547B
RSkib N015 0 1.3
R12 7V4 N011 18
XU1 N003 N008 N004 N005 N009 4N25 ;pnba A)K)C)E)B
R13 N009 0 100k
C2 N005 0 1n
.tran 0 10 0

* LTspice schematic (.asc)
Version 4
SHEET 1 2928 1200
WIRE -1464 -520 -1464 -600
WIRE -1304 -520 -1304 -600
WIRE -1464 -360 -1464 -440
WIRE -1304 -360 -1304 -440
WIRE -792 24 -792 -56
WIRE 888 24 888 -56
WIRE -1112 40 -1112 -56
WIRE 568 40 568 -56
WIRE -216 168 -216 -56
WIRE 1464 168 1464 -56
WIRE -1112 200 -1112 120
WIRE -1048 200 -1112 200
WIRE -792 200 -792 104
WIRE -792 200 -856 200
WIRE 568 200 568 120
WIRE 632 200 568 200
WIRE 888 200 888 104
WIRE 888 200 824 200
WIRE 888 264 824 264
WIRE -1048 296 -1112 296
WIRE -792 296 -856 296
WIRE 632 296 568 296
WIRE 840 296 824 296
WIRE -216 344 -216 248
WIRE -216 344 -248 344
WIRE 1464 344 1464 248
WIRE 1464 344 1432 344
WIRE -1112 360 -1112 296
WIRE 568 360 568 296
WIRE -792 392 -792 296
WIRE -680 392 -792 392
WIRE -472 392 -680 392
WIRE -312 392 -472 392
WIRE 888 392 888 264
WIRE 1000 392 888 392
WIRE 1208 392 1000 392
WIRE 1368 392 1208 392
WIRE -1352 408 -1464 408
WIRE -1176 408 -1272 408
WIRE 328 408 216 408
WIRE 504 408 408 408
WIRE -216 440 -248 440
WIRE 1464 440 1432 440
WIRE -680 456 -680 392
WIRE 840 456 840 296
WIRE 1000 456 1000 392
WIRE -472 472 -472 392
WIRE 1208 472 1208 392
WIRE -216 488 -216 440
WIRE 1464 488 1464 440
WIRE -1112 600 -1112 456
WIRE -680 600 -680 536
WIRE -472 600 -472 536
WIRE -216 600 -216 568
WIRE 568 600 568 456
WIRE 840 600 840 536
WIRE 1000 600 1000 536
WIRE 1208 600 1208 536
WIRE 1464 600 1464 568
FLAG -472 600 0
FLAG -680 600 0
FLAG -1112 600 0
FLAG -1304 -360 0
FLAG -1464 -360 0
FLAG -1464 -600 7V4
IOPIN -176 -768 Out
FLAG -1304 -600 3V3
IOPIN -16 -768 Out
FLAG -1112 -56 7V4
IOPIN 176 -224 In
FLAG -792 -56 7V4
IOPIN 496 -224 In
FLAG -1464 408 3V3
IOPIN -176 240 In
FLAG -216 600 0
FLAG -216 -56 7V4
IOPIN 1072 -224 In
FLAG 1208 600 0
FLAG 1000 600 0
FLAG 568 600 0
FLAG 568 -56 7V4
IOPIN 1856 -224 In
FLAG 888 -56 7V4
IOPIN 2176 -224 In
FLAG 216 408 3V3
IOPIN 1504 240 In
FLAG 1464 600 0
FLAG 1464 -56 7V4
IOPIN 2752 -224 In
FLAG 840 600 0
SYMBOL res -1256 392 R90
SYMATTR InstName R1
SYMATTR Value 220
SYMBOL res -1096 136 R180
SYMATTR InstName R2
SYMATTR Value 120
SYMBOL npn -1176 360 R0
SYMATTR InstName Q1
SYMATTR Value BC547B
SYMBOL res -696 440 R0
SYMATTR InstName R3
SYMATTR Value 100k
SYMBOL voltage -1464 -536 R0
SYMATTR InstName V1
SYMATTR Value 7.4
SYMBOL voltage -1304 -536 R0
SYMATTR InstName V2
SYMATTR Value PULSE(0 3.3 5 0.01 0.01 10)
SYMBOL Optos\\PC817A -952 248 R0
SYMATTR InstName U2
SYMBOL res -808 8 R0
SYMATTR InstName R4
SYMATTR Value 220
SYMBOL npn -312 344 R0
SYMATTR InstName Q2
SYMATTR Value BC547B
SYMBOL res -232 472 R0
SYMATTR InstName Skib2
SYMATTR Value 1.3
SYMBOL res -232 152 R0
SYMATTR InstName R6
SYMATTR Value 18
SYMBOL cap -488 472 R0
SYMATTR InstName C1
SYMATTR Value 1n
SYMBOL res 424 392 R90
SYMATTR InstName R7
SYMATTR Value 220
SYMBOL res 584 136 R180
SYMATTR InstName R8
SYMATTR Value 120
SYMBOL npn 504 360 R0
SYMATTR InstName Q3
SYMATTR Value BC547B
SYMBOL res 984 440 R0
SYMATTR InstName R9
SYMATTR Value 100k
SYMBOL res 872 8 R0
SYMATTR InstName R10
SYMATTR Value 220
SYMBOL npn 1368 344 R0
SYMATTR InstName Q4
SYMATTR Value BC547B
SYMBOL res 1448 472 R0
SYMATTR InstName Skib
SYMATTR Value 1.3
SYMBOL res 1448 152 R0
SYMATTR InstName R12
SYMATTR Value 18
SYMBOL Optos\\4N25 728 264 R0
SYMATTR InstName U1
SYMBOL res 824 440 R0
SYMATTR InstName R13
SYMATTR Value 100k
SYMBOL cap 1192 472 R0
SYMATTR InstName C2
SYMATTR Value 1n