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 (Rev-3)


3. MOSFETS (IRF9530, IRF540 or equivalent)

4.TRANSISTORS(2N3904 or equivalent NPN transistors )

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

6. CAPACITOR(100uF,35v)

7. DIODE(IN4007)

8. ZENER DIODE 11v (1N4741A)

9. LEDS(Red and Green)








Tools :




<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><strong>PWM Battery Charge Controller Version 1</strong></p><p>Hi.</p><p>I am encountering a problem. I am now under the testing process. The problem is when I connect the solar input (without connecting the battery), Arduino pin A1 detects a voltage and the PWM pin 6 is triggered. Likewise, when I connect the battery (without connecting the solar), A0 detects signal.</p><p>Isn't it the right process is when there is no input (Battery or Solar), the analog pins should now be able to detect any signal.</p><p>I tried to connect both, afterwards, I remove the solar, however, there was still signal detected.</p><p>Also, what does the '+' do in the code? (See sample1+ and sample2+)</p><p>Hope to hear from you as soon as possible.</p><p>Thank you for your reply.</p>
<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>
<p>if i want to check output on emulater (proteus) but in that im facing one problem. In that there one option to upload my program into arduino but i have program but i don't have any .HEX program file to upload..... help me asap.....</p>
<p>IRF9530 not found in my city. which one is its equivalent?</p>
<p>i no understand why peoples use old LCD because need many output pin and now have same prize better LDC whit I2C need only 2 output pin. stupid use many pin because maybe need all pins other sensors or others work. and many place I2C LCD have cheapen than old hd44 style lcd who not have good. or if need use many many i/o pin use oled screen same prize. why has stupid and use old ????</p>
<p>Hi Mattiv,</p><p>It is my v-1 controller,it was started before one and half year ago.You can see my </p><p><a href="http://www.instructables.com/id/ARDUINO-SOLAR-CHARGE-CONTROLLER-Version-20/" rel="nofollow">v-2 </a>and <a href="http://www.instructables.com/id/ARDUINO-SOLAR-CHARGE-CONTROLLER-Version-30/" rel="nofollow">v-3</a> controller where I2C LCD is used.Any one can use it in this project also.</p><p>Not a big issue.</p>
good, sorry i tried u first version but i no understand peoples why use old many wire lcd then have better i2c lcd what can use :D <br>
<p>I tried to do your editing, and I have some problems. The switching of the MOSFET P is not made entirely . when the Arduino sent 0 volts , it remains a current equivalent to 50% of max power PV . Why?</p>
<p>I just have read this &quot;mini solar power energy system&quot; very enthusiastically and as an electronic engineering student I would say it's amazing, it contributed me a lot. congratulation to you, this is a cutting edge and breaking the ice...</p><p>I'm interested in DC-DC buck and boost converters and more in designing inverters and will be very glade to help you if you want.</p><p>I hope I can give you a something in return for this step by step tutorial.</p><p>god bless you man!</p><p>iman28aban@gmail.com</p>
<p>Thank you so much..</p><p>I want to make a arduino based pure sine wave inverter .can you help me ?</p>
<p>You may also want to have better resolution for example 1mv or less in order to make you wave more smooth and clean. Then you should be aware of the trade-off issue: as you increase the resolution, you may lose the frequency.</p><p>An example of that can be using the timer/counter 1 which is 16 bit instead of 8 bit. hence if you wanted to have the same frequency of 62.5 KHz, the timer counter I/O clock should be set to about 4GHz!!! which is far more than impossible!</p><p>Remember you can only have maximum frequency of 244 Hz using the 16MHz core and resolution of 76.3 microvolts.</p>
<p>Well, generating sine wave especially for inverters needs to be a pure wave and have minimum extra harmonics or at least attenuated unwanted harmonics in the spectrum of the aforementioned waveform.</p><p>Designing an embedded system is required and it depends on accuracy and frequency of the sine wave you acquire. For example, by using Arduino inwhich the core is ATMEL AVR ATMEGA328 and considering the maximum frequency of 16MHz + using the 8bit timer counter =&gt; you can generate up to 62.5 KHz PWM in normal mode or 31.25 KHz in Phase Correct PWM.</p><p>Thus, the resolution of you wave is 19.5mv (1 step from 256 step considering 5 volt supply)</p>
<p>I'm sorry for my huge absence.</p><p>I've had the some researches on micro-controller-PWM based sine wave and found that analogue function used in Arduino can be used for low accuracy purposes and strongly recommend you to use PIC micro-controllers since they are industrial and you don't have to deal with ambient noise.</p>
<p>ah, becasue you used a IRF MOSFET, you needed a separate driver transistor. If you had used the IRL540, you could have avoided the need for a driver transistor.</p>
<p>Thanks :)</p><p>I didn't know it during building this project.</p>
<p>what is a good out put voltage for a charge controller?</p>
<p>IRF540 is a logic level MOSFET, why you put a MOSFET driver on them?</p>
<p>can i use this instructable to charge 12v battery?</p>
<p>No it needs modifications. You can use my version -2</p><blockquote>http://www.instructables.com/id/ARDUINO-SOLAR-CHARGE-CONTROLLER-Version-20/<br></blockquote>
<p>thanks for the fast reply sir deba..i cant find the parts needed for your ver.2 charge controller :(</p><p>like the mbrf2045 and the tvs diode..</p><p>are the buck converter and current senor is needed there or just optional?</p>
<p>I built this and housed it in a water proof case. Instead of the whole load side I just paralleled off of the battery. I use it to power another arduino circuit. In the picture the middle wire coming out of the bottom is my 6V power jack. Awesome project. Thanks for posting. </p>
<p>Its looking very nice.</p><p>Thanks for sharing the pics.</p>
<p>Say hello to one of your friends can give you the arduino code you wonder</p>
<p>Hello :)</p><p>Have you modified my code ?</p>
<p>what ?</p>
<p>hye..can you guide me on how to design this controller to have both solar panel and electrical supply (ac) as the input?</p>
<p>I can help you.Just proceed :)</p>
<p>I am doing the same project but I am going to use a 50 watt solar panel so is it ok to use this circuit?</p>
<p>It is possible.</p><p>Just go through my version-2 charge controller.</p><p>It matches your requirement.</p>
<p>How hard is it to build one... for person that have just worked with arduino and stuff like this for 1 month. Will i have to calculate stuff or do i just need to follow your steps. </p>
<p>Its simple.</p><p>You can proceed. If you face any difficulties, I am ready to help you.</p>
amazing detail. I will defiantly build one. quick question. is this design ok for wind turbine charging?
<p>Wind turbine chargers usually have a dump load circuit. That is for when the batteries are fully charged or the turbine is supplying more than the load, it dumps the power into a power resistor or heater to keep the turbine from over speeding. It might not be necessary if the turbine regulates its own speed, but usually putting the power to use like in heating water is preferred to just letting the turbine idle.</p>
brilliant. thanks for the share. I built the vertical axis wind turbine yesterday and next week I will commence playing withe the motor and charging circuit. I will inlude your comments into my design and post an Instructable in due time.
<p>Which motor used in wind turbine</p>
<p>I think it should work..wind turbine input must be connected in parallel to solar panel </p><p>But I never tested it,you can try...best of luck</p>
<p>hye. I've made the solar charge controller circuit. but the problem is when the solar is disconnected, the circuit still reads the solar voltage. it is supposed to be 0 V. Couldn't seem to find what the problem is. can you help? thank you.</p>
<p>Hey U need to ground analog pin after removing solar panel .</p><p>Analog pin in ardiuno needs closed path.</p>
<p>Place the diode D1 in between MOSFET Q1 and battery .It serve the same purpose as before .I think it will work.If it works then tell me..so that any one facing the same problem can rectify.</p>
<p>the diode has been placed, but nothing happened. diode D1 at the input after solar don't have to be changed right? just add the same diode between the battery and mosfet is it? or is it something to do with the coding? </p>

About This Instructable


1,081 favorites


Bio: I am an Electrical Engineer.I love to harvest Solar Energy and make things by recycling old stuffs. I believe in ""IF YOU TRY YOU ... More »
More by deba168:  Intel Automated Gardening System SMART POWER OUTLET DIY SOLAR LI ION/ LIPO BATTERY CHARGER
Add instructable to: