This is a very simple self oscillating switching power supply built only from easily available discrete components, no IC and optocoupler.
The switching power supply has only one transistor - power switch T1. Optocoupler is replaced by derived (indirect) stabilization.
Output voltage is not sensed directly, but is derived from the voltage across C2, which arises rectifying auxiliary winding II.
When C2 is charged to a sufficient voltage,
zener diode begins to conduct and limits current to the base of T1, thereby reducing the width of the pulses (PWM) and the voltage does not grow further.
Among the auxiliary winding II and a secondary winding III applies the transformation ratio. Both are rectified in the same (blocking) direction,
and thus applies the approximate correlation between the voltage at the output and at C2. This allows
approximate stabilization without optocoupler. Stabilization is less accurate because there is leakage inductance between windings, the resistance of windings and
changes in diodes voltage drops. Load regulation is therefore not so perfect. On the other hand, line regulation
(mains voltage frequency ripple and changes suppression) is in this type of supply
surprisingly very good.
The output voltage can be adjusted as needed. Just change the number of turns of the secondary winding (III). It has about 1.17 turns / V (rounded of course). The output voltage is reduced by the drop diode D1. For small voltages (About 6V or less) replace the fast diode D1 by Schottky diode rated 40V or more. When converting this type of supply to a different output voltage do NOT change zener diode value! Tr1 Is a small EE ferrite core transformer. Central pillar has a cross section of 4.5 x 4.5 mm and the air gap of 0.4 mm. The core can be obtained from the auxiliary transformer from ATX. This is a typical "small tall" transformer. Primary has 200 turns of a wire 0.12 mm diameter. First wind the half of the primary (I) (100 turns), then a thick layer of insulation, then secondary (III), then again a thick layer of insulation, then the auxiliary winding (II), then a thinner layer of insulation, and finally the second half of the primary (I) (again 100 turns in the same direction). Transistor T1 can be any of Ucb = 800V and Uce = 450V or more, for example KSC5027, 2SC3150, 2SC3457, 2SC2979, 2SC2866 (Can be salvaged from ATX or small SMPS) or BUT11AF (can be bought cheaply). The maximum output power is about 5W with T1 without heatsink, and with heatsink about 12W.