* Z:\home\khalils\Downloads\files\data\raw_asc\7d883885245a_zero-crossing-detector.asc
* Generated by LTspice 26.0.1 for Windows.
* Zero crossing detector
* How it works:\n \n1. The rectifier rectifies the input AC.\n2. The positive half waves, as long as they are higher than 10V push curren through the phototransistor pulling the output low.\n3. When the positive half waves go lower than 10V the phototransistor shuts down and the output goes high.\n \nNotes:\n1. Can be used with high voltages.
* Rectifier
* Library below included based on ModelFile attribute of instance XU1 (C:\users\khalils\AppData\Local\LTspice\lib\sym\Optos\4N25.asy)
V1 N003 N004 SINE(0 230 50)
D4 0 N003 1N5819
D3 N004 N001 1N5819
R1 N002 N001 1k
D2 0 N004 1N5819
R2 out Vcc 1k
V2 Vcc 0 12
XU1 N002 0 out 0 NC_01 4N25 ;pnba A)K)C)E)B
D1 N003 N001 1N5819
.model D D
.lib C:\users\khalils\AppData\Local\LTspice\lib\cmp\standard.dio
.tran 50m
.lib 4N25.sub
.backanno
.end

* LTspice schematic (.asc):
Version 4.1
SHEET 1 2540 680
WIRE 80 -272 80 -304
WIRE 80 -176 80 -192
WIRE 832 -112 832 -176
WIRE 320 -64 112 -64
WIRE 400 -64 320 -64
WIRE 560 -64 480 -64
WIRE 112 -32 112 -64
WIRE 320 -32 320 -64
WIRE 112 64 112 32
WIRE 112 64 -208 64
WIRE 560 64 560 -64
WIRE 576 64 560 64
WIRE 832 64 832 -32
WIRE 832 64 768 64
WIRE 896 64 832 64
WIRE -208 80 -208 64
WIRE 832 128 768 128
WIRE 576 160 560 160
WIRE -208 176 -208 160
WIRE 320 176 320 32
WIRE 320 176 -208 176
WIRE 832 176 832 128
WIRE 112 208 112 64
WIRE 320 208 320 176
WIRE 112 304 112 272
WIRE 320 304 320 272
WIRE 320 304 112 304
WIRE 560 304 560 160
WIRE 560 304 320 304
WIRE 320 320 320 304
RECTANGLE Normal 368 352 32 -96 1
SYMBOL schottky 336 272 R180
WINDOW 0 24 64 Left 2
WINDOW 3 24 0 Left 2
SYMATTR InstName D2
SYMATTR Value 1N5819
SYMATTR Description Diode
SYMATTR Type diode
SYMBOL voltage -208 64 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V1
SYMATTR Value SINE(0 230 50)
SYMBOL res 496 -80 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R1
SYMATTR Value 1k
SYMBOL res 848 -16 R180
WINDOW 0 36 76 Left 2
WINDOW 3 36 40 Left 2
SYMATTR InstName R2
SYMATTR Value 1k
SYMBOL voltage 80 -288 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V2
SYMATTR Value 12
SYMBOL schottky 336 32 R180
WINDOW 0 24 64 Left 2
WINDOW 3 24 0 Left 2
SYMATTR InstName D3
SYMATTR Value 1N5819
SYMATTR Description Diode
SYMATTR Type diode
SYMBOL schottky 128 32 R180
WINDOW 0 24 64 Left 2
WINDOW 3 24 0 Left 2
SYMATTR InstName D1
SYMATTR Value 1N5819
SYMATTR Description Diode
SYMATTR Type diode
SYMBOL schottky 128 272 R180
WINDOW 0 24 64 Left 2
WINDOW 3 24 0 Left 2
SYMATTR InstName D4
SYMATTR Value 1N5819
SYMATTR Description Diode
SYMATTR Type diode
SYMBOL Optos\\4N25 672 128 R0
SYMATTR InstName U1
FLAG 320 320 0
FLAG 832 176 0
FLAG 80 -176 0
FLAG 896 64 out
FLAG 80 -304 Vcc
FLAG 832 -176 Vcc
TEXT 176 -184 Left 2 !.tran 50m
TEXT 328 -296 Left 4 ;Zero crossing detector
TEXT -128 360 Left 2 ;How it works:\n \n1. The rectifier rectifies the input AC.\n2. The positive half waves, as long as they are higher than 10V push curren through the phototransistor pulling the output low.\n3. When the positive half waves go lower than 10V the phototransistor shuts down and the output goes high.\n \nNotes:\n1. Can be used with high voltages.
TEXT 104 -112 Left 2 ;Rectifier