* SPICE netlist
XU1 N002 0 N001 OUT1 PC817 Igain=1m ;pnba A)K)C)E
V1 IN 0 PULSE(0 5 1n 1n 1n 100u 150u)
R1 N002 IN 100
R2 0 OUT1 220
V2 N001 0 3.3
XU2 N003 0 N004 N005 PC817 Igain=1m ;pnba A)K)C)E
R3 N003 IN 220
Q1 OUT2 N004 N001 0 BC857B
R5 N001 N004 62
R4 OUT2 0 1k
Q2 N008 N009 0 0 BC847B
R6 N008 N009 1k
R7 N009 0 680
R8 N005 0 330
XU3 N006 0 N007 N008 PC817 Igain=1m ;pnba A)K)C)E
R9 N006 IN 220
Q3 OUT3 N007 N001 0 BC857B
R10 N001 N007 62
R11 OUT3 0 1k
XU4 N010 0 N011 N012 PC817 Igain=1m ;pnba A)K)C)E
R14 N010 IN 220
Q5 OUT4 N011 N001 0 BC857B
R15 N001 N011 62
R16 OUT4 0 1k
V3 N012 0 4
R12 N001 N008 1k
.tran 0 200u 90u

* LTspice schematic (.asc)
Version 4
SHEET 1 1664 1904
WIRE 368 -936 176 -936
WIRE 480 -936 368 -936
WIRE 832 -936 480 -936
WIRE -480 -824 -832 -824
WIRE -400 -824 -480 -824
WIRE -288 -824 -400 -824
WIRE -128 -824 -208 -824
WIRE 176 -824 176 -936
WIRE 176 -824 64 -824
WIRE -832 -808 -832 -824
WIRE -128 -728 -160 -728
WIRE 144 -728 64 -728
WIRE 208 -728 144 -728
WIRE 272 -728 208 -728
WIRE 144 -680 144 -728
WIRE -832 -648 -832 -728
WIRE -160 -648 -160 -728
WIRE 480 -648 480 -856
WIRE 144 -536 144 -600
WIRE 368 -472 368 -936
WIRE 368 -472 240 -472
WIRE 368 -440 368 -472
WIRE -400 -392 -400 -824
WIRE -288 -392 -400 -392
WIRE -128 -392 -208 -392
WIRE 240 -392 64 -392
WIRE 304 -392 240 -392
WIRE 368 -312 368 -344
WIRE 432 -312 368 -312
WIRE 480 -312 432 -312
WIRE -128 -296 -160 -296
WIRE 112 -296 64 -296
WIRE 112 -280 112 -296
WIRE 368 -280 368 -312
WIRE -160 -216 -160 -296
WIRE 112 -136 112 -200
WIRE 368 -136 368 -200
WIRE 240 -24 128 -24
WIRE 368 -24 240 -24
WIRE 832 -24 832 -936
WIRE 832 -24 368 -24
WIRE 368 8 368 -24
WIRE -400 56 -400 -392
WIRE -288 56 -400 56
WIRE -128 56 -208 56
WIRE 240 56 64 56
WIRE 304 56 240 56
WIRE 128 72 128 -24
WIRE 368 136 368 104
WIRE 432 136 368 136
WIRE 480 136 432 136
WIRE -128 152 -160 152
WIRE 96 152 64 152
WIRE 128 152 96 152
WIRE 208 152 128 152
WIRE 96 168 96 152
WIRE 368 168 368 136
WIRE 208 200 208 152
WIRE -160 232 -160 152
WIRE 144 248 96 248
WIRE 368 312 368 248
WIRE 96 360 96 328
WIRE 208 360 208 296
WIRE 208 360 96 360
WIRE 368 600 240 600
WIRE 832 600 832 -24
WIRE 832 600 368 600
WIRE 368 632 368 600
WIRE -400 680 -400 56
WIRE -288 680 -400 680
WIRE -128 680 -208 680
WIRE 240 680 64 680
WIRE 304 680 240 680
WIRE 368 760 368 728
WIRE 432 760 368 760
WIRE 480 760 432 760
WIRE -128 776 -160 776
WIRE 144 776 64 776
WIRE 368 792 368 760
WIRE 144 824 144 776
WIRE -160 856 -160 776
WIRE 368 936 368 872
WIRE 144 952 144 904
FLAG -832 -648 0
FLAG -160 -648 0
FLAG 144 -536 0
FLAG 480 -648 0
FLAG -160 -216 0
FLAG 368 -136 0
FLAG 208 -728 OUT1
FLAG 432 -312 OUT2
FLAG -480 -824 IN
FLAG 208 360 0
FLAG 112 -136 0
FLAG -160 232 0
FLAG 368 312 0
FLAG 432 136 OUT3
FLAG -160 856 0
FLAG 368 936 0
FLAG 432 760 OUT4
FLAG 144 952 0
SYMBOL Optos\\PC817A -32 -776 R0
SYMATTR InstName U1
SYMBOL voltage -832 -824 R0
SYMATTR InstName V1
SYMATTR Value PULSE(0 5 1n 1n 1n 100u 150u)
SYMBOL res -192 -840 R90
SYMATTR InstName R1
SYMATTR Value 100
SYMBOL res 160 -584 R180
SYMATTR InstName R2
SYMATTR Value 220
SYMBOL voltage 480 -952 R0
SYMATTR InstName V2
SYMATTR Value 3.3
SYMBOL Optos\\PC817A -32 -344 R0
SYMATTR InstName U2
SYMBOL res -192 -408 R90
SYMATTR InstName R3
SYMATTR Value 220
SYMBOL pnp 304 -344 M180
SYMATTR InstName Q1
SYMATTR Value BC857B
SYMBOL res 224 -488 R0
SYMATTR InstName R5
SYMATTR Value 62
SYMBOL res 352 -296 R0
SYMATTR InstName R4
SYMATTR Value 1k
SYMBOL npn 144 200 R0
SYMATTR InstName Q2
SYMATTR Value BC847B
SYMBOL res 80 152 R0
SYMATTR InstName R6
SYMATTR Value 1k
SYMBOL res 80 232 R0
SYMATTR InstName R7
SYMATTR Value 680
SYMBOL res 96 -296 R0
SYMATTR InstName R8
SYMATTR Value 330
SYMBOL Optos\\PC817A -32 104 R0
SYMATTR InstName U3
SYMBOL res -192 40 R90
SYMATTR InstName R9
SYMATTR Value 220
SYMBOL pnp 304 104 M180
SYMATTR InstName Q3
SYMATTR Value BC857B
SYMBOL res 224 -40 R0
SYMATTR InstName R10
SYMATTR Value 62
SYMBOL res 352 152 R0
SYMATTR InstName R11
SYMATTR Value 1k
SYMBOL Optos\\PC817A -32 728 R0
SYMATTR InstName U4
SYMBOL res -192 664 R90
SYMATTR InstName R14
SYMATTR Value 220
SYMBOL pnp 304 728 M180
SYMATTR InstName Q5
SYMATTR Value BC857B
SYMBOL res 224 584 R0
SYMATTR InstName R15
SYMATTR Value 62
SYMBOL res 352 776 R0
SYMATTR InstName R16
SYMATTR Value 1k
SYMBOL voltage 144 808 R0
SYMATTR InstName V3
SYMATTR Value 4
SYMBOL res 112 56 R0
SYMATTR InstName R12
SYMATTR Value 1k