# An Optimizing Solar Charge Controller

Like most power generation systems, solar panels (or Photovoltaic Panels, or PV Panels) generate the most power when they are presented with an optimal load. Figure 1 shows the V-I curve for a typical solar panel (Sharp ND-224U1F), and output power under different lighting conditions. Click on the figure for the panel's full specification.

Figure 1

The solar panel behaves like a constant current source at high current, and like a voltage source at low current. The transition region is where the highest power can be obtained. The voltage and particularly the current at the optimum point vary considerably with the amount of light incident to the panel.

The solar panel is typically used to charge batteries since solar energy is only available during the day, but typical electrical power usage extends during dark periods. On cloudy days, limited power may be available even at mid-day.

Batteries operate at a relatively stable voltage which at best may only match the optimum voltage of a solar panel under one set of conditions.

Therefore, an optimized battery charger must be able to determine the "maximum power point" (MPP) of the panel under the current condition and adjust the load to match it, keeping in mind that the MPP varies during the day as a function of the amount of available light and the panel's temperature.

Fortunately, switching regulators of the type used in high efficiency battery chargers can vary the load while maintaining the proper output voltage for battery charging.

All that is needed is a circuit that can find the maximum power point and control the battery charger to operate there.

## How it works

Our optimizing controller operates under the principle of controlled perturbation.

It continuously monitors the panel's output power while modulating the load by a small amount. When the power increases as the load is increased, the controller increases the average load. When the power does not change between the two load values, the panel is operating across the MPP. See figure 2 below.

Figure 2

In the figure above, points P1 and P2 correspond to non-optimized operation. The current is high, but the delivered power is less than it would be if the load was a little lighter (less current and more voltage).

When the charger operates between points P1 and P2, the unequal power levels drive the controller to a lower average load (lower current) in order to increase the delivered power. Eventually, the operating points move to P3/P4, where the power delivered is equal and the controller stays at that level, until the amount of light or the temperature (or the battery state of charge) change.

In that figure, points P1 and P2 (respectively P3/P4) are more widely spaced than desirable, for illustration. If the points were so widely spaced, the controller would never operate at the peak power. You can see that P3 and P4 are about 5W below the MPP. By making the modulation a small fraction of the available power, points P3/P4 will move much closer together and the controller will operate very close to the MPP.

The charger provides the load. In our example, the modulation represents about 5% of the average load. This amount can be adjusted depending on the power of the actual panel used, the sensitivity and dynamic range of the power monitoring circuit and how close you want to be from the MPP. Typical values will be around a few percent.

If the power goes up when the load is increased, the charger's average load is increased, and inversely if the power goes down.

When a small amount of load change does not cause the power to change one way or the other, we are just straddling the MPP.

Figure 3 shows the overall block diagram of our controller.

Figure 3

Figure 4 shows a simplified schematic with more detail on how each block functions.

Figure 4

In that schematic, from the left:

• The PhotoVoltaic Panel delivers power
• The Power Monitor around R1 and the multiplier delivers a voltage that represents the power delivered by the panel under the current conditions of light, temperature and load.
• The circuit around the clock, SW1 and U1 is the optimizing controller
• The circuit around R2, R3, R4 and Q1 represents the battery charger.

## Solar Panel

The PV_Panel diode model was created from information in an Intusoft application note (Ref [2])
According to that application note, the Photovoltaic Panel is simulated with a special diode in parallel with a current source.

The model was simulated to see how well it matches the shape of the Sharp I/V curves.

Figure 5

Aside from an obvious scaling factor (this model is operated with current from 0.5 to 1A, the Sharp panel is rated at almost 9A at full illumination), the curves match the shape of those on the Sharp datasheet fairly well.

You can get the Spice schematic by clicking on the figure. Source V1 is used to sweep the load on the panel and plot the V/I curve.

Different illuminations can be represented by varying the current source I1. In that simulation, the current source I1 is stepped through 3 different values using the SPICE .STEP directive.

Please note that for this model to work, you need to add the special PV_Panel diode model to the LT Spice library.

To do this, just add the following text as a single line in the file "standard.dio" under the library folder in the installation directory of LT Spice, "C:\Program Files\LTC\LTspiceIV\lib\cmp" on this computer:

```.model PV_Panel D(Is=10n Rs=.5 N=77.06 Cjo=10n M=.5 Eg=85 Xti=230 BV=30 IBV=.001 Vj=.4 Iave=1 Vpk=30 mfg=Generic type=PV)
```

This model is probably grossly inacurate with regard to actual performance, particularly regarding the power available and also the behavior over temperature, but it represents the V/I behavior well enough at one temperature for the purpose of demonstrating the operation of the optimizing controller.

Unlike the Sharp PV Panel used at the beginning of this article, the LT Spice model is intended for a maximum current of about 1A.

## Power Monitor

We need to be able to measure power in order to find the MPP. A power meter block diagram is shown in Figure 6.

Figure 6

To find out the power, we need to measure the voltage and the current and multiply the two. Multiplication is a little hard to do in analog electronics. One way to make an analog multiplier is to convert the two pieces of data to be multiplied to a log scale, then add the two values, and convert back to a linear value through an anti-log converter. It sounds complicated, but log conversion is easily done with bipolar junctions. It is simple to convert the log of a current into a voltage, and the log of a voltage into a voltage. Add the two and you have the log of the power.

The following circuit (Figure 7) does that. I got the idea from this blog (Ref [1]) and simplified it. Refer to the link for a detailled explanation of its operation.

Figure 7

The purpose of the negative resistance circuit around A2 is to eliminate the error due to the voltage across Q1/Q2. Without it, the current through Q1 is equal to (Vpv - Vsum)/R1. For Vq1 to be the log of Vpv, the current through it should be equal to Vpv/R1, so the Vsum term has to be eliminated. Without the negative resistance circuit, the Power Monitor would be affected by an error that would become larger as the voltage from the PV Panel becomes lower. However, with most solar panels with an output voltage of 12V or more, the error is small and can be ignored for the purpose of building an optimized charger (remember that we are only interested in relative power, not absolute), so the negative resistance circuit will be omitted from our simulation.

Vsum is a voltage proportional to the logarithm of the power delivered by the panel, not a linear function of the power itself. However, we are not interested in measuring the actual power, we just want to know when it peaks, so a logarithm function (or any monotonic function) allows us to do that.

Rs should be sized for the maximum current expected from the solar panel (8 to 10A for this panel). Its value should be small enough to introduce a negligible power loss. 0.01 ohm will achieve that while keeping the voltage developped across it high enough to make the offset voltage of A1 negligible.

The values of R1 and R2 are not critical, however they must be chosen so that Q1, Q2 and A1 are not overloaded. A maximum of 5mA will work. Therefore, with the selected panel R1 should be no less than 8k ohm, and R2 should be no less than about 20 ohms.

## Solar Panel and Current Monitor

This model simulates the Solar Panel and Current Monitor to verify the response of the current monitor in the actual circuit.

Figure 8

You can see that the Power Monitor's response deviates at low output voltages as predicted, but that the response near the maximum power point tracks the actual solar panel power pretty well. The most important is that the MPP be the same.

## Switching Battery Charger

The switching battery charger design is not critical for this experiment. It could be a Buck regulator if isolation is not required. Suffice to say that any topology where the load (output current) can be programmed by an input voltage would work. Our controller will drive the control input in order to achieve and maintan the optimum load for the solar panel.

### Battery Charger modeling

Now we need a simple circuit that can simulate the Battery Charger. The circuit needs to be able to draw a variable amount of current controlled by a voltage. A MOSFET and a fixed resistor (to limit the maximum amount of current) will do the job, as described in Figure 9.

Figure 9

In that figure, V1 is the power source (solar panel in our case), V2 represents our controller. Resistor R1 should be sized for the maximum current (at the corresponding voltage) that we expect to draw from the panel.

The actual circuit (Figure 4) uses two resistors R2 and R3 to drive the gate of the MOSFET. These two resistors drive the MOSFET with the weighted average of the voltage coming from U1 and the square wave coming from the clock. The signal from the clock is used to provide a small amount of modulation superimposed on the voltage from the controller. R2 provides the average load if you will, and R3 provides the modulation around it. By making R3 about 10 or 20 times larger than R2, we make sure the modulation is a small fraction of the average load.

## Controller

The controller is composed of a clock circuit generating an approximately 50% square wave. The square wave directly drives the control input of the battery charger, modulating the load. An inverted copy of the clock drives an SPDT switch. The phasing is such that when the clock's output is high (and the voltage on the gate of the MOSFET is higher), switch SW1 connects the output of the power monitor to C1. When the clock's output islow, C2 is connected to the power monitor.

C2 and U1 form an integrator, while C1 and U1 form a sample and hold.

When the output from the power monitor is different depending on the state of the clock, U1's output will be driven in one direction or the other, depending on which phase of the clock provides the most voltage (case P1/P2 in Figure 2).

Referring to Figure 2, in the P1/P2 case, P1 correspond to the battery charger drawing more current (clock output is high and SW1 is connected to C1). P2 correspond to less current (but more power) and SW1 is connected to C2.

Since the voltage on C2 is greater, the output of U1 will be driven lower, which will reduce the average load on the PV panel.

Eventually, the output of U1 will drop enough so that the controller operates at the points P3/P4, which are just around the MPP.

The following figure highlights the controller part of the overall schematic.

Figure 10

The controller is composed of a clock circuit generating an approximately 50% square wave.

The square wave directly drives the control input of the battery charger, modulating the load. An inverted copy of the clock drives an SPDT switch. The phasing is such that when the clock's output is high (and the voltage on the gate of the MOSFET is higher), switch SW1 connects the output of the power monitor to C1, so that C1 charges to the voltage from the power monitor when the load is heavier (lower resistance). When the clock's output is low and the load lighter (higher resistance), SW1 connects C2 to the power monitor.

We could have returned C2 to ground instead of to the output of U1, but by returning C2 to the output of U1, U1 becomes an integrator. Integrators are much easier to stabilize in closed loop circuits, so it will save development time and a few components in the finished product.

C2 and U1 form an integrator, while C1 and U1 form a sample and hold.

## Complete LT Spice Model of the controller

Figure 11 shows the LT Spice schematic of the model.

Figure 11

To simulate different illuminations, simply change the value of the current source (1A in the default file) to a lower value.

Figure 12 shows a Transient simulation of the model above.

Figure 12

Here is what the traces represent:

• Green trace, V(Vout)*I(R1), represents the actual power delivered by the PV panel. This what we try to maximize.
• Red trace, (V(Vpwr)-1.25)*150+2, represents the output from the power monitor, scaled so that variations can be seen on the graph. The voltage is actually very close to 1.25V for most of the operating range of the PV panel, so at a scale of 1:1, we could not see variations on the plot.
• Purple trace, V(Vctrl), represents the output from the controller. A higher voltage represents a higher load.
• Light Blue trace, -I(R2) is the absolute current coming from the PV panel.
• Blue trace, V(Vout) is the voltage across the PV panel.

You can see that as the controller ramps up after power up, the output power (both green and red traces) goes up and stabilize. After stabilization, the red trace (output of the power monitor) has no visible modulation in spite of the 150:1 scaling, while the green trace (actual power) has a little bit of modulation. That is probably due to the fact that, as explained above, the power monitor is not absolutely perfect. However, the small error (a fraction of a watt) would be negligible in an actual implementation.

Notes:

• In the SPICE Simulation command, enter 6.5 (sec) in the "Stop Time" box and 4.5 (sec) in the "Time to start saving data" box. The controller takes several seconds before the output of U2 is high enough to cause the MOSFET M1 to start drawing current (due to the MOSFET's threshold voltage). Until that point, the output of the controller changes very slowly. This is only a problem because of the greatly simplified circuit we use to model the battery charger.
• In the model above, source V3 has a negligible effect. It was used initially to fine tune the model. It can be removed without effect on the simulation result.
• The ratio between R5 and R7 defines the amount of modulation. Here, the ratio is about 50. By decreasing the ratio (for instance by increasing R8), the amount of modulation will decrease.
• An actual product would use actual components to replace the ideal switches S1 and S2. CMOS analog switches such as the MC14066 would be a good fit.
• The clock signal could be generated by a timer circuit such as the LM555.

## Conclusion

We demonstrated that it is possible to realize a simple analog controller capable of optimizing the amount of power recovered from a solar panel over a range of environmental conditions (illumination, temperature).

We also realized a simple model for a Photovoltaic Panel.

It is to be noted that nowadays, a small microcontroller would perform all the tasks required probably at lower cost, but it would not be nearly as much fun :)