MPPT Solar Charger Testing II

It’s time to follow up on the MPPT Solar Charger project. Progress has been slow since I’m currently working full time and doing a master’s degree at the same time. Given that this blog has previously been something close to a 50% job at times things will necessarily slow down a bit. But all the projects, including this one and the ultrasonic anemometer are alive and well and I’m working on them whenever I find some time.

20161012_userinterfacereva_014

User Interface

So what’s new with the MPPT solar charger? First of all, it got this nice user interface. Unfortunately there were still some issues with the first version so there is an identically looking but much-improved and bug-free Rev B.  I’ll do a separate post on that documenting all the things I’ve changed.

I re-used the white-on-blue display from the initial version for the Rev B. as opposed to the black-on-white used with the Rev A. They are pin compatible so you can use whichever you prefer. I more and more start liking that black-on-white look. It’s about 10 bucks cheaper as well. What’s your opinion on this?

img_4334

Solar Panel drains Battery

My intention with this design was to just leave the solar panel connected to the input of the buck converter. There’s a problem with that, however. The input of a buck is always at least at the output voltage minus a diode drop. With a 12V lead-acid battery at the output the input (i.e. where the solar panel is connected) the voltage never drops much below 12 volts.

That’s a serious problem since even a small solar panel like the monocrystalline 30W panel I have here sinks around 10mA at that voltage. So whenever the panel is not providing any power it considerably drains the battery.

Try a Diode

Obviously we need a way to avoid that. The first solution that comes to mind is a diode. But there’s a problem with that, too. To keep the power loss in the diode acceptable, the diode needs to have a low forward voltage. However, any diode with a low forward voltage also comes with a high reverse leakage.  Physics seems to dictate that.

Leakage can easily be in the range of milliamps for a diode that can handle, say, 4A like needed here. And that reverse leakage is also highly temperature dependent. It may be ok-ish at room temperature and then detoriate by an order of magnitude at 50 degrees centigrade.

To get an acceptable reverse leakage one needs to tolerate at least half a volt of forward drop which is something like 3% in efficiency. Since our converter operates at around 97% efficiency that would mean doubling the energy dissipated.

P-Channel or N-Channel Mosfet

So the next obvious thing to try is a mosfet acting as a switch.  Yes, a mosfet also has a body diode that also has a reverse leakage. But the body diode is a bad diode in terms of forward drop and has a correspondingly low reverse leakage.

A nice way of solving our problem would be to use a p-channel high-side switch disconnecting the battery from the converter whenever the panel is not producing. That not only disconnects the panel but powers off the entire buck including the input and output caps and everything. Where there is no voltage no power can get wasted. Perfect.

img_4342

Unfortunately, powerful (i.e. low Rds-on) p-fets are relatively large,  rare and expensive. As a rule of thumb a p-fet needs twice as much silicon area for the same performance compared to a n-fet. Besides that, that would be another type of component and I’m trying to not use too many distinct components.

So the other solution is to use an n-fet as low-side switch just disconnecting the panel. We already have 6 powerful n-fets in our design and they are cheap, too. So this is what I’ll do in the next version.

For now I’ve used one of the power outputs to connect the panel. I’ve cut some traces and soldered in some wires so that the fet is on whenever the buck is powered on.

Buck Software

During early testing of the buck converter I managed to kill the bottom fet several times. Since I was able to run the buck at relatively high power levels for prolonged periods of time without any issues (and without getting hot) I suspected that this was caused by carelessly written software. This seems to have been the case indeed. Whenever I killed a fet it happened at startup or shutdown, usually the latter. In the mean time I’ve written well-defined startup and shutdown routines and never had any issue since.

bootstrapcapacitorcharging

Synchronous converters are dangerous in this respect. It is very easy to short the battery to ground via the bottom fet. All it takes is a duty cycle that’s too low or a timer is running too slow or not at all. Or you stop the PWM module at a time when the bottom fet is on and it will stay on forever.  Or at least a few milliseconds until it’s dead.

Asynchronous topologies are much more forgiving in this respect since you can’t short anything. So an easy solution would be to start up and shut down in asynchronous mode. We can easily make this an asynchronous converter in software by just not utilizing the bottom fet. The diode in parallel with it will then automatically take over.

Unfortunately we cannot start up in asynchronous mode. Why? To enable the upper fet we need a bootstrap voltage above the input voltage. And we don’t have that unless the converter is running. It’s a chicken and egg problem, really. So we need to start up in synchronous mode at least for a few switching cycles for the bootstrap diode to charge up.

That’s exactly what the startup routine does. It completes 16 cycles in synchronous mode at a neutral duty cycle. What do I mean by neutral? Simple: Duty Cycle = Output Voltage / Input Voltage. That means no current actually flows on average. So this is a nice, soft way to start up. After those 16 duty cycles the buck enters asynchronous mode. As the screenshot above shows, the bootstrap capacitor is fully charged after just one full duty cycle so that number is more than sufficient.

This routine is critical. If it doesn’t do precisely what it should chances are high that the buck is destroyed. So I’ve checked it carefully by both looking at the code and the scope. I’ve run it many times and observed closely what it does just to be sure it starts up nicely very time.

Why run in asynchronous mode? Because it’s more efficient at low power levels. Once the current rises above a software-defined threshold the converter will change to synchronous mode. If the current later falls below a second (lower) threshold, the buck changes back into async mode.

The optimal values for the two threshold will have to be determined experimentally but will likely be in the range of a few hundred milliamps.

buckturnoff

The shutdown sequence is simple. The buck is shut down if the current falls below a very low threshold (say, 10mA) below which it cannot run profitably. If the current falls even lower we are better off shutting down the buck and entering a low-power mode. Since the current is low when we shut it off, the converter is already in async mode. So shutting it down is now easy and uncritical. We just turn off the top fet and can then also turn off the timer and supply voltage to the buck. The screenshot above shows an example of that.

Conserving power

A main feature of this solar charger is it’s ability to (hopefully…) run at a very low (<100microamps) current when not in use. So we obviously need to turn off everything we don’t need and run the PIC at a much lower frequency as well.

The PIC’s maximum operating frequency is 48MHz. This is the frequency it runs at when the buck and/or USB (not yet implemented) is on. These two features need that clock frequency to perform their task.

If both the buck and USB are off we can clock the PIC down to 8MHz which already saves a great deal of power. At 8MHz we can still do everything else, including running the user interface. Updating the display and particularly calculating the display content consumes quite some computation time and so we need a few MHz to do this.

If the user interface is not used for a certain time (say, 10 seconds), it is turned off. We can then lower the board voltage to 2.3 volts and lower the CPU frequency even further to 32.768kHz.  This is the frequency of the real-time clock that is running anyway. At such a low frequency the PIC’s computational power is low but still sufficient to do some housekeeping tasks.

One can wake up the user interface at any time by pressing the push button. Turning the encoder won’t help because that, too, has been powered off.

While in this low power mode every 6 seconds the board voltage is raised to 3.3 volts and all temperatures as well as the input and output voltages are measured. That all happens at 32.768kHz. After the measurement is complete the PIC decides if the panel voltage is high enough to start harvesting energy or not. If this is not the case the board voltage is lowered again and a new set of measurements is captured 6 seconds later.

img_4336

Despite all those efforts the board consumes something like 530 microamps which is much more than it should. About 100 microamps comes from the voltage divider used to measure the panel voltge. That’s an easy to solve design problem that I’ve described earlier already. But that still means that something is drawing 400 microamps. Not much at all but still way too much.

I’ve spent an evening trying to find the problem but I still don’t know. I’ve suspected the capacitors but when I measured some spare caps of the same type they hardly drew any current at 12 volts. I also un-soldered the buck’s mosfet driver but that made hardly any difference so that’s also not the problem. It may even just be some near-short on my board homemade board. So I leave that for now and check again once I have a revised design with a proper PCB.

Buck testing

I’ve saved the most interesting part for last 😉 I’ve established before that this converter has a similarly high efficiency than the Arduino version published some time ago. But at that time I was only able to test up to 35 or so watts.

This solar charger is capable of handling much more power than that. Testing how much was a bit more difficult than expected. Unless the battery is very empty it won’t draw as much as this charger is able to provide. And you don’t want to discharge a lead acid battery too much, they don’t appreciate it at all. So once again my constant current dummy load came to the rescue.

img_4339

With the dummy load at one of the power outputs I was able to draw some serious current. I set the dummy load to 4 amps and the battery absorbed (or provided) whatever was left. Obviously, I can only do that for a limited amount of time until the dummy load gets too hot. It automatically shuts down once the heat sink reaches 70 degrees centigrade which is soon the case at 4 amps.

I let the charger draw 4.5 amps at a bit more than 17 volts for as long as I could. The coil got quite warm, slightly hot even, maybe something like 60 degrees. The mosfet only got lukewarm and I’m not sure if this was because of their own power dissipation or due to their proximity to the coil.

img_4341

So from this test I’d conclude that this was about the power which the charger can handle for a prolonged period of time. So I think something like 75 watts is a realistic power rating.

I’ve also had another look at the datasheet of the coil and it pretty much confirmed my findings. 75 watts at (say) 13 volts output corresponds to 5.8 amps through the coil. The datasheet states that the coil starts saturating at 8.2 amps which means we’re still safe with 5.8 amps plus the ripple current. The datasheet also states a 40 degree temperature rise at 5.3 amps. So thermally the coil is pretty much at its limit at 75 watts. That, too, seems realistic to me having touched it after some time at that power.

The road ahead

So how to continue? As we have seen, there is a number of design issues but the general concept works. During testing and debugging I’ve cut and re-soldered many traces and also made some modifications like the one with the n-fet described above. I’ve unsoldered and changed many components as well. All of that doesn’t improve the reliability of the board. At some point it makes sense to design a new version, build it and take it from there. A clean slate kind of.

I think this point has been reached here. So I will work on a new revision from now on. The concept won’t change at all but I’ll try to apply what I’ve learned so far. I also hope to reduce the number of different components, reduce the size and total cost while not sacrificing performance. In other words move a step towards a design that may one day be built as a small series. Let’s see.

19 thoughts on “MPPT Solar Charger Testing II”

  1. I have been following your work and real likes what you are doing , will appreciate to have update and all progress on MPPT III
    keep it up, everything is neat and professional, its on even like a project

  2. This is an awesome project, I would like to work with you and try to see if this would be a good fit for MeshPoint (http://www.meshpoint.me/).

    I also thought of starting open source MPPT solar charger, but then I saw your project.

    Would it be possible to modify your design to work with LiFePO4 batteries?

    Cheers,
    Valent.

    1. Hi Valent

      Thank you for your encouraging feedback. 3 or 4 cell LiFePO4 batteries can easily be accomodated by setting a few software parameters (like maximum charging voltage, minimum discharge voltage) appropriately.

      regards
      lukas

  3. Ditto on the great series. Many thanks.

    Was wondering if an INA219 I2C voltage/current sensor could be used instead of what you are using.

    1. Hi John.
      I didn’t know that chip but just checked its datasheet. A highly interesting device indeed. And yes, it could absolutely be used. You’d need two, one at the input and one at the output and they would replace both the DAC as well as those two TI current-measurement chips. You don’t even need to change the current shunt resistors, with the INA219 set to PGA=1 they should be just fine.
      Thank you for pointing out this highly useful chip to me.
      Lukas

      1. My pleasure.
        You can buy modules with that chip on eBay cheap.

        Thanks again for all your posts. They have inspired me to try making a charger. Since I’ve been doing a lot with the ESP8266 I will try using that. Then I can send my readings to an IOT site.

        The ESP8266 is a power hog, so I’m planning on using an ATtiny84 for the PWM. It will talk to the ESP with analog in to adjust the duty. Then the ESP can sleep mostly.

        I have not studied your PIC code yet, but I’m not clear how you make the signal for the low side switch. Are you rolling your own PWM?

        In any case, happy holidays to you.

        1. Hi John
          Sounds cool with IOT and all. Regarding the PWM: I’m using one of the PIC’s enhanced PWM modules that can generate up to 4 PWM signals from a single clock signal. So the inverted signal is generated by the PIC in hardware, absolutely no software intervention required.

    2. I’m also starting to play with INA219 + ESP8266 wifi module for remotely sending measured values to Thingspeak IOT servers… so I would highly recommend this combination to you to also try out…

  4. Hi, I have been following your project for a while. Still Interested ! How much effort to increase Current / Watts (260 Watt panel, for example) via adding FET’s in parallel ?

  5. Hi John
    First of all, attaching a 260 Watt pannel won’t damage anything. The charger is smart enough to not pull more current than it can handle.
    The limiting factor with this design is not the FETs. It is limited by the coil (both thermally and saturation-wise) and the ripple current rating of the input capacitor. So the first thing to do would be to upgrade to a beefier coil with a lower (!) inductance. Something like a 4.7 or 6.8 uH coil with a 20 A current rating. Then you need to use something like 4 input caps and two output caps of the same size to not exceed the ripple current rating.
    The mosfets might even be fine with 4 times the current even though they will probably run quite hot (now they barely warm up at all). The same type is also available in a TO-220 package. That might be a better choice than SMD for 260 watts since you can easily attach a small heatsink.
    Hope that helps.
    Lukas

  6. Also have you considered posting progress of this awesome project on Hackaday? Your project is above and beyond of quality and detail than most project on Hackaday…

    1. Hi Valent
      Thanks. And yes, I’d definitely like to show this project on Hackaday but only after everything is up and running and working as it should. The next iteration (Rev C) is well under way…
      Lukas

      1. Thank you for your suggestions for 260 Watt panel capable version. Along that line, have you considered dual or multiple size Circuit board foot prints – allowing for the larger / higher current inductor and other changes (maybe spaces for heat sinks, etc) you mentioned ? Of course, it also means wider traces, or thicker copper, etc … so maybe it is too much rework if your Rev C is far along.

  7. Hi Lukas,
    my name is Valent and I have build MeshPoint (www.meshpoint.me) and my next step is make it work with solar power and LiFePO4 batteries.

    I’m really impressed with your work on MPPT solar charger, because I was also trying to do that with one of my colleagues, but due to the huge amount of work we have on MeshPoint I couldn’t dedicate time to make our own MPPT solar charger.

    I’m really interested if it would be possible to work together, as we both are doing open source projects this could be a good starting point for cooperation. I would like to include your MPPT charger in MeshPoint. If I can help you in any way to finish your MPPT charge controller I would be glad to do so and we can discuss details via email.

    If you are interested to read the background of MeshPoint you can find if here:
    https://medium.com/@mesh_point/how-the-refugee-crisis-gave-birth-to-a-cool-hardware-project-80c83280b2d1#.lnpxn8cfa

    I’m a really strong believer in open source and sharing knowledge and helping people trough education. I have held many, many workshops and founded a local hackerspace so I thing we have lots of things in common.

    What do you think? Let’s do this!

    Best regards,
    Valent.

    1. Hi Valent

      Thank you very much for this and your previous comments. I’ve looked at that MeshPoint project and I think this is really a great thing. I’ll be happy to contribute to MeshPoint if I can. Everything on my blog is open source so that’s definitely not a problem.
      Maybe you could elaborate a bit on how you would like to include a solar charger in your MeshPoint router. Would it be housed inside the router itself? I think that’s probably the way to go if you have a bit of space left inside. I thought about this yesterday and this morning and I think it would be a good idea to have a central power supply module that does the solar charging and supplies the unit with power at the same time. So it would connect to the battery as well as an optional solar panel and mains. What are your ideas about this?

      Can you maybe give me a bit more details about how the power supply currently works? What’s the battery voltage? What voltage(s) does the unit need? How much current does it consume? Can you connect the unit to AC mains or does it exclusively run on battery? How large is the solar charger allowed to be?

      I’m already working on a smaller and better version of my solar charger and I think much of it could be re-used for the MeshPoint project. Just strip away all the USB stuff, display and other unnecessary features and you have a small and affordable power supply unit.

      Regards
      Lukas

  8. Hi Lucas,

    I’ve been working on the ESP/Attiny of your design and it’s coming along. At least I think I’m done burning out parts on my breadboard version!

    Earlier I had mentioned the INA219. It is a very convenient way of getting current and voltage. However so far I have difficulties comparing their reading with what I measure. I’ve even implemented smoothing. Maybe I’m not measuring at the right node or something, but I wanted to give you a heads up.

    What I am curious about is that looking at your different sw versions, I see you have switched back and forth between tracking on an optimal panel voltage and tracking on maximum panel watts.

    I was just wondering what things influenced your decision.

    I have a PCB coming soon and when I get it all working I’ll share a link to the build page.

    Keep up the good work (time permitting).

    1. Hi John

      Great to hear you’re making progress with your own build. I’ll be happy to share a link here once you’re done.
      I was basically just experimenting with different ways of tracking the maxiumum point of power. So far I haven’t found a way that I’m entirely happy with. What ultimately counts is the power delivered to the battery but there is a considerable time-lag. And the converter’s efficiency doesn’t vary that much so input power may be a good proxy.

      lukas

      1. Hi Lucas,

        If it’s OK, I thought I’d share a link to the beginnings of my write up for my adaptation of your charger. Feel free to remove this if it’s not appropriate at this time. The write up is here …
        http://brohogan.blogspot.com/

        All the best,
        John

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.