I want to design a 5v 1A SMPS power supply from a 220v mains supply. I dont have much idea of the circuit and how it works. I once opened a small unit and saw that AC mains was rectified and and through a 20 ohm resistor fed to a small SMPS transformer and through an optocoupler the output was given. can anyone help me in building one?
not quite like that... the rectified mains voltage ~ 300VDC give or take a bit is then
through one of the primary windings of the transformer and through a hi freq switching transistor (what they often call a chopper transistor) oscillating/switching ~ 1 to 3KHz region. That higher freq means the transformer can be much smaller than a normal linear PSU where the mains AC voltage is at 50 or 60 Hz (depending on your country).
the output off the secondary winding/s goes through fast recovery diodes smoothed,regulated and sent to output cable.
NOTE the opto-coupler is usually between the secondary and primary sides... it provides feedback to the HV switching side.
still a relatively basic description,but fills in a few more gaps for you.
It is probably cheaper and
DEFINATELY SAFER to spend $20 on a 5V SMPS plugpack from your local electronics store than buying the parts and trying to build one
Unless you have worked with high voltage and very familiar with such ccts, I wouldnt recommend you playing with such PSU's
cheers
Dave