## Charging a high voltage capacitor

So, today we are going to charge a capacitor from a 12V power supply or battery to 600V. Since the most efficient way to charge it is with a current source, the converter topology will be a flyback. The flyback and not the boost, because otherwise you need a high voltage transistor, which is known to have much worse parameters (Rds, Qq, Ciss) than the low voltage one.

As you know, the transformer of a flyback converter is essentially a two winding choke, by magnetizing the core with the primary winding, we draw power from the secondary winding while the transistor is off.

Transformer, which is participating in the experiment has the EE25x10x6 core, PC40 material, contains 6 turns of 0.4 three-wire wire in the primary and 70 turns of 0.18 wire in the secondary. It is quite compact for me. With the gaps between the outer cores the inductance of the primary was 7.2uH at 1kHz. For example, a picture of the board of an electric shepherd with such a transformer:

The following was done to take the readings:

All this stuff is controlled by a PIC16F18326 MCU, which has on board all the necessary peripherals for measurements and sends data to a computer via UART.

The parameters we are interested in:

- Feedback through the voltage divider goes to the operational amplifier included in the voltage repeater circuit as a buffer;
- Comparator, which receives the signal from the current transformer located at the output of the secondary winding. In this way it is possible to control the moment when the energy from the core is completely transferred to the load;

A small digression: the core stores energy during the time when the transistor is open (we will call this time T-on) and releases it when the transistor is closed (we will call this time T-off). The core can store some energy during T-on time, and if it is not closed after a certain time, depending on inductance of the primary winding and mass-size parameters of the core, saturation will occur. The primary winding will cease to be an inductance and will become an ordinary conductor with an extremely low resistance, which will cause an instantaneous increase of current through the switch and will end with magic smoke. Therefore the T-on time, which depends in particular on the supply voltage, is strictly fixed, and in our case is 8us.

During the T-off time, the core has to give full energy to the load, which in the next period will allow the transistor to turn on again at zero current and voltage (soft mode), and this is a big plus. If you want to know more about flyback operation modes at DCM , CCM and ZVS and ZCS.

It should not be forgotten that a fully discharged capacitor has almost zero resistance, which gradually decreases as it is charged. It is this peculiarity that distinguishes it from a normal load consuming a fixed current and makes fixed frequency converters ineffective. Let’s see how the charge occurs.

Let’s imagine that the energy stored in the core during the T-on time is in our cup in the form of ordinary water, which we pour into the capacitor during the T-off time. It would look like this:

At the beginning of the charge, literally a few cups will quickly increase the level of charge (voltage), but the further, the more and more cups will be needed to increase the level, and most importantly, this will change the T-off time for which energy is transferred to the load!

The operation of the test circuit looks as follows:

The pictures were taken at different times and loads, the scale of the first one is not very good – but it will be enough for understanding.

The microcontroller sends a T-off pulse of 8us duration, then it measures the time for which the energy from the core is completely transferred to the load (the capacitor), then it measures the voltage on the capacitor and pauses for 200us. Then the cycle repeats. The results of the UART measurements are sent to the computer, where they were used to make charge graphs.

Here and below, in the diagrams showing the time during which energy is transferred, the first few cycles are omitted because they have values like ~160, 140, 100, 80us and because of this the visibility area will be less informative.

The first graph shows how the time required to transfer energy decreases with each period as the charge increases. The second shows an increase in voltage with each period passed. The word period in this case refers to the time T-on+T-off=208us.

Why is a fixed frequency converter inefficient? For example let’s say that the frequency in our inverter is 40kHz, in this case, at the very beginning of the charge about the first ~120 clock cycles the current protection will trip (if any) and the key will not work optimally. At 40kHz the period is 25us. Of these 8us the key is in open state (T-on) and 17 in closed state (T-off). After ~for example already on 600th cycle time of 17-8=9us will be useless pause, which will grow along with capacitor charge.

Let’s charge the 50uF capacitor to 600 volts (9 joules):

You can see that it took about 1900 cycles to reach 200V. But it took about 7100 to reach 400V. It took as many as 16500 cycles for the capacitor to reach 600 volts, which is the harsh reality. Now let’s see how during those 16500 clock cycles the power output time to the load is measured:

You can see that after the 3000th stroke this parameter has stabilized to about 4.125us. Let’s round it up to 5. So we have 8us (T-on) + 5us = 13us = 76.9kHz, which is the optimal frequency for 80% of the capacitor charging time!

My task was to charge an electric shepherd capacitor with a maximum pulse rate of 800ms and a maximum capacitance of 100uF of the capacitor used. For the solution we made a diagram of capacitor charging with the maximum capacity, slightly increased parameter T-off for safety and entered the obtained result as a small array into the MCU.

This solution allowed to meet the allotted time without any problems (with a reserve of several times), even it was necessary to do the algorithm, which on the contrary, would have stretched the charge time to the maximum possible (~700ms) to reduce the current load on the power supply.

The red line is 70 turns, the blue line is 140 turns. The voltage graph has not changed, but the time of transferring energy to the load has increased significantly. Now we have seen everything.

And yes, to anyone interested, approximate charge function: y=134.4088714*x^(-0.4021521). You can play with the numbers, of course. That’s all for now, thanks for your attention!