# MPPT Solar Charge Controller DIY Homemade

In this project I have made a MPPT Solar Charge Controller using Arduino. It can charge the different type of batteries such as flooded batteries, AGM batteries and Gel type batteries. The input voltage can be from 16 to 50 volts, so we can use 12 volts to 24 volts solar panels with this charge controller. It can handle up to 40 amps and it can display Input voltage, input current, input power as well as output voltage, output current and output power.

A Solar Charge Controller is used to hold the battery from overcharging with the aid of using regulating the voltage and current coming from the Solar Panel to the battery. It is programmed at 15-A/200-W unit and makes use of MPPT (Maximum Power Point Tracking) to boost up solar charging of the battery as much as 30% in step a day. MPPT examines the output of the Solar Panel compares it to the battery voltage and adjusts it to the satisfactory voltage a good way to get maximum current in to the battery. The Solar Charge Controller makes use of a 25-A circuit breaker to guard it towards over current and has a baseline of non-stop strength intake of 35 mA.

## Block Diagram

Following is the block diagram of the project. Arduino is the processing unit of the project. Here I have used two current sensors, one for the input and other for the output. And also I have used two voltage sensors for input and output. The buck converter is used to step down the voltage to charge the batteries. 16×2 LCD is used to display the parameters. Three push buttons are used to set the parameters.

## Circuit Diagram

### of MPPT Solar Charge Controller

Following is the Circuit Diagram of the project.

## Programming Code

```#include <EEPROM.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(7,6,5,4,3,2);
int dut,pwm,v,j,tmp;
bool st,m;
float vo,vi,current,current1,cutoff,cv,p,p1,ef;
void setup() {
lcd.begin(16, 2);
lcd.clear();
TCCR1B = TCCR1B & B11111000 | B00000001; // Set PWM frequency for D9 & D10:
Serial.begin(9600);
pinMode(9,OUTPUT);
pinMode(10,INPUT_PULLUP);
pinMode(11,INPUT_PULLUP);
pinMode(12,INPUT_PULLUP);
if(v>2)v=0;
switch(v){
case 0:
cutoff=15.4; // flooded
break;
case 1:
cutoff=14.8; //agm
break;
case 2:
cutoff=14.0; //Gel
break;
}
}
void loop(){
j++;
if(m==0){
current=0;
for(int i = 0; i < 100; i++) {
current = current + (.049 * analogRead(A3) -25);// for 20A mode
current1 = current1 + (.049 * analogRead(A2) -25);// for 20A mode
delayMicroseconds(100);
}
current = current/60;
current1 = current1/70;
if(current<0.1)current=0;
if(current1<0.1)current1=current=0;
vo=((vo*0.06)/100);
vi=(((vi)*0.6)/80);
//if(v)
vi=(vo*10)-vi;
p=current*vo;
p1=current1*vi;
ef=(p/p1)*100;
if(vo>cutoff)pwm--;
if(pwm<0)pwm=0;
if(vo<cutoff+1)pwm++;
if(pwm>200)pwm=200;
analogWrite(9,pwm);
if(j>10){
j=0;
lcd.setCursor(0,0);
lcd.print("P ");
tmp=vi;
if(tmp<10)lcd.print(" ");
lcd.print(tmp);
lcd.print("V ");
if(current1<10){tmp=current1*10;
lcd.print(tmp/10);
lcd.print(".");
lcd.print(tmp%10);}
else{ tmp=current1;
lcd.print(" ");
lcd.print(tmp);
}
lcd.print("A ");
tmp= p1;
lcd.print(tmp);
lcd.print("W    ");
lcd.setCursor(0,1);
lcd.print("B ");
tmp=vo;
if(tmp<10)lcd.print(" ");
lcd.print(tmp);
lcd.print("V ");
if(current<10){tmp=current*10;
lcd.print(tmp/10);
lcd.print(".");
lcd.print(tmp%10);}
else{ tmp=current;
lcd.print(" ");
lcd.print(tmp);
}
lcd.print("A ");
tmp= p;
lcd.print(tmp);
lcd.print("W    ");
Serial.print("dcyc ");
Serial.print(pwm);
Serial.print("Vo ");
Serial.print(vo);
Serial.print("v Io ");
Serial.print(current);
Serial.print("A Po");
Serial.print(p);
Serial.print("W Vi ");
Serial.print(vi);
Serial.print("v ");
Serial.print("Ii ");
Serial.print(current1);
Serial.print("A Po");
Serial.print(p1);
Serial.print("W efc");
Serial.print(ef);
Serial.println("%");
}
}
st=1;
lcd.clear();
if(m==1){
EEPROM.update(0, v);
switch(v){
case 0:
cutoff=15.4; // flooded
break;
case 1:
cutoff=14.8; //agm
break;
case 2:
cutoff=14.0; //Gel
break;
}
}
m=!m;
}
if(m==1){
st=1;
v=v+1;
if(v>2)v=0;
}
st=1;
v=v-1;
if(v<0)v=2;
}
lcd.setCursor(0,0);
lcd.print("  Battery Type  ");
lcd.setCursor(0,1);
switch(v){
case 0:
lcd.print("    Flooded     ");
break;
case 1:
lcd.print("      AGM       ");
break;
case 2:
lcd.print("      Gel       ");
break;
}
}
delay(10);
}```

Step-1
Following is the PCB of this project, where all components will be soldered over.

Step-2
All the components of this project MPPT Solar Charge Controller, are ready to instal on the PCB for soldering in its back.

Step-3
Opposite side view is shown in the following image.

Step-4
Soldering components is in process in the following image.

Step-5
In the following image, I have already installed LCD Display with the battery connections. The circuit is already running well without error.

Step-6
Here is the final image where the project is active and its in final running position.

## Watch Video Tutorial

### of the project MPPT Solar Charge Controller

Thanks for watching & visiting the site. Please SHARE it with your friends. Thank you.

(Visited 4,137 times, 1 visits today)