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: Electricity is always dangerous. Proper skill is required to work with electricity. Do work at your own risk. The author will not be responsible for any misuse or harmful act or any mistake you make. The contents of this website are unique and copyright protected. Kindly don’t do any nonsensical act copying and claiming it as yours. Most of the articles published here are kept as open-source to help you. Take the knowledge for free and use it, but if you are interested you can buy the ready resources offered here. If you need any help or guide feel free to comment below, the author will try to help 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 has 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 of Solar Charge Controller:

A charge controller has a basic operation of sensing and switching the electrical connection among the 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 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.

Solar Charge Controller circuit

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. 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 inverter are used which already have their own discharge protection. But in small charge controllers loads are being directly connected with the charge controller.


Types of solar charge controller:

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:

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 the 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 steps 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 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.

Solar Charge Controller circuit

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:

Solar Charge Controller circuit
ON/OFF charge controller

And PWM type Solar Charge Controller circuit:

Solar Charge Controller circuit
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 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:

Solar Charge Controller analog circuit

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.

Basic operation:

Solar Charge Controller analog circuit
Charging part
Solar Charge Controller circuit
Discharge Control circuit
Solar Charge Controller 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:

If replaced by micrcocontroller:

Solar Charge Controller circuit using PIC12F675
ON/OFF Charge controller circuit with PIC12F675 micro-controller

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


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


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.


JLCPCB – Only $2 for PCB Prototype (Any Color)

24 Hours fast turnaround, Excellent quality & Unbeatable prices

$18 Welcome Bonus for new registrations Now!!!

Check this out: 5 coolest multimeters you can buy


I'm Mithun from Bangladesh. Electronics is my passion, love to work with electronics. This is my personal blog. Besides my regular works, I write some articles here. Most of them are open-source and everything is presented in the easiest way so that anyone can understand and learn it. Thanks.


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.

Seun · July 9, 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 · July 10, 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 · July 13, 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 · July 13, 2021 at 4:20 pm

        Which one did you found P-Channel? All N-Channel MOSFETs were used here.

      Seun · August 12, 2021 at 3:58 am

      Sir, please for 48v system, for the load section, how can I made it for 12v loads. Thanks

        MKDas · August 12, 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 · August 14, 2021 at 10:07 pm

          Thanks, please do you have any simple buck converter circuit

          MKDas · August 15, 2021 at 11:53 am

          Welcome. Yes, please search ‘Buck’ on the top.

Lakshman · July 30, 2021 at 10:19 am

Dear Sir,
Have nice day ,
My wishes for your help and support to sharing your knowledge

Leave a Reply

Avatar placeholder

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