1. Blog>
  2. 220V-AC to 12V-DC 18W Switching Power Supply

220V-AC to 12V-DC 18W Switching Power Supply

by: Nov 28,2022 16499 Views 9 Comments Posted in Technology

By Hesam Moshiri, Anson Bao

Flyback is the most common circuit topology to build galvanically isolated AC to DC or DC to DC converters. Flyback circuit is cheap and relatively easy to manufacture, therefore nowadays the majority of home or industrial appliances are powered using AC to DC Flyback converters. In general, a Flyback converter is suitable for low-power applications, mostly below 100W.

In this article/video, I designed a cheap AC-to-DC flyback converter using a DK124 IC that can deliver up to 18W continuously. I calculated the transformer to handle 12V at the output which can be easily modified to reach other output voltages as well. The DK124 chip does not need any auxiliary winding or even an external startup resistor. The 220V Mains input has been protected using a MOV, an NTC, and a Fuse. The PCB board is single-layer and all components are through-hole.

To design the schematic and PCB, I used Altium Designer 22. The fast component search engine (octopart) allowed me to quickly consider components’ information and also generate the BOM. To get high-quality fabricated boards, I sent the Gerber files to PCBWay. To test the power supply, I used Siglent an SDL1020X-E DC Load, an SDM3045X Multimeter, and an SDS1104X-E/SDS2102X Plus oscilloscope.


Input Voltage Range: 85 to 265V-AC

Output Power: 18W Continuous

Output Voltage: 12V-DC

Switching Frequency: 65KHz

Download the Gerber or order 10Pcs high-quality boards here

Order a fully assembled PCB board, without the transformer (FREE shipping).

Circuit Analysis

Figure 1 shows the schematic diagram of the 220V to 12V switching power supply. As it is clear, the heart of the circuit is IC1, DK124 [1]. I used Altium designer to draw the schematic. 

Figure 1

Schematic diagram of the switching power supply (Altium)

P1 is a terminal connector for 220V-AC. F1 is a 500mA fuse to protect the board, PCB tracks, and wiring against unpredicted malfunction or short-circuit. R2 is a 10D561 varistor [2] to provide high-voltage clamping and surge protection. C2 is a 100nF X2 capacitor to reduce the noise. T1 is a common-mode choke for high-frequency noise suppression and waveform distortion prevention. BR1 is a bridge rectifier and C3 reduces the ripple of the rectified voltage.

R3, C4, and D1 build a snubber circuit to suppress transient spikes of the transformer. The snubber protects the switching Mosfet and reduces the EMI as well (Mosfet was embedded inside the DK124). IC1 is the flyback controller chip. According to the Dk124 datasheet: “The DK124 IC is specially designed for off-line switch mode power supply, maximum power is 24W. Different from the PWM controller and external power-separated MOS combination design, the PWM controller, 700V power transistor, and high voltage starting circuit are integrated into his DK124 IC, to save external circuits, component use, and cost. Also, the size and weight of the product are reduced. It is especially suitable for price-sensitive flyback switch mode power supply.”

C10 and C11 capacitors are used to reduce the noise. OP1 is the PC817 [3] optocoupler to provide an isolated feedback path and balance the output voltage. D1 is a Schottky diode to rectify the voltage of the secondary winding of the transformer (T2). C5 and C6 are used to reduce the voltage ripple. L1, C7, and C8 build an LC filter to reduce the noise and ripple. D3 is a 3mm LED to indicate a proper output voltage and R5 limits the D3 current. D3 also plays a role of a small dummy load to help to stabilize the output. R9 potentiometer is used to adjust the output voltage and fix it on 12.0V. Reg1 is the TL431 [4] shunt regulator.

As it is clear, IC1 (DK124) does not need any external supply (an axillary transformer winding) or even a resistor for the startup phase. 

PCB Layout

Figure 2 shows the PCB layout of the switching power supply. It’s a single-layer PCB board. I used Altium designer to draw the PCB. Figure 3 shows the assembly drawings. As you see, I created two board cut-out areas (isolation gaps) to follow the IPC rules of high-voltage and creepage. 

Figure 2

PCB Layout of the 220V-AC to 12V-DC switching power supply (Altium)

Figure 3

Assembly drawings of the PCB board


The most influential component in a flyback power supply circuit is the transformer. As professionally you wind and build the transformer, you’ll get better results.

Core: Ferrite, EE-25-13-7

Primary Winding: 1.79mH (80 turns of a 0.25mm wire)

Gap: around 0.25mm (mathematically)

Secondary Winding: 8 turns of 2*0.67mm wires (two 0.67mm wires in parallel)

Bobbin: 5+5, EE25, Horizontal

Usually, EE cores come with no gap (a gap between the two middle legs of the core). Therefore, you have to grind the middle EE legs equally to build a gap, but making such a gap accurately and winding the transformer without any winding error is very difficult. 

The easy solution is to use an LCR meter! First, assemble the transformer (without any gap) and measure the inductance of the primary winding. Naturally, the inductance would be higher than 1.79mH. Therefore, you have to grind the middle leg of the EE ferrite and build a gap, then assemble the core and measure the inductance of the primary again. As a result, simply increase the gap and measure the inductance till it gets as close as possible to 1.79mH. A little tolerance from 1.79mH is fine and does not make any difference. Figure 4 shows the EE core and the gap. This is the simplest flyback transformer with one primary and one secondary winding, so you shouldn’t have any problem in this process.

Figure 4

The 25-13-7 EE core and the non-magnetic gap of the middle legs

Assembly and Test

Figure 5 shows the assembled PCB board. All components are through-hole and easy to assemble. You can also order the board assembled (without the transformer). 

Figure 5

Assembled PCB board of the 220V-AC to 12V-DC Switching power supply

Put the R9 potentiometer in the middle and place a 500mA fuse in the holder and connect the power supply board to 220V-AC. Adjust the R9 to read 12V at the output. Your board is ready!

To test the regulation of the power supply, I used a Siglent SDL1020X-E DC load. This power supply should be able to handle a maximum current of around 1.4A to 1.5A continuously, so I tested the output regulation by applying a 1.4A CC load, using the DC load. The drop was only around 50mV to 55mV. Figure 6 shows the test setup. I also used the Siglent SDM3045X to read the output voltage with no drop, although you can also read the voltage using the DC load independently, using two wires from the back.

Figure 6

Output regulation of the switching power supply (maximum load)

Figure 7 shows the power supply output noise under no load. Figure 8 shows the output noise of the power supply under the maximum load. For both experiments, the probe was set on X10, and bandwidth was limited to 20MHz. I believe a good fraction of the noise (Figure 7) is EMI and does not come from the output connector, that’s why switching power supplies are always embedded inside a metal enclosure, where it is necessary. Without such an enclosure, I was read around 50mvP-P (Figure 8).

Figure 7

Output noise of the switching power supply (no load, no EMI shield barrier)

Figure 8

Output noise of the switching power supply (maximum load, no EMI shield barrier)

To get other output voltages/currents, you have to modify the transformer winding and the value of R6, R8, R9, and optionally the snubber circuit.

Bill of Materials

Figure 9 shows the bill of materials for the project. The Octopart website is not just a fast search engine for electronic components, but it also provides a very nice tool to build any kind of BOM for free.

Figure 9

Bill of materials of the AC to DC switching power supply


[1]: DK124: https://grupoautcomp.com.br/wp-content/uploads/2016/11/Specification-IC-DK124.pdf

[2]: 10D561: https://octopart.com/mov-10d561k-bourns-19184788?r=sp

[3]: PC817: https://octopart.com/pc817x1j000f-sharp-39642331?r=sp

[4]: TL431: https://octopart.com/tl431aclpr-texas+instruments-521800?r=sp

Join us
Wanna be a dedicated PCBWay writer? We definately look forward to having you with us.
  • Comments(9)
You can only upload 1 files in total. Each file cannot exceed 2MB. Supports JPG, JPEG, GIF, PNG, BMP
0 / 10000
    Back to top