Introduction: Arduino - PV MPPT Solar Charger

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.

IF YOU LIKE MY EFFORT THAN PLEASE VOTE THIS INSTRUCTABLES.

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. even 90% is considered worst.

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.

Step 2: HOW MPPT WORKS?

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))) 
{
    
if(duty_cycle>0) 
{
   
 duty_cycle -=1;
   
 }
   
 analogWrite(buck_pin,duty_cycle);
 
 }
  
else if ((Vout<Vout_max) && (Iout<Iout_max) && ( (Pin>Pin_previous && Vout_sense>Vout_last) || (Pin<Pin_previous && Vout_sense<Vout_last)))
{
if(duty_cycle<240) 
{<br>    duty_cycle+=1;
    
}
    
analogWrite(buck_pin,duty_cycle);
  
}
  
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

UPDATE:-

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

Comments

author
ronakpatel5391 made it!(author)2017-06-07

can you tell me about mosfet driver ic ?

which one you use ?

author
tytower made it!(author)2017-05-20

Well firstly a correction 12V lead acid batteries are fully charged at 12.7V.

Secondly couldn't you put the code in an arduino text file ".ino" for easy download

author
abhiV4 made it!(author)2017-05-21

current code is highly customized for personal use. i'll clean it up and upload.

and about batteries you are right but wrong also. A lead acid battery needs higher voltage i.e. 13.2 - 13.8 volts to charge properly. this voltage is considered as Float charging voltage. also if battery is deep discharged below 30% than a voltage of 14.2 - 14.8 volts is required to fast charge the battery, it,s known as Boost charging. this type of charging is required compulsory once in a month to remove sulfation from battery plates thus increases battery life.

now you are right because a full charge battery have 12.7 volts at resting condition. but it requires higher voltage to force the current into the battery.

author
tytower made it!(author)2017-05-31

A few tenths of a volt only . Any voltage over whatever the battery voltage sits at will start a current flowing . Going to say 13 Volts is sufficient . What do you think we have all these catchy names for ? . The manufacturer says , yeh- yeh- Boost charge it yeh. I'm saying don't be duped into destroying your batteries .

author
HarryB80 made it!(author)2017-05-22

Thats spot on, well explained.

author
nepcono made it!(author)2017-05-22

Hi looks great I want to built something like this. First I want to buy a set solar panels, charging station and battery but this turns out quite expensive.

Your approach looks promising but do you have building plans, bom, and code.

Awaiting your reply.

author
abhiV4 made it!(author)2017-05-28

just updated all things. thank you.

author
abhiV4 made it!(author)2017-05-26

BOM differs with power requirements of user. But only values of capacitor and inductor are changed.

And yes i do have code but it's messed up. I'll clean it up and post a clean code here to avaoid any risks. Will also upload the complete ckt to build this.

author
Utsav25 made it!(author)2017-05-28

Excellent project! I was planning to make a MPPT controller for a long time for my 50W system but was not able to find a good tutorial. I would like to make this project. can I have the arduino code for this project? Also I would like to know how to drive the MOSFET gate with 10volts? Thank you!

author
abhiV4 made it!(author)2017-05-28

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

author
hemaraj made it!(author)2017-05-20

can we integrate? both buck and boost converter in it.

author
abhiV4 made it!(author)2017-05-20

Yes we can do this. Code should be modified to control the boost converter as well.

But I don't see any advantage of doing this in a solar charger as solar panels always output higher voltage than nominal 12v. So we only need to lower it down. But technically we can do this. I have done it in buck boost converter project.

author
tytower made it!(author)2017-05-20

If you do not agree check the battery university web site for battery data

About This Instructable

2,460views

61favorites

License:

Bio: I,m an Electronics Engineer. Love to make things work. Believe in Learn by Making it.
More by abhiV4:Arduino - PV MPPT Solar ChargerWireless Power Transfer PrototypeRaspberry Pi Tutorial
Add instructable to: