Benchspice

Benchspice › Community › Power supplies & converters

AC mains detector (PC817)

by ·

0 likes1 copies0 comments
Power supplies & converters#ac-detector#mains-detector#ac#detector

Open it in Benchspice to change it☆ BookmarkCopy it, change any value and run every analysis, free in your browser.

Isolated AC mains presence detector (90-264 VAC): resistor dropper, bridge rectifier, smoothing caps, green indicator LED and a PC817 optocoupler that pulls the shot-timer input low while mains is present.

Parts

PartCountValues and models
Resistor610meg, 15k, 1k, 100, 10k
Voltage source2SIN(0 {Vac*sqrt(2)} {f}), 5
Capacitor233u, 100n
BRIDGE_RECT1
Diode1LED_GREEN
PC8171

Picture

AC mains detector (PC817): schematic and simulated waveforms of a power supplies & converters circuit
AC mains detector (PC817): schematic and simulated waveforms, made with Benchspice.

Simulation

This circuit is set up for a transient (time domain) analysis: .tran 0 300m 0 50u. Run it in your browser, change values and see the waveforms update.

SPICE netlist

* AC mains detector (PC817) - Main
.param Vac=230
.param f=50
V1 line neutral SIN(0 {Vac*sqrt(2)} {f})
R6 neutral 0 10meg
R1 line n001 15k
R2 neutral n002 15k
R3 n001 n002 1k
XB1 n001 n002 dcp dcn BRIDGE_RECT
C1 dcp dcn 33u
C2 dcp dcn 100n
R4 dcp n003 100
D1 n003 n004 LED_GREEN
R5 vcc out 10k
V2 vcc 0 5
X1 n004 dcn 0 out PC817
.include PC817.sub
.include NTC_10K.sub
.subckt BRIDGE_RECT ac1 ac2 outp outn
D1 ac1 outp DBR
D2 ac2 outp DBR
D3 outn ac1 DBR
D4 outn ac2 DBR
.ends BRIDGE_RECT
.model DBR D(Is=1n Rs=0.05 N=1.2 Cjo=20p)
.model LED_GREEN D(Is=1e-20 N=1.8 Rs=10 Cjo=10p)
.meas tran vdc AVG V(dcp,dcn) FROM=250m TO=300m
.meas tran iled AVG I(R4) FROM=250m TO=300m
.meas tran vout_max MAX V(out) FROM=250m TO=300m
.meas tran ir1 RMS I(R1) FROM=250m TO=300m
.meas tran p_r1 PARAM ir1*ir1*15k
.tran 0 300m 0 50u
.end

More power supplies & converters circuits