[ Play Video ]

In my previous instructables I described the details of energy monitoring of a off grid solar system.I have also won the 123D circuits competition for that.You can see this ARDUINO ENERGY METER.

Finally I post my new version-3 charge controller.The new version is more efficient and works with MPPT algorithm.

You can see it by clicking the following link.


You can see my version-1 charge controller by clicking the following link.


In solar power system, charge controller is the heart of the system which was designed to protect the rechargeable battery .In this instructables I will explain the PWM charge controller.

In India most of the people are living in rural area where national grid transmission line is not reached till now.The existing electric grids are not capable of supplying the electricity need to those poor people.So renewable energy sources ( photo voltaic panels and wind-generators) are the best option I think. I know better about the pain of village life as I am also from that area.So I designed this DIY solar charge controller to help others as well as for my home.You can't believe, my home made solar lighting system helps a lot during the recent Cyclone Phailin.

Solar power have the advantage of being less maintenance and pollution free but their main drawbacks is high fabrication cost, low energy conversion efficiency. Since solar panels still have relatively low conversion efficiency, the overall system cost can be reduced using a efficient solar charge controller which can extract the maximum possible power from the panel .

What is a Charge Controller ?

A solar charge controller regulates the voltage and current coming from your solar panels which is placed between a solar panel and a battery .It is used to maintain the proper charging voltage on the batteries. As the input voltage from the solar panel rises, the charge controller regulates the charge to the batteries preventing any over charging.

Types of Charge controller :


2. PWM


The most basic charge controller(ON/OFF type) simply monitors the battery voltage and opens the circuit, stopping the charging, when the battery voltage rises to a certain level.

Among the 3 charge controllers MPPT have highest efficiency but it is costly and need complex circuits and algorithm.As a beginner hobbyist like me I think PWM charge controller is best for us which is treated as the first significant advance in solar battery charging.

What is PWM:

Pulse Width Modulation (PWM) is the most effective means to achieve constant voltage battery charging by adjusting the duty ratio of the switches ( MOSFET ). In PWM charge controller, the current from the solar panel tapers according to the battery’s condition and recharging needs. When a battery voltage reaches the regulation set point, the PWM algorithm slowly reduces the charging current to avoid heating and gassing of the battery, yet the charging continues to return the maximum amount of energy to the battery in the shortest time.

Advantages of PWM charge controller :

1. Higher charging efficiency

2. Longer battery life

3. Reduce battery over heating

4. Minimizes stress on the battery

5. Ability to desulfate a battery.

This charge controller can be used for :

1. Charging the batteries used in solar home system

2. Solar lantern in rural area

3. Cell phone charging

I think I have described a lot about the background of the charge controller.let starts to make the controller.

Like my earlier instructables I used ARDUINO as the micro controller which include on-chip PWM and ADC.

Step 1: Parts and Tools Required :

Parts :

1. ARDUINO UNO ( Amazon )

2. 16x2 CHARACTER LCD ( Amazon )

3. MOSFETS (IRF9530, IRF540 or equivalent)

4.TRANSISTORS(2N3904 or equivalent NPN transistors )

5. RESISTORS (Amazon / 10k ,4.7k,1k,330ohm)

6. CAPACITOR( Amazon / 100uF,35v)

7. DIODE( IN4007 )

8. ZENER DIODE 11v (1N4741A)

9. LEDS( Amazon / Red and Green)

10. FUSES ( 5A) AND FUSE HOLDER ( Amazon )

11. BREAD BOARD ( Amazon )


13. JUMPER WIRES ( Amazon )




Tools :

1. DRILL ( Amazon )

2. GLUE GUN ( Amazon )

3.HOBBY KNIFE ( Amazon )

4. SOLDERING IRON ( Amazon )


great project with a wonderful experience
<p>can this circuit charge my 12 volt batteries </p>
<p>No.</p><p>You can follow my v-2.0 which is for 12V battery.</p><p><a href="http://www.instructables.com/id/ARDUINO-SOLAR-CHARGE-CONTROLLER-Version-20/">http://www.instructables.com/id/ARDUINO-SOLAR-CHAR...</a></p>
<p>Sir deba168 can you send me your code at jed_elacion@yahoo.com.....thank you!</p>
<p>how much watt is your solar panel?</p>
<p>can i use the battery and it still charging from the solar panel </p>
<p>Yes you can</p>
<p>sir can you please mention the ratings of the components that u have used in the above images,can you post a video of it,would be useful for my project </p>
and I forget to mention 2 bjt and there number is 2n2222 and normal diode
<p>sir i find no lcd panel for displaying the result and whats the rating <br>of the small battery and solar panel that you have used sir.</p>
sorry I didn't post a video because I an not so good in video making and if you face any difficulty the maker of the project explain the project more than perfect you can ask him and you can ask Me also any time <br>best regards
here's the photos
<p>Dear Deba168:</p><p>thanks a lot for this good work.........but still have some confusion about one thing ...concerning the circuit schematics...relating to measuring the voltages of solar charger and battery...The time that MOSFET is ON,the voltage will be nearly the same on charger and Battery even if you start to charge the battery from low voltage level...so how could you measure the battery voltage while MOSFET is ON???</p><p>I was thinking about that issue alot..and i thought that you might measure the voltage of battery in zero period of the input PWM signal but is this time enough to make battery return to its actual voltage level...???</p><p>thanks</p>
<p>hello pz i need the full codes........can u plz send it on thimmaiaharjun@gmail.com........</p>
<p>Hello! Please, can you send me the code?</p><p>My mail: federicojfg@gmail.com thanks from Argentina!</p>
<p>great stuff maen!!</p>
<p>plz send me full source code my mail id is shmdadhich@gmail.com</p>
<p>What kind of battery are you charging? It doesn't need constant <br>current in addition to constant voltage? </p>
<p>hi sir, can you explain how you determine the state of charge of the battery while charging pls. thank you</p>
<p>Can i use 12 V, 3 watt Solar Panel</p>
<p>Yes you can use it.But need some modification in voltage divider.</p><p>You can see my V-2 charge controller</p>
<p>Hi, Nice project,</p><p>wonder why does the charging from 50% becone 25% so easily, considering that the load has just activated in a short while, (or you trim the video?)</p><p>thanks,</p><p>JAson</p>
<p>Big fan of your Solar Chargers projects.<br>I want to start with them version by version so I'm beginning with version 1.<br>being a mechanical engineer, my grasp over electronics and electricity is still less than perfect.<br><br>will this version work with higher or lower MPPT PV voltages?<br>say, 17 Volts or 6 Volts?<br>and what's the governing factor determining the MAX voltage and MAX current of the project other than the component's allowed specs?</p>
<p>Thank you for sharing your work</p>
<p>How can I modify this for a 12v system? Also, can I replace that IRF540 at the end with a relay?</p>
<p>sir i want........whenever 6 volt battery voltage coming to 2.5 volt reference, automatically cut off the load...and that load automatically connect with regulated dc supply coming from 230 volt ac....by using arduino.....plz help me</p>
<p>sir i have a 12v 2w solar panel (2 nos) and a 12v 4.5 Ah battery what modifications has to be made in the code and what changes in the hardware?can you please upload the arduino.ino file of your program.</p>
<p>@deba sir can u kindly upload the sketch or hex file of this project.will be highly useful.please reply.</p>
<p>Arduino: 1.6.7 (Windows 8), Board: &quot;Arduino/Genuino Uno&quot;</p><p>sketch_feb25a:188: error: redefinition of 'float sample1'</p><p> float sample1=0; // reading from Arduino pin A0</p><p> ^</p><p>sketch_feb25a:13: error: 'float sample1' previously defined here</p><p> float sample1=0; // reading from Arduino pin A0</p><p> ^</p><p>sketch_feb25a:189: error: redefinition of 'float sample2'</p><p> float sample2=0; // reading from Arduino pin A1</p><p> ^</p><p>sketch_feb25a:14: error: 'float sample2' previously defined here</p><p> float sample2=0; // reading from Arduino pin A1</p><p> ^</p><p>sketch_feb25a:190: error: redefinition of 'int pwm'</p><p> int pwm=6; // pwm out put to mosfet</p><p> ^</p><p>sketch_feb25a:15: error: 'int pwm' previously defined here</p><p> int pwm=6; // pwm out put to mosfet</p><p> ^</p><p>sketch_feb25a:191: error: redefinition of 'int load'</p><p> int load=9; //load is connected to pin-9</p><p> ^</p><p>sketch_feb25a:16: error: 'int load' previously defined here</p><p> int load=9; //load is connected to pin-9</p><p> ^</p><p>sketch_feb25a:192: error: redefinition of 'int charged_percent'</p><p> int charged_percent =0; </p><p> ^</p><p>sketch_feb25a:17: error: 'int charged_percent' previously defined here</p><p> int charged_percent =0; </p><p> ^</p><p>sketch_feb25a:193: error: redefinition of 'LiquidCrystal lcd'</p><p> LiquidCrystal lcd(12,11, 10, 5, 4, 3, 2);</p><p> ^</p><p>sketch_feb25a:18: error: 'LiquidCrystal lcd' previously declared here</p><p> LiquidCrystal lcd(12,11, 10, 5, 4, 3, 2);</p><p> ^</p><p>sketch_feb25a:194: error: redefinition of 'int backLight'</p><p> int backLight = 13; // pin 13 will control the backlight</p><p> ^</p><p>sketch_feb25a:19: error: 'int backLight' previously defined here</p><p> int backLight = 13; // pin 13 will control the backlight</p><p> ^</p><p>sketch_feb25a:195: error: redefinition of 'int RED'</p><p> int RED=7; // To indicate discharged condition of battery</p><p> ^</p><p>sketch_feb25a:20: error: 'int RED' previously defined here</p><p> int RED=7; // To indicate discharged condition of battery</p><p> ^</p><p>sketch_feb25a:196: error: redefinition of 'int GREEN'</p><p> int GREEN=8; // for charging and battery fully charged</p><p> ^</p><p>sketch_feb25a:21: error: 'int GREEN' previously defined here</p><p> int GREEN=8; // for charging and battery fully charged</p><p> ^</p><p>C:\Users\USER\AppData\Local\Temp\arduino_a67ec9a0b0bd091968e1d217eda8e9ec\sketch_feb25a.ino: In function 'void setup()':</p><p>sketch_feb25a:198: error: redefinition of 'void setup()'</p><p> void setup()</p><p> ^</p><p>sketch_feb25a:23: error: 'void setup()' previously defined here</p><p> void setup()</p><p> ^</p><p>C:\Users\USER\AppData\Local\Temp\arduino_a67ec9a0b0bd091968e1d217eda8e9ec\sketch_feb25a.ino: In function 'void loop()':</p><p>sketch_feb25a:215: error: redefinition of 'void loop()'</p><p> void loop()</p><p> ^</p><p>sketch_feb25a:40: error: 'void loop()' previously defined here</p><p> void loop()</p><p> ^</p><p>exit status 1</p><p>redefinition of 'float sample1'</p><p> This report would have more information with</p><p> &quot;Show verbose output during compilation&quot;</p><p> enabled in File &gt; Preferences. these types of error are coming pllzz see to it.</p>
<p>hii i m working on same project but code is not working some re-declaration problem is coming</p>
<p>can some one reply pls</p>
<p>kindly reply soon if possible</p>
<p>@ deba 168: sir i have a 12v 2w solar panel (2 nos) and a 12v 4.5 Ah <br>battery what modifications has to be made in the code and what changes <br>in the hardware?</p>
Yes a forget the lcd a Norma lcd <br>And you need a 5W (Voc=10v)solar panel and a 6v and5.5Ah SLA battery for storing the power <br>And a fuse and a 11v Zeneca diode <br>As I said before the maker explain every thing
<p>hi i have been searching for a answer to this a question and i found some information and i would like to say if it right deal.</p><p>first thing why you dont just use a mosfet without transistor i think the answer is the current that comes from the micro-controller is not enough to turn the mosfet on and off at a high frequency but how know its not enough i search in the data sheet and found a lot of things but non of them give me the wanted answer </p><p>second:</p><p>why you use a mosfet for controlling PWM why you don't just use a transistor </p>
<p>at first mosfet depend on voltage not current but i use transistor with mosfet if i need to turn on/off mosfet with voltage greater than 5 volt see this link http://www.gammon.com.au/motors</p>
<p>so that's it now i can undersatnd </p><p>thanks alot FadyA5 </p>
<p>What are the modifications for (12V battery and 5w,12V solar panel), </p>
<p>Will the code work in Arduino Mega ??</p><p>I am planning to do this in a 36W PV panel</p>
<p>Can this charge controller be useful for a Piezoelectric Generator?</p>
My final year project topic is design and implementation of a solar charge controller for lightning of a building... was wondering if i could use this procedure?
My final year project topic is design and implementation of a solar charge controller for lightning of a building... was wondering if i could use this procedure?
There is just a problem i have a battery 3.7v 3800mah it needs 4.67 hours to charge but after less than 1 hour of charging the battery volt is more than 3.7v and it stops charging without full charge. PLS HELP ME
<p>I think it is due to wrong voltage sensor calibration.Check your arduino 5V pin voltage and calibrate accordingly.</p><p>The + in the code add 150 samples from analog pin.After that I calculate the average value by dividing the result by 150.This is done for getting more accurate reading.</p>
<p>How to correctly calibrate the voltage sensor? I already did the calibration stated in the Arduino Energy Meter and I got similar results. (I used 6V and got 279 reading on the serial monitor.</p>
<p>use this equation </p><p>voltage = ( 5/1024)* ( 14.7/4.7)*sample</p><p>voltage = 0.015271 * 279 = 4.26V</p><p>First measure voltage at arduino 5V pin.Substitute the voltage you get in your case, in the place of 5. I mean </p><p>voltage =( Vcc/1024)* (14.7/4.7) * sample</p>

About This Instructable




Bio: I am an Electrical Engineer.I love to harvest Solar Energy and make things by recycling old stuffs. I believe &quot;&quot;IF YOU TRY YOU MIGHT ... More »
More by deba168:DIY All in One Solar Power Pack DIY Egg Shell Mood Lamp DIY Solar Powered  Mason Jar 
Add instructable to: