Built-in project · no microcontroller

Mains to 17 V DC

A 230 V to 12-0-12 V mains transformer, two 1N4007s as a full-wave rectifier and 1000 uF of smoothing: a scope shows the ripple and a meter the DC into a 100 ohm load. There is no microcontroller in it: the simulator solves the 8 parts as a circuit, so it runs the moment you press Run, and nothing needs compiling.

Teaching? Assign it to your class in one click.

Intermediate About 30 minutes to build and run. Runs in your browser. Free, and no account needed.

The parts retail for about $11.25. On Mokxi they're free.

The circuit runs here once the page has loaded.

What you'll learn

  • How a transformer steps mains down
  • A full-wave rectifier built from two diodes and a center tap
  • How a smoothing capacitor turns pulses into DC
  • Ripple and how load and capacitor size change it
  • Difficulty: Intermediate
  • Time: About 30 minutes
  • Parts: 6

How it works

The signal generator stands in for the wall socket: a 50 Hz sine wave of 325 V peak, which is 230 V rms. It drives a 12-0-12 V transformer. The center tap CT of the secondary is the circuit's ground.

The two ends of the secondary swing in opposite directions around CT. Each diode passes the half cycle when its end is positive, so the 1000 uF capacitor is topped up twice a cycle, every 10 ms.

The capacitor charges to about 17.2 V. The 100 ohm load drains it between peaks, so the scope shows a sawtooth with about 1.2 V of ripple. The meter reads about 16.5 V.

Parts list

6 parts, plus the jumper wires and 3 bench instruments. The parts retail for about $11.25; on Mokxi they're free, and so are the instruments.

Wiring table

Every connection, pin by pin, read from the circuit itself. Each row joins the pin on the left to the pin on the right, by a jumper wire or a breadboard strip.

Part and pinConnects to
Mains transformer, 230 V or 120 V to 12 V pin P1Signal generator pin OUT
Signal generator pin GNDGround
Mains transformer, 230 V or 120 V to 12 V pin P2Ground
Diode (1) pin AMains transformer, 230 V or 120 V to 12 V pin S1
Oscilloscope pin CH1Mains transformer, 230 V or 120 V to 12 V pin S1
Mains transformer, 230 V or 120 V to 12 V pin CTGround
Capacitor, 1000 µF pin 2Ground
Resistor, 100 Ω pin 2Ground
Oscilloscope pin GNDGround
Multimeter pin COMGround
Diode (2) pin AMains transformer, 230 V or 120 V to 12 V pin S2
Diode (2) pin CDiode (1) pin C
Capacitor, 1000 µF pin 1Diode (1) pin C
Resistor, 100 Ω pin 1Diode (1) pin C
Oscilloscope pin CH2Diode (1) pin C
Multimeter pin VDiode (1) pin C

The notes that come with it

There is no microcontroller in this one, so nothing is compiled: the simulator solves the circuit itself. The file in the editor is the notes that come with it.

sketch.ino
// A linear power supply: mains to smooth DC with a transformer, two diodes
// and a capacitor.
//
// There is no microcontroller here. Press Run and the simulator solves the
// circuit.
//
// WHAT IT IS. The generator stands in for the wall socket: a 50 Hz sine of
// 325 V peak, which is 230 V rms. It drives the primary (P1, P2) of a
// 12-0-12 V mains transformer. The secondary has three leads: S1 and S2 are
// its two ends and CT, the center tap, is the circuit's ground.
//
// THE RECTIFIER. S1 and S2 swing in opposite directions around CT. Each
// diode passes the half cycle when its end is positive, so the capacitor is
// topped up twice a cycle, every 10 ms: a full-wave rectifier with two diodes
// instead of a bridge's four.
//
// THE NUMBERS. Each half of the secondary is a little over 12 V rms at this
// light load, about 18 V at its peak. Less one diode's drop, the capacitor
// charges to about 17.2 V. Between peaks the 100 ohm load drains it, so the
// scope's blue trace (CH2) is a sawtooth with a ripple of about 1.2 V, and
// the meter's DC reading sits between the two, about 16.5 V.
//
// THINGS TO TRY. Make the capacitor 100 uF: the ripple grows ten times. Make
// the load 1 k: the ripple almost disappears. Take out one diode: half-wave,
// topped up once every 20 ms, and twice the ripple.
//
// ON THE BENCH. The primary side is mains: never build this side on a
// breadboard. Buy the transformer in a plug-in adapter, or have the mains
// side wired and insulated by someone qualified.

Troubleshooting

The usual mistakes with this circuit, and the fix for each.

  • The ripple is much larger than expected This project
    Check the capacitor is 1000 uF and both diodes are in. With one diode removed it is half-wave and the ripple doubles.
  • The output is near zero This project
    Check the center tap CT goes to ground, and the diode cathodes join the capacitor and load.
  • You want to build the mains side for real This project
    Never build it on a breadboard. Use a plug-in adapter transformer, or have the mains side wired and insulated by someone qualified.
  • The circuit under test shows clipped or distorted signals. Signal generator
    A sine swinging below zero can exceed what an input allows. Add a DC offset or bias so the signal stays inside the supply range of the part.
  • Measurements are off or noisy. Signal generator
    Join the generator's ground to the circuit ground. Keep amplitude and frequency within what the connected parts can handle.
  • Wiring the primary side is dangerous. Mains transformer
    The mains side can kill. Only a qualified person should wire it, with a fuse, an enclosure and no exposed contacts. For learning, use a low voltage AC supply or a sealed plug in transformer.
  • The output voltage is not what you expected. Mains transformer
    A 12 V rating is RMS at full load. With no load the output is higher, and a rectifier and capacitor give about 1.4 times the AC voltage, near 17 V. Check it against the ratings of your parts.
  • The diode is in backwards, so nothing flows, or a flyback diode conducts all the time. Current flows from the anode to the cathode, the end with the stripe. Diode
    Put the striped end toward the more positive side for a series diode. For flyback across a coil, the stripe goes to the positive supply side of the coil.

Change it and keep it

Open it in the editor, change the circuit or the code, and keep your version in a free account.