#### noobeestudent

##### Junior Member level 1

I was required too build a Phase Firing Circuit for a aquarium heater that I am going to use in a PCB Etching Tank.

However, I wasn't able to simulate it properly using LTSpice. I am not sure where i did wrong.

Attached below is the Phase Firing circuit in LTSpice and the output.

The green line shows the 240V AC mains, red showing the pulse that I send to the optocoupler (MOC3021) and blue line shows the output (voltage across the 100Ω resistor)

The MOC3021 optocoupler and Q8004L4 TRIAC was imported.

**MOC3021 optocoupler Library**

Code:

```
* OPTO TRIAC
* Helmut Sennewald 8/10/2004
* MOC3021 I_trig=8mA
* D+ D- MT2 MT1
.SUBCKT MOC3021 AN CT T2 T1
.PARAM Itrig=8m
.PARAM RH1=20k
.PARAM RH2=20k
.PARAM RH3=16.7k
Q2 vb1 vb1p vd1 0 PNP1
Q1 vb1p vb1 4 0 NPN1
R3 vb1 4 {RH2}
D1 1 2 DL
R1 ctrl1 4 1
C1 ctrl1 4 10
R2 ctrl1 vb1 {RH1}
R4 vd1 vb1p {RH3}
B1 ctrl1 4 I=-500*I(D1)*3m/Itrig
R6 vd2 vb2 {RH2}
D3 vd2 3 D1
Q3 vb2 vb2p 4 0 PNP1
Q4 vb2p vb2 vd2 0 NPN1
E1 vd2 N001 ctrl1 4 -1
R5 N001 vb2 {RH1}
R7 vb2p 4 {RH3}
D2 3 vd1 D1
R34 3 4 100MEG
.MODEL PNP1 PNP(Is=1e-15 BF=10 Cjc=10p Cje=20p Tf=0.1u Ise=1e-12)
.MODEL NPN1 NPN(Is=1e-15 BF=10 Cjc=10p Cje=20p Tf=0.1u Ise=1e-12)
.MODEL D1 D(Is=0.1u Rs=2 Cj0=50p) .MODEL DL D(Is=1e-20 Rs=5)
.ENDS
```

**Q8004L4 TRIAC Library**

Code:

```
*SRC=Q8004L4;Q8004L4;TRIACS;TECCOR;800V 4A
*SYM=TRIAC
.SUBCKT Q8004L4 T2 G T1
* TERMINALS: MT2 G MT1
QN1 5 4 3 NOUT OFF
QN2 11 6 7 NOUT OFF
QP1 6 11 3 POUT OFF
QP2 4 5 7 POUT OFF
DF 4 5 DZ OFF
DR 6 11 DZ OFF
RF 4 6 16MEG
RT2 1 7 0.123
RH 7 6 17.5
RGP 8 3 24
RG 2 8 11.6
RS 8 4 2.4
DN 9 2 DIN OFF
RN 9 3 12.2
GNN 6 7 9 3 0.166
GNP 4 5 9 3 0.352
DP 2 10 DIP OFF
RP 10 3 7.12
GP 7 6 10 3 0.112
.MODEL DIN D (IS=229F)
.MODEL DIP D (IS=229F N=1.19)
.MODEL DZ D (IS=229F N=1.5 IBV=50U BV=800)
.MODEL POUT PNP (IS=229F BF=5 CJE=1.68N TF=76.5U)
.MODEL NOUT NPN (IS=229F BF=20 CJE=1.68N CJC=335P TF=5.1U)
.ENDS
```