Several problems with simulating bridge rectifier

Sure. One thing I’ll add is that it looks like you might be using the 330 and 1K to form a voltage divider to acheive a target voltage. If VOUT is going elsewhere to power a device, that device will load down the voltage at the output depending on how much current it draws. You can see this in simulation by putting a DC current source on the output with a value at the estimated average current draw of the device. If the loading down is undesirable, then you need something to “buffer” the output. Typically linear voltage regulators are used for this because they not only buffer but also reduce 120Hz ripple by using a feedback loop to keep the output constant. See @holger 's LM317 example here: Simulation examples for KiCad/Eeschema/ngspice

1 Like

Ok great, thanks! For now I’m just building the rectifier, but good to keep in mind if I decide to go further

1 Like

Progress update-- I added explicit resistor components for the transformer winding resistances (32 & 2 for primary & secondary) which resulted in the simulator saying the output V = 0. I took out the explicit resistors and defined them in the subcircuit instead, giving me the output below-- weird. Why would switching the resistors from being explicit to going in the subcircuit correct the simulation like that? Shouldn’t both get the same result?

They will give the same result…but only if connected properly. Your subcircuit netlist represents the following:
.

You created parallel resistors instead of series ones, so you’re shorting out the inductors and hence getting near zero output. If you want something which represents my previous schematic, you need to do something like this instead:

.SUBCKT XFORMER 1 2 3 4
L1 5 2 250u
L2 3 6 10u
K1 L1 L2 1
R1 1 5 32
R1 6 4 2
.ends

Note that because you have series components additional internal nodes are needed in between those components. I used 5 and 6 above, but to make it easier to read I’ll use different labels (doesn’t matter) and order the lines differently too (also doesn’t matter):

.SUBCKT XFORMER 1 2 3 4
R1 1 INT1 32
L1 INT1 2 250u
L2 3 INT2 10u
R2 INT2 4 2
K1 L1 L2 1
.ends

Hopefully it makes sense. Give that a shot and see what it gets you.

1 Like

There is another issue then:

The inductance of 250uH is far off from the real inductance of a 60Hz mains transformer. Resistor and coil represent a voltage divider (R and jwL). With low L there will be not enough “resistance” to create any reasonable voltage across the coil, thus 0 output.

Indeed it is difficult to find numbers in the web. It seems to me that, depending on size and power capability, the primary inductance is between 10H and 100H or so. The simulation will show, what results are achievable.

I will update my example as well

2 Likes

Ah, that makes sense. So when the resistor was 100mohm, the 250uH inductor impedance would swamp out the resistor. Now with 32ohm it swamps out the inductor. OK, so I guess adding the measured ESR without the measured inductance to match it was a poor idea. My bad. I suppose if one wants to make decent models of their inductive components they ought to invest in an LCR meter.

Ok makes sense – I tried one simulation with the resistors explicitly defined and one with them defined in the subcircuit following your instructions. Running with the resistors defined in the subcircuit results in a voltage output, but having them defined explicitly doesn’t. Is that what @holger is talking about?


Is there a way to measure or approximate the inductances of the transformer just using a multimeter?

I think that the I-V characteristic of a mains frequency transformer will generally be very non-linear. It is defined by the B-H loop. Therefore discussing it in terms of simple inductance is likely to be inaccurate, and it will be difficult to find such a specification.

Have a look at this waveform

image

or see

https://www.google.com/search?sxsrf=APq-WBspHbZGNB2l3tdEH_ep6wyJTUWYmw:1647146597049&source=univ&tbm=isch&q=transformer+magnetizing+current+waveforms&fir=IuNPlP09iPsZsM%2C9WZIMGOqtq9pUM%2C_%3BCPyoalV7xqgyRM%2CyfyQHq6g-owMzM%2C_%3B5h7bFYVsqWoQDM%2C9WZIMGOqtq9pUM%2C_%3B49vQNxn-BycsNM%2CeqozhziyQTkxpM%2C_%3BpzaCE_r4qUZ3mM%2CeqozhziyQTkxpM%2C_%3BdNqteTe84IoPlM%2CNcreJdeewVj8KM%2C_%3BweQUtmMwhccypM%2C7wEcsc-woK-drM%2C_%3BDFELbnojamkWdM%2C9WZIMGOqtq9pUM%2C_%3BO1Oe06wKf553FM%2CgPzXv0_S0mLL8M%2C_%3BwX_flI0f_PluDM%2CXPIBQeGYpMMZ6M%2C_&usg=AI4_-kTM8GD8Nj5ETzc2tgwx0Md-fgPs_g&sa=X&ved=2ahUKEwillr2eo8L2AhXUPn0KHewFCEIQjJkEegQICRAC&biw=2133&bih=1121&dpr=0.9#imgrc=dTRqJY3_Y0nwpM

BTW one could make the magnetizing current waveform much more linear by introducing a gap in the transformer core. But that would greatly increase the magnetizing current, would increase losses, and would generally gain no other benefits.

1 Like

No, that’s not what he’s talking about. It sounds like you have two separate issues being conflated. First is introducing the resistors into the subcircuit correctly. You haven’t shown that in your screenshot, so it’s possible you haven’t done it correctly. Second is that your measured values of 32ohm and 2ohm don’t mesh well with the very low values of inductance which you specified in the micro-henry range. High wire resistance will correlate with higher inductances, simply because a longer piece of wire (more resistance) results in more turns around the core (higher inductance). When you increased the primary resistance from 100milliohm to 32ohm, it completely overshadows the puny little 250uH as if it’s no longer there anymore.

Not that I know of. But I don’t think you need the exact values unless you want to calculate the actual K of the transformer. Holger’s suggestion is to increase the primary into the 10 to 100 Henry range. That puts you into the ballpark of an actual AC mains transformer’s typical primary inductance. So to keep your same turn ratio, you can do something like 25H in the primary and 1H in the secondary. You can also see his LM317 power supply example in this post as another reference:

1 Like

Is the inaccuracy caused by ignoring this a huge deal? I don’t really know much about electrical engineering and want to make as many simplifying assumptions as I can make, at least in this first attempt to build the rectifier.

It depends upon what you are analyzing. If you have a typical transformer that is heavily loaded, then this current waveform might be a small percentage of the total. But if the transformer core is being heavily driven (maybe it is designed for 220 VAC 60 Hz and it is being used with 250 VAC 50 Hz) and the output loading is light, then this current component is likely to be significant.

My guess is that there are some SPICE models which better account for this. But component modeling is not an area of my expertise.

EDIT: If the transformer is powered by the mains, and you are generally concerned with output characteristics, then IMHO it is not so likely to be an issue.

1 Like

Ok, sorry forgot to include that-- now it looks to be the same


1 Like

Also, this might not be the right place to ask this question, but basically my process from here is assembling the components onto a breadboard prototype and testing with a function generator. The function generator I have access to has voltage that’s way too low (I’d need the amplitude to be 170VAC) – do you have any recommendations for inexpensive function generators that would do the job?

I doubt that there is such a thing. Understand that what you are doing is potentially dangerous if you do not know what you are doing. I have done a significant amount of work with AC mains voltage.

I think you want a variable autotransformer and an isolation transformer. But those two together would probably be a few hundred dollars.

1 Like

Ok, sounds good, thanks for the heads-up

I still don’t know what you are connecting after the 1Kohm resistor, but as your simulation stands right now you’re only drawing around 15mA RMS from the AC line. You might able to provide yourself some safety by getting one of these receptacles and install a fuse (I listed a few) which gives you enough headroom for your project but still cuts off quite low. Buy a handful extra in case you blow them.
https://www.digikey.com/en/products/detail/adam-tech/IEC-F-1/9830738
https://www.digikey.com/en/products/detail/nte-electronics-inc/74-5FG500MA/11653568
https://www.digikey.com/en/products/detail/nte-electronics-inc/74-5FG250MA/11651571
https://www.digikey.com/en/products/detail/nte-electronics-inc/74-5FG100MA/11651228

1 Like

How to calculate the transformer boost ratio and coil setting, why I set the inductance according to the square root ratio, does not get the corresponding boost ratio or step-down ratio?

Ok thanks-- yeah the circuit is ending at the 1k resistor

Probably need to see your complete simulation circuit definition. There are a few possibilities.