0% found this document useful (0 votes)
8 views43 pages

MPPTCharge Controller 3

The document presents a project on designing an Arduino-based Maximum Power Point Tracking (MPPT) Solar Charge Controller, aimed at improving the efficiency of photovoltaic systems. It discusses the importance of renewable energy, particularly solar energy, in addressing electricity shortages in Bangladesh, and outlines the system's components, including solar panels, charge controllers, and batteries. The project compares the performance of the proposed MPPT system with existing algorithms to enhance power extraction from solar sources.

Uploaded by

n210032
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views43 pages

MPPTCharge Controller 3

The document presents a project on designing an Arduino-based Maximum Power Point Tracking (MPPT) Solar Charge Controller, aimed at improving the efficiency of photovoltaic systems. It discusses the importance of renewable energy, particularly solar energy, in addressing electricity shortages in Bangladesh, and outlines the system's components, including solar panels, charge controllers, and batteries. The project compares the performance of the proposed MPPT system with existing algorithms to enhance power extraction from solar sources.

Uploaded by

n210032
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

See discussions, stats, and author profiles for this publication at: [Link]

net/publication/368414775

Design of an Arduino based Maximum Power Point Tracking (MPPT) Solar


Charge Controller Course

Experiment Findings · February 2023


DOI: 10.13140/RG.2.2.13850.93124

CITATIONS READS
0 4,314

1 author:

Neloy Prosad Bishnu


Khulna University of Engineering and Technology
9 PUBLICATIONS 4 CITATIONS

SEE PROFILE

All content following this page was uploaded by Neloy Prosad Bishnu on 10 February 2023.

The user has requested enhancement of the downloaded file.


Design of an Arduino based Maximum Power
Point Tracking (MPPT) Solar Charge
Controller
Course No: EE 3200
Course Title: Electrical and Electronic Project Design

A Project
Submitted to the Department of Electrical and Electronic Engineering of
Khulna University of Engineering &Technology
By
Neloy Prosad Bishnu -1803022

Supervised by
Dr. Md. Salah Uddin Yusuf
Professor
Department of Electrical and Electronic Engineering
Khulna University of Engineering & Technology (KUET)

1|Page
Acknowledgments
First, I would like to acknowledge my supervisor Dr. Md. Salah Uddin Yusuf, for his guidance and
advice in helping us decide on our topic of interest and for monitoring my work. He has provided various
ideas and enlightened us about solar cells and power electronics. He has guided us all the way through
despite his busy schedule. Mr. Salah Uddin sir, has always managed to take that time and guide us
through. I was privileged enough to have been assisted and directed by him throughout this project.

Abstract
Renewable sources such as Photovoltaic Systems (PV) have been used over decades to focus on greener
power generation sources. Today it has become a matter of concern how to reduce COST and improve
EFFICIENCY to harness and use these natural resources in a much better way possible. Hence the idea
of a Maximum Power Point Tracking System (MPPT) has emerged, which is a system used by charge
controllers for wind turbines and Photovoltaic Systems to employ and also provide a maximized power
output. This Thesis is mainly concerned with the utilization of such a system in order to achieve
controlled photovoltaic power using the MPPT mechanism. The main aim of this project was to track
the maximum power point of the photovoltaic module so that the maximum possible power can be
extracted from the photovoltaic systems by varying certain conditions in the algorithm and set up
mechanism. Finally, the output data from this project was compared with the other MPPT algorithms to
attain an improved performance and a better MPPT system.

2|Page
Contents

Introduction
1.1 Introduction to Solar Energy 5
1.2 Background 5
1.3 Motivation 6
1.4 System Description using block diagram 6
1.5 The Panel Solar 6
1.6 MPPT Solar charge Controller 7
1.7 Battery 8
Full System Overview
2.1 Photovoltaic Panels 9
2.2 Photovoltaic Modules/Array 10
2.3 Photovoltaic Cell Model 10
2.4 Maximum Power point Tracking 12
2.5 MPPT Methods 13
2.6 Constant Voltage Method 13
2.7 Open Circuit Voltage Method 14
2.8 Short Circuit Current Method 15
2.9 Perturb and Observe Method 15
2.10 Incremental Conductor Method 17
DC-DC Converters
3.1 Introduction 19
3.2 Buck-Boost Converter 19
The Proposed Arduino based MPPT Solar Charge Controller Design
4.1 Arduino as microcontroller 20
4.2 Current sensing 21
4.3 Voltage sensing 22
4.4 Buck converter 23
4.5 Pulse Width Modulation 25
4.6 Some Jumper Wires 26
4.7 Breadboard 26
4.8 All Components 27
Design Function and Findings of the Project
5.1 Circuit diagram 28
5.2 Modes of Charging 29
5.3 Snapshot of the Project 30
5.4 Limitations faced during project work 32
Cost Calculation
6.1 Cost Sheet 33

3|Page
Conclusion
7.1 Summary 34
7.2 Conclusion remarks and future prospects 34

4|Page
Introduction
1.1 Introduction to Solar Energy
One of the most important renewable energy sources nowadays, which has caught the attention
of many, is ‘Solar Energy,’ and it is through harnessing this energy that we are meeting some of our
energy demands. It is a known fact nowadays that non-renewable resources such as coal, oil, and other
such sources are almost on the verge of termination. On the other hand, renewable energy sources such
as solar are plentiful and have the most excellent availability compared to other energy sources. Solar
energy is clean and free of emissions since it does not produce pollutants or by-products harmful to
nature. Therefore, it is a booming industry of research, where new and more efficient modes of
harnessing solar energy are challenging. The conversion of solar energy into electrical energy has many
application fields.

There are mainly two ways solar-to-electrical conversion can be done: thermal and photovoltaic. Solar
thermal is the conventional AC electricity generated by a steam turbine; heat extracted from intense solar
rays is used to transduce steam and stored in thermally insulated tanks for usage during lack of sunshine
or night time. Solar photovoltaic use cells made of silicon or certain types of semiconductor materials,
which convert the light energy absorbed from incident sunshine into DC electricity. To make up for
intermittency and night time storage of the generated electricity in a battery is needed.

Bangladesh is a country that is concerned about environmental problems, and sustainable energy sources
are becoming more and more popular here. The charge controller determines the flow of converted
electricity from PV. An efficient charge controller is crucial to do the battery charging and discharging
process faster and better. The existing electric grids are not capable of supplying the electric need. Even
in rural areas, people face the most challenging conditions for the electricity crisis; hence we aim to
make solar energy popular by increasing its efficiency and making it one of the best renewable energy
sources.

1.2 Background
The electricity crisis is a major problem in recent times and is even more critical for a densely
populated, poverty corrupted, developing third-world country like ours. Many of us live here without
one of the basic facilities, electricity. In some areas outside the city, there is a general electricity service
called ‘PALLI BIDYUT,’ which can supply minimal electricity to those areas. As days go by, the crisis
of electricity is increasing. In contrast, no other solution is left for us without harnessing the gift of nature
into electricity hence by use of solar power or wind turbine to generate this electricity requirement. We
face an electricity crisis, and the cost of gas and other natural resources like fuel, diesel, and pets are
increasing daily. Hence using solar energy is the best alternative for this country and is very suited for
its weather conditions. Additionally, having an MPPT solar charge controller ensures a much better
efficient conversion of this solar energy to the desired power source.

5|Page
1.3 Motivation
In Bangladesh, the amount of sunlight available primarily can meet quite a lot of the demand for
electricity in this country. Over time the use of Solar panels is spreading, especially throughout many
rural areas. However, a back flaw is the ability of these panels to harness that sunlight with proper
efficiency and use it properly. Solar energy is ideal as it can provide griddles power and is clean in terms
of pollution and health hazards. Even after having so many advantages of using solar energy, it still
needs to be more widely used; the central concern remains in terms of its efficiency and another big
question about its operation during cloudy weather conditions. Hence, keeping all these matters in mind,
we wanted to design an MPPT solar charge controller to adjust charging rates depending on the battery's
charge level to allow charging closer to the battery’s maximum capacity and monitor battery temperature
to prevent overheating. An MPPT controller is better suited for colder conditions; PV array voltage can
be higher than battery voltage; hence the MPPT solar charge controller will harvest more power from
the solar array. There are quite a few advantages of having an MPPT solar charge controller for the PV
panels, which might increase the use of solar panels to their full potential.

1.4 System Description using block diagrams


Sunlight
MPPT Solar

Solar Panel Charge Battery

Controller

Fig: 1.1 An overview of our system’s major components are shown as a block diagram.
a) Solar panel
b) MPPT Solar Charge Controller
c) Battery

Each of the major components shown in the block diagram is briefly described below:

1.5 The Panel Solar


Solar panels are such types of devices that convert light into electricity. A solar panel is a
collection of solar cells. It depends on the amount of light hitting the cells s. The more light that hits a
cell, the more electricity it produces. Spacecraft are usually designed with solar panels that can always
be pointed at the Sun even while the spacecraft’s body moves around.
As we all know, the energy from the sun is renewable (not a finite source), and it is an entirely pollution-
free source of electricity. Instead of burning fossil fuels dug up from the ground in big power plants, a
limited energy source, solar panels convert sunlight directly into electricity with no harmful emissions.

6|Page
Fig: 1.2 Use of solar panels in rural areas on roofs of houses.

The basic unit of a solar panel is a solar cell, which usually consists of one or two layers of silicon-
based semiconductor wafers. When the photons strike the solar cells in sunlight, they generate an
electrical charge due to the "photovoltaic effect,” which produces a voltage from photons. The flow of
these electrons causes a steady electrical current from one side of the cell to the other.

Dozens of these PV cells are packaged together and called solar modules. They are again packaged
into solar panels straddling a rooftop and arranged to maximize their hours of exposure to direct
sunlight. The electricity generated by all those solar cells is direct current (DC); it is for this reason that
this current is then sent to an inverter that transforms it into the same alternating current (AC) and then
ready to be used by the appliances at home or even for the local utility electricity distribution grid.

Some of the advantages of solar panels are:

• These are the most readily available solar technology.


• These require significantly less maintenance.
• These operate best on bright days with the sun shining incident to the panels.

1.6 MPPT Solar Charge Controller


The core function of a charge controller is to maintain the battery at the highest possible state of
charge. When the PV module charges the storm, the charge controller shields the battery from
overcharging and detaches the load to prevent deep or full discharging. In other words, it simply performs
the necessary function of ensuring that the batteries cannot be damaged by overcharging by effectively
cutting off the current from the PV panels when the battery voltage reaches a certain level. So basically,

7|Page
a Maximum Power Point Tracking Solar Charge Controller performs an extra function to improve the
system efficiency.
The efficiency loss in a basic system is due to a mismatch between the voltage produced by the PV
panels and that required to charge the batteries under certain conditions. Ideally, the charge controller
directly controls the state of charge of the storm. Without charge control, the current from the module
will flow into a battery proportional to the ‘IRRADIANCE’ (the radiant power received by a surface per
unit area), whether the battery needs to be charged or not. If the battery is fully charged, unregulated
charging will cause the voltage to reach exceedingly high levels, causing electrolyte loss and internal
heating and might lead to grid corrosion. So, we can say that a charge controller maintains the health and
extends the battery's lifetime. Hence the necessity of having such a type of charge controller has an
immense advantage while using solar panels. This work done by the controller has a very complex
mechanism where the main components are a converter and sensor. Specific algorithms are assigned to
the system to compare and decide on the correct voltage and power, making the system truly smart and
efficient. So, the sunlight captured by the PV panels is turned into the current, which is later sent to these
controllers for further modifications.

1.7 Battery
The battery’s primary responsibility is to store the charge modified from the solar charge
controller for later use. From what solar energy is concerned, selecting the correct type of battery is the
most important thing. So, in this case, the deep cycle type battery is preferred for its efficiency. Deep
cycle batteries are energy-storing units in which chemical reactions occur that generate voltage and
electricity. It is called deep cycled because it works in two cycles.

1) Charging cycle
2) Discharging cycle.

The methodology followed by the deep cycle batteries is exciting. While a car battery is designed to
supply an instant bulk of energy to start up, a deep cycle battery provides power at a flat rate, slowly
powering up the load.
Again, different types of deep-cycle batteries are categorized more vividly for more efficient use in
other climatic conditions. They are as follows,

1) Flooded batteries
2) Gel batteries
3) AGM (absorbed glass mat)
4) Lithium ion

As far as the conventional scenario is concerned, flooded batteries are primarily used he standalone PV
systems. Other types are also used in off-grid connections. Lithium-ion batteries are preferably used in
grid-connected systems in many households but are less popular for not being cost-efficient.

8|Page
Full System Overview
2.1 Photovoltaic Panels
The whole process by which a photovoltaic cell works is pretty complex. Simply put, the
mechanism is as such; the light excites electrons to move from one layer to another through semi-
conductive silicon materials. This ultimately produces an electric current. This whole process is called
the photoelectric effect. Solar cells, called photovoltaic, are made from thin slices of crystalline silicon,
gallium arsenide, or other semiconductor materials capable of converting solar radiation directly into
electricity.

Fig 2.1: Mechanism of a PV Panel

The generation of electric current happens inside the depletion zone of the p-n junction. The area around
the p-n intersection is called the depletion zone, where the electrons from the “n-type” silicon have
diffused into the holes of the “p-type” material. Whenever a photon of light hits the surface and is
absorbed by one of these atoms in the “n-type” silicon, it will dislodge an electron, thus creating a free
electron and a hole. The free electron and hole produced have sufficient energy to jump out of the
depletion zone. If a wire is connected from the cathode (n-type silicon) to the anode (p-type silicon),
electrons will flow (current) through the wire. The electron is attracted to the positive charge of the “p-
type” material and travels through the external load creating a flow of electric current. The hole created
by the freed electron is attracted to the negative charge of “n-type” material and drifts to the back
electrical contact. As the electron enters the “p-type” silicon from the rear electrical connection, it
combines with the hole establishing the electrical neutrality.

By connecting large numbers of these cells into modules, the cost of photovoltaic electricity gets reduced
to a certain amount per kilowatt-hour. The most superficial solar cells provide small power for watches
and calculators. More complex systems can provide electricity to houses and electric grids.

9|Page
2.2 Photovoltaic Modules/Array
The basic building blocks of solar or PV system are solar or PV cells. These small individual
cells produce about 1 or 2 KW of power. To power the output of the PV cells, they have to be connected
forming larger units called modules. These modules, however, can be connected to form interconnected
arrays to produce more power. By combining these cells or modules in series, the voltage can be
increased. On the other hand, by connecting the cells or modules in parallel, the output current can reach
higher values.

Fig: 2.2 The formation of a PV system from the cell to the array.

The PV devices can be made using different semiconductor materials and arranged in various structures.
There are mainly three types of materials used for solar cells: silicon, polycrystalline thin films, and
single crystalline thin film.

2.3 Photovoltaic cell model


The characteristics of a PV cell can be further explained using an equivalent circuit shown in Fig:
2.3. The PV model consists of a current source, a diode, and a series resistance. The effect of parallel
resistance represents the cell’s leakage resistance, which is very small in a single module. The current
source represents the current generated by the photons, and its output is constant under constant
temperature and constant incident radiation of light.
Ipv

Rs
Id1

Iph Rsh Vpv

Fig: 2.3 Equivalent circuit of PV cell


10 | P a g e
Current-voltage (I-V) curves are obtained by exposing the cell to a constant level of light while
maintaining a constant cell temperature, varying the resistance of the load, and measuring the produced
current. When an I-V curve is drawn, it usually passes through two points:

Short-circuit current (𝑰𝒔𝒄 ): This is the current produced when the positive and negative terminals of
the cell are short-circuited (i.e., when the solar cell is short-circuited), and the voltage between the
terminals is zero, which corresponds to zero load resistance.

Open-circuit voltage (𝑽𝒐𝒄): This is the voltage across the positive and negative terminals under open-
circuit conditions when the current is zero, which corresponds to the infinite load resistance.

𝑮 (1)
𝑰𝒑𝒉 = [𝑰𝒔𝒄 + 𝒌𝒊 (𝑻 − 𝟐𝟗𝟖). ]
𝟏𝟎𝟎𝟎

𝟏 𝟏 (2)
𝑻 𝟑 𝒒. 𝑬𝒈𝒐 . ( − )
𝑻𝒏 𝑻
𝑰𝒐 = 𝑰𝒓𝒔 . ( ) . 𝐞𝐱𝐩⁡[ ]
𝑻𝒏 𝑨. 𝑲

𝑵𝒔 . 𝑲. 𝑻 (3)
𝑽𝑻 =
𝒒

𝑽 + 𝑰. 𝑹𝒔
𝑰𝒔𝒉 =
𝑹𝒔𝒉 (4)

(𝑽 + 𝑰. 𝑹𝒔 )
𝑰 = 𝑰𝒑𝒉 − 𝑰𝒐 . [𝐞𝐱𝐩 { } − 𝟏] − 𝑰𝒔𝒉 (5)
𝑨. 𝑽𝑻

𝑽𝒎𝒑 ⁡ × (𝑽𝒎𝒑 + 𝑰𝒎𝒑 × 𝑹𝒔 ) (6)


𝑹𝒑 = ⁡
𝑽𝒎𝒑 + 𝑰𝒎𝒑 × 𝑹𝒔
𝑽𝒎𝒑 × 𝑰𝒑𝒉 − 𝑽𝒎𝒑 × 𝑰𝒐 × 𝐞𝐱𝐩 ( ) + 𝑽𝒎𝒑 × 𝑰𝒐 − 𝑷𝒔𝒕𝒄
𝑽𝒕 × 𝑵𝒔 × 𝒂

𝑽𝒎𝒑 𝑽𝒎𝒑 (7)


𝑹𝒑𝒐 = − − 𝑽𝒐𝒄
𝑰𝒔𝒄 + 𝑰𝒎𝒑 𝑰𝒎𝒑

𝐼𝑝ℎ Photocurrent 𝐴 Ideality factor


𝐼𝑠𝑐 Short circuit current 𝑅𝑠 Series resistor
𝐼𝑜 Saturation current. 𝑅𝑠ℎ Shunt resistor
𝐼𝑟𝑠 Reverse saturation current 𝑞 Electron charge
𝐼𝑠ℎ Shunt current 𝐸𝑔𝑜 Band gap energy
𝑇 Temperature 𝑉𝑜𝑐 Open circuit voltage
𝑅𝑝 Resistance in parallel connection 𝑉𝑚𝑝 The voltage at the maximum power point
𝑅𝑝𝑜 Resistance in parallel connection for 𝐼𝑚𝑝 Current at the maximum power point
the initial condition
𝑇𝑛 Normal temperature 𝐼𝑠𝑐 Short circuit current
𝑘𝑖 Short circuit temperature constant 𝐼𝑑 Current through diode
𝐾 Boltzmann constant 𝑁𝑠 No series cell
𝑉𝑇 Thermal voltage 𝑃𝑚𝑎𝑥,𝐸 Maximum power

11 | P a g e
(Vmp,Imp)

Current (A)

Power (W)
I-V Curve
(Isc,0)

(Vmp,Imp)

(0,0) (Voc,0)

Voltage (V)
Fig: 2.4 The I-V graphs showing the characteristic of a PV cell

2.4 Maximum PowerPoint Tracking


In the Power-Voltage or current-voltage curve of a solar panel, there is a peak operating point at
which the Solar Panel delivers the maximum possible power to the load. This unique point is the solar
panel’s entire power point (MPP). The photovoltaic nature of the solar panels makes the (Power-Voltage
or current-voltage) curves depend on temperature and irradiance (the flux of radiant energy per unit area)
levels. In other words, depending on the amount of sunlight per unit area of the panels, the curve will
vary; hence the peak point or MPP will vary accordingly. Therefore, it can be deduced that the operating
current and voltage which maximize power output will change with environmental conditions.

Fig: 2.5 Shows the variation of maximum Power Point (MPP) at different sunlight conditions

12 | P a g e
From Fig: 2.5, it can be seen that the MPP depends on certain conditions, such as the irradiance, which
is given by the symbol ‘G’. At different values of G from the graph it can be seen how the importance
of MPP has slightly shifted. It is hence the work of the charge controller using a specific algorithm to
calculate the MPP at every instance, providing the maximum power, and making the system more
efficient. In these applications, the load can demand more power than the PV system can deliver. There
are many different approaches to maximizing the energy from a PV system, this range from using
superficial voltage relationships to more complex multiple sample based analysis.

2.5 MPPT Methods


There are some conventional methods for MPPT. Seven of them are listed here. These methods
include:

1. Constant Voltage method


2. Open Circuit Voltage method
3. Short Circuit Current method
4. Perturb and Observe the method
5. Incremental Conductance method
6. Temperature method
7. Temperature Parametric method
Out of these methods mentioned, the first five methods have been discussed in detail in this paper.

2.6 Constant Voltage Method


The constant voltage method is quite a simple method but an inefficient method. This method
uses single voltage to represent the 𝑉𝑁𝑃𝑃 . In some cases, this value is set by an external resistor connected
to a current source pin of the control IC. The method will collect about 80% of the maximum available
power for the various irradiance variations .The average level of irradiance will determine the actual
performance. Since the maximum power point of a solar PV module does not always lie between 70-80
percent of 𝑉𝑜𝑐 , this is why the tracking efficiency is low in this case.

Fig: 2.6 Flowchart of constant voltage method


13 | P a g e
2.7 Open Circuit Voltage Method
Another method that is similar to the constant voltage method but an improvement to it is the
Open Circuit Voltage method which uses⁡𝑉𝑜𝑐 to calculate 𝑉𝑁𝑃𝑃 . Once the system obtains the 𝑉𝑜𝑐 value,
𝑉𝑚𝑝𝑝 is calculated by,
𝑉𝑁𝑃𝑃 = 𝐾 ∗ 𝑉𝑜𝑐

Fig: 2.7 I-V and P-V characteristics of Open circuit voltage method

The 𝑉𝑜𝑐 is the open circuit voltage of the PV Panel. The K value is typically between to 0.7 to 0.8 as it is
always less than unity (commonly used as 0.76). It is necessary to update 𝑉𝑜𝑐 occasionally to compensate
for any temperature change. Sampling the 𝑉𝑜𝑐 value can also help correct temperature changes and to
some degree changes in irradiance. Monitoring the input current can indicate when the 𝑉𝑜𝑐 should be re-
measured. The K value is a function of the logarithmic function of the irradiance, increasing in
importance as the irradiance increases.

Benefits of using this method:


• The cost is relatively low.
• It is a much simpler method and easy to implement.

Drawbacks of this method:


• It is not a very accurate method and may not operate precisely at the Maximum Power
Point.
• The open circuit of the solar PV module varies with temperature, so the open circuit
The voltage needs to be measured continuously for temperature variations.

14 | P a g e
2.8 Short Circuit Current Method
This technique is also referred to as the constant current method. The short circuit current method
uses a 𝑰𝒔𝒄 (Short Circuit Current) to estimate 𝑰𝑵𝑷𝑷 (Maximum power point current). The 𝑰𝒔𝒄 is the short
circuit current of the PV panel.
𝑰𝒔𝒄 = 𝐾 ∗ 𝑰𝒄𝒄
This method uses a short load pulse to generate a temporary circuit condition. The input voltage will go
to zero during the short circuit pulse, so the power conversion circuit must be powered from
another source. One advantage of this system is the tolerance for input capacitance compared
to aggressive 𝑽𝒐𝒄 method. The K values are typically close to 0.9 to 0.98 (always smaller than 1)

Fig: 2.8 Flowchart for Short circuit method

Benefits of using this method:


• It is simple and implementation cost is low.
• No input is required for this method.

Drawbacks of this method:


• In most cases, the irradiation is never precisely at the MPP due to variations on the array
that are not considered (it is not always accurate).
• Data varies under different weather conditions and locations.
• It has low efficiency. In these two methods, we have to choose the correct constant k value
carefully to calibrate the solar panel accurately.

2.9 Perturb and Observe Method


This method is a widely used approach to determine the MPP. In this method, the controller
adjusts the voltage by a small amount from the array and measures power. If the power increases, then
further adjustments are made in the direction until power no longer increases. This is called the Perturb

15 | P a g e
and Observe Method. This method works by perturbing the system by increasing or decreasing the PV
module operating voltage and observing its impact on the output power supplied by the module.

The voltage to a cell is increased initially; if the output power increase, the voltage is persistently
increased till the point until the output power starts declining. Once the output power decreases, the cell’s
voltage is reduced until the maximum capacity is reached. This process is continued until the MPPT is
attained. This results in an oscillation of the output power around the MPP. The PV module’s output
power curve is a function of the voltage (P-V curve), at the constant irradiance and the constant module
temperature, it is also assumed that the PV module is operating at a point away from the maximum power
point. If a minute amount perturbs the PV module's operating voltage, the resulting power P is then
observed. If it is seen that the P is positive, then it is supposed that it has moved the operating point
closer to the MPP. Hence further voltage perturbations in the same direction will continue driving the
operating point toward the MPP. If the P is negative, the working end will be moving away from the
MPP and the path of perturbation should be inverted to move back toward the MPP.

Fig 2.9: Shows the flowchart of P & O

Benefits of using the P&O method:


• The simplicity of its algorithm
• Ease of implementation
• It has comparatively less implementation cost
• It is comparatively a more accurate method

16 | P a g e
Limitations to using this method:
• It cannot determine when it has reached the MPP. Under steady state operation
the output power oscillates around the MPP.
• This method is relatively slow to find the MPP if the voltage is far away from MPP
• In any case if there is any shadow on any of the panels (as they are in series of parallel)
then the power-voltage curve of the PV will have several peaks and the P&O will not be
able to distinguish them and find the actual height.

2.10 Incremental Conductance Method


An observation based on a P-V characteristic curve the Incremental Conductance Method was
planned. In 1993 when this algorithm was made it was intended to overcome some drawbacks of the
P&O algorithm. The MPP can be calculated with the help of the relation between dI/dV and -I/V. The
incremental conductance method is based on the fact that, the slope of the PV array of the power curve
is zero at the MPP, positive on the left of the MPP and negative on the right on the MPP. This can be
given by,

So, if the MPP lies on the right side, dI/dV < -I/V, then the Photovoltaic voltage must be reduced to
reach the MPP. To find the MPP IC method can be used, it has been known to improve the PV efficiency,
reduce power loss and system cost. When IC method is implemented in a microcontroller it is seen to
produce a much more stable performance compared to P&O method.

The procedure starts with measuring the present values of PV module voltage and current. Then, it
computes the incremental changes, dI (change in contemporary) and dV (change in voltage), which uses
the present and previous values of the voltage and current. With the help of the relationships in the

17 | P a g e
equations mentioned above the primary check is done. If the condition satisfies the inequality equation
shown above, it is assumed that the operating point is at the left side of the MPP thus must be moved to
the right by increasing the module voltage. Similarly, suppose the condition satisfies the inequality
equation. In that case, it is assumed that the operating point is at the right side of the MPP, thus must be
moved to the left by decreasing the module voltage.

Benefits:
• It can successfully detect any changes in the irradiation and shift its MPP value by
adjusting the duty cycle.
• It has a good tracking efficiency
• This method reduces oscillation around the MPP point
• It can reduce power loss and system cost as well

Drawbacks:
• The computational time is increased due to slowing down of the sampling frequency
resulting from the higher complexity of the algorithm compared to the P&O method.

Fig 2.10: Shows the Flowchart of the Incremental and conductance Method

18 | P a g e
DC-DC Converter
3.1 Introduction
An electronic circuit which converts a source direct current (DC) from one voltage level to
another is known as a DC-DC converter. These DC-DC converters are commonly used in controlled
switch-mode dc power supplies and dc motor drives applications. The input of these converter is
often not any regulated DC voltage. This is obtained by rectifying the line voltage hence it will
fluctuate because of the changes in the line voltage magnitude. Switch-mode DC-DC converters
convert the unregulated dc input into a controlled/ monitored DC output at a desired voltage level.
The heart of MPPT hardware is a switch-mode DC-DC converter. MPPT uses the converter for a
different purpose: regulating the input voltage at the PV MPP and providing load matching for the
maximum power transfer. In this chapter, we have discussed about the various topologies of DC-DC
converters. We have explained Buck-Boost, SEPIC, and Buck converters and their operation mode.
1. Buck-Boost
2. SEPIC (Single Ended Primary Inductor Converter)
3. Buck Converter (Step down Converter)

Generally for the Photo Voltaic system with batteries, the MPP of commercial PV module is set
beyond the charging voltage of batteries for most combinations of irradiance and temperature. One
remarkable fact about the buck converter is that it can operate at the MPP under almost all conditions.
Still, it cannot do so when the MPP goes below the battery charging voltage under a low-irradiance
and high-temperature condition. In such cases an additional boost capability can slightly increase the
overall efficiency.

3.2 Buck Converter (step-down converter)


A Buck Converter is mainly a DC-DC power converter which (while stepping up the current)
steps down the voltage from its input (supply) to output (load). The converter mainly consists of
transistors, diodes, capacitors (mainly as an energy storage element) and inductors. To reduce the
voltage ripples, filters made of capacitors or inductors are added to the output of such converters. In
other words, there are load side filters and input filters added.
Buck converters mainly act as switching converters, delivering a much higher power efficiency as DC-
DC converters than linear regulators. Buck converters are typically very efficient about 90%, making
them an ideal tool for tasks like converting a computer's mass supply voltage down to lower voltages
required for the CPU and DRAMS.

19 | P a g e
General Circuit diagram of a Buck Converter:

Fig 3.1: A simplified buck converter circuit

The proposed Arduino based MPPT Solar Charge Controller Design


In our project the Maximum Power point Tracker was implemented using an Arduino with the
preferred program to execute the desired algorithm. The panel voltage and current is taken where the
implemented program will run and the MPP will be achieved with the help of this algorithm. Through
our research and by judging all possible methods for calculating the MPP value we have taken necessary
steps starting from the testing process and finally implementing each component of our design one by
one hence designing the charge controller. We have mainly carried out specific tests such as the panel
testing, current sensor testing, voltage divider testing and also battery testing. The algorithm we have
used is the Incremental and conductance method we have followed for our design. The current sensing
was also a crucial part of the design.

Hardware Section
4.1 Arduino as Microcontroller
As mentioned above we have used Arduino as microcontroller for implementing our project and
it can be defined as the heart of our project. Arduino is a combination of both physical programmable
circuit board and software. As a matter of fact, it is almost like an IDE (integrated development
environment) that we use in our personal computer. That is why we chose Arduino to get a more precise
result in our project. The current sensor senses the present, the voltage sensor senses the voltage and they
fed the result into Arduino. Therefore Arduino compares them with the preset instruction and changes
accordingly to extract the result. It needs 5 volts to get powered up and is supplied by the 12V lead acid
battery we used.

Fig 4.1: Arduino Uno


20 | P a g e
4.2 Current Sensing
To sense the current generated by the PV module in different conditions we used a hall-effect
current sensor manufactured commercially for sensing AC, DC to use in industrial or research or
communication systems. Most importantly, it is the most preferable microchip assembled Ic to be used
with microcontrollers as Arduino. (MicroSystems, 2016)

Fig:4.1 ACS-712 hall effect current sensor

Fig 4.2: Pin configuration

Fig 4.3: Calibration procedure


We tested the current sensor and gathered calibration data to establish the current sensing equation.
We set up the sensor with our 50w PV module. The connections were made as the pin outs
configuration described above. With the help of the Arduino, we ran the program and varied the PV
module's supplied current by shading it partially or fully and collected data for 10 instances. Than
21 | P a g e
we put the data in MATLAB and did regression analysis. Henceforth, we used polyfit function of
MATLAB to get the most fitted output and to establish our equation. The equation we got is
Y = 1.5625*(X)-3.7375

Fig 4.4: Curve after regression analysis

4.3 Voltage Sensing


The main target of the charge controller is to charge up the battery by supplying it the required
voltage level. Arduino achieves it by the preset algorithm of MPP. Notably, Arduino microcontroller
chip consists of a built-in analog to digital converter. This conversion enables the analog ac input to
convert into quantized digital values and then fed to the algorithm to compare the voltage level with
previous output level. Since, in our proposed system we used a buck converter to step down the panel
output voltage so we had to implement a voltage division setup to acquire our desired value.
Purposely, two sets of voltage divider configuration is introduced in our system. Correspondingly,
one is used in input side and other in the output side before the voltage is fed to the battery. The
voltage level sensed in those parts is supplied to Arduino by connecting them to Arduino analog pin
and, therefore, gets converted to digital quantized values. Ultimately, voltage of the battery and PV
module is sensed in this way

22 | P a g e
4.4 Buck Converter
DC- DC converter or switch is a voltage converter which converts voltage level. Among other
converters, Buck converter is ubiquitously used for efficiently converting a high voltage to a low voltage.
We used buck converter to vary input voltage as our output battery is fixed in this case. A buck converter
circuit is shown below:

Fig 4.5: Simplified buck converter

A buck converter is designed by MOSFET, diode, inductor, capacitor and resistor assembling by
the above order. When a pulse width comes to the MOSFET, a switch works to open or close the
[Link] control is on because of reverse biased condition diode remains open during on
period. As the diode is open current flow through inductor increases which means inductor stores
energy.

Fig 4.6: equivalent circuit for switch on period

On the other hand, switch on period when switch off that means the circuit is open and the diode is
closed because of forward biased condition. At that time charge or current through inductor decreases
that means inductor started to discharge through the diode and RC combination till off period.

Fig 4.7: Equivalent circuit for switch off period

23 | P a g e
The duty ratio of on and off condition is calculated by using the following formula:

D = V0 / Vs

Where,
D = Duty ratio
V0 = Input voltage from solar
Vs = Output voltage to the load
To calculate the minimum inductance we have to take use much higher switching frequency. The
equation we use to calculate minimum inductance is:
Lmin = (1-D) R / 2Fs

Where,
D = Duty ratio
R = Load resistance
Fs = Switching frequency
In practical the inductance is higher than Lmin. To calculate proper inductance from the circuit we
use
L = V0 (1-D) / d(iL).Fs

Where,
L = Inductance
V0 = Output voltage to the load
D = Duty ratio
d(iL) = Change in inductance current
Fs = Switching frequency
The value of capacitor is determined by:

C = (1-D) / 8L(dV0/V0)Fs2

Where,
C = Capacitance
D = Duty ratio
(dV0/V0) = Output voltage ripple
Fs = Switching frequency
Value of components:

Component Value
Capacitor 100uF
Inductor 115 mH
Diode Schottky Diode
MOSFET IRFZ44n

24 | P a g e
4.5 Pulse Width Modulation
Switching mechanism of a DC-DC converter (buck converter in our case) requires two stages of
operation. 1) a controller stage, 2) a power stage. The controller stage supervises the precision of
power supply stage by regulating voltage (Keeping, 2014). Therefore, pulse width modulation
technique is introduced here for regulation of voltage. PWM refers to the method of achieving analog
result by digital means. Since, in our proposed system we are using Arduino and switching
mechanism is involved, the PWM technique has to be integrated. PWM works by changing the duty
ratio of the switches to produce a constant output voltage. To clarify, duty ratio means the stage
period of a digital signal where the signal is in square waveform. The duty ratio is always described
in percentage. Duty ratio in buck converter is found to be proportional to the input voltage.
Vout = D × Vin

So, if duty ratio is 0% then it means the circuit is grounded and if the duty ratio is 100% then we will get
the maximum output voltage for maximum output voltage. In our case we tried to achieve the MPP to
charge the battery at a top level by varying duty cycle in our algorithm. Furthermore, we have set the
duty ratio to change by sensing the battery voltage level like; when it needs to be charged and when it
needs to stop charging. PWM is the most crucial mechanism for switching Buck converter we are
implementing in our project.

Fig 4.8: PWM modulation check in oscilloscope

25 | P a g e
4.6 Some Jumper Wires:
A jump wire (also known as jumper, jumper wire, DuPont wire) is an electrical wire, or group of them in
a cable, with a connector or pin at each end (or sometimes without them –"tinned"), which is typically
used to interconnect the components of a breadboard or other prototype or test circuit, internally or with
other equipment or parts, without soldering.

Fig 4.9: Jumper wires

4.7 Breadboard:
A thin plastic board used to hold electronic components (transistors, resistors, chips, etc.) that are wired
together. Breadboards can be used to develop electronic circuit prototypes for future jobs.

Fig 4.10: Breadboard


26 | P a g e
4.8 All Components:

Name of the Components Quantity


• Arduino NANO 01
• i2c 01
• LCD Display (16*2) 01
• ACS712-5A Module 01
• Small Buck Converter 01
• IRFZ44N MOSFET 01
• BC547 NPN 01
• Relay 01
• 33uH Inductor 01
• 100uf 50V Capacitor 01
• 3A Fuse 01
• Zenner 1N47 diode 02
• SR560 Schottky diode 02
• Battery 01
• 100R Resistor 02
• 1K, 7K, 10K Resistor 01
• Jumper Wire As required
• 20AWG Solid Copper Wire As required
• Bread Board 01

27 | P a g e
Design Function and Findings of the Project

5.1 Circuit diagram:

Fig 5.1.1: Schematics of the complete circuit with connectors to Arduino and Solar input

Fig 5.1.2: Breadboard configuration

28 | P a g e
5.2 Modes of Charging:

• Bulk mode:
In bulk mode, charge until battery reaches 14.4 V with a constant current 0.2 Amp.
• Absorption mode:
After 14.4 V in absorption mode keep constant voltage 14.4 V until current 50 mA.
• Float mode:
The float mode keep battery at 13.5 volt.

Table 5.2.1: Datasheet of total Operation


PWM
Time (min) Solar Voltage Battery Volt Solar Current % Charging Mode Load Status
0 29.5 9.7 0.23 60 BULK OFF
20 29.5 10.5 0.23 60 BULK ON
50 29.5 11.4 0.23 60 BULK ON
75 29.5 12.9 0.21 56 BULK ON
80 25.3 12.9 0.2 69 BULK ON
100 21.8 13.1 0.21 81 BULK ON
190 29.4 14.4 0.14 52 ABSORPTION ON
230 29.4 14.4 0.09 46 ABSORPTION ON
240 29.4 13.2 0.05 37 FLOAT ON

Battery Voltage & Solar Current Vs Time


16 0.25

14
0.2
12

10 0.15
8

6 0.1

4
0.05
2

0 0
0 20 50 75 80 100 190 230 240

Battery Volt Solar Current

Fig 5.2.1: Battery Voltage & Solar Current Vs Time


29 | P a g e
5.3 Snapshot of the Project:

Load OFF & ON Case:


If the battery voltage is below 10 volts it is in the OFF load condition. Higher than the 10 volts
the system will be in the ON load condition.

Fig 5.3.1: System is in OFF load condition

Fig
5.3.2: System is in ON load condition

30 | P a g e
Bulk Mode: In bulk mode, charge until battery reaches 14.4 V with a constant current 0.2
Amp.

Fig 5.3.3:
Bulk mode charging

Absorption Mode: After 14.4 V in absorption mode keep constant voltage 14.4 V until
current 50 mA.

Fig 5.3.3: Absorption mode charging

31 | P a g e
Float Mode: The float mode keep battery at 13.5 volt.

Fig 5.3.4: Float mode charging

5.4 Limitations faced during project work:


We conducted our experiment and data collection process during the rainy season. So, the weather
condition was unpredictable, and the data collection process was delayed. Moreover, for the
fluctuations in weather conditions, the data we achieved has lots of shifted values. Therefore, it was
difficult for us to extract the exact data for analysis.

32 | P a g e
Cost Calculation
6.1 Cost Sheet:
Table 01: Describing the total cost of the project
Name of the Components Quantity Price
Arduino NANO 01 1050 /-
i2c 01 120 /-
LCD Display (16*2) 01 225 /-
ACS712-5A Module 01 184 /-
Small Buck Converter 01 300 /-
IRFZ44N MOSFET 01 35 /-
BC547 NPN 01 4 /-
Relay 01 30/-
33uH Inductor 01 5/-
100uf 50V Capacitor 01 20/-
3A Fuse 01 25/-
Zenner 1N47 diode 02 6/-
SR560 Schottky diode 02 10/-
Battery 01 850/-
100R Resistor 02 2/-
1K, 7K, 10K Resistor 01 3/-
Jumper Wire As 100/-
required
20AWG Solid Copper Wire As 20/-
required
Bread Board 01 80/-
Total 3069/=

33 | P a g e
Conclusion
7.1 Summary:
In the final analysis, this thesis presents an efficient photo voltaic system with the capability of
tracking the maximum power point using incremental conductance method. Each components of this
system such as the solar panel, charge controller, DC-DC converter has all been discussed about. The
coding in terms of flowchart and MATLAB simulations of the I-V characteristics for load and
irradiations variation has been presented. Since the purpose of this thesis was to design a more
efficient MPPT solar charge controller using an Arduino, so we have explained the maximum power
point tracking and the procedure we have followed to achieve that point. A brief comparison has
been made between perturb and observe method. The use of an Arduino and its advantages has been
provided in this paper along with the converter used for our design of the solar charge controller. We
have later done the hardware implementation and matched the data we collected to differentiate the
efficient method between the two. Comparatively incremental conductance method showed more
promising output than perturb and observe method.

7.2 Concluding remarks and future prospect:

Solar Energy is the ultimate source of ultra clean, sustainable and natural energy. Most importantly
it is the most cost-efficient energy source we can use in our favor and for securing financial
benefits. In this regard developing more efficient charge controller is a progressive step to fulfill
the need of power generation using green energy. For that purpose it is our wish to continue
further study on making the PV module more efficient. To be specific, the charge controller can be
more improved by making the circuit more integrated and coming up with new algorithm to make
the maximum power point tracking more efficient. Additionally, more digital logic can be
implemented for maximizing the output hence reducing the physical work.

34 | P a g e
References:
[1] choudhary, dhananjay and saxena, anmol ratna (2014) ‘DC-DC buck converter for MPPT of
PV system’, International Journal of Emerging Technology and Advanced Engineering, 4(7).
[2] Kotak, V.C. and Tyagi, P. (2013) ‘DC To DC Converter in Maximum Power Point Tracker’,
International Journal of Advanced Research in Electrical, Electronics and Instrumentation
Engineering, 2(12).
[3] [Link] (no date)
Available at: [Link]
mode-power-supply/[Link] (Accessed: 10 July
2016).
[4] Harjai, A., Bhardwaj, A. and Sandhibigraha, M. (no date) ‘STUDY OF MAXIMUM POWER
POINT TRACKING (MPPT) TECHNIQUES IN A SOLAR PHOTOVOLTAIC ARRAY’, .
[5] Putri, R.I., Wibowo, S. and Rifa’i, c M. (2015) ‘Maximum power point tracking for
Photovoltaic using incremental Conductance method ☆’, Energy Procedia, 68, pp. 22–30. doi:
10.1016/[Link].2015.03.228.
[6] MicroSystems, A. (2016) Allegro MicroSystems - ACS712: Fully integrated, hall-effect- based
linear current sensor IC with 2.1 kVRMS voltage isolation and a low-resistance current
conductor. Available at: [Link] ICs/Zero-
To-Fifty-Amp-Integrated-Conductor-Sensor-ICs/[Link] (Accessed: 7 August 2016).
[7] Kumari, S.J., Babu, C.S. and Professor, A. (2011) ‘COMPARISON OF MAXIMUM POWER
POINT TRACKING ALGORITHMS FOR PHOTOVOLTAIC SYSTEM’,International Journal
of Advances in Engineering & Technology ©IJAET, 1(5), pp. 133–148.
[8] Keeping, S. (2014) Voltage- and current-mode control for PWM signal generation in DC-to-
DC switching regulators.
Available at: [Link]
mode-control-for-pwm-signal-generation-in-dc-to-dc-switching-regulators (Accessed: 8
August 2016).

35 | P a g e
[9] Rahman, S., Sultana, N. and Masud, Q. (2012) Design of a Charge Controller
Circuit with Maximum Power Point Tracker (MPPT) for Photovoltaic System.
Thesis Report, BRAC University (2012),
Available at:
[Link]
20Charge
%20Controller%[Link]?sequence=1&isAllowed=y (Accessed: 15 May
2016).
[10] Pürschel, M. (2009) Automotive Power.
Available at: [Link]
[Link]?fileId=db3a304412b407950112b41887722615 (Accessed: 11
August 2016).
[11] News &
analysis (2016)
Available at:
[Link]
optocoupl ers (Accessed: 12 August 2016).
[12] L.N.T, L., M.W.N.S, L., K.K, N. and W.M.W, W. (2014) Development Of Smart
Grid With Renewable Energy sources.
[13] Hua, C., Lin, J. and Shen (1998) ‘Implementation Of a DSP-Controlled
Photo-voltaic System with Peak Power Point Tracker’, IEEE TRANSACTIONS
ON INDUSTRIAL ELECTRONICS, 45(1).
[14] Thenkani, A. (2011) ‘Design Of Optimum Power Point Tracking Algorithm
For Solar Panel’, Tamilnadu,India: ICCCET

36 | P a g e
APPENDIX A
Code For MPPT Method:
//Libraries
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,20,4); //LCD i2c adress sometimes 0x3f or 0x27

//Icons
uint8_t Battery[8] = {0x0E, 0x1B, 0x11, 0x11, 0x1F, 0x1F, 0x1F, 0x1F};
uint8_t Panel[8] = {0x1F, 0x15, 0x1F, 0x15, 0x1F, 0x15, 0x1F, 0x00};
uint8_t Pwm[8] = {0x1D, 0x15, 0x15, 0x15, 0x15,0x15, 0x15, 0x17};
uint8_t Flash[8] = {0x01, 0x02, 0x04, 0x1F, 0x1F, 0x02, 0x04, 0x08};

//Constants
#define bulk_voltage_max 14.5
#define bulk_voltage_min 13
#define absorption_voltage 14.4
#define float_voltage_max 13
#define battery_min_voltage 10
#define solar_min_voltage 19
#define charging_current 0.25
#define absorption_max_current 0.25
#define absorption_min_current 0.05
#define float_voltage_min 13.2
#define float_voltage 13.4
#define float_max_current 0.12
#define LCD_refresh_rate 1000
byte BULK = 0; //Give values to each mode
byte ABSORPTION = 1;
byte FLOAT = 2;
byte mode = 0; //We start with mode 0 BULK

//Inputs
#define solar_voltage_in A1
#define solar_current_in A0
#define battery_voltage_in A2

//Outputs
#define PWM_out 10
#define load_enable 2

//Variables
float bat_voltage = 0;
int pwm_value = 0;
float solar_current = 0;
float current_factor = 0.1; //Value defined by manufacturer ACS712 20A

37 | P a g e
float solar_voltage = 0;
float solar_power = 0;
String load_status = "OFF";
int pwm_percentage = 0;
unsigned int before_millis = 0;
unsigned int now_millis = 0;
String mode_str = "BULK";

void setup(){
pinMode(solar_voltage_in,INPUT); //Set pins as inputs
pinMode(solar_current_in,INPUT);
pinMode(battery_voltage_in,INPUT);

pinMode(PWM_out,OUTPUT); //Set pins as OUTPUTS


digitalWrite(PWM_out,LOW); //Set PWM to LOW so MSOFET is off
pinMode(load_enable,OUTPUT);
digitalWrite(load_enable,LOW); //Start with the relay turned off
TCCR1B = TCCR1B & B11111000 | B00000001; //timer 1 PWM frequency of 31372.55
Hz
[Link](9600);

[Link](); //Init the LCD


[Link](); //Activate backlight

[Link](0, Battery);
[Link](1, Panel);
[Link](2, Pwm);
[Link](3, Flash);
before_millis = millis; //Used for LCD refresh rate
}

void loop(){
solar_voltage = get_solar_voltage(15);
bat_voltage = get_battery_voltage(15);
solar_current = get_solar_current(15);
solar_power = bat_voltage * solar_current;
pwm_percentage = map(pwm_value,0,255,0,100);

now_millis = millis();
if(now_millis - before_millis > LCD_refresh_rate)
{
before_millis = now_millis;
[Link]();
[Link](0,0); //Column 0 row 0
[Link](1); //Panel icon
[Link](" "); //Empty space
[Link](solar_voltage,2); //Soalr voltage
[Link]("V"); //Volts

38 | P a g e
[Link](" "); //Empty spaces
[Link](0); //Battery icon
[Link](" "); //Empty space
[Link](bat_voltage,2); //Battery voltsge
[Link]("V"); //Volts

[Link](0,1); //Column 0 row 1


[Link](" "); //Empty spaces
[Link](solar_current,2); //Solar current
[Link]("A"); //Ampers
[Link](" LOAD "); //Print LOAD
[Link](load_status); //LOAD status

[Link](0,2); //Column 0 row 2


[Link](" "); //Empty spaces
[Link](solar_power,2); //Solar power
[Link]("W"); //Watts
[Link](" PWM "); //Print PWM
[Link](pwm_percentage); //PWM value
[Link]("%"); //Percentage

[Link](0,3); //Column 0 row 3


[Link](mode_str); //Print the mode

if(bat_voltage < battery_min_voltage){


digitalWrite(load_enable,LOW); //We DISABLE the load if battery is
undervoltage
load_status = "OFF";
}
else{
digitalWrite(load_enable,HIGH); //We ENABLE the load if battery
charged
load_status = "ON";
}

///////////////////////////FLOAT///////////////////////////
///////////////////////////////////////////////////////////
if(mode == FLOAT){
if(bat_voltage < float_voltage_min){
mode = BULK;
mode_str = "BULK";
}

else{
if(solar_current > float_max_current){ //If we exceed max current
value, we change mode

39 | P a g e
mode = BULK;
mode_str = "BULK";
}//End if >

else{
if(bat_voltage > float_voltage){
pwm_value--;
pwm_value = constrain(pwm_value,0,254);
}

else {
pwm_value++;
pwm_value = constrain(pwm_value,0,254);
}
}//End else > float_max_current

analogWrite(PWM_out,pwm_value);
}
}//END of mode == FLOAT

//Bulk/Absorption
else{
if(bat_voltage < bulk_voltage_min){
mode = BULK;
mode_str = "BULK";
}
else if(bat_voltage > bulk_voltage_max){
mode_str = "ABSORPTION";
mode = ABSORPTION;
}

////////////////////////////BULK///////////////////////////
///////////////////////////////////////////////////////////
if(mode == BULK){
if(solar_current > charging_current){
pwm_value--;
pwm_value = constrain(pwm_value,0,254);
}

else {
pwm_value++;
pwm_value = constrain(pwm_value,0,254);
}
analogWrite(PWM_out,pwm_value);
}//End of mode == BULK

40 | P a g e
/////////////////////////ABSORPTION/////////////////////////
///////////////////////////////////////////////////////////
if(mode == ABSORPTION){
if(solar_current > absorption_max_current){ //If we exceed max
current value, we reduce duty cycle
pwm_value--;
pwm_value = constrain(pwm_value,0,254);
}//End if > absorption_max_current

else{
if(bat_voltage > absorption_voltage){
pwm_value++;
pwm_value = constrain(pwm_value,0,254);
}

else {
pwm_value--;
pwm_value = constrain(pwm_value,0,254);
}

if(solar_current < absorption_min_current){


mode = FLOAT;
mode_str = "FLOAT";
}
}//End else > absorption_max_current

analogWrite(PWM_out,pwm_value);
}// End of mode == absorption_max_current

}//END of else mode == FLOAT

//[Link](bat_voltage);
}//End void loop

/////////////////////////FUNCTIONS/////////////////////////
///////////////////////////////////////////////////////////

41 | P a g e
float get_solar_voltage(int n_samples)
{
float voltage = 0;
for(int i=0; i < n_samples; i++)
{
voltage += (analogRead(solar_voltage_in) * (5.0 / 1023.0) * 7.76);
}
voltage = voltage/n_samples;
if(voltage < 0){voltage = 0;}
return(voltage);
}

float get_battery_voltage(int n_samples)


{
float voltage = 0;
for(int i=0; i < n_samples; i++)
{
voltage += (analogRead(battery_voltage_in) * (5.0 / 1023.0) * 7.38);
}
voltage = voltage/n_samples;
if(voltage < 0){voltage = 0;}
return(voltage);
}

float get_solar_current(int n_samples)


{
float Sensor_voltage;
float current =0;
[Link](analogRead(solar_current_in));
for(int i=0; i < n_samples; i++)
{
Sensor_voltage = analogRead(solar_current_in) * (5 / 1023.0);
current = current + (Sensor_voltage-2.403)/current_factor;
}
current = current/n_samples;
//if(current < 0){current = 0;}
return(current);
}

42 | P a g e

View publication stats

You might also like