Part

Mains transformer, 230 V or 120 V to 12 V

Two windings on one iron core: mains AC in, low-voltage AC out, with nothing joining the two sides. Rectify it for DC.

See every part
  • 5 pins
  • 1 setting
  • In 1 project
Drawn live by the editor's own code, at the size you see it.
At a glance

The Mains transformer, 230 V or 120 V to 12 V in brief

What it is, and every setting the properties panel gives it.

A mains transformer is two coils on one iron core. Alternating current in the primary makes a changing field in the iron, and that field makes a voltage in the secondary in proportion to its turns, so fewer turns give a lower voltage and more current. The only link between the two sides is the field, which is why the secondary floats until the circuit gives it a ground. The Mokxi part has five pins: P1 and P2 for the primary, S1 and S2 for the ends of the secondary, and CT for its center tap. Seven models are rated like the ones sold, from 230 V to 12 V at 1 A to 120 V to 24 V at 1 A. It reproduces the turns ratio, the isolation, the regulation (a 12 V 1 A model reads about 13.2 V with nothing on it) and the primary’s magnetizing current of about a tenth of the rating at no load. A steady DC voltage passes nothing. Saturation, core loss, heating and the switch-on inrush are not modeled.

Family
Power and wiring
Pins
5
model
230V to 12V 1A (or 230V to 12-0-12V 1A, 230V to 9V 1A, 230V to 6V 500mA, 120V to 12V 1A, 120V to 12-0-12V 1A, 120V to 24V 1A)
Pins

5 pins

Named as the editor names them, so a wire lands where you expect it.

Pin
What it does
P1
Primary, one end. Mains live goes here, through a fuse on a real build.
P2
Primary, the other end. Mains neutral.
S1
Secondary, one end.
CT
The middle of the secondary, the center tap.
S2
Secondary, the other end.
How to use it

How to use a mains transformer in a power supply circuit

There is no wall socket in a simulator, so the project uses the signal generator as one: a 50 Hz sine of 325 V peak, which is 230 V rms, wired to the primary on P1 and P2. For 120 V mains use 170 V peak at 60 Hz and a 120 V model. The secondary’s ends S1 and S2 swing in opposite directions around CT, and CT is the circuit’s ground.

Each of two 1N4007 diodes passes the half cycle in which its end of the secondary is positive, so a 1000 uF capacitor is topped up every 10 ms, a full-wave rectifier with two diodes instead of four. Each half of the secondary is a little over 12 V rms at this light load, about 18 V at the peak, and less one diode drop the capacitor charges to about 17.2 V.

A scope shows the blue trace as a sawtooth with about 1.2 V of ripple, and the multimeter sits in between at about 16.5 V into 100 ohms. Try 100 uF and the ripple grows ten times; try a 1 k load and it almost vanishes; take out one diode and it is half-wave, topped up only every 20 ms. On a real bench, never build the primary side on a breadboard.

Part pin
Board pin
P1
The generator’s OUT (mains live, through a fuse on a real build)
P2
The generator’s GND (mains neutral)
S1
The first diode’s anode and scope channel 1
S2
The second diode’s anode
CT
Ground, the circuit’s 0 V
Diodes’ cathodes
The capacitor and the 100 ohm load, then the scope’s channel 2 and the meter

The low-voltage side can feed a regulator and a board. Only build that side by hand, on a plug-in adapter or a transformer wired and insulated by someone qualified.

Mains to 17 V DC with a 12-0-12 V transformerlive0.000 s 0.00x
Click to open it in the editor
This is the simulator itself, running here. Click anything to open it in the editor.
Common errors

Common Mains transformer, 230 V or 120 V to 12 V errors and fixes

What goes wrong
The fix
The secondary reads nothing when the primary is fed from a battery or a plain DC source.
A transformer passes only changes. DC on the primary drives current through the copper and nothing across the core. Use a generator set to a sine at the mains frequency, offset 0.
The secondary reads about 10 percent above the model’s rating.
Small transformers are sold by their voltage at full load, and the open-circuit voltage is higher. A 12 V 1 A model reads about 13.2 V unloaded and 12 V at 1 A.
The two halves of a 12-0-12 V secondary give 12 V from end to end.
S1 to CT and CT to S2 are 12 V each, so S1 to S2 is 24 V. Ground CT and use each end for one rectifier diode.
The rectified supply has far more ripple than expected.
The capacitor is too small for the load. Ripple scales with load current over capacitance, so ten times the capacitance is a tenth of the ripple, and a 1 k load nearly removes it.
Questions

Questions and answers

How do I simulate mains with a transformer?

Use a generator set to sine at the mains frequency with offset 0 and the amplitude at the peak: 325 V for 230 V rms, 170 V for 120 V rms. Wire its OUT to P1 and GND to P2.

What does the center tap do?

On a 12-0-12 V model it is the middle of the secondary. Tied to ground, it makes two 12 V halves of opposite sign, which two diodes turn into a full-wave rectifier. On single-secondary models you can leave it unconnected.

How much does the primary draw with nothing on the secondary?

About a tenth of the rated current, the magnetizing current. Real ones also get warm from core loss, which the model leaves out.

Is it safe to build this circuit on a real breadboard?

No. The primary is lethal mains. Simulate that side here and build only the low-voltage side, from a sealed plug-in adapter or a properly insulated transformer.

How it is modeled

What is true about the Mains transformer, 230 V or 120 V to 12 V, here

In its help article’s own words: what the simulation gets right, and where it stops.

Modeled

  • The turns ratio, and the isolation between the two sides.
  • Regulation: a small transformer is sold by its voltage at full load, and its open-circuit voltage is about 10% higher. So a 12 V 1 A model reads about 13.2 V with nothing on it and 12 V at 1 A.
  • The magnetizing current: the primary draws about a tenth of its rated current with no load at all.
  • DC passes nothing. A steady voltage on the primary only drives current through the copper, which on a real one blows a fuse or burns the winding.

From Mains transformer, in full.

Projects

See the Mains transformer, 230 V or 120 V to 12 V in a project

One built-in project uses it. It opens in the editor, already wired.

Wire up the Mains transformer, 230 V or 120 V to 12 V

Open the editor and push it into the breadboard. It is free, and it runs on your own machine.