# Could someone answer my questions on a transformer with regulator circuit in LTspice?

The circuit itself is a UK mains power supply turning 230Vac to 20Vdc.

The first section is a transformer. The second part is a bridge rectifier, it then moves onto a voltage regulator by the name of LM317.

Questions:

Considering that this is a UK mains power supply what transformer resistances are usual?

I understand that this requires more in-depth knowledge of the core and windings, its resistances and reactances, however choosing a resistance of 1 seems to be a bit too “simple” should I say. Upon changing resistances, it mostly only affects the negative voltage. I.e reaches a positive peak of 20V but does not reach a negative peak of -20V, like 0.01 out.

I understand for LTspice to determine the ratio of voltage, is to use the equation (V1/V2)^2 = L1/L2. Which is why the inductances are 2640 and 10 respectively as this produces a 20V output.

However, to simulate such a thing in ltpsice is this the correct way of doing so? (Youtube videos really don’t help much.)

Also, the inductance coefficient is 1, what is a more reasonable value?

The bridge rectifier (i.e changing 20Vac to 20Vdc) is easier to understand.

But I’m lacking understanding of how I could reduce the voltage lost? For this the peak voltage loses about 1V.

The diode used is the default diode for LTspice, which I have some sources claiming to be the 1n4148

Are there better diodes to use as bridge rectifiers?

I’m most confused about the voltage regulator.

C1 is important to reduce noise and upon adding more capacitors the noise reduces.

Is adding more capacitors before the voltage regulator good?

Is adding a polarised capacitor better?

C2 is there just for the voltage drop, otherwise it would be zero. However changing C2 to a resistor say, the input signal to the voltage regulator has a lot more fluctuations.

Why is this? I didn’t think it would have such an effect.

The input voltage into regulator is ~19V and output is 12.5V with fluctuations in the 10^-5. I do not understand how there is 6.5 voltage drop and regardless of the input voltage into the regulator the voltage is 12.5V.

What is the cause and how could I reduce this?

I guess the most important question here is, is this a good power supply circuit?

What could be done to make this better?

I understand that this is a long question, I appreciate your time for answering.

• This isn't a long question. It's a series of open questions which have only one thing in common -- they are part of a power supply. These questions will resonate quite differently in different minds and the answers will likely vary quite widely. You also are making some wrong assumptions (your questions assume something not shown or demonstrated and then ask why, which can't really be answered without first fixing your wrong-minded question.) All of this makes it annoyingly difficult to give you a straight, direct answer. That said, some good in there too. – jonk Oct 28 at 16:21
• The first obvious error I see is that neither terminal of L2 should be grounded. As drawn, diode D3 is shorted by ground connections on both sides. I don't know if this actually answers any of the questions you asked. – The Photon Oct 28 at 16:23
• RE: "Are there better diodes to use as bridge rectifiers?", We can 't answer this if you don't tell us what diode you did use. – The Photon Oct 28 at 16:26
• In LTspice (probably in most simulators, though the exact details of schematic editing and the features offered will probably vary), you do want to arrange things so that the inductance of the primary, relative to the secondary, has a squared relationship with respect to the desired voltage ratings. So, if your mains is $230\:{\text{V}_{\!\text{AC}}}$ and your desired secondary is $20\:{\text{V}_{\!\text{AC}}}$ then you do want $L_1=\left(\frac{230\:{\text{V}_{\!\text{AC}}}}{20\:{\text{V}_{\!\text{AC}}}}\right)^2\cdot L_2=132.25\cdot L_2$. Assuming coupling of 1, of course. – jonk Oct 28 at 16:52
• @ThePhoton Ah sorry, Yes I've amended it now. – Benstead Oct 28 at 16:55

Upon changing resistances, it mostly only affects the negative voltage. I.e reaches a positive peak of 20V but does not reach a negative peak of -20V, like 0.01 out.

The Ground symbol on L2 short circuits it to the other ground symbol on R3 which is your output ground, making the rectifier diodes useless. Remove the ground symbol circled in red...

But I’m lacking understanding of how I could reduce the voltage lost? For this the peak voltage loses about 1V.

1V sounds correct for usual rectifier diodes.

Are there better diodes to use as bridge rectifiers?

You can use schottky diodes for lower voltage drop, but that's uncommon. These days, linear power supplies like this one are used for low switching noise. If you worry about efficiency, get a switching power supply, that'll spare you the losses in the LM317...

C1 is important to reduce noise and upon adding more capacitors the noise reduces.

C1 is the smoothing cap... it is charged by the rectifiers and supplies the regulator when the rectifiers do not conduct, which is most of the time, since the input is AC.

Is adding more capacitors before the voltage regulator good?

On 50Hz AC, rectifiers will charge C1 every 10 milliseconds, rectifiers stay on for a couple milliseconds then C1 supplies load current. There should be enough capacitance so the voltage does not drop below what U1 requires to keep the output voltage in regulation at the maximum design current, plus a bit of margin.

Is adding a polarised capacitor better?

Weird question. The simulator doesn't know about polarized caps, but in real life, sure...

C2 is there just for the voltage drop, otherwise it would be zero.

Huh?

C2 is the output cap after the regulator. It handles the higher frequency AC part of load current. Depending on which regulator you use it may be required for stability, with conditions on capacitance and ESR (read the datasheet).

However changing C2 to a resistor say, the input signal to the voltage regulator has a lot more fluctuations.

Sure, if you put a load on the regulator it's going to draw current, so voltage ripple on C1 will increase. This is normal, as I said above C1 should have enough capacitance so the voltage on it does not drop below what U1 requires.

The input voltage into regulator is ~19V and output is 12.5V with fluctuations in the 10^-5. I do not understand how there is 6.5 voltage drop and regardless of the input voltage into the regulator the voltage is 12.5V.

It's a regulator... it regulates the output voltage... check LM317 datasheet, it explains how to pick R3 and R4 to get the output voltage you want.

I guess the most important question here is, is this a good power supply circuit?

Sure it'll work.

Unless your load is very sensitive to switching noise, a wall wart switching supply will be cheaper and more efficient though.

• Thank you for answering. It seems my understanding of this is a lot less than I expected. Thank you again for the clarifying it all. – Benstead Oct 28 at 16:42
• I should have explained the resistor part of the regulator a bit better however. Although R3 and R4 determines the output voltage, there are a lot more fluctuations in the output voltage if I alter these values. Considering I'm using a voltage regulator to maintain a constant voltage, it seems a bit useless if the signal is still fluctuating a lot. How could I solve this? – Benstead Oct 28 at 16:49
• Check the input voltage to the regulator is high enough. It needs a few volts dropout (ie, margin) between input and output. See datasheet for exact value. – peufeu Oct 29 at 0:51

Considering that this is a UK mains power supply what transformer resistances are usual?

The model above works for a simple transformer. The other thing AC mains transformer do is have saturation and coil resistance.

AC mains transformers saturate for safety reasons, this is difficult to model in spice as one needs to model the saturation, and it can be difficult to determine parameters from datasheets and translate them to the model. If I were doing this myself, I would probably neglect the saturation, but ensure that the transformer did not saturate when pulling a max load. Eg, a 10W load needs at least a 10W transformer, with some margin.

The coil resistance is low hanging fruit, once a transformer is selected, the coil resistance can be added to the model and the loss approximated. Most of the time the mutual coupling factor is not 1, something like 0.95 might be better (fringe fields cause loss OR transformers don't send all of their power to the secondary, the indcutors can self copule).

However, to simulate such a thing in ltpsice is this the correct way of doing so?

Use simulations to augment your understanding, but not replace it. Make sure you understand all aspects of the design before building the circuit and know the level of approximation. No model can fully replicate what is happening in the physical world. If you needed to know all currents to within 10's or 100's of mA I think the model above would be acceptable. If you needed to know currents to 1uA, then you'd need a much more detailed model.

Also, the inductance coefficient is 1, what is a more reasonable value?

0.95 or 5% leakage is more reasonable for a low side number, if you really need to pin it down, buy the transformer that your interested in and measure the leakage inductance

Is adding more capacitors before the voltage regulator good?

Simulate the model with the max load, if you see ripple on the output, then more capacitance is needed because there is not enough energy storage to source current through the dips of the AC cycle.

Is adding a polarised capacitor better?

They are cheaper, and electrolytic's come in bigger sizes than ceramics.

• Thank you for answering the questions. This really helped in me understanding it. – Benstead Oct 28 at 16:43
• Fringe fields don’t necessarily mean that power is somehow lost. Fringe fields are caused by leakage inductance and that inductive power loss is zero. Transformer regulation issues are caused by non 100% coupling. – Andy aka Oct 28 at 17:43