Arduino MPPT Solar Charger Shield


A friend has approached me regarding his solar project. He wants to install a solar panel together with a battery and an inverter in order to have power at his allotment garden. He had looked at a hobbyist project where an arduino was used to build a MPPT (maximum point of power tracking) charge controller. I took a look at the design, liked a lot of what I saw and decided to build something similar.


The basic idea behind an MPPT solar charger is simple. A solar panel has a certain voltage (in the region of 17 to 18 volts for a 12 volts pannel, somwhat dependent on temperature) at which it provides most power. So as long as the battery needs charging, you want to pull just as much current to reach this voltage. But once the battery is full you need to avoid overcharging the battery. So you want to maintain a maximum voltage for your battery (somewhere around 13.8 volts for a 12 volt lead acid battery) and no longer care about the pannel’s voltage.


So the charger needs to convert an input voltage of 17-18V to an output voltage of 12-14V as efficiently as possible. Obviously, a step-down (aka buck) switching converter is ideally suited for the job. However, a typical DC-DC converter is designed to maintain a stable voltage at it’s output, independent of it’s input voltage. As described above, our requirements here are different.


Switching converters are controlled by the duty cycle of a (typically) fixed-frequency PWM signal. So a microcontroller could be used to do the job. In most applications, this wouldn’t work that well because a microcontroller would be too slow to react to sudden changes in load or input voltage. But this is not much of a concern in our solar application: Sun intensity changes within seconds at best and the battery will absorb any sudden changes in load. So if we adjust our duty cycle a few times per second we’ll be more than fine. And that’s easy to do with a microcontroller.


The next step was to figure out at which frequency to run our converter. An arduino runns at 16MHz. At a 8-bit resolution, this gives us a maximum PWM frequency of 62.5kHz. That’s a pretty slow speed for a switching DC-DC converter nowadays. Most modern designs run in the hundreds of kHz to a few MHz. The main reason of using higher and higher switching frequencies is size. The higher the frequency, the smaller the inductor can be. For us, using a somewhat bigger inductor is totally acceptable. And in terms of efficiency, a lower frequency is even preferable since it reduces switching losses.


The project here is intended mainly as a proof on concept. I expect it to be fully functional but it will consume quite a bit of power while sitting idle. The display (including backlight) is always on, the same goes for all the other components. But the main drain on the battery will be the Arduino itself which consumes around 50mA when running at 16MHz. That might not sound like much but it will add up during the many hours the solar panel doesn’t produce any power. The system will be installed in Zürich, Switzerland so you can’t count on having 8 hours of sunshine every day. In winter, there might be snow on the panel, preventing it from producing anything for weeks in an extreme case. So a productive system should draw hardly any current (say <1mA) when not doing anything useful.


At least for now, the we’ll be using a 30W 12V monocrystaline panel and a 45Ah car battery. So I’ve scaled this converter to comfortably handle 30W input power which translates to about 1.8 amps at the input and 2.5 amps at the output.

As deba168’s design, I’m using a synchronous buck topology. If you’re new to switchers, you might want to check out this wiki page. If you’re serious about designing your own you might want to read Sanjaya Maniktala’s ‘Switching Power Supplies A – Z’, it’s a great book. I’ve also read his other two books on the topic but this is the one I love the most, especially to start with. I’m also using the same half bridge driver (IR2104) even though I find the 540ns off time somewhat excessive. But I like the enable/pwm input signals as opposed to having to drive each fet individually and I found this feature to be somewhat rare.


Apart from that I’ve really done my own design, mainly using parts I’ve still had from previous projects. As most stuff I build, it’s entirely SMD, except for the input and output capacitors. Not only are SMS designs smaller in size. The parts are much easier to source (and often cheaper) than conventional through-hole components nowadays. And contrary to popular belief, with a bit of practice I find them easier and faster to solder.

The FETs are IPB136N08N3, a quite large surface-mount type that I use quite frequently. They have a 11mOhms Rds-on resistance which will be great for efficiency. They are also easy to drive in terms of gate capacitance. Probably a bit oversized for the 2.5 amps we’re trying to switch here but I still have some here and they’re not expensive, around 70 cents each. The inductor is a 100uH Coilcraft MSS1583 with a resistance of 0.103 ohms and a 2.8A current rating. 100uH is a bit much at full load, 68uH would easily do. But the system will spend most time at moderate loads (remember, this is not California). I’ve ordered a 68uH as well and intend to use it for a later design or maybe to see what difference it makes. Input and output caps are quite a bit oversized as well, 680uF 35V at the input and 820uH 25V at the output. They are from the Panasonic FR series which I like using for my switchers since they work well at frequencies up to a few hundred kHz while being afordable and having very high ripple current ratings.


I’m doing voltage and current sensing at both input and output. I’ve decided to use conventional high-side, shunt resistor based current sensing. The Texas INA213 are fairly precise, work up to 26 volts and have a fixed gain of 50. Also here, I still had some left over from my dummy load project. Most components are much cheaper if you buy 10 in stead of just one or two so I tend to buy 10 😉

I’ve also added a standard 2×16 characters LCD display so I can see what’s going on. And you may have noticed that I’ve put a zero ohms resistor at several places. This will enable me to easily measure current consumption of the respective sub-circuit. As mentioned before, current consumption will play a major role in the final design so I’m interested to see how much juice is used by certain components under real-life conditions.

Besided the connectors for the panel and the battery, I have added a separate connector for the power supply. This is handy for early testing and programming. Just connecting this supply will power up the entire system. The arduino, the display, the converter and all. But there is not yet any load at the converter’s output and no supply at it’s input. So I can start programming the Arduino, start measuring and displaying voltages and currents and even turn on the converter to see if everything behaves as expected. And since there is nothing at the converter’s input and output, not much can go wrong. I don’t risk blowing up the FETs due to a bug in the program or a problem with the board. Only once I’m confident that everything works as expected I will connect a panel and a battery. At that point, the 12V input can just be connected to the battery as well.


I’ve written a simple sketch for the Arduino that measures voltage and current at the input and output and displays the result on the LCD. Once the input voltage exceeds a certain threshold, it will enable the half bridge driver and start switching. It starts at a duty cycle that will produce an output voltage equal to the current battery voltage. That means that no current will flow to the battery yet so the converter can start up with no load. Once the switcher is turned on, the Arduino will adjust the duty cycle about 4 times a second. If the input voltage is above its optimum and the battery has not yet reached its maximum voltage, the duty cycle will be increased by 1/255. If either the battery voltage is too high or the input voltage is below its optimum, the duty cycle is decreased by 1/255. There are also some checks for overcurrent at the input and output.


The switcher is turned off when the input voltage or the output current falls below a pre-defined threshold. This is a synchronous converter so current can flow back from the battery to the panel. We can’t just wait for the input voltage to fall. As long as the switcher is on, the input will never fall because energy is pumped from the battery to the panel. A synchronous buck converter is just the same as a synchronous boost converter with its inputs and outputs inverted. So we need to make sure current is actually flowing to the battery. Luckily, a car battery will always draw a clearly non-zero current at 13.8 volts, even when fully charged. So when current stops flowing to the battery, we know the panel is no longer able to provide any power and we can or rather must turn the converter off.


This post ist getting rather long so I’ll stop here and will write another post later about how the circuit has been performing and what I have learned so far. I guess this project will turn into a little series, maybe with further (and hopefully improved) versions being developped. Looking forward to that.

Before I forget: Here’s the eagle files as well as schematic and layout PDFs as a zip file: SolarCharger_Rev1.

Update: Click here to see how the shield performs or here for an overview over this project.

Update 2: Now there is an entirely new design.

47 thoughts on “Arduino MPPT Solar Charger Shield”

    1. Hi Jari. Thank you for sharing your interesting link. Cutting power consumption is definitely doable. My approach is rather to replace the arduino with a on-board MCU running at 3.3 or 2.5 volts and running at a much lower frequency (in the tens of kHz) when not doing much. This way I can still keep monitoring things and speed up the MCU only when the converter is on.

      1. Hi, what I had checked some time ago, is that only with internal 8Mhz and 3.3V and lowpower library (as an example) you can get the best cuting power consumption. Down to tens of KHz reduces also the power consumption, but only a litlle bit.

  1. I have been meaning to build a solar charge controller tracking and logging the voltages over wifi. I will follow your experiments with interest. I am in Australia and I think/hope there will be enough left over power to run a UDOO Neo for logging even in winter.

    Have you done any simulations on solar harvest potential where you live ? This is some work we did over Adelaide, Australia

    1. Hi whatnickd. Thank you for sharing your thoughts and previous work. To be honest, I havent’t done any analysis on the potential here in Zurich, Switzerland. I thought I’ll hook everything up, do some data logging and see what I’m getting out of it 😉 I’m sure it’s possible to do data logging even in winter, maybe not with a power-hungry arduino but definitely with a home-brew lower power design.

    1. Yes, it is. I will follow up with a post on testing and software where I will also post the sketch. Feel free to use it for whatever you like.

  2. I like your write up, and thank you for sharing your designs!

    Have you considered methods to alter your charging voltage based on the battery temperature? In cold weather you may need higher charging voltage and in warm weather lower voltage.

    Depending on the exterior design of the enclosure (mostly shading and air flow) the battery can get quite warm in sun.

    Without compensation you may find your battery lifespan is much shorter that expected.

    1. Hi EMS. Totally correct, the maximum voltage for a lead acid battery is quite dependent on temperature. So you have to set a conservative maximum voltage or measure the temperature and compensate for that in software. In a later version I will definitely go with the second approach. In this prove-of-concept I didn’t do this. Also, the ideal panel voltage depends quite a bit on temperature. The higher the temperature the lower the power-maximizing voltage. Quite relevant since the panel might heat up significantly in the sun.

    1. Hi Jonas. Thanks for your comment. You are absolutely correct, all my boards here are milled, not etched. I’m using a LPKF Protomat S62 that I happen to have access to. Getting started with this machine and all the CAD/CAM stuff was kind of hard but now it’s quite quick and easy for me to make a prototyping board like this one. The process is not suitable for more than a few pieces as it almost doesn’t scale with quantity but really nice for prototyping. I’m planning to do a post on how I make these boards once I get to it.

  3. thanks ….i was mis interpret the dc to dc conversion process inside the mppt controller

    simple and straight forward power conversion
    say we have a panel that produces 18vmp and 3amp
    in the first case the buck will take the 18v@3a
    and will trun it into 13.5 @4 ,…you see we have gained a full amper…..while power is the same at the both sides is the same which 18*3=13.5*4 = 54 watt

    the problem is that the panel voltage is fluctuating and current as well controller dont know if this fluctuating
    is because the dc to dc is loding the panel drawing too much current…or it is external factors (heat…brightness)
    a panel with 18vmp@4amp should see load at….18/4 = 4.5 ohm….and it is the duty of dc-to-dc and mcu to let see this

    basically the dc to dc will trun almost any voltage to any voltage …but the question does it produce output from voltage source at the voltage source’s maximum power?

    dc to dc that designed to produce 13.5 @5.3a out of 18v@4a will load down to death solar panel that have 17v@2a …and at the end it wont even harvest its power
    which is 32 watt

    so the only solution is ..HOVER ..yes it tried to reduce the output charging current and look for increase in voltage at the panel and then increase the charging current a bit …at all the time …some how some where there is a regester inside the microcontrooler that keeps on registering the i*v(power) and determined the DIRECTION at which the mcu should go ??

    should it go towrds reducing current drawn from panel high voltage
    should result …if not then ,,it is not a loading problem …it is just sun and tempreture ….ok what about drawing more current ??? does panel voltage stays the same ok …
    ………..AND at all this fluctiation …the output voltage is the same it is the battery charging voltage which is 13.5 or more according to battery state

    after all this my question is AM I RIGHT?????????

  4. Hi Wael
    If I understood you correctly you are right. Basically everything is fluctuating. Because of sun intensity, how full/empty the battery is, the load demanded from the battery (you might use power at the same time as you are harvesting energy from the pannel), temperature, whatever. And yes, you need to find the sweet spot maximizing the power you are harvesting…

  5. Hi ,
    Thanks for this project . Is it possible to have a list of what is needed (hardware , components , … )
    Many (many!) thanks…

  6. Nice article ! I want to build this for myself but i have a hard time finding IPB136N08N3 FET, can you sugest an alternative ? Is IRFZ44N a good replacement ?

    Thank you!

    1. Hi Alex

      There are probably hundreds of good replacements for the type I used. I just used something i still had laying around. If you specifically look for it you almost definitely find something even better.

      Things to look out for (in brackets the values for the type used):
      -Sufficient voltage rating (anything above 30 volts should be more than save, this one has 80 which is overkill)
      -Low Rds on. This means high efficiency when on. (13.6 miliohms)
      -Low gate charge. This means low switching losses. (18nC @ 10Vgs)
      -And of course it should be an N-channel type

      Gate charge is somewhat less critical here due to the low switching frequency. I just checked the IRFZ44N’s datasheet. Good choice, quite similar performance. Go ahead and let me know how it goes.


  7. Hi Lukas,

    I have seen your post about the ARDUINO MPPT SOLAR CHARGER. I am also trying to do this project.

    I would like to ask if I can buy your product of this MPPT controller for my reference?

    Many Thanks!


    1. Hi Sam
      I don’t sell kits of that solar charger (at least not yet) but the design is open source, feel free to take the eagle files and get a board made.
      cheers lukas

  8. Hello,

    As he said it here:

    Update : 29.07.2016

    I am no more working on this project due to some issues.This controller is not working.

    So don’t try to build, if you don’t have enough knowledge on this field.

    You may take ideas from this project.

    So you claim that your design is working and worth to build?

    Although solar panels and even mppt chargers getting cheaper by year there are way too many bs ripoff products on ebay advertise themselves as mppt while they are pwm or a broken pwm implementation:

    For example all those MPPT white boxes -T -M series (with the temperature sensor jack on top), no wonder that the sellers never upload pictures from the inside because it would be obviously not have a coil.

    Anyway around 100 eur you will find real ones like:

    But how good they are who knows again, there are so many of them on ebay that hard to find reviews. I planning to build my own this summer also for learning purposes with grid standby functionality.

    1. Hi Bratac
      I suspect there is a firmware issue with that design on instructables that keeps burning the FETs. I’ve had a similar issue with a very early version of my software where I turned the converter on and off rather carelessly. After I have improved the software I have not burned a single FET and the converter works as it should. I will show a revised version on my blog probably this week that improves on a lot of aspects and is more of a production version than a prototype.

  9. Hello,

    Excellent work, I can’t wait to read that as well!
    If you want to reduce the consumption of your circuit you should go with SparkFun Pro Micro or even go down to micro amps level with barebone Atmega328P.

    Although I want to build a system which powers 7/24 running ARM devices (raspis, orangepis, routers) so I would not care much about an extra 50-100mW consumption from the charge controller. I have these all on a PicoUPS right now, only consuming around 10-12Wh. When I built the system I did so in mind with switching this to a hybrid solar system where everything would be 100% powered by Solar power and the grid would only kick in when the lead acid batteries fall under a critical voltage (solar panels are not able to charge them enough anymore).

    Also introducing some protections in your circuit eg: reverse current from the battery -> solar panel, fuses, polarity check would be nice.

    1. Hi Bratac

      Some fuses are definitely needed but I’d rather locate them very closely to the panel and the battery, respectively. Polarity protection using diodes is rather costly in terms of efficiency so I’ve dropped them. Usually, one sets up the charger and panel and battery only once (or at least not very often) so I think it’s reasonable to expect the user to exercise some caution…

  10. battery 12v 100Ah

    Pmax = 140 Watt,

    Isc = 8.39 A,

    VOC = 22 V

    What is all the changes to hardware and software?

    1. Software should not need any changes. but you need a much bigger coil (higher current rating, lower DC resistance) but about 4 times lower (not higher) inductance. You will also need much higher current rating of the capacitors. That typically means more and/or bigger capacitors. The Mosfets should still be fine.

  11. Hello Lukas,
    Thanks for sharing your work.
    I was wondering what sort of changes will I have to make in order to use a 100 Watt solar panel.
    Thank you

    1. Hi Diana
      First of all, you can use this board as-is with a 100W panel. The charger is smart enough to not pull more current than it can handle. Besides, a nominally 100W panel doesn’t produce more than 30 watts much of the time.
      If you really need 100W peak power you’ll need to make a few changes. Most components will work just as well for 100W. The mosfets should be fine for example. What you’ll need is a coil rated for more (~10amps) current but with less (not more) inductance. Here, I’ve used a 100uH coil which was already a bit much. I’d use something like 22uH at 100W. Maybe you can even use the same physical size but the 22uH version to get the current rating you need. Then you need more capacitors (or larger ones) at both the input and output. If you use the same caps as here, you’ll need about 3 each. The relevant parameter is not primarily the capacity but rather their current handling capability.
      Hope that helps

      1. Lukas thank you for the quick and detailed reply.
        I really appreciate you taking the time to get back to me.
        Just to make sure we are on the same page, I intend to make version 1 (incorporating Arduino) using a 100W panel.
        Solar Panel Link “”
        I intend to use 12 V 45Ah battery like you.

        So from what I understand here is what I’m changing:

        Use 22uH inductors instead of 100 or 68 uH
        (would MSS1583-223ME be fine for this) ?

        About Capacitors:
        I know you used 680uF 35V at the input and 820uF 25V at the output.”
        What do you recommend I use ? (if possible please specify current rating as well).

        Thank you

      2. I have assembled a list of parts I’m going to use, can you give me thoughts on it ?
        Do you want me to paste the list here ?
        Thank you

  12. Hi Lucas,
    Thank you for sharing your design. It is really useful. I want to build your design. I will use 10w solar panel and 12V 7Ah lead acid battery. What should I change on design or software ? I try to calculate buck converter side but I am confused. How much inductor and capacitor should I use? if I use higher or lower value than calculated one , what happened ? Thank you so much

    1. You don’t have to change much if you don’t want to. With less power you need less capacity, but leaving it as it is won’t hurt. Same with the current rating of the inductor. Conversely, the inductance needs to be increased, not decreased. But the 100uH I’ve used for 30 watts were a bit on the high side so that will work for 10 watts as well, at least with the capacitors as they are. If you have a choice, you maybe want to increase the inductance to 220uH or so. All those values are not that critical as long as they are about right and can handle the current.

        1. A great book to learn this kind of design is Switching Power Supplies A-Z by Sanjaya Maniktala. One aims at 20-40% ripple current at full load and picks the inductance accordingly. The capacitors are mainly chosen by their ripple current rating, i.e. they need to be able to handle the current ripple. If they fulfill that requirement, you usually have more capacitance than you need. Also, my designs tend to be on the safe side, i.e. rather have too much inductance (which would be too costly for high volume production),

          1. So as you said, your design requirements my design aim ( 10W solar panel and 12V 7Ah lead acid battery) . Thank you so much Lukas. One more question I want to ask. I saw your new design of mppt. Can I adapt your PIC design to arduino design ? Is it possible to achieve this by changing PIC to Arduino ?

          2. depends on what you really want. except the USB stuff, it could probabely be done with an Arduino as well. But you’ll be re-writing a lot of code, expect to spend a lot of time… And besides that, the Arduino’s frequency only 16MHz severely limits its ability to operate the converter at a reasonably high frequency which makes the the whole design physically bulkier

          3. Dear Lukas, I calculated according my system ( 10W panel, 0.833 A output current, 16V input voltage, 12V output (battery side) voltage, I take %35 current ripple and %1 voltage ripple. When I calculated L=202uH and C=102uF. So you said that You can choose capacitor higher value. But What about inductor? If I use 100uH like your design, What problems do I encounter? I’ve asked so much question but I want to understand. Thank you for your patient

          4. In that case I’d go for a 220uH inductor. Seems a perfect fit. For the capacitors: You can’t have too much capacity in a design like this and the minimum capacitor size is often determined by current rating rather than capacitance. So there’s nothing wrong with, for example, using one of the 470uF cap I’m using in my design. That panasonic FR series handles current very well, is inexpensive and offers low ESR which is another important consideration.

  13. My comment is disappeared? Is it needed to be approved? If not, I can write again

  14. Dear lucas, I have build the circuit with some adding circuit. I made pcb. And now I am trying to test pcb. But I have some problems for mosfets. Mosfet1 is always open when 12V is on circuit and Mosfet2 is closed. Could you ask you something if you write your email or send a mail if you are convenient ? Have a nice day.

    1. Hi
      Sorry for the late reply, I’ve moved to a new place so the last few weeks were somewhat chaotic. I’d suggest you write some debugging code, e.g. toggling the mosfet gates every 10 seconds or so. Then you can check if the signal really arrives at the mosfet driver and at the mosfet gates as intended and observe what the mosfets do. A mosfet that is always closed no matter what is most often destroyed and always shorted…

  15. hi,
    i am having a problem burning low side mosfet. why is it burning always everytime i connect to battery?
    i am using your first mppt using arduino.

    1. Very likely it’s a software issue. the low mosfet must never, ever be on continuously. otherwise it will cause a short. maybe try the circuit without the 2 mosfets installed and see what your software does..

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.