Pages

Sunday, 17 March 2013

NgSpice, bridge rectifier with zener diode

Now another spice example, this time we are going to see how to model (in a simple way) a transformer and a zener diode to have a better and stable DC output voltage after the bridge rectifier.




Cause does not make any sense write here all the code, I give directly the spice file, and the others at the end of the post.


Vin n1 0 SIN(0 220 50)
LA n1 n1x 100m
RA n1x 0 1

LB n2 n3x 1m
RB n3x n3 1
KAB LA LB 1


First of all, you can see that the transformer with a turns ratio 10:1 is modeled as two inductors LA,LB with a couple factor KAB. The value of the two inductors can be figured out recalling that $L \propto N^2$, then: $L_B=N^2L_A$.
We must add a series resitor with the inductance, because spice need it to calculate the dc currents of the circuit, otherwise would be infinity returning an error. Also, all the elements of the circuit must have a pth to ground, then Vac and LA must be connected to the ground.

The zener diode is defined as well are the other diodes, but in the model, you should add  the value of Breakdown voltage BV, that in such example is $5\,V$.

DZ 0 out zener
.MODEL zener d BV 5

The value of the resistor before the zener diode, should be calculated assuming a maximum output current. In such case I have supposed $I_L=50\,mA$ and a voltage drop in the diodes of the bridge $V_D=1\,V$. Then if $V_Z$ is the zener voltage and $V_T$ the voltage in the second port of the transformer:
$$R\le\frac{V_T-V_L-2V_D}{I_L}= 300\,\Omega$$ 
I have chose $R=260$ to reach greater current value at the output but increasing the power dissipated across the resistor.

I have obtained the results with a control statement, and not with a batch output, as in the last example. This method is much more flexible, because you are able to write such code inside the spice circuit. In the control script I have measured the value of the ripple and the average value of the output, together with the fourier transform, where you can see the low values of the harmonics compared to the last simulation. 



The output waveform is close to a constant DC value of 5V, though the circuit is designed for a maximum output current of $50\,mA$. Infact if the load require more current, the output voltage is no loger $5\,V$, and if the load doesn't absorb any current then the zener diode must be able to dissipate all the power over it. 
However this is just a spice simulation, and this is not the the better solution to generate a constant DC voltage, especially if the load absorb more than $30\,mA$.

Spice_file, raw_file, output_file.


1 comment: