Intellgent Solar Charge Controller using ARM Cortex M3 board

AbstractDue to the energy crisis in Pakistan, the demand for alternative energy sources has increased. The Battery is a component of primary importance in these applications. This paper presents the design of PWM based Solar charge controller that prevents battery from damage. It control flow of charges to battery and load such that prevents battery from over charging, under charging and overvoltage meanwhile providing power to the load when required. It also prevents the system from abnormal conditions i.e. over current. It uses PWM to control the flow of power. It also displays state of battery on LCD and two LEDs are used to indicate the position of the system. Furthermore, a data acquisition system is also built to view data on a computer.
 
Keywords—Charge Controller; Cortex M3; Microcontroller; Battery;
Introduction
Due to the energy crisis in Pakistan, use of alternate energy sources like solar has increased to an extent. The battery in one of the main component used in these systems to store energy for later use. Every battery has a certain capacity to store the electricity. Also over charging, over voltage , over current and other conditions can reduce the lifetime of the battery and even cause damage. As a battery is one of the most expensive components of the system so its protection is important. So in this paper, we present a charge controller that regulates the voltage of battery and source and prevents it from unwanted conditions. A charge controller is a device that regulates the condition of a battery and prevents it from damage.













Figure 1: A typical stand alone solar system with charge controller[1]

It prevents overcharging and may protect against overvoltage, which can reduce battery performance or lifespan, and may pose a safety risk. It may also prevent completely draining ("deep discharging") a battery, or perform controlled discharges, depending on the battery technology, to protect battery life[2].
The battery storage in a PV system should be properly controlled to avoid catastrophic operating conditions like overcharging or frequent deep discharging. Storage batteries account for most PV system failures and contribute significantly to both the initial and the eventual replacement costs. Charge controllers regulate the charge transfer and prevent the battery from being excessively charged and discharged.[3]
The output of the solar panel is firstly checked for over voltage and over current condition for protection purpose. The voltage is then given to microcontroller.  The controller keeps the battery fully charged without over-charging it. When the load is drawing power, the controller allows the charge to flow from the generation source into the battery, the load, or both using PWM and switch. When the controller senses that the battery is fully (or nearly fully) charged, it reduces or stops the flow of electricity from the generation source to the battery. It allows the load to connect with battery only when a source is not generating enough energy. It automatically disconnects the system once a battery is in the deep discharge position.  An LCD and two LEDs are used to display the condition of the system as shown in Figure 2.





Figure 2: Block Diagram of the Intelligent solar charge controller

Protection is provided with Zener diode and fuse. A diode was used to prevent reverse current. The load is on off using switch and battery is charged with PWM.

     I.     System Design

A.    Protection

First of all input of solar is passed through a protection block which consists of a Zener, a diode, and a capacitor. Rating for the fuse is 3A so it will protect for over current. All the components used in the further circuit is of rating above 3A. A Zener is used in reverse to protect the circuit from over voltage and its rating is 15V. So any voltage above 15V will cause the system to shutdown. A diode is used to block reverse current and capacitor is used to protect the system from ripples that can cause damage to battery and microcontroller as well.
















Figure 3: Protection Circuit for Charge controller

B.    Voltage divider for Sampling of Voltage

Voltages are sampled by controller in two places of circuit for making decision. First it sampled input from solar panel, second it was sampled from battery. TM4C123 can bare <5V and it's a good practice to fed voltages less than 3.3V so we designed a voltage divider with 10k and 4.7k ohm resistance which is placed near battery and solar panel in parallel fashion.























Figure 4: Voltage divider for sampling

In this voltages for controller will be
.  
  

                          (1)



As our R1=4.7K,  R2=10K so our voltage dividing ratio is 0.3197. So maximum voltage that can appear in MCU analog pin is
Vout= 8.2*0 .3197
        =2.62154V
And in cause of some fault in our protection system, our MCU will be safe for voltage upto15.6396 V.
Power used by this circuit is very small due to high resistance.

 P  =  V2/R                       (2)
 P  =  8.22/14.7k  =  0.00457W which is negligible.

C.  Switching

There are two spots in the circuit where switching is used, one is battery and second is load. Battery and load are in series so battery is charged by PWM so that power can be provided to load by battery when solar power is not available. MOSFET are used for switching. N channel MOSFET is used for switching of load namely IRF540  and P-Channel MOSFET is used for  battery namely IRF5430.
Load is simply switched on or off while battery needs PWM based charging. Duty cycle of is controlled by Microcontroller based on charging state of battery.




















Figure 5: Switching Circuit for battery

MOSFET driver is used here with Mosfet reason to used this is MOSFETs have a large stray capacitance between the gate and the other terminals, which must be charged or discharged each time the MOSFET is switched on or off. As a transistor requires a particular gate voltage in order to switch on, the gate capacitor must be charged to at least the required gate voltage for the transistor to be switched on. Similarly, to switch the transistor off, this charge must be dissipated, i.e. the gate capacitor must be discharged.

   II.    Circuit Design

The complete circuit is first simulated on proteus. As proteus don't have TM4C123 so instead another controller is used for the simulation purposes. Solar panel was also simulated as battery for simulation purpose only. Simulation
Input of solar panel is first passed through some protection block which checks for over voltage, over current and reverse current flow as discussed earlier.  Then this is sampled with a voltage divider connected in parallel. This is for voltage of solar panel. This voltage value is used in software to make some decisions that will be discussed in software design. Then there is switching driver for battery charging. This uses a mosfet and transistor. PWM is generated on the terminals of the transistor which then charges battery according to duty cycle of the PWM. Battery voltage is also sampled to see the present condition of the battery. Then load is connected in series with battery. Another driver is used to switch on or off the load. Theses decisions are made on based of software. Two Leds are used to indicate system condition. When Red is on means battery is fully discharged (<10%). Green led blinking means charging of battery and green led on means battery is fully charged. LCD shows percentage charging of the battery and voltages of panel and battery. Serial communication is also used to communicate with computer if needed.
Figure 6: Complete Circuit of charge controller.

    III.   Software Design

This is heart of the project where all the logic is applied. Voltage is sampled from solar panel and battery and based on these two inputs, all the logic is applied. Main work of software is to decide charging of battery, on and off situation of load. Display, leds and serial communication is also done by this software.

A.    Battery and Solar Panle Voltages

Battery and solar voltages are two inputs of the system that decides situation of the system. For this system following logic was used

a)       if Solar Voltage > Battery Voltage and also battery Voltage is less than 6.96 then it means battery is not chareged so battery need to be charged at 95% PWMb)       if Solar Voltage > Battery Voltage and also battery Voltage is between 6.96 and 7.2 then it means battery is > 80% chareged so battery need to be charged at 10 % PWM
c)       if Battery Voltage is >= 7.2 or Solar Voltage is less than Battery voltage it means battery can't be charged as >7.2 Voltage means battery is fully charged and Solar voltage is less than battery voltage means it cannot be charged by panel.
d)       if Battery voltage is less than 6 it means battery is dead. Red light will be on and Display and serial communication will show alarming situation.
e)       If Solar Voltage is less than 3 and battery Voltage is 6.2 which means battery is charged and solar light is not enough to produce power, so load will switched to battery.
f)        Battery voltage between 6 and 6.2 shows that battery is fully discharged.

B.    ADC Sampling

TM4C123 have two ADC modules with 12 bit resolution. In this application we used software triggered conversion with busy wait synchronization. As speed of conversion doesn't matter much in this application so we used lowest sampling rate of 125k samples/second. Output of ADC is in bits which is then converted to voltage level using following formula.

V Measure = (ADC reading/ Resolution of ADC)*V System     (3)

C.    PWM generation

There are three modes related to PWM.
If battery is fully charged than duty cycle will be 0%. If battery is 80% charged than PWM duty cycle will be 10%  and if battery is less than 80% charged  than PWM duty cycle is 80%.
TM4C123 has 2 specific pwm modules with 16 bit counters.
 Figure 8: 10% and 90% PWM duty cycle

    

When timer is initially start with count value of zero, immediately loaded with reload value which is proportional to  frequency of PWM. Reloading also sets output flip flop to be low as in figure 8. Now counter starts decrementing with each cycle and current value is continuously compared against duty cycle value. Initially counter value is higher than duty cycle comparator. When current value equals to duty cycle comparator value, flip flop value goes high and it resets. Count continue decrementing un till it reaches  0 and underflow occurs which causes reload so PWM cycle ends and new cycle start again. [4]
Figure 8: PWM generation in TM4C123

Two parameters are used here for PWM generation. We are using 100Hz PWM with duty cycle of 90% and 10%. Re laod value determines frequency of PWM with following relationship
V Reload = f clock/f PWM                               (4)
V reload will be 160,000, as counter is 16 bit which can have maximum value of 65,356 so pre-sclaer needed  to be used here. A pre-scaler of 16 is used so new reload value of 10,000 is used.
For duty cycle, value is subtracted from reload value. So for 90% duty cycle, duty cycle comparator will have value of 1, 000 and for 10% it will be 9,000.
PWM charge controller will increase charging efficiency, allow for rapid recharging, and maintain healthy battery life. In all, a PWM charge controller comes with the following advantages Battery Aging Adjustments,  Battery Gassing and Heating Reductions, Charge Acceptance Increase,High Battery Capacity Maintenance: Lost Battery Recovery, Self-Regulation with Drops in Voltage or Temperature.[5]

 D. Algorithm


IV.   Hardware

PCB of the circuit is made using Proteus. Circuit is designed in two different modules, one is main controlling circuit and second is LCD for display.

Figure 10: PCB of the main circuit.               

V.    Data Acquisition

Data is send using serial communication with a baud rate of 9600. A application using Labview is made to get and display this data.
Current status of the system is send using 3 values battery voltage , Solar Voltage and % charging of battery and end using e\n like 07,08,9,e\n. This is then separated using string function of Labview and converted into float value which is then displayed. In this application we use usb cable for data communication. For practical purposes, BLE or another appropriate device

VI.   Conclusion

A small voltage, low cost charge controller construction is described using ARM Cortex microcontroller. PWM is used as it is cheap to build and much better than traditional  on-off charge controller as in perspective of battery life and efficient use of energy. A data acquisition system is also built to view the data on computer.  This type of small charge controller can be used in small applications to increases battery life and efficient use of energy.

VII.  References


[1]     Power Electronics Circuits Devices and Applications, 3rd ed., Elsevier B.V.,USA,2010,pp728
[2]     Webarchive backup: Brown, David. "Technical Article: Battery Charging Options for Portable Products." (Commercial website). Analogic Tech, 2006-07-01. Retrieved on 2007-08-21.
[3]     Power Electronics Circuits Devices and Applications, 3rd ed., Elsevier B.V.,USA,2010,pp727
[4]     ARM Microprocessors Systems, Cortex-M Archtecture Programming and Interface,Dr. M. Tahir,Dr. kashif Javed,1st ed,UET Lahore,2015,ch 9
[5]     Blue light, 'Overview of PWM Charge Controller',2010, [online] Availabl:http://e-bluelight.com/article-345-Pulse+Width+Modulation +Charge+Controllers+Explained.html



No comments:

Post a Comment

Thank you for your response.