Introduction: Arduino - PV MPPT Solar Charger

About: I,m an Electronics Engineer. Love to make things work. Believe in Learn by Making it.

There are many charge controllers available in market. ordinary cheap charge controllers are not efficient to use maximum power from solar Panels. The ones which are efficient, are very costly.

So i decided to make my own charge controller which is Efficient, and smart enough to understand the battery needs and solar conditions. it takes appropriate actions to draw maximum available power from solar and put it inside the battery very efficiently.


Step 1: What Is MPPT and Why Do We Need It?

Our Solar panels are dumb and not smart to understand the battery conditions. Assume we have a 12v/100 watt solar panel and it'll give an output between 18V-21V depends upon manufactures, but batteries are rated for 12v nominal voltage, at full charge conditions they will be 13.6v and will be 11.0v at full discharge. now lets assume our batteries are at 13v charging, panels are giving 18v, 5.5A at 100% working efficiency(not possible to have 100% but lets assume). ordinary controllers have a PWM voltage regulator ckt which drops the voltage to 13.6, but no gain in current. it only provides protection against over charging and leakage current to panels during nights.

So we are having 13.6v*5.5A = 74.8 watt.

We loose approx 25 watt.

To encounter this issue i have used smps buck converter. these kind of convertes have above 90% efficiency.

Second problem that we have is non-linear output of solar panels. they needs to be operated at certain voltage to harvest maximum available power. Their output varies through the day.

To solve this issue MPPT algorithms are used. MPPT(Maximum Power Point Tracking) as the name suggests this algorithm tracks the maximum available power from panels and varies the output parameters to sustain the condition.

So by using MPPT our panels will be generating maximum available power and buck converter will be putting this charge efficiently into batteries.


I,m not gonna discuss this in detail. so if you wanna understand it have a look to this link -What is MPPT?

In this project i have tracked the input V-I characteristics and output V-I also. by multiplying the input V-I and output V-I we can have the power in watts.

lets say we are having 17 V, 5 A i.e. 17x5 = 85 watt at any time of the day. at the same time our output is 13 V, 6A i.e 13x6 = 78 Watt.

Now MPPT will increase or decrease the output voltage to by comparing to previous input/output power.

if previous input power was high and output voltage was lower than present then output voltage will be lower down again to get back to the high power and if output voltage was high then present voltage will be increased to the previous level. thus it keeps oscillating around maximum power point. this oscillations are minimized by efficient MPPT algorithms.

Step 3: Implementing MPPT on Arduino

This is the brain of this charger. Below is the Arduino code to regulate the output and implementing MPPT in a single code block.

// Iout = output current

// Vout = output voltage

// Vin = input voltage

// Pin = input power, Pin_previous = last input power

// Vout_last = last output voltage, Vout_sense = present output voltage

void regulate(float Iout, float Vin, float Vout) {<br>  if((Vout>Vout_max) || (Iout>Iout_max) || ((Pin>Pin_previous && Vout_sense<Vout_last) || (Pin<Pin_previous && Vout_sense>Vout_last))) 
 duty_cycle -=1;
else if ((Vout<Vout_max) && (Iout<Iout_max) && ( (Pin>Pin_previous && Vout_sense>Vout_last) || (Pin<Pin_previous && Vout_sense<Vout_last)))
{<br>    duty_cycle+=1;
Pin_previous = Pin;
Vin_last = Vin;
Vout_last = Vout;

Step 4: Buck Converter

I have used N-channel mosfet to make the buck converter. usually people choose P-channel mosfet for high side switching and if they choose N-channel mosfet for the same purpose than a driver IC will be required or boot strapping ckt.

but i modified the buck converter ckt to have a low side switching using N-channel mosfet. i,m using N-channel because these are low cost, high power ratings and lower power dissipation. this project uses IRFz44n logic level mosfet, so it can be directly drive by an arduino PWM pin.

for higher load current one should use a transistor to apply 10V at gate to get the mosfet into saturation completely and minimize the power dissipation, i have also did the same.

as you can see in ckt above i have placed the mosfet on -ve voltage, thus using +12v from panel as ground. this configuration allows me to use a N-channel mosfet for buck converter with minimum components.

but it also have some drawbacks. as you have both sides -ve voltage seperated, you don't have a common reference ground anymore. so measuring of voltages are very tricky.

i have connected the Arduino at Solar input terminals and using its -ve line as ground for arduino. we can easily measure the input volateg at this point by using a voltage divider ckt as per our requirement. but can't measure the output voltage so easily as we don't have a common ground.

Now to do this there is a trick. instead of measuring the voltage accros output capacitor, i have measured the voltage between two -ve lines. using solar -ve as ground for arduino and output -ve as the signal/voltage to be measured. value that you have got with this measurement should be substracted from the input voltage measured and you will get the real output voltage across output capacitor.

Vout_sense_temp=Vout_sense_temp*0.92+float(raw_vout)*volt_factor*0.08; //measure volatge across input gnd and output gnd.<br>
  Vout_sense=Vin_sense-Vout_sense_temp-diode_volt; //change voltage difference between two grounds to output voltage.. 

For current measurements i have used ACS-712 current sensing modules. They have been powered by arduino and connected to input gnd.

internal timers are modified to gain 62.5 Khz PWM at pin D6. which is used to drive the mosfet. a output blocking diode will be required to provide reverse leakage and reverse polarity protection use schottky diode of desired current rating for this purpose. Value of inductor depends upon frequency and output current requirements. you can use online available buck converter calculators or use 100uH 5A-10A load. never exceed the maximum output current of inductor by 80%-90%.

Step 5: Final Touch Up -

you can also add additional features to your charger. like mine have LCD too display the parameters and 2 switches to take input from user.

I'll update the final code and complete ckt diagram very soon.

Step 6: UPDATE:- Actual Circuit Diagram, BOM & Code


I have uploaded the code, bom and circuit. it,s slightly different from mine, because it,s easier to make this one.

Power Supply Contest

Participated in the
Power Supply Contest

Lights Contest 2017

Participated in the
Lights Contest 2017