MPPT Circuit using PIC16F88 with 3-Level Charging

An MPPT as we all know refers to maximum power point tracking which is typically associated with solar panels for optimizing their outputs with maximum efficiency. In this post we learn how to make a PIC16F88 microcontroller based MPPT circuit with a 3-stage charging.

This data was donated by: Mr. hisham bahaa-aldeen (hisham2630@gmail.com)



The optimized output from MPPT circuits is primarily used for charging batteries with maximum efficiency from the available sunshine.

New hobbyists normally find the concept to difficult and get confused with the many parameters associated with MPPT, such as the maximum power point, "knee" of the I/V graph etc.

Actually there's nothing so complex about this concept, because a solar panel is nothing but just a form of power supply.

Optimizing this power supply becomes necessary because typically solar panels lack current, but posses excess voltage, this abnormal specs of a solar panel tends to get incompatible with standard loads such as 6V, 12V batteries which carry higher AH rating and lower voltage rating compared to the panel specs, and furthermore the ever-varying sunshine makes the device extremely inconsistent with its V and I parameters.

And that's why we require an intermediate device such as an MPPT which can "understand" these variations and churn out the most desirable output from a connected solar panel.

You might have already studied this simple IC 555 based MPPT circuit which is exclusively researched and designed by me and provides an excellent example of a working MPPT circuit.

The basic idea behind all MPPTs is to drop or trim down the excess voltage from the panel according to the load specs making sure that the deducted amount of voltage is converted into an equivalent amount of current, thus balancing the I x V magnitude across the input and the output always up to the mark...we cannot expect anything more than this from this useful gadget, do we?

The above automatic tracking and appropriately converting the parameters efficiently is implemented using a PWM tracker stage and a buck converter stage, or sometimes a buck-boost converter stage, although a solitary buck converter gives better results and is simpler to implement.

In this post we study an MPPT circuit which is quite similar to the IC 555 design, the only difference being the use of a microcontroller PIC16F88 and an enhanced 3-level charging circuit.


MPPT Circuit using PIC16F88 with 3-Level Charging
PLEASE CONNECT IC LM358 PIN#2 WITH PIN#1 (NOT SHOWN IN THE DIAGRAM)



The basic function of the various stages can be understood with the help of the following description:

1) The panel output is tracked by extracting a couple of information from it through the associated potential divider networks.

2) One opamp from IC2 is configured as a voltage follower and it tracks the instantaneous voltage output from the panel through a potential divider at its pin3, and feeds the info to the relevant sensing pin of the PIC.

3) The second opamp from IC2 becomes responsible for tracking and monitoring the varying current from the panel and feeds the same to another sensing input of the PIC.

4) These two inputs are processed internally by the MCU for developing a correspondingly tailored PWM for the buck converter stage associated with its pin#9.

5) The PWM out from the PIC is buffered by Q2, Q3 for triggering the switching P-mosfet safely. The associated diode protects the mosfet gate from overvolatges.

6) The mosfet switches in accordance with the switching PWMs and modulates the buck converter stage formed by the inductor L1 and D2.

7) The above procedures produce the most appropriate output from the buck converter which is lower in voltage as per the battery, but rich in current.

8) The output from the buck is constantly tweaked and appropriately adjusted by the IC with reference to the sent info from the two opamps associated with the solar panel.

9) In addition to the above MPPT regulation, the PIC is also programmed to monitor the battery charging through 3 discrete levels, which are normally specified as the bulk mode, absorption mode, an the float mode.

10) The MCU "keeps an eye" on the rising battery voltage and adjusts the buck current accordingly maintaining the correct Ampere levels during the 3 levels of charging procedure. This is done in conjunction with the MPPT control, that's like handling two situations at a time for delivering the most favorable results for the battery.

11) The PIC itself is supplied with a precision regulated voltage at its Vdd pinout through the IC TL499, any other suitable voltage regulator could be replaced here for rendering the same.

12) A thermistor can be also seen in the design this may be optional but can be effectively configured for monitoring the battery temperature and feeding the info to the PIC, which effortlessly processes this third information for tailoring the buck output making sure that the battery temperature never rises above unsafe levels.

13) The LED indicators associated with the PIC indicate the various charging states for the battery which allows the user to get an up-to-date information regarding the charging condition of the battery throughout the day.

14) The proposed MPPT Circuit using PIC16F88 with 3-Level Charging supports 12V battery charging as well as 24V battery charging without any change in the circuit, except the values shown in parenthesis and VR3 setting which needs to be adjusted to allow the output to be 14.4V at the onset for a 12V battery and 29V for a 24V battery.

The next article gives the access to the entire source code for the above discussed MPPT circuit using PIC16F88

Please Share this Post:



60 comments:

  1. sir,
    I want to design the same circuit for our mobile battery Having rating 2900 mAH/11.02Wh nominal charge voltage 3.8 V.Limited charge voltage 4.35 V as per any anroid mobile battery.Can I make the charger portable using the same pic based mppt technique or I should go for Linear technology or any other method mppt method to make the circuit portable.
    2.How can I add auto cut off feature in this circuit.

    ReplyDelete
    Replies
    1. Shailesh, according to me it would be an overkill to use the above design for a modest requirement like yours.

      An MPPT might not be required for your application, rather a simple buck based smps charger would be more than sufficient.

      here's one design which is extremely portable, and extremely customizable and might suit your application well:

      http://www.homemade-circuits.com/2015/05/5v-pwm-solar-battery-charger-circuit.html

      for including an auto cut-of you could include the second circuit from the following link in the proposed design:

      http://www.homemade-circuits.com/2011/12/how-to-make-simple-low-battery-voltage.html

      Delete
  2. Sir can u please explain the function of voltage follower and current follower in the ic2 stage or suggest some other article related to that

    ReplyDelete
    Replies
    1. Vijay,
      voltage follower is a configuration where the input voltage to the opamp is simply carried forward across its output but after buffering through the opamp so here opamp acts like a buffer.

      the current amplifier monitors the voltage across the sample resistor and switches its output ON or OFF depending upon the set threshold...it's a comparator actually

      Delete
    2. I have not yet covered these topics in this website, soon I may include these...

      Delete
  3. Can you see any problems using this circuit to charge 39.5 V 50AH LiFePO4 battery pack?

    ReplyDelete
  4. Could this circuit be used for charging a 50AH 39.5V battery pack? Would replace the solar panel with a power source cause any issues?

    ReplyDelete
    Replies
    1. it would be possible, just make sure to change the component values accordingly which are recommended to be changed for the 24V version ....through cross multiplication.

      Delete
  5. Hi, has anyone built this and do you have any details on the inductor L1, i.e guage of wire, toroid size and number of turns?

    Regards
    Mac.

    ReplyDelete
    Replies
    1. Hi Mac,
      You will get ready inductor available in market.
      Regards,
      Ram

      Delete
  6. what maximum current it can handle please

    ReplyDelete
    Replies
    1. as per the rating of Q1...please check it through its datasheet

      Delete
  7. This is a copied design from silicon chip , an australian magazine

    ReplyDelete
  8. Dear sir
    can u giv ckt diagram and ideas of PWM/MPPt based solar street light charge Controller for 200Wp panel and 200Ah battery

    ReplyDelete
    Replies
    1. Dear Pradeep,

      you can try the following design

      http://www.homemade-circuits.com/2015/11/simple-solar-mppt-circuit-part-2.html

      Delete
  9. Hello sir,

    I want to charge 48 v 175 AH battery with 250 W solar panel . (Mppt voltage 30 v, MPPT current 8 A).
    I want to charge the battery with Mppt and current control. Can above circuit be useful for me?

    Please suggest the solution

    ReplyDelete
    Replies
    1. Hello Nikhil, the above circuit is specified for 24V max, so it cannot be used for 48V application.

      and a 30V 8amp supply cannot be used for charging a 175AH battery with any modification....the current should be at least 25 amps

      Delete
    2. Thank you sir for your reply.

      The basic idea is to charge batteries of E vehicle. Limitation is space on roof of vehicle. Maximum 1 panel can accommodate on roof. Though charging current is less but it will keep battery charging whole day. You may please suggest suitable solution.

      Delete
    3. you will need a boost MPPT charger circuit which can boost the solar panel voltage to 48V.

      or you can use an external boost circuit for converting the 30V from the MPPT to 48V @ 5amp

      you can try the last circuit from the following article, and modify the transformer appropriately for getting the desired results

      Delete
    4. here's the link

      http://www.homemade-circuits.com/2013/09/half-bridge-mosfet-driver-ic-irs21531d.html

      Delete
  10. WHAT IS THE VALUE OF RX RESISTOR ?
    REGARDS KAROL.

    ReplyDelete
  11. Where to is connected pin2 of LM358?

    ReplyDelete
    Replies
    1. It will connect with pin#1....mistakenly not shown in the diagram....

      Delete
    2. Thank you very much. Karol.

      Delete
  12. Dear sir,
    iam kishore bhadra, i want to know about sinewave inverter. Can I start the project using that code ?

    ReplyDelete
  13. please give inductor details ie how to built that

    ReplyDelete
  14. hi sir,can i use this circuit to charge higher ah batteries ,such as 180 amp.or do i need to change some in circuit.

    ReplyDelete
    Replies
    1. yes it is possible provided Q1 is appropriately rated for handling the specified amount of current....

      Delete
  15. Hi sir,
    Can I use this circuit for my 1600 VA 24 volt solar inverter and 250 watt 24 volt solar PV panels? I am using two batteries in series of rating 12 volt 220 VA each.
    Thanks,
    Ram

    ReplyDelete
    Replies
    1. You can try it out, just make sure Q1 is appropriately upgraded to handle the high current....

      Delete
    2. Sir,
      Thanks for your reply. Can you explain, what exactly do I have to do to Q1 ?

      Delete
    3. Also I would like to inform you that I am purchased 4 nos. of solar PV panels to connect in parallel, each rating of 250 watt, 24 volt.

      Delete
    4. Ram, you will have to select Q1 such that it is able to handle much above 24V and current in excess of the result obtained by solving 1600/24

      that's great, you can now go ahead with the project....wish you all the best

      Delete
    5. Hi sir,
      For above specs, can I use 40V, 50A P-CHANNEL POWER MOSFET (UTT40P04) as Q1 ? Or please suggest voltage and current for Q1 and code number if any please.

      Delete
    6. Hi Ram, you can try it, but you will need to mount it on a large heatsink

      Delete
    7. What is S1 (Equalise) stands for? I dont get its meaning. Please explain.
      Thanks,
      Ram

      Delete
    8. you can search it online...."what is equalization in battery charging"

      Delete
  16. This comment has been removed by the author.

    ReplyDelete
  17. hi sir,whats about d1 and d 2 to charge higher voltage battries.Do i need to change them ,because they are in series of battry.Dr they are able to handle higher voltage and current.thanks

    ReplyDelete
    Replies
    1. Hi Ravipal, yes you are right, those diodes must be equally rated as Q1 in terms of handling the specified load voltage and current

      Delete
    2. hi sir,Thanks for reply,Can you please specify the value of Q1 and D1 ,D2 to charge 96 volt 150 ah batteries.thanks

      Delete
    3. ravipal, you may have to check online for this to find the favorable device...you can search for "120V 10amp mosfet datasheet" for the required results

      Delete
  18. Dear Sir,
    Circuit consist of 68,000 micro F DC capacitor. It costs too much & require big space. Is there any alternative for this?

    Thanks,
    Ram

    ReplyDelete
    Replies
    1. Ram, higher capacitor value will allow proportionately higher current for the load and will prevent the output from dropping with higher loads....nevertheless you can dimension it as per your load wattage through some practical experimentation.

      Delete
  19. sir, can i use 2 or three irf 9540 in parallel to get higher current,and same in mbr 20100ct diode.please reply.thanks

    ReplyDelete
    Replies
    1. Ravipal, yes that's possible for the mosfet, but if you want to use parallel diodes, then make sure to attach the sets over a common heatsink so that those diodes are able to share the heat and conduct uniformly

      Delete
  20. I am a final year student at the University of the West Indies. For my final year project I am building this same exact circuit to charge a 12V lead acid battery using a 24V, 5A solar panel that i constructed for myself. Do I have to use a 12V 10A DC fuse?

    ReplyDelete
    Replies
    1. you can connect it if you wish to, there's nothing critical about it. the circuit is current controlled anyway

      Delete
    2. ok thanks. what voltage to set VR2 at? or how should i set VR2?

      Delete
    3. sorry I have not yet studied that since this is not my design...and since it's a programmed one

      Delete
  21. This comment has been removed by the author.

    ReplyDelete
  22. Hi sir
    This Srinivas
    WHAT IS EQUALANT TL499À
    Thanks & regards

    ReplyDelete
    Replies
    1. Hi Srinivas, I could not figure out the reason of using TL499, when an ordinary 7812 could also work, you can try a 7812 and check the results...

      Delete
  23. Hi. Could this circuit be used for charging a 10v 640ah battery pack from solar panel 30v 10 amp to obtain 30 amp carging current? Thanks.

    ReplyDelete
    Replies
    1. Hi, your battery will require 10 x 64 = 640 watt or 64 ampere for charging whereas the panel is rated to produce only 30 x 10 = 300 watts....so it's not possible

      Delete
  24. Hi, I really like your circuit. I understand the LM358 voltage follower circuit for voltage measurement however I don't understand the use of the 2.2k resistor.

    I would also be most grateful if you could explain the purpose of the 1.5k, 8.2k, and 68k resistors on the LM358 for low side current sensing as I am trying to do the mathematics to work out the voltage drop in mV I should expect over the 0.01 ohm currents sensing resistor. I am basing my theoretical calculations using a 20 Amp supply from the panel and the 0.01 Ω resistor. My raw calculation is 200mV however I am guessing the resistor circuit adds some gain.

    V = I x R
    V = 20 Amps x 0.01 Ω
    V = 0.2 Volts
    V = 0.2 x 1000 = 200 mV

    Any help you can provide would be greatly appreciated.

    ReplyDelete
    Replies
    1. Hi, thanks, however this is not my circuit, it was sent to me by one of the avid readers of my blog for publishing, and that's the reason I wouldn't be able to answer your questions precisely.

      the 2k2 resistors doesn't make sense for sure unless there;s something that may be linked inside the MCU with these resistors, so you may try removing it and see if it makes any difference.

      the resistors 1.5k, 8.2k, and 68k at the inverting input appears like some kind of hysteresis arrangement, but interpreting this network looks confusing since pin#3 is grounded

      you an see a similar explanation here:

      http://www.homemade-circuits.com/2017/01/universal-battery-charger-circuit.html

      Delete
  25. Hi, Thank you for your reply. I had a look at the link you provided regarding hysteresis and noted the dual detection features of Op Amps. This has resolved another issue I have so thank you very much for your link.

    ReplyDelete
    Replies
    1. You are most welcome, and glad I could help!!

      Delete

Please Note: If you find any DEAD link starting with http//:homemadecircuitsandschematics.blogspot.com, please replace it with http://www.homemade-circuits.com/ for making it visible and alive again.