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) {  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) `
```{    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.`
```  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.

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.<br><br>Your approach looks promising but do you have building plans, bom, and code.<br><br>Awaiting your reply.
<p>BOM differs with power requirements of user. But only values of capacitor and inductor are changed. </p><p>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. </p>
<p>Well firstly a correction 12V lead acid batteries are fully charged at 12.7V.</p><p>Secondly couldn't you put the code in an arduino text file &quot;.ino&quot; for easy download</p>
<p>current code is highly customized for personal use. i'll clean it up and upload.</p><p>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.</p><p>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.</p>
Thats spot on, well explained.
can we integrate? both buck and boost converter in it.
<p>Yes we can do this. Code should be modified to control the boost converter as well. </p><p>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. </p>
<p>If you do not agree check the battery university web site for battery data</p>