Solar Charge Controller circuit & working principle of ON/OFF charge controller

Published by MKDas on

In this article, we are going to learn about the solar charge controller. There are different types of solar charge controller 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!

Disclaimer: Electricity is always dangerous. Skill required to work with electricity. Do work with your own risk. Author will not be responsible for any misuse or harmful act. This website contents is also copyright protected. Anything copied and directly posted in your website and claiming it as yours is prohibited and nonsensical. Author published all the articles as opensource to help you making your project and learning purpose only. Learn and make one for yourself. If need any help feel free to ask the author. Author will be helpful to you. Thanks.

What is a solar charge controller?

In a solar power system, energy is being harvested from sunlight and stored in a battery; then, the battery gives us the power backup when required. This is very simple. But the problem is, each battery have a limit of taking charge and being discharge. That is why we need a controller to control both the charge and discharge limit. Otherwise, the battery will be damaged.

Charge controller

Working principle:

A charge controller have a basic operation of sensing and switching the electrical connection among solar panel, battery and load. Although this mechanism differs from controller to controller (we’ll discuss this later) but you can say this as some kind of switch like relay switch. There is a switch between solar panel and battery and another switch between the battery to load. Besides, it sense the battery voltage and panel presence. That’s it in the very simple way.

Here SW is the switch. This switch can be electronic or relay type depending on the controller situation. But let guess it as simple as a switch. Now, two voltage need to be sensed, that is why two voltage sensor is required. Although for the advance 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. Afterwards, if the battery is fully charged the controller turn 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 large charge controller the load switch part is not available. Because in large power system other devices like inverter is used which already have its own discharge protection. But in small charge controllers loads are being directly connected with charge controller.

Types of solar charge controller:

Based on operation principle, solar charge controllers are three basic types. These are

  • ON/OFF Charge controller
  • PWM Charge controller
  • MPPT charge controller

ON/OFF Charge controller:

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.

Simple circuit, less maintenancePoor battery management
Lowest in price comparing other controllersPoor charging efficiency

PWM Charge Controller:

In PWM Charge controller, PWM (Pulse Width Modulation) is used to control the charging current. This is an extra feature comparing 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 step charging control is possible. Which improves the battery charging efficiency as well as improves backup time with battery life.

Improved battery charging ensures longer battery lifeLow power harvesting capacity than MPPT
Low priceModerate 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 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.

Maximum power harvesting from solar panelComplex circuitry
Excellent battery and load managementHigh Price

In this article, we will discuss about the first two types of solar charge controller.

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 a different position.

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 opto-coupler. Opto-coupler works like a voltage shifter here as well as an isolator too.

ON/OFF type:

ON/OFF charge controller

And PWM type:

PWM Charge Controller

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 become 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.

Charging part
Discharge Control circuit
Voltage Regulation part

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:

ON/OFF Charge controller circuit with PIC12F675 micro-controller

See? Using a small 8 pin micro-controller makes the control circuit lot more 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.


Program for, Simple ON/OFF charge controller
Program Written by_ Engr. Mithun K. Das;
MCU:PIC12F675; X-Tal: 4MHz(internal). Compiler: mikroC pro for PIC v7.6.0
Date: 28-03-2021; ©
#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
     //read battery voltage
     battery=0;//clear previous data
        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(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
           ch_led = ~ch_led; // Toggle ch_led for charging indication
           charge_pin = 1;//keep on charging mosfet
        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
        load_pin = 1; //load MOSFET on
        ld_led = 1;//LOAD on indication
        load_pin = 0; //load MOSFET off
        ld_led=~ld_led;//LOAD off indication

  }//end of while(1)
}//end of void main


Code is very simple for ON/OFF charge controller. If you have mikroC compiler you can build the hex file but if you do not have any, you can download this hex from here.


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.


Mithun K. Das; B.Sc. in EEE from KUET. Blog:


Joy · March 28, 2021 at 5:37 pm

Nice ..sir.

Asimiyu · March 29, 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 · March 29, 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 · March 29, 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 · March 29, 2021 at 8:04 am

    The transformer can be used if overloading is monitored properly. Otherwise the transformer will be burnt.

Asimiyu · March 29, 2021 at 9:54 am

Thank you sir. It is cleared.

PWM Solar Charge Controller with PIC12F675 – Lab Projects BD · March 31, 2021 at 2:21 pm

[…] I’ve already discussed about this in the previous article. So I’m not discussing again. Kindly read that article first. […]

Leave a Reply

Your email address will not be published. Required fields are marked *