Saturday, January 21, 2017

The Solar Misconception

Let’s just breeze over the fact that I am terrible at maintaining my blog. I know that. In my defense tho, I can say that my Linux work laptop is still broken.

Somehow the display driver of the board went kaput. OEM replacement was costing me too much so I went for a local repair. BIG MISTAKE. Although the laptop boots up, something is messing up the thermals. The temperatures reach up to 105 C and the fan never even attains full speed for max cooling. I even tried running water over the CPU block and northbridge in thin copper vapor pipes.

Yes, I am liquid cooling my laptop.

But even that did not work very well as for some reason, the pump seems to fail ever so often. I have more or less given up on it unless I can find a better pump. Any better ideas for this?

But again, that is not the only thing I have been busy doing. I was curious with all the fuss around the ESP8266 and Lua(?) and NodeMCU and things like that, so I wanted to check them out.
Just recently I got NodeMCU v0.9 and I started experimenting with it. It turned out to be great little wifi Arduino kinda thing and if used with Blynk, practically anyone can make their own IoT controlled appliances. It's good fun!

But again, that was not even close to the main thing I was doing, which of course is, the Desk Project.

Please concentrate on the lighting effect. Also, this is an old photo, so you see the old speakers.

I was cleaning up my desk space, which as you can see from my previous posts, was a bit too much of a mess of wires and solder blobs popping out everywhere. Even the wire colors were mismatched. So I decided to clean it up, and maybe make some small upgrades in the entire system, make it more foolproof.

Side note:- Talking of foolproof, I blew up my 300w ATX PSU. It had something to do with PWM whines/signals traveling back to the ground pin of PSU and damaging the capacitors over time. I cannot confirm because I don't have an oscilloscope. But the speakers attached with the system also made the whining noise, so that is how I guess it is what it is. Since the whole system is juiced up now, I don't really need a PSU, but I'm still using it as the wires are a very useful distribution system.

Anyhow, time for the final reveal, My desk space v2.0, (I think)

Notice the Sub hidden behind the pen stand. Some more tiding up of wires is required, But its much better now.

Let’s go over the changes slowly

Firstly, there is a (kinda) new battery. A Rocket 12V 26Ah SMF pack provides all the juice for anything I may ever need.

I hot glued a wood peice to the battery, and screwed on the charge controller. Now that I think about it, there is something called double tape as well.

Then there is the new charge controller I got, a 10A PWM charge controller. It turns out that the way I was using the previous charge controller with the battery and the load connected was actually very bad for the battery and has considerably damaged them. Plus my second mistake was using 2 diff batteries in parallel. Don’t do that. This controller, on the other hand, has independent PV Battery and Load lines, all PWM controlled. It also has a 1 amp USB port, which I am using to power the next thing on the list.

A big battery also requires a bigger power source, so I replaced my old 5 Watt panel with a decent 20-watt one. However, there is a catch and I will discuss that later.

3 current sensors, with 3 voltage dividers attached with them. MOSFET to control the LCD Backlight. All controlled by an Arduino Pro Mini

This is a masterpiece. Really. It’s an Arduino pro mini, which has 3 ACS-712 current sensors and 3 voltage dividers which measure the current and voltages on each of the solar charge controller lines and give the net power in Watts for each channel. That is, how much the PV is generating, How much the battery is charging, how much power my load is consuming. Not only that, I was bored with having to adjust the LCD backlight intensity myself from time to time, so I also added an LDR which is then used to control the backlight intensity as per the ambient lighting. That means that I am using nearly all of the Arduino pins to get this to work, and after some initial difficulty of coding with arrays, the whole system is now nearly perfect!

Notice the small LDR just above the Chinese text on the LCD.
-ve Current is because the battery is charging up, so reversed direction of current.
Also causes the "W" to get displaced.

I am storing all the ADC values in individual arrays and then taking a running average of those values. Kind of like the Arduino smoothening example, but applied to all 7 ADC pins of Arduino. That allows for consistent reading and stable values on the display.

The Left side PCB is the LED Driver and Distribution board.
There is another Pro Mini and an HC-05 Bluetooth module now.

Next change is the LED Driver board, the one with the 6 MOSFETs and central wire tappings. This is now modified as a common power distribution board as well as allows the 2nd Arduino Pro mini to control the RGB Strips as well. They were Pi exclusive previously.

The last change in the addition of a 2nd Arduino in the system. This is now a standalone Bluetooth connected device which I use to change the intensity of desk lamp, RGB strip or turning the speakers on or off.

Oh yes, the speakers! Gone are the Creative sbs380 and now I am using a 2.1 channel Harman Kardon speaker set. Notice the Sub woofer hidden behind the books. Audiophiles would say that I am blocking the sound, but in reality, the sound isn't affected that much. The only downside is that the tweeter units are quite directional and the wires are fixed in the speakers and the sub, so it is a bit of a mess, as you can see...

I want to clean up the right side a bit better. Maybe use wire casings?

Another side note on the foolproofing, I added directional diodes in my circuits so that back powering is avoided. Previously, if I powered on the RGB Strip, the sound organ Arduino automatically got powered on, because it is linked to the same RGB strip. Adding a simple 1n4007 fixed that. Evolving circuits, you see.

MSGEQ7 circuit, hidden behind the monitor on the second desk. Notice the Diode and the cut in PCB.

Now that I have thoroughly shown off and bragged about a mildly not-so-boring system, I want to talk about the Power source of everything here. The Sun.

No really. Since all of this is powered by a giant open fusion reactor, I want to talk about how I, and in general, many small scale SPV users are being “cheated” just a teeny bit.

Since I got a big battery (relatively), I knew that my old panel and my charge controller won't be able to charge it properly. I had anyways thought of getting a new, or I should say a proper charge controller, so I sneakily ordered a 20-watt solar panel as well.

For Indian readers, both SPV and controller are from a company called Sparkel. No sponsorship but I wish I had it.


I was really excited when my parcel came, in some amazing huge bubble wrap. Anyhow. When I hooked up the panel, I had in mind the thought that my existing battery set would take only 1/4 the time, since the panel was now 4 times more powerful. I was wrong. I checked the open circuit voltage and the short circuit current of the panel, and it was more or less matched the spec sheet.

The Datasheet of my SPV module. Quite useful!
If you know what you are looking for.

I thought that maybe the old charge controller is at fault, and can regulate only so much... So I proceeded and replaced that with the 10A controller as well.

After some observational period, I realized that the time to charge the batteries has improved, but not by a factor of 4, as I expected it to, but only by around 1.5 or 2. Something was definitely off.
So I got to work.

Having initially checked the open circuit voltage and short circuit current, I wrote an email to the company. The folks replied with a very detailed answer and a proper data sheet from the OEM. Great! They also suggested that I take measurements when the load is connected since the panel will then operate at max efficiency, A fact I already knew, but was too lazy to test.

However, after the first email, I did actually measure voltage and current values with just the solar panel and the battery hooked up. Prepare for numbers!

Since I am using a 20W panel, I was expecting around 16-18 watts of power that would be supplied to charge up the batteries. When I hooked up my multimeters, I was getting a peak power output of around 11W only.


All the conspiracy theories started popping up, that maybe I have a defective piece and so on and so forth.
However, once I checked the voltage and current that was being drawn from the solar panel, I realized that the panel is not reaching its rated peak power output. So maybe again the panel is defective...

The basic thing that I was forgetting at that time was that the charge controller was a PWM based controller. The way these works are as follows:-

The SPV module in ideal conditions is rated for 17.5V and 1.12 A, under maximum load. That gives a power output of roughly 20W, the actual rating of the panel. However, when a Lead acid battery needs to be charged, it is usually done using CV or constant voltage charging. That charging voltage, although dependent on diff manufacturers, is usually in the range of 13.6 to 14.5V

What the charge controller does, is that it takes the raw input from the PV, a plain DC line, and then chops it up into small pieces of PWM signal, using a MOSFET. It's the same way we use to vary the intensity of LED Lights, by PWMing the voltage.

For example, a 50% duty cycle of PWM for a 12V source will effectively give a 6V signal. So the 12V LED connected in such a way will be approximately set at half brightness level. Not exactly half, because that depends on the characteristic curves of the LED, but you get the point.

In the same way, the charge controller, which receives a 17.5V signal, will chop it using PWM and will automatically set the duty cycle so that the output from the MOSFET, which is used to charge the battery, is maintained at around 13.5V or so.

Should be self-explanatory

Nice little simple trick. But this means that if 17.5V is reduced to 13.5V which implies a 33% drop of voltage using PWM, then 33% of the total current that was previously passing is also cut short because effectively the panel is not charging the battery for 33% of 1 complete charge “duty cycle”. For 33% of the time, the panel is practically dead.

This implies that if for my particular setup, 20W of power is PWM'ed and reduced as per the voltages required mentioned above, 33% of the 1.12A, that is around 350mA of the current that can be generated is available but actually never used to charge up the battery. It may not sound like much, but 350mA is actually quite a lot, and incidentally current required by a 3W high power LED, which as we all know, are pretty darn bright.

It's not that the panels are bad or the controller is bad, its just how it works. A solar panel can give max power at a certain voltage level, and due to design constraints and FoS principles, the max power range of a panel is designed to be at around 17V for 12V panels. Since there is no actual power conversion method actually inside the PWM controller, it effectively disconnects the supply after the set duty cycle, or at the set apparent voltage. Thus it prevents the panel from actually working at its peak efficiency so that the battery can be charged safely.

So if 350mA of current is never used and it is or can be generated by the panel at 17.5V, the apparent loss of power due to PWM is around 6W. Damn, that is more loss than my previous panel was actually producing! And taking this fact into account, my measured power reading of 12W of charging power made sense, since 12+6 =18W which is roughly what I was expecting out of a 20W panel anyways.
MPP - Maximum Power Point, so by default, maximum efficiency

I must state that the company from which I got the solar panels and the charge controller was very prompt and helpful and they made me realize the fallacy of my thinking process about the power output and things like that.

So I think that effectively all the small scale solar users, who are using PWM based controllers, are not actually getting the power output that they are expecting.

I say small scale because, for large scale uses, the losses of PWM would be too much. If the system is 12V, the loss of power is around 3W for every 10W the panel can produce. So for a 10kW SPV system, there would be 3kW of untapped solar energy, Which just does not make any sense. So, large scale SPV plants use MPPT charging methods. Fancy name. It stands for Maximum power point tracking. Fancy full-form as well.

What MPPT is actually doing is using a simple DC-DC Buck converter. This allows the panel to be operated at its maximum power output level at all times, in my case, 17.5V and 1.12A, but “bucks” the output voltage to around 13.5V Now you may say, that even PWM is doing that. Correct, but PWM controllers actually decrease the power by reducing the time the current can flow, MPPT is converting power, and by reducing the voltage, it actually increases the current at the output.

Remember transformers? AC transformers? 1A at 220VAC is the same amount of power at 2A 110VAC? That is what the buck converter is doing for the panel and the battery.

When I hooked up a buck converter directly to the panel, I got the following results

Direct Panel connection
Voc = 21.2V Open circuit voltage
Asc = 0.93A Short circuit current
W = 19.5W Not exact as panel is not under load, but good enough for general comparison

After Buck conversion to 13.5V
Voc = 13.5V
Asc = 1.3A
W = 17.5 W which is 6.5W more than the PWM charge method.

Which is only a 2W loss in power as compared to 6W. This means using a buck converter, I can charge my battery with 4W more power from essentially the same panel. Crunching some more numbers, I get to the fact that PWM charge controllers will get limited to about 70% of peak efficiency, whereas MPPT controllers can touch 95% or plus efficiency.

A simple Buck converter. I used this as a test bench for MPPT design.
Actual MPPT charge circuits are much more complex, and usually, have buck/boost working side by side.

Why isn't MPPT used then? It is, but the cost factor in small scale usage prevents a complete replacement of PWM based systems as they are cheaper and simpler to make and maintain. For large scale and commercial systems, MPPT controllers are the obvious choice. In these cases, the working voltages are also increased to 24V or sometimes 48V, for off-grid systems.

Do I want the extra 4W of power from my panel? Obviously.

Will I do something about it? Maybe make my own MPPT controller? I don't think so because I just don't have the time as of now.