Electronic – Transformerless power supply


I'm looking for building a power supply circuit that will convert 230VAC to 5VDC in order to power up an Atmega328P. I also want this to be as small as possible.

I know a transformer is one option but since I want to shrink it I was concerned about using a 5.1V zener diode.

Here is a schematic I found:
5V trasformerless power supply

But how much heat will the the capacitor/diode produce? Is it more efficient to use a transformer instead?

Best Answer

If you're here asking about the basics of a line-connected power supply for running some hobby project, then you shouldn't be trying to do this at all. This is NOT where you want to learn by experimenting. The cost of mistakes are too high. The results can burn down your house or electrocute you, or someone else.

If you need a little current at 5 V to run a microcontroller from, just buy the power supply, or use a USB power adapter. These things are cheap, small, and easily available. Someone else who actually knows what they are doing has done the engineering to provide the 5 V safely.

The Meanwell IRM-01-5 is just one of many examples. This one mounts on your PCB like any other part, only has a footprint of 1.3 x .9 inches (34 x 22 mm), puts out 200 mA at 5 V, works with line power anywhere in the world, and costs under $5 in singles. Doing this yourself just doesn't make sense.