In this article, we are going to learn about the solar charge controller. There are different types of solar charge controllers in the market. All these have different working principles. But the basic principle is the same. In this article, we will learn the basic principle of the solar charge controller and little details with a circuit diagram. I hope this article will be helpful to you. So let’s start our Solar Charge Controller circuit.
Disclaimer:
Handling electricity carries inherent risks. It’s essential to have the appropriate skills to manage it safely. Proceed at your own risk, as the author disclaims responsibility for any misuse, harm, or errors. All content on this website is unique and copyrighted; please avoid unauthorized copying. While most articles are open-source for your benefit, feel free to use the knowledge provided. If you find our resources helpful, consider purchasing available materials to support our work.
For assistance or guidance, leave a comment below; the author is committed to helping. Some articles may contain affiliate links that support the author with a commission at no additional cost to you. Thank you for your understanding and support.
Table of Contents
What is a solar charge controller?
In a solar power system, energy is harvested from sunlight and stored in a battery; then, the battery gives us power backup when required. This is very simple. But the problem is, each battery has a limit of taking charge and being discharged. That is why we need a controller to control both the charge and discharge limit. Otherwise, the battery will be damaged.
Working principle of Solar Charge Controller:
A charge controller has a basic operation of sensing and switching the electrical connection between the solar panel, battery, and load. Although this mechanism differs from controller to controller (we’ll discuss this later) but you can say this is some kind of switch-like relay switch. There is a switch between the solar panel and the battery and another switch between the battery and to load. Besides, it senses the battery voltage and panel presence. That’s it in a very simple way. Check this block diagram of the Solar Charge Controller circuit.
Here SW is the switch. This switch can be electronic or relay type depending on the controller situation. But let’s guess it is as simple as a switch. Now, two voltage need to be sensed, that is why two voltage sensor is required. Although for the advanced charge controller, there are some other functions for the basic one, this is all we need to have.
So how the charge controller works?
First of all, the controller senses the battery condition. If it needs to be charged, it turns on the switch between the solar panel and the battery. Afterward, if the battery is fully charged the controller turns this charging switch (between solar panel and battery) off. Besides, the controller keeps the switch (between the battery and load) on and if the battery is discharged below a certain level, it turns this load switch off. This is how the charge controller works.
Sometimes in a large charge controller, the load switch part is not available. Because in large power systems, other devices like inverters are used which already have their own discharge protection. But in small charge controllers, loads are directly connected with the charge controller.
Types of solar charge controllers:
Based on operation principles, solar charge controllers are three basic types. These are
- ON/OFF Charge controller
- PWM Charge controller
- MPPT charge controller
ON/OFF Charge controller:
The on/Off charge controller is the most basic and easy one. It simply uses a simple switch as the block diagram explained earlier. Usually, MOSFETs are used as the switch. As there is no extra current control mechanism in the ON/OFF charge controller so it can not manage the battery charging capacity. That is why this type of charge controller is not so efficient.
Pros | Cons |
Simple circuit, less maintenance | Poor battery management |
Lowest in price comparing other controllers | Poor charging efficiency |
PWM Charge Controller:
In the PWM charge controller, PWM (Pulse Width Modulation) is used to control the charging current. This is an extra feature compared with the ON/OFF Charge controller. To fully utilize the charging capacity of a battery the battery should be charged in three steps.. Bulk, Absorption, and float. Only with PWM control, this 3 steps charging control is possible. Which improves the battery charging efficiency as well as improves backup time with battery life.
Pros | Cons |
Improved battery charging ensures longer battery life | Low power harvesting capacity than MPPT |
Low price | Moderate charging efficiency |
MPPT Charge Controller:
In the MPPT charge controller, the DC/DC converter (SMPS) is used. Usually, a Buck converter is commonly used. The switch-mode power supply is much more efficient in power converting. That is why it is more efficient in switching. Besides, the MPPT charge controller uses MPPT algorithms to get the maximum power from a solar panel. I’ve posted an article on this. Please check this article here. I’ve explained detailed information about MPPT in that article. That is why I’m not discussing the circuit of the MPPT charge controller here.
Pros | Cons |
Maximum power harvesting from solar panel | Complex circuitry |
Excellent battery and load management | High Price |
In this article, we will discuss the first two types of solar charge controllers.
Circuit diagrams:
There is no difference rather than the switching signal between an ON/OFF and PWM charge controller. The common circuit diagram is like this; where the current flow direction is shown. Based on the current flow, MOSFETs are used in different positions.
Now, keep a note that most of the MOSFETs are voltage biased and the gate to source voltage Vgs is 10V for full contact. That is why, to switch these MOSFETs properly, we need to use an optocoupler. Opto-coupler works like a voltage shifter here as well as an isolator too.
ON/OFF type Solar Charge Controller circuit:
And PWM type Solar Charge Controller circuit:
As you see, there is no basic difference rather than the charging signal. Now, you can make a control circuit for either the ON/OFF one or for PWM one. Using a micro-controller makes everything easier than using analog circuitry. If the micro-controller becomes complex to you, you can use a simple OP-Amp-based control circuit. But it is recommended to use a micro-controller as it is a wide option to design your control system.
As you’ve seen the basic circuit I hope you have got the concept. Now, as we need to control everything so we need some kind of controller and some sensing circuit for sensing the voltages or presence of voltage. For that, we can modify the circuit diagram a little like this:
Here the left part is controlling the charging and the right side controlling the load or discharge. And a voltage regulator L78L05 is used to get a regulated 5V supply.
Read more:
- Connect to Raspberry Pi from your Laptop/Desktop using VNC Viewer
- How to reduce noise from DC motor
- Interfacing External EEPROM with PIC microcontroller
- Not Enough ROM/RAM error with micro-controllers
- Read ThingSpeak Channel using ESP8266 and Arduino
- Caller ID detection using Arduino
- PWM Generation with STM32
- Fingerprint attendance system with R503
- Simple voltage protector for your appliances
- DC/DC converter using Transistors
- Simple Component Detector using PIC16F877A
- Voltage Stabilizer Circuit with 4 Relays
- 6V Lead-Acid battery charger circuit
- 5 coolest multimeters you can buy
- Top 5 bench power supplies you can buy
- Top 5 handheld oscilloscopes you can try
- Top 5 Digital Multimeters for Beginners
- Digital Clock with DS3231 & PIC microcontroller
- Digital Clock with PIC16F676 & Seven Segment Display
- Digital Clock using a PIC microcontroller & RTC DS1307
- How to remove noise/garbage from the HD44780 LCD display
- How to design a voltage stabilizer using a micro-controller from A to Z
- PICKit2 colon Simplified
- Capacitor Power Supply parts calculator
- Solar Charge Controller circuit & working principle of ON/OFF charge controller
- A smart Battery charger circuit design guide
Basic operation:
Analog circuit needs lots of tuning to get an optimum result. Also, all the components are not ideal. Small tolerance of the resistors can displace the working point. That is why you need to tune the circuit properly. But as simple Op-Amps are very cheap in the market, so the total cost is pretty low.
But on the other hand, using a small micro-controller makes this very easy to control and tune. If we convert this analog circuit into a micro-controller based circuit then it will be like this:
If replaced by a microcontroller:
See? Using a small 8 pin micro-controller makes the control circuit lot easier than the analog circuit. Also, we can control the charging and discharging level at whatever we want. Simple programming will work fine with this circuit and the total cost is also much lower than MPPT and PWM. Even if a programmer wishes to make a PWM signal using this small micro-controller that is possible.
You may read this: PWM Solar Charge Controller with PIC12F675
Coding:
/******************************************************************************* Program for, Simple ON/OFF charge controller Program Written by_ Engr. Mithun K. Das; mithun060@gmail.com MCU:PIC12F675; X-Tal: 4MHz(internal). Compiler: mikroC pro for PIC v7.6.0 Date: 28-03-2021; © labprojectsbd.com *******************************************************************************/ #define charge_pin GP0_bit #define load_pin GP4_bit #define ch_led GP5_bit #define ld_led GP2_bit #define solar_sense GP3_bit unsigned int battery=0; int i=0; bit charge; bit load; void main() { TRISIO = 0b00001010;//set I/O ; 1=input, 0=output GPIO = 0x00; CMCON = 0x07;//comparator off ANSEL = 0b00000010;//AN1 analog only ADCON0 = 0x05;//AN1 channel selected while(1) { //read battery voltage battery=0;//clear previous data for(i=0;i<20;i++) { battery += ADC_Read(1)*27/100; // *5/1023*(10+2.2)/2.2*10*calibration Delay_ms(10);//keep a delay for smooth measurement } battery/=20; // make an average result from 20 samples. //Note: here rather than taking floating point variable, unsigned int //is used and while calculating, eliminated fractions to reduce further //RAM & ROM use. //charge control if(solar_sense) { if(battery>145)charge = 1;//charge high cut if(battery<132)charge = 0;//charge reconnect if(charge)//full charge condition { ch_led = 1; //full charge indication charge_pin = 0;//keep off charging mosfet } else { ch_led = ~ch_led; // Toggle ch_led for charging indication charge_pin = 1;//keep on charging mosfet } } else { charge_pin = 0; //do not charge ch_led = 0; //indicator off charge = 0;//reset charge } //load control if(battery>126)load = 1;//load reconnect if(battery<116)load = 0;//load disconnect if(load) { load_pin = 1; //load MOSFET on ld_led = 1;//LOAD on indication } else { load_pin = 0; //load MOSFET off ld_led=~ld_led;//LOAD off indication } }//end of while(1) }//end of void main //End
The code is very simple for the ON/OFF charge controller. If you have a mikroC compiler you can build the hex file but if you do not have any, you can download this hex from here.
Conclusion:
To make a PWM charge controller we need to change only the charging signal. In that case, you can code yourself to add software PWM. I’ll try to publish the PWM one in my next article. Please subscribe and stay with this blog. So that you can get the updated project notification.
I hope this project was helpful to you. If you make one for yourself, it will be a great pleasure for me. Anywhere you need help, let me know. Please share this project and subscribe to my blog. Thank you.
Don’t forget to subscribe if you want to get more useful articles.
For Professional Designs or Help:
Check this out: 5 coolest multimeters you can buy
53 Comments
Joy · 28/03/2021 at 5:37 pm
Nice ..sir.
Asimiyu · 29/03/2021 at 2:39 am
Thank you sir for the new project updated. May God Almighty Allah continue to enrich you more in knowledge, with strength, money, long life and prosperity. I have gained more knowledge from your blogs this morning, and it has been added to what I had learned and being doing. So thank you.
However, sir. The question is that, (1) at the solar panel voltage side, what is the range of the solar Voltages that can be connected, since MOSFET’s gate needs at least 10volts (2) I can see from the programs you developed for ON/OFF (codes), you have used channel (1) or (AN1) for battery sensing only, I was expecting you would use channel (0) for solar sensing too but you have used digital sensing. (i.e if(solar_charge)), so please, Can the microcontroller sense any signal below +5VDC as digital signal ? Because, I was studying the circuit, if the resistors you have used can divide or limit the Voltage to +5V sensing by microcontroller digital pins.
Mithun K. Das · 29/03/2021 at 8:03 am
The solar voltage depends on the battery voltage. This design is for 12V system. But can be used for 24V system with increased heatsink.
issue 1: for 12V PV max is 22V.
issue 2: Digital pin can sense anything over 2.5V as digital 1. As this pin GP3 can be used only as input, so we can use this facility to sense the solar. Otherwise, this pin can’t be used as output or need to be left unused.
Asimiyu · 29/03/2021 at 7:15 am
Secondly, please. Can this circuit be remodified by replacing solar panel with rectified voltage through stepdown transformer to charge battery?, ( That converted to automatic battery charger).
Mithun K. Das · 29/03/2021 at 8:04 am
The transformer can be used if overloading is monitored properly. Otherwise the transformer will be burnt.
Asimiyu · 29/03/2021 at 9:54 am
Thank you sir. It is cleared.
Seun · 09/07/2021 at 6:16 pm
Well done Sir, for efforts put into this. I have some questions.
1. What is the benefit of the optocoupler?
As there are circuit using opamps only.
2. The LED bulb for the charging will always be on even when sun is no more, how can it off at night.
3. If I want to do for 48v system, what are the modifications to do?
4. What is the function of the voltage regulation?
Please how can I incorporate fast 5v output to charge phones, I have tried 7805s in parallel.
Thanks Das
MKDas · 10/07/2021 at 1:36 am
1 >> Isolation is the main point. Then voltage shifting to a higher level.
2 >> In that case, two options. a. driving LED with solar supply but triggering by MCU through a transistor. b. sensing solar voltage and let MCU decide what to do.
3 >> You’ll need two voltage regulators. One for 12V for MOSFET Gate another is 5V for MCU.
4 >> Supplying a constant voltage to its loads. For Cellphone charger you can try MC34063A based 5V SMPS from this link: MPPT Solar Charge Controller.
& Thanks for your comment.
Seun · 13/07/2021 at 2:36 am
Please Sir, can I use either p- or n- channel MOSFETs, because I can see you used p- channel along the negative line.
MKDas · 13/07/2021 at 4:20 pm
Which one did you found P-Channel? All N-Channel MOSFETs were used here.
Seun · 12/08/2021 at 3:58 am
Sir, please for 48v system, for the load section, how can I made it for 12v loads. Thanks
MKDas · 12/08/2021 at 11:47 am
If you use a 48V system and want to drive loads of 12V then make a buck converter that can convert 48V into 12V. Then integrate with your 48V system.
Seun · 14/08/2021 at 10:07 pm
Thanks, please do you have any simple buck converter circuit
MKDas · 15/08/2021 at 11:53 am
Welcome. Yes, please search ‘Buck’ on the top.
Lakshman · 30/07/2021 at 10:19 am
Dear Sir,
Have nice day ,
My wishes for your help and support to sharing your knowledge
MKDas · 30/07/2021 at 2:12 pm
Thanks.
Selina Atalifo · 28/10/2021 at 6:14 am
Sir, if you replace the pic12f675 with pic 16f877 microcontroller,will it affect/change the circuit?
Lab Projects BD · 28/10/2021 at 3:19 pm
Only in code declaration of I/O and some other settings. But why do you need to use a cannon to kill a mosquito?
Bob · 29/11/2021 at 4:48 pm
Cannot get PC817 opto couplers, can I use 4N35, I have quite a few of these?
D1 in your schematic, how many 1N5408’s must be in parallel, as you indicate with an “X”
I have nice fat diode of 20amps to use here.
Lab Projects BD · 30/11/2021 at 10:47 am
You can use 4N35. Each Diode 1N5408 can handle 3A. So select qty of diodes depending on your current keeping some safety factor.
Anthony Bosun Osibajo · 30/12/2021 at 10:02 pm
Thanks so much for this. Please i am working on using MPPT to charge batteries ranging from 48-96VDC i will be glad to have your super with the circuitry .
MKDas · 01/01/2022 at 10:39 am
Check this one: https://labprojectsbd.com/2020/04/22/mppt-solar-charge-controller-with-synchronous-buck-converter-with-smps-mobile-charger/
Azim Uddin · 27/05/2022 at 11:42 am
MicroC program gulo ki arduino diye pic microcontroller e upload deya jabe? Process ta jodi janaten pls. Thanks.
MKDas · 27/05/2022 at 2:25 pm
No. You have to use mikroC
Noshin · 18/09/2022 at 10:42 pm
Sir, i have few questions.
1. What will be the input for 12v battery charger
2. If i get 9v from solar and want to charge two 3.7v Lithium-ion battery what will be the Changes in the circuit.
3. How can i understand that my circuit is running in simulation software? When i simulate it i couldn’t see or understand if the circuit is charging or discharging.
MKDas · 20/09/2022 at 10:56 am
1. BAT1
2. It will damage the battery
3. Put test points or meters to investigate.
Aftaqri · 21/01/2023 at 9:28 pm
After 5 seconds of solar sense I want to turn on the charge mosfet. Sir can you help me please.
MKDas · 22/01/2023 at 12:39 pm
use delay(xxx)
Aftaqri · 22/01/2023 at 5:23 pm
if(solar_sense)
{
if(battery>146)charge = 1;//charge high cut
if(battery<128)charge = 0;//charge reconnect
if(charge)//full charge condition
{
ch_led = 1; //full charge indication
charge_pin = 0;//keep off charging mosfet
}
else
{
l —————————————————————————————————–
l ch_led = ~ch_led; // Toggle ch_led for charging indication l
l Delay_ms(5000); l
l charge_pin = 1; //keep on charging mosfet l
——————————————————————————————————-
}
}
——————————————————————————————————————————–
Sir" Charge Led Billing Works Slowly. Please help me Sir
MKDas · 23/01/2023 at 11:41 am
yes, its ok. Test it.
Aftaqri · 23/01/2023 at 1:01 pm
Yes, I tried it but Charge Led Billing Works Slowly.
I want.
(1) When the solar sense is on, the charge LED will blink five times with 1000ms delay.
(2) Charge LED After five times blink It will start blink again for 250ms. and
Charge Mosfet will on.
Hope you solve my problem.
Please help me Sir.
MKDas · 23/01/2023 at 2:27 pm
use for loop
Aftaqri · 24/01/2023 at 3:09 pm
I use delay.
No for loop is needed.
Yes working is fine.
Thanks Sir.
Lino · 20/06/2023 at 4:46 pm
Well done.
These microchip PIC16F877A & PIC12F675 are not available right now. Would you please advise which one I can use to build a cheaper prototyping of the Solar Charging system 50W 17.8V and battery 12V using MPPT
MKDas · 02/07/2023 at 7:31 pm
use similar one, then match the settings registers.
mt · 22/04/2024 at 6:00 pm
hey,
Just have a question regarding the 5v voltage regulator. why did we use it and how come we use a 5v regulator with a 12v system?
could you explain more why do we use it and how it works exactly in the circuit?
MKDas · 23/04/2024 at 11:42 am
Hy buddy. Use 7805 regulator. It is very simple matter. In maximum diagram it is not drawn.
MT · 22/04/2024 at 6:03 pm
Hi,
I have some questions regarding using of 5v voltage regulator.
1- can you explain why do we use a voltage regulator in detail?
2- how come we use a 5v regulator with a 12v battery system?
MKDas · 23/04/2024 at 11:42 am
7805
mw · 23/04/2024 at 3:47 am
can you explain why do we use 5v regulator and why we use 5v regulator with a 12v battery system?
please explain it in detail.
thank you
MKDas · 23/04/2024 at 11:43 am
to run the MCU which need 5V to run. Not more than that.
mo · 24/04/2024 at 12:40 pm
how do I add a Temp check function to the circuit which has the op-amp not the micro controller?
MKDas · 24/04/2024 at 4:32 pm
use NTC thermistor with OP-AMP Comparator. then adjust using POT
mt · 24/04/2024 at 3:32 pm
regarding the comparator which compare the solar panel voltage and the battery level, I am missing something here because the battery level does not affect the output voltage of the battery.
Like if the battery is 50% it will still output 12v as well.
so shouldn’t we compare the current?
MKDas · 24/04/2024 at 4:33 pm
U4A.
Michael · 26/04/2024 at 7:42 pm
Can you please confirm if both 12 SLA and 12V LiPos can be charged with this system? If not which one?
Thank you.
MKDas · 26/04/2024 at 8:18 pm
not suitable for lithium cells. but you can use the concept. little modification will be needed for lipo.
atsedemariam · 03/06/2024 at 5:45 pm
hi sir how are u i need ask u 1N5408XN REPLACE BY OTHERS, HOW RECOMMEND
I CANT ACSSES THE MARKET
MKDas · 04/06/2024 at 11:58 am
use any 3A shockley diode
atsedemariam · 05/06/2024 at 2:30 pm
tanks sir but i have a question i designed manually on/ off charge controller according to your circuit diagram but the circuit is not working practically, i assembled correctly but i cant figured out the error am graduating student the project name is solar charge controller pls sir if there is any tip you can recommend me
MKDas · 05/06/2024 at 5:02 pm
show me what you have done, contact through whatsapp
ZLT · 08/08/2024 at 1:00 pm
Thanks
MKDas · 09/08/2024 at 12:11 pm
👍