Embedded Systems and Power Electronics

Total Pageviews

About Me

My photo
I am currently a PhD student at UC Berkeley, following a 6-year journey working at Apple after my undergrad years at Cornell University. I am a 2025 Paul & Daisy Soros fellow. I grew up in Dhaka, Bangladesh where my interest in electronics was cultivated, resulting in the creation of this blog.

BTemplates.com

Powered by Blogger.

Showing posts with label power supply. Show all posts
Showing posts with label power supply. Show all posts

May 1, 2025

Using a PV panel indoors by biasing with an external power supply


My introduction to working with solar panels goes back a long time. In fact, in 2012, I posted this article when I was working on some charge controllers and inverters. One consistent challenge when doing such work is always having a consistent reliable PV panel outdoors in bright (ideally not-too-hot) sunlight. This becomes difficult with varying weather conditions and limits development.

Recently I learned about how you can very easily use an external power supply (capable of operating in constant current mode) to use the PV panel indoors and emulate its outdoor behavior! This ends up being great for testing charge controllers and MPPT algorithms!

Fig. 1 - Setup for characterizing PV panel behavior indoors
Panel: SLP010-12U
Power supply: Rigol DP832
Eload: Rigol DL3031

Fig. 1 shows the test setup used for obtaining PV panel IV curves indoors. The only equipment required for emulating the PV panel itself is the power supply. The electronic load is used to vary the voltage imposed on the panel to obtain the IV curve. You can even see the panel facing down so that light is not incident onto it!

Fig. 2 - Simple PV panel model

We can start by recognizing that a PV panel may be simply modeled as shown in Fig. 2. Iph represents the photocurrent generated by the panel under sunlight. When the panel is indoors, Iph is a miniscule value under typical indoor lighting conditions. What we can do is, instead, use an external power supply to bias the panel with a constant current source. This is represented by Iext in Fig. 3. 

Fig. 3 - External power supply used to emulate photocurrent in PV panel

This is as simple as configuring the power supply's voltage at (or higher than) the panel's open-circuit voltage (Voc), and setting the current limit at the panel's short-circuit current (Isc). For the panel I picked, these correspond to 21.6V and 0.68A (at 100% luminosity).

The short-circuit current limit for the PSU can be varied to provide Iext emulating varying luminosities! For example, using 50% of the panel's short-circuit current, a condition of approximately 50% luminosity may be emulated!

This may be taken even further by adding a series voltage source to emulate voltage shifts in the IV curve.

Tests with 10W panel:

To generate the IV curves in a repeatable fashion, I wrote a Python script that imposes different panel voltages by issuing the corresponding SCPI commands to the electronic load. The curve is then plotted in real-time, as shown in Vid. 1 below. The GUI was built by modifying the one from a previous blog post: SmartSinePy, and an example of GUI development with PySide6 ~ Tahmid's blog

Vid. 1 - Characterizing panel IV curve at 100% emulated luminosity

To illustrate the operation at 50% emulated luminosity, the power supply current is set to 0.34A instead of 0.68A. The corresponding curve is generated as shown in Vid. 2.

Vid. 2 - Characterizing panel IV curve at 50% emulated luminosity

These obtained curves are also shown below in Fig. 4 and Fig. 5.
Fig. 4 - Obtained IV curve at 100% emulated luminosity

Fig. 5 - Obtained IV curves at 100% (top, same as Fig. 4) and 50% (bottom) emulated luminosities

Fig. 6 - IV curves provided in the panel datasheet

Fig. 6 shows the IV curves of the panel from its datasheet, showing close agreement between the curves obtained indoors with the 25°C curve! Slight tweaking of the open-circuit voltage and short-circuit current to match the 25°C curve can give slightly better match!

More significantly, this now allows testing with the PV panel indoors without worrying about weather conditions! Of course, all final tests for any charge controller or MPPT algorithm should be run outdoors with the panel under varying weather conditions, but this emulation method can significantly improve development time. I will soon share a demonstration of an MPPT controller developed using this setup!

Characterization of a 100W panel:

The same technique can be used for different panels and power levels. Fig. 6 shows one such IV curve obtained using the techniques outlined here but with a more capable power supply and electronic load. The power supply was set to 24.3V (panel open-circuit voltage) and 5.21A (panel short-circuit current at 100% luminosity).
Fig. 6 - Obtained IV curve for a 100W panel

This simple technique can significantly improve development and testing times for projects using PV panels! For more details about this emulation technique and further enhancements, refer to the following papers which provide much greater detail:

1. S. Qin, K. A. Kim and R. C. N. Pilawa-Podgurski, "Laboratory emulation of a photovoltaic module for controllable insolation and realistic dynamic performance," 2013 IEEE Power and Energy Conference at Illinois (PECI), Urbana, IL, USA, 2013, pp. 23-29, doi: 10.1109/PECI.2013.6506029.
https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=6506029

2. T. -L. Huang, F. S. Bagci and K. A. Kim, "Indoor Panel-Based Photovoltaic Emulation Method Implementation and Evaluation," 2024 IEEE Workshop on Control and Modeling for Power Electronics (COMPEL), Lahore, Pakistan, 2024, pp. 1-7, doi: 10.1109/COMPEL57542.2024.10613957.
https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=10613957

Dec 31, 2024

Insights from repairing a 30V 5A power supply (BPS-305)


When I started working on a project (hopefully more on that soon), I reached out for an old 30V 5A power supply (Lavolta BPS-305). I rotated the voltage dial to try to get to 24V and observed that the voltage would not go past 15V, even though it is rated for 30V. Even though this supply was a few years old, I had not personally used it before. So, it wasn't clear whether it was a previously-functioning supply that stopped working, or whether it was always broken.

Fig. 1 - Lavolta BPS-305 power supply

Upon some more poking and prodding, I identified that the power supply had several issues:

  1. Output voltage only goes up to about 15V instead of 30V max.
  2. Output voltage is not stable and fluctuates at steady state, appearing unregulated. See video below.
  3. Output voltage flickers when relays switch around ~7V and ~14V and the relays keep flickering unless the voltage is moved far away from the transition points.
  4. Output current measurement (when HI/LO button is pressed down to LO) is off by a factor of 2.
  5. Output current measurement (when HI/LO button is pressed up to HI) displays zero.
Output voltage unstable at "steady state" - moving between 10.2V to 11.1V with a fixed output load

Hopeful that I can repair the supply, I opened it up. Noticing a relatively simple one-layer PCB, I set out to find a schematic or other reference for the supply. This is where I realized that many many (low-cost) 30V 5A power supplies are based on the same couple designs. I'll link to a few useful resources here that I came across during my search:

Instead of going through all my investigations, I'll highlight a few standouts here.

Broken potentiometers

After lots of investigating, the key offenders were 2 broken potentiometers. Referring to the file PS305D Schematic Main in the Drive link, these are VR104 and VR102. These are shown below in Fig. 2.
Fig. 2 - The culprits. VR104 is marked 502 (5kΩ) and VR102 is marked 501 (500Ω). Both parts measure open at component ends.

VR104 is used for output voltage feedback. Once this part was replaced with a functioning 5kΩ pot, the output voltage was now stable and would go all the way up to 30V. The pot is trimmed until the max output voltage is 30V.

VR102 sets the max output current when the HI/LO button is released (HI -> 5A current limit). There was no current limit being set in this setting with the faulty part. Since I did not have a 500Ω pot on hand, I replaced VR102 with a 5kΩ pot in parallel with a 470Ω resistor. This allows tuning the resistance as shown in Fig. 3. Fig. 4 shows the parallel 470Ω resistor soldered on the back side of the board. Once these parts were provisioned, the 5kΩ pot was trimmed until the max output current was set to 5A. The red dot in Fig. 3 indicates the final trimmed resistance.

Fig. 3 - combined resistance of 5kΩ pot in parallel with 470Ω resistance as the pot is trimmed.

Fig. 4 - soldered 470Ω resistor in parallel with VR102

FIg. 5 - the two blue potentiometers replace the broken ones in Fig. 2

Tuning the current display

Fig. 6 - Output current reading 6.89A when the real measured value is 5A
Fig. 7 - DMM on the PSU; the trim pots are the blue components near each chip. Left display is for current and the corresponding trimpot is VR211. Right display is for voltage and the corresponding trimpot is VR201.

When the HI/LO button is pushed down to the LO position, the PSU's output current limit is set to 2.5A tuned by VR101. When the HI/LO button is at the HI position, the output limit is set by VR102 (and the parallel 470Ω resistor) as described previously. However, there was a fair bit of error on this reading, as shown in Fig. 6. By adjusting VR305 (see PS305D Schematic Controls in the Drive link) in conjunction with the reference voltage set by the blue trimpot VR211 (see PS305D Schematic Display in the Drive link) in Fig. 7, the output current can be tuned. Since VR211 affects the reference voltage for the current meter, adjusting it affects both the HI and LO current readings. The procedure then was to set the switch to HI and then tune VR211; once that is corrected, switch to LO and then tune VR305.

Relay-selectable transformer secondary winding

Fig. 8 - secondary selection scheme with relay

Because the regulation stage in the power supply is based on a linear regulator, the difference between the input and output power is dissipated as heat. Since the power supply has a large selectable output range, this would result in very high power dissipation in the regulator at lower input voltages. To overcome this drawback and reduce the power dissipation, the power supply utilizes a selector circuit on the secondary as shown in Fig. 8.

As an example, let's consider that the output power is desired to be 3.3V. Suppose the input voltage post-rectifier is 40V (which is the case between S3-S0 for the BPS-305). At an output current of 3A, the power dissipated in the regulator would be roughly: Pout-Pin = Vout*Iout - Vin*Iin ~ (Vout-Vin)*Iout = 110.1W.  All this for only 13.2W of output power. At lower output voltages and higher output currents, this gets even worse!

By using the scheme shown in Fig. 8, the voltage at the input of the regulator is selected based on the desired output voltage to reduce power dissipation. With the example above, now suppose that for 3.3V, the input to the regulator is 14.8V, the power dissipation is reduced to 34.5W now! That's 75W less than the previous example!

For my unit, the voltage bins transitions happen for output voltages 8V, 15V, 21V and 30V. This is a good design decision rather than having a fixed 40V input for the regulator.

Output testing

For testing the output, different resistor combinations were used as the load. In addition, a constant current circuit was used even as the output voltage is varied. A simple circuit can be designed using the jellybean LM317 part. The datasheet shows an example circuit in Section 9.3.3 (Precision Current-Limiter Circuit).
Fig. 9 - constant current circuit using LM317

The output (ADJUST pin) is tied to GND for testing. Using R1 = 4.7Ω provides a ~250mA constant current load. Similarly, R1 is swapped out for lower values for higher currents. It is important to have a heatsink mounted on the LM317, especially at higher voltages. This constant current value was also used to validate the output current display across PSU output voltages.

Other observations

  1. The logic GND for the electronics are shorted to the positive output instead of the negative output. Even though the circuits in the PSU closely reflect those of PS305D Schematic Main/Display/Controls, this grounding scheme is reflected in hy_3005_dc_power_supply.
  2. Many of these 30V 5A power supplies seem to be based on a couple base designs with slight tweaks in implementation.
  3. The build quality appears shoddy. Many components were haphazardly soldered - many caps weren't fully seated. The fan wires run adjacent to (and touch) the (potentially very hot) heatsink for the transistors. However, none of these appear to impact functionality, at least in the short term.

Feb 22, 2013

Ferrite Transformer Turns Calculation for Offline SMPS Half-Bridge Converter



On different forums, I often find people asking for help in calculating the required turns for a ferrite transformer they are going to use in offline SMPS half-bridge converters. The half-bridge topology is very popular for offline converters in the power range 100W to 500W, sometimes going up to even 1000W. In an offline SMPS half-bridge converter, the line voltage is rectified and filtered and is then converted to high frequency with 2 MOSFETs – one in high-side configuration and the other in low-side configuration. This high frequency high voltage AC is fed to the ferrite transformer to step down the voltage to low voltage high frequency AC which is then rectified to DC and filtered to provide clean DC output. A vital thing to remember is that in a half-bridge converter, the 2 MOSFETs work along with 2 capacitors to create the high voltage high frequency AC. The configuration of the capacitors, MOSFETs and transformer causes the transformer to be supplied half the voltage of the rectified DC. This means that, compared to a full-bridge converter, half the number of turns is required for the primary, but the power output would be half. Thus power/energy density is halved.

Now let’s move on to the calculation. Calculation of required turns is actually quite simple and I’ll explain this here.

For explanation, I’ll use an example and go through the calculation process.
Let’s say the ferrite transformer will be used in a 250W converter that will be used to charge a 12V lead acid battery. The selected topology is obviously half-bridge. The power source for the converter is the AC mains. Here I’ll take that to be 220V RMS, 311V peak, 50Hz. So, you must remember that the mains AC should be rectified to DC first. Output voltage of the DC-DC converter stage will be 14V. Switching frequency is 50kHz. The selected core is ETD44. Remember that the output of the transformer will be high frequency AC (50kHz square wave in this case). When I refer to an output of low voltage DC (eg 14VDC mentioned above), this is the DC output obtained after rectification (using schottky, preferably, or ultrafast recovery diodes configured as full-wave rectifier) and filtration (using LC filter). Since I plan to use full-wave rectification (with 2 diodes) at the output, the secondary of the ferrite transformer will be center tapped.

We must take a maximum and minimum input voltage rating for the converter. For our example, these will be a low line voltage of 150V and a high line voltage of 250V. During operation, the output voltage will stay fixed as the converter is expected to have feedback circuitry. 

Vinmin = 150VAC = (150* √2)VDC = 212VDC

Vinmax = 250VAC = (250* √2)VDC = 354VDC

Vinnom = 220VAC = (220* √2)VDC = 311VDC

The formula for calculating the number of required primary turns for a forward-mode converter is:


For our half-bridge transformer, this will be twice the required number of turns, that is, the actual number of primary turns will be half that calculated from the above formula if we use the full voltage, or exactly what is calculated if half the voltage is used. This is because the voltage across the transformer is half the line voltage, as previously mentioned.

So, the actual formula would be:
 


Npri means number of primary turns; Nsec means number of secondary turns; Naux means number of auxiliary turns and so on. But just N (with no subscript) refers to turns ratio.


For calculating the required number of primary turns using the formula, the parameters or variables that need to be considered are:



  • Vin(nom) – Nominal Input Voltage. We’ll take this as 311V. So, Vin(nom) = 311.
  • f – The operating switching frequency in Hertz. Since our switching frequency is 50kHz, f = 50000.
  • Bmax – Maximum flux density in Gauss. If you’re accustomed to using Tesla or milliTesla (T or mT) for flux density, just remember that 1T = 104 Gauss. Bmax really depends on the design and the transformer cores being used. In my designs, I usually take Bmax to be in the range 1300G to 2000G. This will be acceptable for most transformer cores. In this example, let’s start with 1500G. So Bmax = 1500. Remember that too high a Bmax will cause the transformer to saturate. Too low a Bmax will be under utilizing the core.
  • Ac – Effective Cross-Sectional Area in cm2. You will get this information from the datasheets of the ferrite cores. Ac is also sometimes referred to as Ae. For ETD44, the effective cross-sectional area given in the datasheet/specification sheet (I’m referring to TDK E141. You can download it from here: www.tdk.co.jp/tefe02/e141.pdf  ). The effective cross-sectional area (in the specification sheet, it’s referred to as Ae but as I’ve said, it’s the same thing as Ac) is given as 175mm2. That is equal to 1.75cm2. So, Ac = 1.75 for ETD44.
So now, we’ve obtained the values of all required parameters for calculation of Npri – the number of required primary turns.



Vin(nom) = 311                                        f = 50000                              Bmax = 1500                          Ac = 1.75

Plugging these values into the formula:





                                    Npri = 29.6

We won’t be using fractional windings, so we’ll round off Npri to the nearest whole number, in this case, rounded up to 30 turns. Now, before we finalize this and select Npri = 30, we better make sure that Bmax is still within acceptable bounds (it will be since this is such a minor percentage change, but I’ll show this anyways so that you know what to do, just in case). As we’ve increased the number of turns from the calculated figure (up to 30 from 29.6), Bmax will decrease very slightly. We’ll now figure out just how much Bmax has decreased.

 



                                        Bmax = 1481 



The new value of Bmax is well within acceptable bounds and so we can proceed with Npri  = 30.
 

So, we now know that for the primary, our transformer will require 30 turns.

In any design, if you need to adjust the values, you can easily do so. But always remember to check that Bmax is acceptable. 

  • I’ve started off with a set Bmax and gone on to calculate Npri from there. You can also assign a value of Npri and then check if Bmax is okay. If not, you can then increase or decrease Npri as required and then check if Bmax is okay, and repeat this process until you get a satisfactory result. For example, you may have set Npri = 20 and calculated Bmax and decided that this was too high. So, you set Npri = 30 and calculated Bmax and decided it was okay. Or you may have started with Npri = 40 and calculated Bmax and decided that it was too low. So, you set Npri = 30 and calculated Bmax and decided it was okay.
Now it’s time to move on to the secondary. The output of our DC-DC converter is 14V. Keep in mind that there will be a voltage drop due to the output rectifiers. So, the transformer output must be [14 + (Total Voltage Drop Due to Diodes)]V at all input voltages, from all the way up from 354VDC (254VAC) to all the way down to 212VDC (150VAC). To keep the voltage drop due to the diodes a minimum, use schottky didoes.

Naturally, feedback will be implemented to keep the output voltage fixed with line and load variations – changes due to mains voltage change and also due to load change. So, some headroom must be left for feedback to work. So, we’ll design the transformer with secondary rated at 16V. This headroom compensates for voltage drops due to output rectifier diodes. Feedback will just adjust the voltage required by changing the duty cycle of the PWM control signals. Besides that, the headroom also compensates for some of the other losses in the converter and thus compensates for the voltage drops at different stages – for example, in the MOSFETs, in the transformer itself, in the output inductor, etc.

This means that the output must be capable of supplying 14V with input voltage equal to 212VDC and also input voltage equal to 354VDC. For the PWM controller, we’ll take maximum duty cycle to be 98%. The gap allows for dead-time.


At minimum input voltage (when Vin = Vinmin), duty cycle will be maximum. Thus duty cycle will be 98% when Vin = 212VDC = Vinmin. At maximum duty cycle = 98%, average voltage to transformer = 0.98 * 0.5 * 212V = 103.88V.

So, voltage ratio (primary : secondary) = 103.88V : 16V = 6.493

Since voltage ratio (primary : secondary) = 6.493, turns ratio (primary : secondary) must also be 6.493 as turns ratio (primary : secondary) = voltage ratio (primary : secondary). Turns ratio is designated by N. So, in our case, N = 6.493 (I’ve taken N as the ratio primary line voltage : secondary).

Npri = 30
Nsec = Npri / N = 30 / 6.493 = 4.62

Round off to the nearest whole number. Nsec = 5

Now, notice how this rounding up is not an insignificant rounding up. So, let’s try to keep Nsec = 5 and adjust Npri again.

Npri = N * Nsec

Npri = 5 * 6.493 = 32.5 = 33 (rounded off to the nearest integer)

Now let’s check if Bmax is okay with Npri = 33, ie, if Bmax is within acceptable bounds.




  
                                    Bmax = 1346


Bmax = 1346 is okay. So, Npri = 33 and Nsec = 5. Thus 5 + 5 turns are required for the secondary. With proper implementation of feedback, a constant 12VDC output will be obtained throughout the entire input voltage range of 150VAC to 250VAC.

Of course, notice here that Bmax is very small and can be increased to reduce the required turns. So, let’s reduce Nsec from 5 to 4.

Nsec = 4

Npri = N * Nsec = 6.493 * 4 = 25.97 = 26 (rounded off to nearest integer)

Checking Bmax again:
  



                                   Bmax = 1709 

Here, one thing to note is that even though I took 98% as the maximum duty cycle, maximum duty cycle in practice will be smaller since our transformer was calculated to provide 16V output. In the circuit, the output will be 16V (transformer output will be 14V + Voltage drop of diode), so the duty cycle will be even lower. However, the advantage here is that you can be certain that the output will not drop below 12V even with heavy loads since a large enough headroom is provided for feedback to kick in and maintain the output voltage even at high loads and low line voltages.

If any auxiliary windings are required, the required turns can be easily calculated. Let me show with an example. Let’s say we need an auxiliary winding to provide 17.5V. I know that the output 14V will be regulated, whatever the input voltage may be, within the range initially specified (Vinmin to Vinmax – 150VAC to 250VAC). So, the turns ratio for the auxiliary winding can be calculated with respect to the secondary winding. Let’s call this turns ratio (auxiliary : secondary) NA.

NA = Naux / Nsec = (Vaux+Vd)/ (Vsec + Vdsec). Vdsec is the output diode forward drop (at the secondary). Vd is the output diode forward drop at the auxiliary. Let’s assume that in our application, schottky rectifiers with Vd = 0.5V is used.

So, NA = 18.0V/14.5V = 1.24 

Naux / Nsec = NA 

 Naux = Nsec * NA = 4 * 1.24 = 4.96

Let’s round off Naux to 5. Since the rounding up is very small (from 4.96 to 5), the output voltage will be pretty close to the desired voltage, but I'll just show you how to calculate what the output voltage is.



(Vaux + Vd) / (Vsec + Vdsec) = NA = Naux / Nsec = 5 / 4 = 1.25

(Vaux + Vd) = (Vsec + Vdsec) * NA = 14.5V * 1.25 = 18.13V

Vaux = 17.63V

That is great for an auxiliary supply. If in your designs, you ever find that Vaux is far too off the required voltage, a simple voltage regulator (using 78XX for example) should be used to provide the stable auxiliary voltage.

Another option is to recalculate Npri and Nsec to accommodate for a near accurate auxiliary voltage but you can just use a voltage regulator to simplify things. After all, the voltage regulator will keep the output voltage regulated stable.

So, there we have it. Our transformer has 26 turns for primary, 4 turns + 4 turns for secondary and 5 turns for auxiliary.

Here’s our transformer:




Here’s the transformer at work in a circuit (block diagram):






Calculating required number of turns for a transformer for an offline SMPS half-bridge converter is actually a simple task and I hope that I could help you understand how to do this. I hope this tutorial helps you in your ferrite transformer designs for offline SMPS half-bridge converters. Do let me know your comments and feedback.