Arduino based PWM Solar Charge Controller

Similar projects worth following
A large proportion of the world (around 1.1 billion people – 14% of the global population) does not have access to electricity according to Energy Access Outlook 2017. Around 84% of those without electricity access reside in a rural area where a grid-connection would be prohibitively expensive. One way of providing electricity to those people is to use renewable energy sources, like solar Power.

As the energy coming from the sun is available only during the day, it must be
stored in a battery for use during the night. Batteries need to be protected from over-charging during the day and over-discharging during the night. This can be done with a Charge Controller, There is two type of Solar Charge Controller 1. PWM 2. MPPT

The objective of this project is to make a reliable PWM Charge Controller which include the following features
1. Charging the battery
2. Provide protection to the battery and load
3. Visual Indication of various parameters

The PWm charge controller have combine feature of energy meter and charge controller.The charger can automatiaclly 6V or 12V battery and set all the charging set points  accordingly . You need not worry about any change in the software.

Specification of  charge controller :

1.Charge controller as well energy meter

 2. Automatic Battery Voltage Selection (6V/12V) 

 3.PWM charging algorithm with auto charge set point according to the battery voltage 

 4.LED indication for the state of charge and load status 

 5. 20x4 character LCD display for displaying voltages,current,power,energy and temperature.

 6.Lightning protection 

 7.Reverse current flow protection

8.Short Circuit and Over load protection

9. Temperature Compensation for Charging

Electrical specifications : 

 1.Rated Voltage= 6v /12V 

 2.Maximum current = 10A 

 3.Maximum load current =10A 

 4. Open Circuit Voltage = 8-11V for 6V system /15 -25V for 12V system

  • 1 × Arduino Nano
  • 1 × P-MOSFET - IRF9540
  • 1 × Electrolytic Capacitors ( 100uF and 10uF)
  • 1 × 20x4 I2C LCD
  • 1 × RGB LED

View all 24 components

  • Shematic for PWM Charge Controller V2.1

    Open Green Energy07/15/2018 at 19:07 0 comments

  • Future Planning for PWM Charge Controller - V2.1

    Open Green Energy07/15/2018 at 19:03 0 comments

    1. The future planning is for V2.1 Charge controller is to  implementing 3 stage charging algorithm. 

    2. Hardware modification for better control 

    3.  Option to implement multi chemistry  battery charging 

    4. Adding a USB port to charge USB charging gadgets like smartphone/tablets.

    5. Making a custom PCB for the  circuit.

    6. Making a 3D printed enclosure for the project.

    7. Adding an ESP8266 for remote monitoring through Smartphone App

    PWM Charge Controller -V2.1  Algorithm 

    When the controller is connected to the battery, the program will start the operation.

    Initially it checks if the panel voltage is sufficient for charging the battery. If yes, then it will enter into the charge cycle. The Charge Cycle consists of 3 stages. 

    Stage 1 Bulk charge: 

    Arduino will connect the Solar Panel to the battery directly ( 100 % duty cycle). The battery voltage will increase gradually. When the battery voltage reaches 14.4V, stage 2 will begin.

    In this stage current is almost constant. 

    Stage 2 Absorption charge: 

    In this stage Arduino will regulate the charging current by maintaining the voltage level at 14.4 for one hour. The voltage is kept constant by adjusting the duty cycle. 

    Stage 3 Float charge: 

    The controller generates the trickle charge to maintain the voltage level at 13.5V. This stage keeps the battery to be fully charged. If battery voltage is less than 13.2V for 10mins,

    The charge cycle will be repeated. 

    Load Control: 

    In the evening, when the PV voltage level falls to +8V for 5mins, the controller will turn on the light. In the morning when the PV voltage is larger than battery voltage for 3mins, the light will be turned off.

    Low Voltage Disconnect: 

    The charge controller will disconnect the load from the battery at LVD point, 11.5V.

    Low Voltage Reconnect: 

    Once the load is disconnected, it will reconnect again only when the battery voltage is more than LVR point, 12.5V

    Set point values

    Float set point: 13.5

    Bulk set point: 14.4

    Charge Restart set point: 13.2

    Absorb time limit: 1 hour

    Charge restart time limit: 10 minutes 

    Offset for AGM (vs flooded): -0.2 

    Low voltage disconnect: 11.5

    Low voltage reconnect: 12.5 

    Temperature compensation: -20 mV / degree C

  • Charging Algorithm

    Open Green Energy07/13/2018 at 09:25 0 comments

    1.Bulk :At this mode, a preset maximum constant amount of current (amps) is fed into the battery as no PWM is present. As the battery is being charged up , the voltage of the battery increases gradually

    2. Absorption: When the battery reaches the bulk charge set voltage, the PWM begins to hold the voltage constant. This is to avoid over-heating and over-gassing the battery. The current will taper down to safe levels as the battery becomes more fully charged. 3. Float: When the battery is fully recharged, the charging voltage is reduced to prevent further heating or gassing of the battery

    This is the ideal charging procedure.

    The present charge cycle block of code is not implements 3 stages charging.I use a easier logic in 2 stages.It works good.

    I am trying the following logic for implementing the 3 stages charging.

    Future Planning for Charging Cycle :

    The bulk charge begins when solar panel voltage is larger than battery voltage. When the battery voltage reaches 14.4V, absorption charge will be entered. The charging current will be regulated by PWM signal to maintain the battery voltage at 14.4V for one hour. Float charge will then enter after one hour. The float stage generates a trickle charge to keep the battery voltage at 13.6V. When the battery voltage falls below 13.6V for 10mins, the charging cycle will be repeated.

  • Sensors Calibration

    Open Green Energy07/13/2018 at 09:23 0 comments

    Voltage Sensors :

    5V = ADC count 1024

    1 ADC count = (5/1024)Volt= 0.0048828Volt


    Vin = Vout*(R1+R2)/R2 R1=100 and R2=20

    Vin= ADC count*0.00488*(120/20) Volt

    Current Sensor:

    As per seller information for ACS 712 current sensor

    Sensitivity is =100mV / A =0.100V/A

    No test current through the output voltage is VCC / 2= 2.5

    ADC count= 1024/5*Vin and Vin=2.5+0.100*I (where I=current)

    ADC count= 204.8(2.5+0.1*I) =512+20.48*I

    => 20.48*I = (ADC count-512)

    => I =(ADC count/20.48)- 512/20.48

    Current (I) =0.04882*ADC -25

    More details on ACS712

    Temperature Sensor :

    As per data sheet of LM35

    Sensitivity=10 mV/°C

    Temp in deg C =(5/1024)*ADC count*100

    Note : The sensors are calibrated by assuming the arduino Vcc= 5V reference.But in practical it is not 5V always.So there may be chance of getting wrong value from the actual value.It can be solved by following way.

    Measure the voltage between arduino 5V and GND by a multimeter.Use this voltage instead of 5V for Vcc in your code.Hit and try to edit this value until it matches the actual value.

    Example: I got 4.47V instead of 5V.So the change should be 4.47/1024=0.0043652 instead of 0.0048828.

  • Voltage and Current Sensing

    Open Green Energy07/13/2018 at 09:21 0 comments

    1.Voltage Sensor:

    The voltage sensors are used to sense the voltage of solar panel and battery.   It is implemented by using two voltage divider circuit. It consists of two resistors R1=100k and R2=20k for sensing the solar panel voltage ans similarly R3=100k and R4=20k for battery voltage.The out put from the R1and R2 is connected to arduino analog pin A0 and out put from the R3 and R4 is connected to arduino analog pin A1.

    2.Current Sensor :

    The current sensor is used for measuring the load current.later this current is used to calculate the load power and energy.I used a hall effect current sensor (ACS712-20A)

    3.Temperature Sensor :

    The temperature sensor is used to sense the room temperature. I used LM35 temperature sensor which is rated for −55°C to +150°C Range.

  • Initial design Idea

    Open Green Energy07/13/2018 at 09:16 0 comments

    The heart of of the charge controller is an Arduino Nano board. The Arduino MCU senses the solar panel and battery voltages. According to this voltages it decides how to charge the battery and control the load.

    The amount of charging current is determined by difference between battery voltage and charge set point voltages. 

    Currently the controller uses two stages charging algorithm.According to the charging algorithm it gives a fixed frequency PWM signal to the solar panel side p-MOSFET. The frequency of PWM signal is 490.20Hz(default frequency for pin-3). The duty cycle 0-100% is adjusted by the error signal.

    The future planning is to implement 3 stage charging algorithm. 

    The controller gives HIGH or LOW command to the load side p-MOSFET according to the dusk/dawn and battery voltage.

    Main Functions :

    The charge controller is designed by considering the following points :

    1.Prevent Battery Overcharge: To limit the energy supplied to the battery by the solar panel when the battery becomes fully charged.This is implemented in charge_cycle() of my code.

    2.Prevent Battery Over discharge: To disconnect the battery from electrical loads when the battery reaches low state of charge.This is implemented in load_control() of my code.

    3.Provide Load Control Functions: To automatically connect and disconnect an electrical load at a specified time. The load will ON when sunset and OFF when sunrise.This is implemented in load_control() of my code.

    4.Monitoring Power and Energy : To monitor the load power and energy and display it.

    5.Protect from abnormal Condition: To protect the circuit from different abnormal situation like lightening,over voltage,over current and short circuit etc.

    6.Indicating and Displaying: To indicate and display the various parameters

    7.Serial Communication: To print various parameters in serial monitor

View all 6 project logs

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates