Boost Peak Power Tracking Battery Charger

[Rusdy] is building a solar charger for his electric bike, and quickly realized the lithium cells in his bike wouldn’t work well with the most common charge controllers out there. Solar cells have an IV curve, of course, and this changes with the amount of sunlight, requiring some conversion circuitry. Most of the charge controllers out there operate in buck mode, but the commercial boost mode converters [Rusdy] needed for his 36V battery are pricey as all get out. What was [Rusdy] to do? Build his own Boost MPPT solar charger, of course.

The circuit used for the charge circuit is fairly similar to a boost converter, with a little bit of logic required to get the maximum power out of the solar cells. [Rusdy] had an Arduino lying around, so that took care of the logic, and by sampling the voltage and current with the analog pins, he can turn a MOSFET on and off to get the most out of his solar cells.

The finished product works perfectly with an efficiency greater than 87%. Charging current and the final trickle charge is adjustable through software, allowing [Rusdy] to get the most out of his solar panels and electric bike. The board itself is just a prototype and could use a layout revision, but we’ve got to hand it to him for cloning a >$300 charge controller with an Arduino and a few scraps in a part drawer.


25 thoughts on “Boost Peak Power Tracking Battery Charger

  1. The MOSFET may be designed for logic-level drive, this design would really benefit from a proper gate driver, because an I/O pin cannot sink and source sufficient current to switch the MOSFET quickly. With a proper gate driver, the switching losses could be greatly reduced, and the switching frequency could be increased, which would in turn reduce current ripple. Also, with an integrated gate driver, he could even use synchronous rectification, to reduce the losses on the flyback diode.

    I do appreciate that he readily admits that he is new to such switching regulators, and clearly documents his mistakes for others to learn from.

    1. Does anyone sell panels that have an MPPT boost controller instead of bypass diodes? It might only add 5% to the panel’s output but for DC applications it would save thousands on the “inverter” (DC applications don’t need an inverter, just an MPPT tracker).

      1. The hardware cost of adding MPPT to an inverter is so trivial that it doesn’t make sense to make an inverter without MPPT.

        That said, there are MPPT controllers that mount on the back of solar panels.

        1. Don’t really need an inverter, thanks.

          The MPPT-mounted-on-the-back ones are inverters too, like I build my own but the bypass diode wastes more energy than a DC-DC converter does.

          1. A bypass diode only wastes energy when that part of the panel received insufficient light; it doesn’t waste anything (or at least an insignificant amount of energy) when the whole panel receives roughly the same amount of light.

            If you mean a series diode, which is only a single diode for a whole panel, instead of the bypass diodes, which are placed across every single cell (these are somewhat optional, as each cell is already a diode, but with a somewhat higher voltage drop than a schottky diode), than you would be half correct; if the boost converter uses synchronous rectification, there is no fixed forward voltage drop. If it uses a flyback diode (which most boost converters do), you still lose 1x the forward voltage drop of the diode, but you lose it from the output voltage, which is higher, and at a lower current, rather than from the input voltage, which is lower, and where a larger current would flow through the diode.

            A buck converter would still need a series diode, because the body diode of the MOSFET would allow a reverse current if the panel voltage is lower than the output voltage (generally a battery), so this only applies to boost converters and galvanically isolated converters.

            I only now read the part about the control software; don’t get me wrong, but he has a lot to learn there! His algorithm causes a VERY large current ripple, won’t extract any energy at all if the desired peak current can’t be reached, will generally operate at a very low frequency, and probably suffers from a whole host of other problems.

            The “common” way to do this is simply to use the PWM periferal (at many tens or even hundreds of kHz) to drive the MOSFET, and to monitor the output current and voltage. The product of those will give you the output power. By adjusting the pulsewidth, and observing the change in output power, you can continuously track the maximum power point. A rather straightforward algorithm would be to have a tracking pulsewidth, add a little for a short period of time, substract a little for a short period, and adjust the tracking pulsewidth in whichever direction produced (slightly) more power. The difference will be small, so the algorithm should always be very close to the maximum power point, while continuously trying to throttle the MOSFET a little more and a little less, to figure out on which side of the actual optimum value you are.

      2. The bypass diodes ares needed in case a part of the panel is shaded, and are placed anti-parallel with every single cell. A MPPT boost converter is generally connected to a lot of cells wired in series; it would be very ineffcient to try to boost a voltage of about 500-700mV (voltage of a single cell), or even less if the cell isn’t receiving a lot of light, and it would be prohibitively expensive to use a separate converter for every single cell.

        What this guy build is not an INVERTER, it’s a CONVERTER, which is a huge difference; it still outputs a DC voltage and current, in this case it’s a boost converter, so it’s output voltage is always greater than or equal to the input voltage. You can’t do maximum power point tracking without some from of switching regulator (generally buck or boost, but it could be buck-boost, forward, flyback, Cuk, split-pi, etc.), because you need active control of the load current, and the load (generally a battery with or without various loads connected) will either require a certain controlled voltage, or will more or less impose an output voltage, in the case of a battery.

        An inverter, on the other hand, will generate something the is or resembles an alternating voltage (either a true sine wave, or a “modified sine”, meaning a dirty square wave). A practical inverter generally consists of a switchmode DC-DC converter, which may or may not be galvanically isolated, followed by an inverter stage.

        There is one HUGE advantage to using a boost converter versus a buck converter: a boost converter has a continuous input current (assuming the converter is in continuous conduction mode, that is), while a buck converter always has a discontinuous input current, even if the inductor is operating in continuous conduction mode. This means the current through the solar panel is also continuous, and has relatively low ripple, without having to use very large input capacitors.

        Also, when using a boost converter, you can get useful energy from very little light, because you only need to compensate the idle losses of the converter to get a net positive power, whereas the buck converter needs an input voltage at least equal to the load voltage before it can extract any energy. Also, the boost converter inherently provides the series diode, which is needed to prevent a reverse current through the panel when it’s dark.

  2. Make sure your inductor is rated for the expected peak current. In a boost converter, this means the the inductor should be rated for at least the solar panels short-circuit current, and may need to be even greater.

    One way to limit the peak inductor current is to increase the PWM frequency – ripple current is greatly reduced. You still need to compute a duty cycle (on_time/period), but with a PWM peripheral, you can set the period and on_time, and forget about it for a couple dozen msec. (It doesn’t require continuous firmware attention to run.) Read whitepapers discussing boost converters, in particular the section that relates boost factor to duty cycle – it’s not hard.

    A short PWM period also gets to continuous conduction operation where you control average inductor current. This in turn, controls battery charging current, or the panel MPTP current, whichever is most limiting.

    Logic level driven MOSFETs can be driven directly from many microcontroller (MCU) output pins if they can sink AND source more than 10mA (many go to 25mA). Pins can sometimes be paralleled IF they are switched together (ie SET PORT, or CLEAR PORT instructions). Large-ish gate currents are required to move the gate charge in/out of the gate capacitance quickly. While you are moving that charge, the MOSFET is operating in its linear (resistive) region, and dissipating power (heat). Don’t depend on the gate load resistor (R4 in you last drawing) to turn the MOSFET off – drive that circuit to ground – hard.

  3. What is the frequency? I am not sure that arduino’s PWM frequency is high enough to be efficient in converter design with reasonable size of inductor. Am i wrong? I’ve tried to design something similar myself and i’ve runed into this issue…

    However i really like to see that this is possible somehow… I’ve been looking for way to make buck/boost converter using arduino (or atmega/tiny) with constant voltage and current limit. So i can use it for effective smart lead acid battery charger with 1-10A programmable output current. So i am looking hard for any similar projects to get inspiration…

    Also the current limit seems to be problematic to achieve for me… i’ve thought about sensing shunt using differential inputs with programable gain that some of atmels (including some arduinos) have…

    1. The ATMEGA based Arduinos can use a PWM clock of 16MHz, so you’d get 160 counts if you want a PWM frequency of 100kHz, which would be somewhat limited. I’ve build a rather large (80A, 3kW) boost converter based on a 25MHz HCS12 controller in the past; it does work, but is far from ideal.

      I know some DSPs from TI (the piccolo series) have PWM periferals that can run at anywhere between 500MHz to over a GHz, using a high speed free running oscillator, while running on a system clock upto 60MHz. Obviously, such devices are hardly suitable for the “arduino target audience”; the excellent documentation spans over 2500 pages…

      1. 25MHz, 500MHz, GHz?
        Aren’t these too high? Is it possible to properly drive MOSFETs at such frequencies under sane conditions? How high the gate currents will be? Also… It’s well up in RF spectrum… i am not much confident in there, so i guess there will be some complicated RF design involved…

        1. You need to divide this base frequency by your desired resolution. If you want 8bit PWM resolution you divide by 256. If you want 10bit resolution and want a 500kHz PWM you “suddenly” need a clock frequency of 500MHz.

  4. If anybody wants to use the Arduino code and in particular the “TimerOne” library then for Linux, note that the permissions must be changed or the Arduino IDE will not include the libraries ,and, the example code will not compile. The author of this blog restricts comments to google members only so I won’t be posting it on his site.

  5. Have you played with at all? retty nice little It’s a pretty nice little java tool for selecting component values and shows simulated waveforms for debugging switchmode power supplies..
    I’m working on a different style DC-DC MPPT converter for thin film solar panels that I expect to operate at around 50V. I’m playing with the Weinberg topology because it looks like it can handle a wide range of input voltages.

  6. @hackaday staff:
    thanks for covering my ‘hack’. You guys actually read and assess them, no copy and paste, that is unheard of these days! Thank you!

    I do admit I’ve underestimated the function of gate driver. I did deliberately omit this from my circuit due to my less-than-average PCB making skills and surface mount soldering (I’ve used Microsoft Word to draw tracks, print them on ‘Press N Peel PCB Film’ using laser jet printer, and etch them using ferric chloride solution, very sad indeed :) ) . However, after I’ve done my calculation (as an afterthought), my particular choice of MOSFET does require large-ish current to turn it on. With Qgs and Qgd 31 and 51nC respectively, using max 40mA output from the Arduino Uno, it still takes 2-ish microsecond to fully turn ‘ON’.

    Thanks for the tip of the Arduino PWM (possible limitation of number of count when frequency increased). I’m a noob on this one, so great info.

    That was exactly what I thought (Arduino Uno Digital I/O should be able to directly control the gate). However, doing my own calc (as my above reply to sparkygsx), even with 40mA it’s still slowish for my particular choice of MOSFET. Although, even if I knew this during design, I probably still do the same thing (not using gate driver), mainly due to my less than average PCB making skills. So, I have to come up with trade-off, by using slower PWM frequency and larger inductor. Luckily, my component choice so far serves me well (pure luck, not by my grand design :) )

    Regarding the R4, that was due to my lack of knowledge of MOSFET (this is first time I’m creating circuit using MOSFET). I didn’t know how sensitive MOSFET to static. So, I’ve included R4 just in case any static will kill my MOSFET during soldering process, until it’s all connected up to the Arduino Uno board.

    This will be highly dependent on the ration output/input voltage. In my application, I use constant offTime of 10us (although, peeking through my oscilloscope, it’s 15us, must be due to arduino overhead). onTime varies between 1 to 40us. It does fall to audible range most of the time, which is very annoying. I might reduce the offTime next time when I have a chance to play around. I don’t want to change anything yet, knowing it’s working so far.

    @Ty Tower:
    Thanks for the tip. I also don’t know my blog has restriction, now fixed :)

    Thanks for the link. The problem I have with market current offering is, they’re on fancy package. For example, I would love to use LT3791-1 and control voltage and current externally, but this is in 38-Lead Plastic TSSOP. Not to mention the cost as well. My original goal was, creating the el-cheapo version of Genasun boost MPTT converter. Until someone creating an Arduino el-cheapo buck-boost shield, I guess I’ll be still using mine for the near future.

  7. I notice there are plenty of boost 2v to 36v power supply modules on Ebay (from China) priced for only a few dollars including postage. I know some people like rolling their own but these would seem to be a far cheaper answer in many cases.
    Anybody tried them?

  8. @TedS:
    Previous of my project, I’ve used the cheap DC-DC converter (USD15.50) from this website:

    It’s great overall. But, since no MPPT, you have to ensure the load is less than the solar panel output capability. Generic boost DC-DC converter becomes unstable (squeezing much less available wattage from your solar panel) if your load / source power balance is not monitored. I’ve documented the result here:

    So, the question of ‘worthiness’ highly dependent on end user. If I have the time to become the ‘slave’ labour of the DC-DC converter (trying to mimic the MPPT), then yes, that particular converter is awesome value for money.

  9. Sounds like the converter you are using is not designed correctly for your application.
    I wonder what is actually causing the instability?
    I suggest that, as you increase the load, the solar cell voltage would be reducing to a value less than the few volts minimum voltage difference between input and output (battery) voltage that the converter will work at.
    Its internal logic circuitry probably thinks it has been switched off. Then the solar cell volts rise because it has no load. This switches the converter back in operation. This repeats giving the apparent oscillation.
    The moral may be that you need a converter that is both a buck and boost converter at the same time. This will supply power even when the solar cell volts is both greater or less than the battery volts.

    1. @TedS:
      You are correct about the instability due to the apparent oscillation between no load and ‘some’ load, as my el-cheapo DC-DC boost converter shuts itself off once the solar panel can’t supply the desired peak current (and the panel voltage drops significantly).

      Regarding buck-boost capability you mentioned, I’m not sure what you meant (I’m slow). For my particular application, I only need boost mode, as my battery is 10-series Lithium NMC (42V fully charged), with 20V (open cct) solar panel. I’m confined in this setting as I had an absolute bargain on my solar panel. Getting higher voltage panel (48V) is not affordable for me.

      One way of getting around this problem, is to set the current setting lower than the panel output. However, what I found on test day, this means I have to set it much lower, just in case there is passing cloud, and my battery charging time increases significantly. If the converter stabilises automatically (as the sky clears again), that would fix most of my problem, but that’s not what I found. I have to install extra input capacitor and unplug-replug my battery to restabilise the converter.

      If anyone sells Arduino Uno shield for DC-DC boost under USD30 (complete with components), I’m definitely your first customer :). Oh, at least 100Watt of course. I’d settle for cheap boost MPPT charger too! (Come on Genasun, I’ve just found out you’ve increased the price to USD320, bad bad Genasun!)

      1. The voltage of a solar cell at a lower than maximum illumination, rises considerably once you take the current load off it because of its virtual internal resistance and the voltage falls when you reapply the load.
        It’s only under bright illumination that the voltage is more constant with varying loads and the current varies (as the battery becomes full) See typical performance curves.

        I would say that when a cloud passes over, the current falls, due to weak light, the solar cell voltage drops below the minimum converter input voltage and the converter “disconnects”.
        As soon at this happens, the disconnected solar cell rises again because it has no load. The converter restarts which drops the solar cell voltage and immediately repeats the switching process. This is the oscillation and there is no way with your current converter design to stop it.

        Do you have a minimum input voltage figure for you converter for the output voltage you want? See if the solar volts are lower than this when the oscillation starts and it will confirm what I say above.

        Maybe you could put a small timer relay driven by the charging current to switch off charging for say 1 minute when the current falls to the point where the oscillation starts,

        This means it would automatically do what you are doing manually by switching it off.

        Maybe at the instant where the converter disconnects, you might be briefly getting more solar cell volts than battery volts. Some boost converters don’t like this. If this is so, a small diode in reverse (Positive to solar cell) between input and output of the converter would stop this.

        A buck-boost converter will supply a constant output voltage over a + or – range of input voltages compared with output. Then you wouldn’t get this oscillation.
        Buck switching converters are used to say reduce 15v to 5v without losses that normally would happen with just a resistor divider.

  10. Another thought, try a diode between converter output and battery in, positive to the converter.
    This means that when the converter ceases to deliver enough power to the battery, (under a cloud) it’s output voltage will drop as the input drops, hopefully keeping the converter working. It won’t be held high by the battery.

    Some people think boost converters on solar cells can help charge a battery when the cell volts are low (overcast) but they only increase the solar current dropping the cell voltage even lower. The gain is minimal. It is power (I x E) you want and you can’t get something for nothing.
    Better to use simple mirrors to increase the light!

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

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