Vous êtes sur la page 1sur 56

CHAPTER 1

INTRODUCTION

All the States in INDIA currently relies heavily on coal, oil, and natural gas for
its energy generation which are non-renewable. Fossil fuels are non-renewable, that is,
if they are used at a rate which is higher than the rate of its generation it will become
extinct which is becoming too expensive or too environmentally damaging to retrieve.
In order to avoid these kind of problems we go for renewable energy resources.

There are many renewable sources like wind energy, tidal energy, solar energy,
biomass energy, geothermal energy etc.

1.1WIND ENERGY:

Wind power is the use of air flow through wind turbines to mechanically
power generators for electric power. Wind power, as an alternative to burning fossil
fuels, is plentiful, renewable, widely distributed, clean, produces no greenhouse
gas emissions during operation, consumes no water, and uses little land. The net effects
on the environment are far less problematic than those of nonrenewable power sources.

Wind power gives variable power which is very inconsistent from year to year
and one more disadvantage is it requires more cost for establishing the wind turbines
and it generates less power when compared with other forms of renewable energy.

As of 2015 Denmark generates 40% of electric power from wind energy which is
most by any country.

Fig1.1 Wind turbines

1
1.2 TIDAL ENERGY

Tidal power or tidal energy is a form of hydropower that converts the energy
obtained from tides into useful forms of power, mainly electricity. Although not yet
widely used, tidal power has potential for future electricity generation. Tides are more
predictable than wind energy and solar power. Among sources of renewable energy,
tidal power has traditionally suffered from relatively high cost and limited availability
of sites with sufficiently high tidal ranges or flow velocities, thus constricting its total
availability. However, many recent technological developments and improvements,
both in design and turbine technology, indicate that the total availability of tidal
power may be much higher than previously assumed, but the main disadvantage is its
high economic and environmental costs which may be brought down to competitive
level in future.

Fig1.2 Tidal energy generation

1.3 BIOMASS ENERGY:

Biomass is an industry term for getting energy by burning wood, and


other organic matter. Burning biomass releases carbon emissions, around a quarter
higher than burning coal, but has been classed as a "renewable" energy source in
the EU and UN legal frameworks, because plants can be regrown. It has become
popular among coal power stations, which switch from coal to biomass to comply with
the law. Biomass most often refers to plants or plant-based materials that are not used
for food or feed, and are specifically called lignocellulose biomass. As an energy
source, biomass can either be used directly via combustion to produce heat, or indirectly
after converting it to various forms of biofuel. Although this is considered as a
renewable resource it will result in huge cut down of forests.so this should not be used
as an alternative to present day’s power generation.

2
1.4 GEOTHERMAL ENERGY:

Geothermal energy is the heat from the Earth. It's clean and sustainable.
Resources of geothermal energy range from the shallow ground to hot water and hot
rock found a few miles beneath the Earth's surface, and down even deeper to the
extremely high temperatures of molten rock called magma. Almost everywhere, the
shallow ground or upper 10 feet of the Earth's surface maintains a nearly constant
temperature between 50° and 60°F (10° and 16°C). Geothermal heat pumps can tap into
this resource to heat and cool buildings. A geothermal heat pump system consists of a
heat pump, an air delivery system (ductwork), and a heat exchanger-a system of pipes
buried in the shallow ground near the building. In the winter, the heat pump removes
heat from the heat exchanger and pumps it into the indoor air delivery system. In the
summer, the process is reversed, and the heat pump moves heat from the indoor air into
the heat exchanger. The heat removed from the indoor air during the summer can also
be used to provide a free source of hot water.
The main disadvantages of this geothermal energy is to get geothermal energy,
requires installation of power plants, to get steam from deep within the earth and this
require huge one-time investment and require to hire a certified installer and skilled
staff needs to be recruited and relocated to plant location and some more disadvantages
are Geothermal sites can run out of steam over a period of time due to drop in
temperature or if too much water is injected to cool the rocks It is only suitable for
regions which have hot rocks below the earth and can produce steam over a long period
of time. For this great research is required which is done by the companies before
setting up the plant and Geothermal sites may contain some poisonous gases and they
can escape deep within the earth, through the holes drilled by the constructors.

1.5SOLAR ENERGY:

Solar power is the conversion of sun light to useful form of energy that is, electricity.
The most common source of solar power uses photo voltaic cells to convert sunlight to
solar energy.
Photovoltaic cells use a semiconductor to absorb the radiation from the sun. When the
semi-conductor absorbs these radiations it releases electrons which are harnessed as
electricity. It is the most widely used form of renewable energy because of its large
number of advantages

Fig1.3 Solar power generation

3
1.5.1 SOLAR TRACKER:

Solar Tracker is a Device which follows the movement of the sun as it rotates
from the east to the west every day. The main function of all tracking systems is to
provide one or two degrees of freedom in movement. Trackers are used to keep solar
collectors/solar panels oriented directly towards the sun as it moves through the sky
every day. Using solar trackers increases the amount of solar energy which is received
by the solar energy collector and improves the energy output of the heat/electricity
which is generated. Solar trackers can increase the output of solar panels by 20-30%
which improves the economics of the solar panel project.

Types of Solar Trackers


1) Passive Trackers
Passive trackers use a low boiling point compressed gas fluid that is driven to
one side or the other (by solar heat creating gas pressure) to cause the tracker to move
in response to an imbalance. As this is a non-precision orientation it is unsuitable for
certain types of concentrating photovoltaic collectors, but works fine for common PV
panel types.
2) Active Trackers
Active trackers use motors and gear trains to direct the tracker as commanded
by a controller, responding to the solar direction. Since the motors consume energy,
one wants to use them only as necessary. These are of two types. They are

1.5.1a SINGLE AXIS TRACKER:

Single axis trackers have one degree of freedom that acts as an axis of
rotation. The axis of rotation of single axis trackers is typically aligned along a true
North meridian. It is possible to align them in any cardinal direction with advanced
tracking algorithms using a micro controller. There are several common
implementations of single axis trackers. These include horizontal single axis trackers
(HSAT), vertical single axis trackers (VSAT), tilted single axis trackers (TSAT) and
polar aligned single axis trackers (PSAT).

Fig1.4 Single/Mono axis solar tracker

4
1.5.1b Dual Axis Trackers
Dual axis trackers have two degrees of freedom that act as axes of rotation.
These axes are typically normal to one another. The axis that is fixed with respect to
the ground can be considered a primary axis. The axis that is referenced to the
primary axis can be considered a secondary axis. There are several common
implementations of dual axis trackers. These are relatively costlier when compared
with single axis trackers but has high amount of accuracy and can produce more
power because of its ability to rotate in both the directions.

Fig 1.5 Dual axis solar tracker

1.5.2 NEED FOR SOLAR TRACKER

We all know that sun rises in the east and sets in the west that means the
position of the sun varies from morning to evening and from time to time but the solar
panel is static facing only one direction which limits the amount of power generation
because of its inability to face the sun.

5
Fig 1.6 Direction of motion of sun from morning to evening

So because of this the amount of power generated will get reduced by an


appreciable amount which can be produced by moving the panel in such a way that the
panel will always face the sun or the maximum illuminated side which enables the panel
to generate more power. This can be achieved by using a device which can rotate the
panel towards the sun. solar tracker makes the panel to rotate towards the sun so that
maximum power is generated.
The amount of power lost while generating the power without using the tracker
will be around 1-cos(i)% where i is the misalignment angle which is the difference
between the ideal angle required for generating max power and the present mismatch
angle

Fig 1.7 Explanation of Angle of mismatch

1.5.3 BLOCK DIAGRAM:

6
Fig 1.8 Block diagram of project

The above block diagram gives an overview of the project in the pictorial form.
With the help of the block diagram we will create pre model of the project and analyze
the function of the project.

7
CHAPTER 2
PROJECT REQUIREMENTS

COMPONENTS USED:
2.1 MOTOR DRIVER IC L293D
The Device is a monolithic integrated high voltage, high current four channel
driver designed to accept standard DTL or TTL logic levels and drive inductive loads
(such as relays solenoids, DC and stepping motors) and switching power transistors. To
simplify use as two bridges each pair of channels is equipped with an enable input. A
separate supply input is provided for the logic, allowing operation at a lower voltage
and internal clamp diodes are included. This device is suitable for use in switching
applications at frequencies up to 5 kHz.

2.1.1. FEATURES:

 Wide Supply Voltage from 4.5 V to 36 V


 Separate Input-Logic Supply
 Internal ESD Protection
 Thermal Shutdown
 High-Noise-Immunity Inputs
 Functional Replacements for SGS L293 and SGS L293D
 Output Current 1 A per Channel (600 MA for L293D)
 Peak Output Current 2 A per Channel (1.2 A for L293D)
 Output Clamp Diodes for Inductive Transient Suppression (L293D)

2.1.2PIN DIAGRAM:

Fig 2.1 L293D pin diagram

8
2.1.3 DESCRIPTION

The L293D is quadruple high-current half-H driver. It designed to provide


bidirectional drive currents of up to 1 A at voltages from 4.5 V to 36 V and to drive
inductive loads such as relays, solenoids, dc and bipolar stepping motors, as well as
other high-current/high-voltage loads in positive-supply applications.

All inputs are TTL compatible. Each output is a complete totem-pole drive
circuit, with a Darlington transistor sink and a pseudo-Darlington source. Drivers are
enabled in pairs, with drivers 1 and 2 enabled by 1,2EN and drivers 3 and 4 enabled by
3,4EN. When an enable input is high the associated drivers are enabled and their outputs
are active in phase with their inputs.

When the enable input is low, those drivers are disabled and their outputs are
off and in the high-impedance state. With the proper data inputs, each pair of drivers
forms a Full-H (or bridge) reversible drive suitable for solenoid or motor applications.
On the L293D, external high-speed output clamp diodes should be used for inductive
transient suppression. A VCC1 terminal, separate from VCC2, is provided for the logic
inputs to minimize device power dissipation. The L293D is characterized for operation
from 0°C to 70°C.

2.1.4 ELECTRICAL CHARACTERISTICS:

Table 2.1 Electrical characteristics of L293d

9
2.1.5 BLOCK DIAGRAM:

Fig 2.2 internal circuit of L293D

2.1.6 FUNCTION TABLE:

Table 2.2 Function table of l293d


2.1.7 LOGIC DIAGRAM:

Fig 2.3 logic diagram of L293D

2.2 DC MOTORS
A motor is a machine which converts energy into rotating motion. The
dictionary definition of motor is broader than that but when engineers and mechanics
talk about motors they are almost always talking about rotating motion. There are
different names for devices which convert energy into other types of motion.

10
A DC motor is a motor that uses direct electrical current (DC) as the
source of its energy. An AC motor is a motor that uses alternating electrical current
(AC) as the source of its energy. AC current is the type of electricity provided by
household wall outlets. DC current is the type of electricity provided by batteries.

A gear motor is a motor with an attached set of gears driving a secondary


drive shaft. Practical motor designs result in motors that spin too fast for most uses. As
a result, almost all gear sets are used to "gear down" the motor. The geared down drive
shaft spins slower than the direct motor drive shaft. The geared down drive shaft also
spins "harder". Motor speed is generally measured in revolutions per minute (RPM).
Rotating force is called torque and for hobby motors is generally measured in inch-
ounces or centimeter-grams. For now, just remember that the higher the number the
harder the motor turns. Gearing down a motor reduces its RPM (speed) but increases
its torque. Gears are generally contained within a housing that protects the gears from
interference and which provides a bearing surface for the various gear shafts and drive
shafts. The term gear box generally refers to the entire system of gears, shafts, bearings

When you apply energy to a motor it spins as fast and hard as its design
allows for that energy level and output load. If you increase the energy supply it spins
faster and harder. If you attach a load the motor will slow down. If you continue
increasing the load it slows ever more until the motors capability to work is exceeded.
When the extreme load causes the motor to stop it is said to be stalled. Reducing the
load causes the motor spin faster. If you entirely remove the load the motor is said to
be "free running" and operates at its maximum speed for that input energy level.

Electric motors both ac and dc motors, come in many shapes and sizes.
Some are standardized electric motors for general-purpose applications. Other electric
motors are intended for specific tasks. In any case, electric motors should be selected
to satisfy the dynamic requirements of the machines on which they are applied without
exceeding rated electric motor temperature. Thus, the first and most important step in
electric motor selection is determining load characteristics -- torque and speed versus
time. Electric motor selection is also based on mission goals, power available, and cost.

An electric motor uses electrical energy to produce mechanical energy.


The reverse process for using mechanical energy to produce electrical energy is
accomplished by a generator or dynamo. Electric motors are found in household
appliances such as fans, refrigerators, washing machines, pool pumps, floor vacuums,
and fan-forced ovens. They are also found in many other devices such as computer
equipment, in its disk drives, printers, and fans; and in some sound and video playing
and recording equipment as DVD/CD players and recorders, tape players and recorders,
and record players. Electric motors are also found in several kinds of toys such as some
kinds of vehicles and robotic toys.

The classic division of electric motors has been that of direct current
(DC) type vs. Alternating Current (AC) types. This is more a de facto convention, rather
than a rigid distinction. For example, many classic DC motors run on AC power, these
motors being referred to as universal motors.

11
2.2.1 COMPARISON OF MOTOR TYPES:

Typical Typical
Type Advantages Disadvantages
Application Drive

Rotation slips
Least expensive
AC Induction from frequency Uni/Poly-
Long life Fans
(Shaded Pole) Low starting phase AC
high power
torque

AC Induction High power


Rotation slips Uni/Poly-
(split-phase high starting Appliances
from frequency phase AC
capacitor) torque

Rotation in-
Clocks
AC sync with freq Uni/Poly-
More expensive Audio turntables
Synchronous long-life phase AC
tape drives
(alternator)

Precision
Slow speed Positioning in
positioning Multiphase
Stepper DC Requires a printers and
High holding DC
controller floppy drives
torque

Long lifespan
High initial cost Hard drives
Brushless DC low Multiphase
Requires a CD/DVD players
electric motor maintenance DC
controller electric vehicles
High efficiency

Low initial cost High Treadmill


Brushed DC Simple speed maintenance exercisers Direct
electric motor control (brushes) automotive (PWM)
(Dynamo) Low lifespan starters

Table 2.3 comparision of motors

12
2.3 SOLAR CELL
Photovoltaic’s is the direct conversion of light into electricity at the atomic
level. Some materials exhibit a property known as the photoelectric effect that causes
them to absorb photons of light and release electrons. When these free electrons are
captured, electric current results that can be used as electricity.

The photoelectric effect was first noted by a French physicist, Edmund


Bequerel, in 1839, who found that certain materials would produce small amounts of
electric current when exposed to light. In 1905, Albert Einstein described the nature of
light and the photoelectric effect on which photovoltaic technology is based, for which
he later won a Nobel prize in physics. The first photovoltaic module was built by Bell
Laboratories in 1954. It was billed as a solar battery and was mostly just a curiosity as
it was too expensive to gain widespread use. In the 1960s, the space industry began to
make the first serious use of the technology to provide power aboard spacecraft.
Through the space programs, the technology advanced, its reliability was established,
and the cost began to decline. During the energy crisis in the 1970s, photovoltaic
technology gained recognition as a source of power for non-space applications.

Fig 2.4 solar cell


The diagram above illustrates the operation of a basic photovoltaic cell, also
called a solar cell. Solar cells are made of the same kinds of semiconductor materials,
such as silicon, used in the microelectronics industry.
For solar cells, a thin semiconductor wafer is specially treated to form an electric
field, positive on one side and negative on the other. When light energy strikes the solar
cell, electrons are knocked loose from the atoms in the semiconductor material. If
electrical conductors are attached to the positive and negative sides, forming an
electrical circuit, the electrons can be captured in the form of an electric current -- that
is, electricity. This electricity can then be used to power a load, such as a light or a tool.

A number of solar cells electrically connected to each other and mounted in a


support structure or frame is called a photovoltaic module. Modules are designed to
supply electricity at a certain voltage, such as a common 12 volts system. The current
produced is directly dependent on how much light strikes the Multiple modules can be
wired together to form an array. In general, the larger the area of a module or array, the
more electricity that will be produced. Photovoltaic modules and arrays produce direct-

13
current (dc) electricity. They can be connected in both series and parallel electrical
arrangements to produce any required voltage and current combination.

Today's most common PV devices use a single junction, or interface, to create


an electric field within a semiconductor such as a PV cell. In a single-junction PV cell,
only photons whose energy is equal to or greater than the band gap of the cell material
can free an electron for an electric circuit. In other words, the photovoltaic response of
single-junction cells is limited to the portion of the sun's spectrum whose energy is
above the band gap of the absorbing material, and lower-energy photons are not used.

One way to get around this limitation is to use two (or more) different cells,
with more than one band gap and more than one junction, to generate a voltage. These
are referred to as "multijunction" cells (also called "cascade" or "tandem" cells).
Multijunction devices can achieve a higher total conversion efficiency because they can
convert more of the energy spectrum of light to electricity.

As shown below, a multijunction device is a stack of individual single-junction


cells in descending order of band gap (Eg). The top cell captures the high-energy
photons and passes the rest of the photons on to be absorbed by lower-band-gap cells.

Much of today's research in multijunction cells focuses on gallium arsenide as


one (or all) of the component cells. Such cells have reached efficiencies of around 35%
underconcentrated sunlight. Other materials studied for multijunction devices have
beenamorphous silicon and copper indium dieseline.

As an example, the multijunction device below uses a top cell of gallium indium
phosphide, "a tunnel junction," to aid the flow of electrons between the cells, and a
bottom cell of gallium arsenide.

2.4 LDR
A Light Dependent Resistor (LDR) or a photo resistor is a device
whose resistivity is a function of the incident electromagnetic radiation. Hence, they
are light sensitive devices. They are also called as photo conductors, photo conductive
cells or simply photocells. They are made up of semiconductor materials having high
resistance. There are many different symbols used to indicate a LDR, one of the most
commonly used symbol is shown in the figure below. The arrow indicates light falling

Fig 2.5 solar cell circuit diagram

14
2.4.1WORKING
A light dependent resistor works on the principle of photo conductivity.
Photo conductivity is an optical phenomenon in which the materials conductivity is
increased when light is absorbed by the material. When light falls i.e. when the photons
fall on the device, the electrons in the valence band of the semiconductor material are
excited to the conduction band. These photons in the incident light should have energy
greater than the band gap of the semiconductor material to make the electrons jump
from the valence band to the conduction band. Hence when light having enough energy
strikes on the device, more and more electrons are excited to the conduction band which
results in large number of charge carriers. The result of this process is more and
more current starts flowing throgh the device when the circuit is closed and hence it is
said that the resistance of the device has been decreased. This is the most
common working principle of LDR

LDR’s are light dependent devices whose resistance is decreased when light falls on
them and that is increased in the dark. When a light dependent resistor is kept in dark,
its resistance is very high. This resistance is called as dark resistance. It can be as high
as 1012Ω and if the device is allowed to absorb light its resistance will be decreased
drastically. If a constant voltage is applied to it and intensity of light is increased the
current starts increasing. Figure below shows resistance vs. illumination curve .

Fig 2.6 Resistance vs illumination curve


Photocells or LDR’s are nonlinear devices. There sensitivity varies with the
wavelength of light incident on them. Some photocells might not at all response to a
certain range of wavelengths. Based on the material used different cells have different
spectral response curves.
When light is incident on a photocell it usually takes about 8 to 12 ms for the change in
resistance to take place, while it takes one or more seconds for the resistance to rise
back again to its initial value after removal of light. This phenomenon is called as
resistance recovery rate. This property is used in audio compressors. Also, LDR’s are
less sensitive than photo diodes and photo transistor. (A photo diode and a photocell
(LDR) are not the same, a photo-diode is a p-n junction semiconductor device that
converts light to electricity, whereas a photocell is a passive device, there is no p-n
junction in this nor it “converts” light to electricity). Types of Light Dependent
Resistors: Based on the materials used they are classified as:
1. Intrinsic photo resistors (Un doped semiconductor): These are made of
pure semiconductor materials such as silicon or germanium. Electrons get excited

15
from valance band to conduction band when photons of enough energy fall on it and
number charge carriers is increased.
2. Extrinsic photo resistors: These are semiconductor materials doped with impurities
which are called as dopants. Theses dopants create new energy bands above the
valence band which are filled with electrons. Hence this reduces the band gap and
less energy is required in exciting them. Extrinsic photo resistors are generally used
for long wavelengths.

2.4.2Construction of solar cell:


The structure of a light dependent resistor consists of a light sensitive material
which is deposited on an insulating substrate such as ceramic. The material is
deposited in zigzag pattern in order to obtain the desired resistance and power rating.
This zigzag area separates the metal deposited areas into two regions. Then the ohmic
contacts are made on the either sides of the area. The resistances of these contacts
should be as less as possible to make sure that the resistance mainly changes due to
the effect of light only. Materials normally used are cadmium sulphide, cadmium
selenide, indium antimonide and cadmium sulphonide. The use of lead and cadmium
is avoided as they are harmful to the environment.2.5

Fig 2.7 Construction of solar cell

2.5 LM35

An example for a temperature sensor is LM35. The LM35 series are precision
integrated-circuit temperature sensors, whose output voltage is linearly proportional
to the Celsius temperature. The LM35 is operates at -55˚ to +120˚C.

2.5.1 Features of LM35 Temperature Sensor:


 Calibrated directly in ˚ Celsius (Centigrade)
 Rated for full l −55˚ to +150˚C range
 Suitable for remote applications
 Low cost due to wafer-level trimming
 Operates from 4 to 30 volts
 Low self-heating,
 ±1/4˚C of typical nonlinearity

16
2.5.2 Operation of LM35:

 The LM35 can be connected easily in the same way as other integrated circuit
temperature sensors. It is attached to a surface or it can also be connected to a surface
and its temperature will be within around the range of 0.01˚C of the surface
temperature.
 This presumes that the ambient air temperature is just about the same as the surface
temperature; if the air temperature were much higher or lower than the surface
temperature, the actual temperature of the LM35 die would be at an intermediate
temperature between the surface temperature and the air temperature.
 The temperature sensors have well known applications in environmental and process
control and also in test, measurement and communications. A digital temperature is
a sensor, which provides 9-bit temperature readings. Digital temperature sensors
offer excellent precise accuracy, these are designed to read from 0°C to 70°C and it
is possible to achieve ±0.5°C accuracy. These sensors completely aligned with
digital temperature readings in degree Celsius

2.6 VOLTAGE REGULATORS


A voltage regulator is used to regulate voltage level. When a steady, reliable
voltage is needed, then voltage regulator is the preferred device. It generates a fixed
output voltage that remains constant for any changes in an input voltage or load
conditions. It acts as a buffer for protecting components from damages. A voltage
regulator is a device with a simple feed- forward design and it uses negative feedback
control loops. These are broadly divided into two types positive and negative voltage
regulator. Positive voltage regulators are 78xx series and 79xx represent negative
voltage regulators. Here in our project we are using only 7805 and 7812 for providing
constant supply L293D and dc motors.

2.7 BRIDGE RECTIFIER:

A bridge rectifier is a type of full wave rectifier which uses four or more diodes in a
bridge circuit configuration to efficiently convert the Alternating Current (AC) into
Direct Current (DC).

2.7.1 CONSTRUCTION

The construction diagram of a bridge rectifier is shown in the below figure. The
bridge rectifier is made up of four diodes namely D1, D2, D3, D4 and load resistor RL.
The four diodes are connected in a closed loop (Bridge) configuration to efficiently
convert the Alternating Current (AC) into Direct Current (DC). The main advantage
of this bridge circuit configuration is that we do not require an expensive center
tapped transformer, thereby reducing its cost and size.

17
Fig 2.8 bridge rectifier

The input AC signal is applied across two terminals A and B and the output DC signal
is obtained across the load resistor RL which is connected between the terminals C
and D.

The four diodes D1, D2, D3, D4 are arranged in series with only two diodes
allowing electric current during each half cycle. For example, diodes D1 and D3 are
considered as one pair which allows electric current during the positive half cycle
whereas diodes D2 and D4 are considered as another pair which allows electric current
during the negative half cycle of the input AC signal.

2.7.2Working
When input AC signal is applied across the bridge rectifier, during the positive half
cycle diodes D1 and D3 are forward biased and allows electric current while the
diodes D2 and D4are reverse biased and blocks electric current. On the other hand,
during the negative half cycle diodes D2 and D4 are forward biased and allows electric
current while diodes D1 and D3are reverse biased and blocks electric current.

18
During the positive half cycle, the terminal A becomes positive while the terminal B
becomes negative. This causes the diodes D1 and D3 forward biased and at the same
time, it causes the diodes D2 and D4 reverse biased.

The current flow direction during the positive half cycle is shown in the figure A (I.e.
A to D to C to B).

Fig 2.9 positive half cycle working

During the negative half cycle, the terminal B becomes positive while the terminal A
becomes negative. This causes the diodes D2 and D4 forward biased and at the same
time, it causes the diodes D1 and D3 reverse biased.

The current flow direction during negative half cycle is shown in the figure B (I.e. B
to D to C to A).

19
Fig 2.10 negative half cycle working

From the above two figures (A and B), we can observe that the direction of current
flow across load resistor RL is same during the positive half cycle and negative half
cycle. Therefore, the polarity of the output DC signal is same for both positive and
negative half cycles. The output DC signal polarity may be either completely positive
or negative. In our case, it is completely positive. If the direction of diodes is reversed
then we get a complete negative DC voltage.

Thus, a bridge rectifier allows electric current during both positive and negative half
cycles of the input AC signal.

The output waveforms of the bridge rectifier is shown in the below figure.

20
Fig 2.11 waveforms of bridge rectifier

21
CHAPTER – 3

INTRODUCTION TO ARDUINO MICROCONTROLLER

AND ARDUINO MEGA 2560

3.1 INTRODUCTION TO ARDUINO


Arduino is an open source physical computing platform based on a simple
input/output (I/O) board and a development environment that implements the
Processing language. Arduino can be used to develop standalone interactive objects or
can be connected to software on your computer.

The Arduino philosophy is based on making designs rather than talking about
them. It is a constant search for faster and more powerful ways to build better
prototypes. We have explored many prototyping techniques and developed ways of
thinking with our hands.

Over the years Arduino has been the brain of thousands of projects, from everyday
objects to complex scientific instruments. A worldwide community of makers - students,
hobbyists, artists, programmers, and professionals - has gathered around this open-source
platform, their contributions have added up to an incredible amount of accessible
knowledge that can be of great help to nov3ices and experts alike.

Arduino was born at the IVREA Interaction Design Institute as an easy tool for
fast prototyping, aimed at students without a background in electronics and
programming. As soon as it reached a wider community, the Arduino board started
changing to adapt to new needs and challenges, differentiating its offer from simple 8-
bit boards to products for IoT applications, wearable, 3D printing, and embedded
environments.

All Arduino boards are completely open-source, empowering users to build


them independently and eventually adapt them to their particular needs. The software,
too, is open-source, and it is growing through the contributions of users worldwide.

22
3.2 THE ARDUINO PLATFORM
Arduino is composed of two major parts: the Arduino board, which is the piece
of hardware you work on when you build your objects; and the Arduino IDE, the piece
of software you run on your computer. You use the IDE to create a sketch (a little
computer program) that you upload to the Arduino board. The sketch tells the board
what to do.

Not too long ago, working on hardware meant building circuits from scratch, using
hundreds of different components with strange names like resistor, capacitor, inductor,
transistor, and so on. Every circuit was “wired” to do one specific application, and making
changes required you to cut wires, solder connections, and more.

With the appearance of digital technologies and microprocessors, these


functions, which were once implemented with wires, were replaced by software
programs. Software is easier to modify than hardware. With a few keypresses, you can
radically change the logic of a device and try two or three versions in the same amount
of time that it would take you to solder a couple of resistors.

3.3 ADVANTAGES OF USING ARDUINO


Arduino has been used in thousands of different projects and applications. The
Arduino software is easy-to-use for beginners, yet flexible enough for advanced users.
It runs on Mac, Windows, and Linux. The main advantages of Arduino over other
microcontroller systems are given below:

 Inexpensive: Arduino boards are relatively inexpensive compared to


other microcontroller platforms. The least expensive version of the
Arduino module can be assembled by hand, and even the pre-assembled
Arduino modules cost less than $50

 Cross-platform: The Arduino Software (IDE) runs on Windows,
Macintosh OSX, and Linux operating systems. Most microcontroller
systems are limited to Windows.

 Simple, clear programming environment: The Arduino Software
(IDE) is easy-to-use for beginners, yet flexible enough for advanced
users to take advantage of as well. For teachers, it's conveniently based

15

23
on the Processing programming environment, so students learning to

program in that environment will be familiar with how the Arduino IDE

works.

 Open source and extensible software: The Arduino software is


published as open source tools, available for extension by experienced
programmers. The language can be expanded through C++ libraries, and
people wanting to understand the technical details can make the leap
from Arduino to the AVR C programming language on which it's based.
Similarly, you can add AVR-C code directly into your Arduino
programs if you want to.

 Open source and extensible hardware: The plans of the Arduino
boards are published under a Creative Commons license, so experienced
circuit designers can make their own version of the module, extending
it and improving it. Even relatively inexperienced users can build the
breadboard version of the module in order to understand how it works
and save money.



3.4 THE ARDUINO MEGA 2560
The hardware of the Arduino has evolved slowly since its introduction in 2005.
Because Arduino as a concept is very much a combination of hardware and software,
it’s important to have a good understanding of what’s involved in both areas, as well as
the areas where they overlap [2]. Let’s undertake a broad outline of the hardware part
of the Arduino MEGA 2560 in this section, going into some detail in a few areas, as
well as its history and how you’ll play a part in its future.

3.4.1 INTRODUCTION

The Arduino Mega 2560 is a microcontroller board based on the ATmega2560.


It has 54 digital input/output pins (of which 14 can be used as PWM outputs), 16 analog
inputs, 4 UARTs (hardware serial ports), a 16 MHz crystal oscillator, a USB
connection, a power jack, an ICSP header, and a reset button. It contains everything
needed to support the microcontroller; simply connect it to a computer with a USB
cable or power it with an AC-to-DC adapter or battery to get

24
started. The Mega is compatible with most shields designed for the Arduino
Duemilanove or Diecimila.

3.4.2 TECHNICAL SPECIFICATIONS

This microcontroller is based on the processor ATMEGA 2560. The specifications


that are provided for that processor will also be applicable to this version of the Arduino
board [3]. The following are some of the technical specifications:

 Microcontroller: ATmega2560

 Operating Voltage: 5V

 Input Voltage (recommended): 7-12V

 Input Voltage (limits): 6-20V

 Digital I/O Pins: 54 (of which 14 provide PWM output)

 Analog Input Pins: 16

 DC Current per I/O Pin: 40 mA

 DC Current for 3.3V Pin: 50 mA

 Flash Memory 256 KB of which 8 KB used by bootloader

 SRAM: 8 KB

 EEPROM: 4 KB

 Clock Speed: 16 MHz

Figure 3.1: Arduino Mega Board

25
3.4.3 POWER SUPPLY

The power supply circuit doesn’t actually supply any power to the Arduino. It
only routes, regulates, and filters power supplied from an external source. The present
circuit has evolved over the years to make it a convenient and almost fool proof process.
The circuit selects the highest available voltage and uses that source to supply the
remainder of the circuit. There is even a resettable fuse installed on the board to help
prevent damage in the event of a short, thus lessening the likelihood of an unauthorized
thermal event. This is a great example of how the Arduino Team has listened to the user
community and added incremental improvements to the product over the years.

There are several ways to get power to your Arduino. The simplest, at least initially,
is to use the power supplied with the USB cable, which comes from your PC. The USB
standard allows for the supply of up to 100mA (milliamps, or 0.1 amps) of current at 5.0V
for an unenumerated USB device (that is, a device plugged into the USB bus but not
properly identifying itself to the host, such as a USB power tap) and as much as 500mA
(0.5 amps) for a properly enumerated USB device. This is more than enough electrical
power to light up several LEDs and a few low-power sensors. It isn’t sufficient for larger
electrical loads, such as relays, heaters, fans, motors, or solenoids.

When the Arduino isn’t connected to a PC via the USB cable, regulated 5V
power can be supplied to it through the power expansion connector pins labelled 5V
and GND. A regulated 5V supply is required when supplying power via the 5V and

GND pins. An unregulated supply’s voltage fluctuates with line voltage and load, with
the distinct possibility of exceeding the narrow voltage range and very likely causing
permanent damage to one or more components, including the processor. The standard
Arduino I/O Board provides a voltage regulator for this purpose.

The Arduino Mega2560 can be powered via the USB connection or with an
external power supply. The power source is selected automatically. External (non-
USB) power can come either from an AC-to-DC adapter (wall-wart) or battery. The
adapter can be connected by plugging a 2.1mm centre-positive plug into the board's
power jack. Leads from a battery can be inserted in the Gnd and Vin pin headers of the
POWER connector.

26
The board can operate on an external supply of 6 to 20 volts. If supplied with
less than 7V, however, the 5V pin may supply less than five volts and the board may
be unstable. If using more than 12V, the voltage regulator may overheat and damage
the board. The recommended range is 7 to 12 volts.

The Mega2560 differs from all preceding boards in that it does not use the FTDI
USB-to-serial driver chip. Instead, it features the Atmega8U2 programmed as a USB-
to-serial converter. The power pins are as follows:

 VIN: The input voltage to the Arduino board when it's using an external
power source (as opposed to 5 volts from the USB connection or other
regulated power source). You can supply voltage through this pin, or, if
supplying voltage via the power jack, access it through this pin.

 5V: The regulated power supply used to power the microcontroller and
other components on the board. This can come either from VIN via an
on-board regulator, or be supplied by USB or another regulated 5V
supply.

 3V3: A 3.3 volt supply generated by the on-board regulator. Maximum
current draw is 50 mA.

 GND: Ground pins.



3.4.4 INPUT AND OUTPUT

The general block diagram of the I/O pin arrangement is as shown in the figure:

Figure 3.2: Basic Structure of any Arduino Board

27
Each of the 54 digital pins on the Mega can be used as an input or output, using
pinMode(), digitalWrite(), and digitalRead() functions. They operate at 5 volts. Each
pin can provide or receive a maximum of 40 mA and has an internal pull-up resistor
(disconnected by default) of 20-50 kOhms. In addition, some pins have specialized
functions:

 Serial: 0 (RX) and 1 (TX); Serial 1: 19 (RX) and 18 (TX); Serial 2: 17 (RX)
and 16 (TX); Serial 3: 15 (RX) and 14 (TX). Used to receive (RX) and
transmit (TX) TTL serial data. Pins 0 and 1 are also connected to the
corresponding pins of the ATmega8U2 USB-to-TTL Serial chip.

 External Interrupts: 2 (interrupt 0), 3 (interrupt 1), 18 (interrupt 5), 19
(interrupt 4), 20 (interrupt 3), and 21(interrupt 2). These pins can be
configured to trigger an interrupt on a low value, a rising or falling edge, or
a change in value. See the attachInterrupt() function for details.

 PWM: 0 to 13. Provide 8-bit PWM output with the analogWrite()
function.

 SPI: 50 (MISO), 51 (MOSI), 52 (SCK), 53 (SS). These pins support SPI
communication, which, although provided by the underlying hardware,
is not currently included in the Arduino language. The SPI pins are also
broken out on the ICSP header, which is physically compatible with the
Duemilanove and Diecimila.

 LED: 13. There is a built-in LED connected to digital pin 13. When the
pin is HIGH value, the LED is on, when the pin is LOW, it's off.

 I2C: 20 (SDA) and 21 (SCL). Support I2C (TWI) communication using the
Wire library (documentation on the Wiring website). Note that these pins
are not in the same location as the I2C pins on the Duemilanove.

The Mega2560 has 16 analog inputs, each of which provide 10 bits of resolution
(i.e. 1024 different values) [2] [3]. By default they measure from ground to 5 volts,
though is it possible to change the upper end of their range using the AREF pin and
analogReference() function.

There are a couple of other pins on the board:

 AREF. Reference voltage for the analog inputs. Used with


analogReference().

28
 Reset. Bring this line LOW to reset the microcontroller. Typically used
to add a reset button to shields which block the one on the board.

To make it easier to connect your Arduino to additional circuitry, four sets of


expansion connectors are provided. The two connectors across the top edge of the PCB
contain the digital pins, along with the analog reference input and an additional ground
connection. The USART TX and RX pins are among these pins, as well.

Along the bottom edge of the PCB are the power and analog connectors. The
power connector provides connections to the main supply voltages (VIN, 5V, 3V3, and
ground) along with a connection to the microcontroller’s -RESET pin. The analog
connector brings out the six analog inputs, which can also be used as digital I/O lines
if need be. A very handy feature of the Arduino PCB artwork is that every pin is clearly
labelled. This considerably reduces or eliminates tedious cross-referencing between
data sheets and code listings.

One of the buried technical details of the Arduino is the naming and grouping
of the I/O pins within the expansion connectors. In Arduino-speak, the pins are simply
numbered: D0–D53 for the 54 digital pins and A0–A15 for the 16 analog pins. The
digital pins run along the top and right edges of the board, and the analog pins are on
the bottom edge of the board.

3.4.5 COMMUNICATION USING SERIAL PORT

The function of the serial port remains unchanged from the earliest days of
Arduino . The connectors have changed, but everyone pretends that everything is the
same. From a functional perspective, this is certainly true.

The serial port is used to communicate. In the development stage of your


Arduino project, the communication is between the Arduino and your PC, where you’re
writing, compiling, and uploading your sketch to the I/O Board. In the application (or
deployment) phase of your project, when your Arduino is performing its intended
purpose, the serial port may continue to communicate with your PC, if that is part of
the plan, or it may communicate with another serial device. The use of the serial port is
optional at the application stage, so it may be communicating with nothing at all. If this

29
is the case, the receive (RX) and transmit (TX) pins can be used as general-purpose
input/output (I/O) lines.

There are several types of serial communication protocols. The Arduino’s serial
port (internally referred to as the USART peripheral, or Universal
Asynchronous/Synchronous Transmitter/Receiver) is used in an asynchronous mode,
meaning it doesn’t provide or require an independent clock signal. This mode of
operation is identical to the serial ports of most PCs, also known as RS-232 ports. The
built-in serial port hardware on the ATmega328 chip is capable of other modes of
operation, including synchronous mode, where a separate, dedicated signal carries the
clock information. The asynchronous method uses one signal to transmit data and
another to receive data. Depending on your application requirements, you may need to
transmit, receive, do both, or do neither.

3.4.6 COMMUNICATION BETWEEN COMPUTER AND ARDUINO

The Arduino Mega2560 has a number of facilities for communicating with a


computer, another Arduino, or other microcontrollers. The ATmega2560 provides four
hardware UARTs for TTL (5V) serial communication. An ATmega8U2 on the board
channels one of these over USB and provides a virtual com port to software on the
computer (Windows machines will need a .inf file, but OSX and Linux machines will
recognize the board as a COM port automatically.

The Arduino software includes a serial monitor which allows simple textual
data to be sent to and from the board. The RX and TX LEDs on the board will flash
when data is being transmitted via the ATmega8U2 chip and USB connection to the
computer (but not for serial communication on pins 0 and 1).

A SoftwareSerial library allows for serial communication on any of the Mega's


digital pins. The ATmega2560 also supports I2C (TWI) and SPI communication. The
Arduino software includes a Wire library to simplify use of the I2C bus.

30
3.4.7 AUTOMATIC SOFTWARE RESET
This setup has other implications. When the Mega2560 is connected to either a
computer running Mac OS X or Linux, it resets each time a connection is made to it
from software (via USB). For the following half-second or so, the bootloader is running
on the Mega2560. While it is programmed to ignore malformed data (i.e. anything
besides an upload of new code), it will intercept the first few bytes of data sent to the
board after a connection is opened. If a sketch running on the board receives one-time
configuration or other data when it first starts, make sure that the software with which
it communicates waits a second after opening the connection and before sending this
data.

The Mega contains a trace that can be cut to disable the auto-reset. The pads on
either side of the trace can be soldered together to re-enable it. It's labelled "RESET-
EN". You may also be able to disable the auto-reset by connecting a 110 ohm resistor
from 5V to the reset line.

3.4.8 MEMORY

The ATmega2560 has 256 KB of flash memory for storing code (of which 8
KB is used for the bootloader), 8 KB of SRAM and 4 KB of EEPROM . The EEPROM
can be accessed using the inbuilt EEPROM.h library which will be discussed in the
interfacing part.

3.4.9 USB OVERCURRENT PROTECTION

The Arduino Mega has a resettable polyfuse that protects your computer's USB
ports from shorts and overcurrent. Although most computers provide their own internal
protection, the fuse provides an extra layer of protection. If more than 500 mA is
applied to the USB port, the fuse will automatically break the connection until the short
or overload is removed.

3.4.10 PHYSICAL CHARACTERISTICS

The maximum length and width of the Mega2560 PCB are 4 and 2.1 inches
respectively, with the USB connector and power jack extending beyond the former
dimension. Three screw holes allow the board to be attached to a surface or case.

Note that the distance between digital pins 7 and 8 is 160 mil (0.16"), not an
even multiple of the 100 mil spacing of the other pins. The Mega2560 is designed to be
compatible with most shields designed for the Uno, Diecimila or Duemilanove. Digital
pins 0 to 13 (and the adjacent AREF and GND pins), analog inputs 0 to 5, the power
header, and ICSP header are all in equivalent locations. Further the main UART (serial
port) is located on the same pins (0 and 1), as are external interrupts 0 and 1 (pins 2 and
3 respectively). SPI is available through the ICSP header on both the Mega2560 and
Duemilanove / Diecimila. Please note that I2C is not located on the same pins on the
Mega (20 and 21) as the Duemilanove / Diecimila (analog inputs 4 and 5).

31
CHAPTER – 4
ARDUINO INTEGRATED DEVELOPMENT
ENVIRONMENT
4.1 INTRODUCTION TO ARDUINO IDE
The Arduino board used in this project supports coding through both the
languages C and C++. In order to program the Arduino board, a specialised software
named as Arduino IDE where IDE stands for Integrated Development Environment has
been provided. Many other IDE’s are also available but this IDE is provided by the
Arduino’s official developers and has wide variety of options to program the board and
also supports all the versions of boards released by the manufacturers. The layout of
the software and the options available in it are discussed in the below sections.

4.2 SOFTWARE LAYOUT


The IDE version used in this project is. However, there are many other versions
of the software available. As there is not much change going from one version to
another, we used the previously available version which was available prior to the
update on . The software layout and different options available in the software are
discussed below.

The IDE provides the following buttons on its toolbar. We can list them as
follows:

1. File menu.

2. Edit menu.

3. Sketch menu.

4. Tools menu.

5. Help menu.

There are options provided in the form of graphical buttons to verify, compile
and upload the code to Arduino board. The code written is stored by the extension of

32
.ino. The code written in the IDE’s window will be transferred to the board using USB
cable.

4.2.1 FILE MENU

The file menu provided in the software looks as follows.

Figure 4.1: Software Analysis - File Menu

The arrangement of the file menu is similar to the file menu available in most
of the softwares. It helps the user to make new files, open recent project files, to save
the files in the desired locations on our computer. It also helps user to access the specific
examples provided within the software the IDE developers.

4.2.2 EDIT MENU

The edit menu is also similar to the edit menu in most of the software’s. It allows
user to perform the undo/ redo operations. Since it is an open source software, there is
an option to copy the code in the form of HTML file, so that it can be published over
the web. The comment/uncomment option is also provided so that the user can

33
eliminate the execution of some part of the program without actually deleting that part
from the actual code. The codes written in the IDE can be easily submitted to the
Arduino forums and the same option is provided in the edit menu. More options can be
seen in the image below.

Figure 4.2: Software Analysis - Edit Menu

The next 2 menus which are going to be elaborated below are the most important
components of the Arduino IDE. Most of the operations on the Arduino board can be
controlled using the options from the Sketch Menu and the Tools menu.

4.2.3 SKETCH MENU

The sketch menu provides the options to verify or compile the code, to upload
the code to the Arduino Board. In some cases, where the whole arrangement of the
Arduino board is not available and only the on-chip microcontroller is available, the
uploading cannot be done using the IDE directly. We need to use the programmers that
are inbuilt in the software specifically for burning the program onto the Atmega

34
microcontrollers. The .ino file after compilation is stored in the form of a binary file in
the default Arduino directory on the computer. We can use this file to execute the same
program on some microcontrollers, which require binary files to be dumped into them
for execution.

Another option provided by the sketch menu is for the management of libraries.
Libraries refer to the default codes and functions written by the developers which can
be used for a specific component. For example: the Hex-Keypad and LCD display
require the invoking of the Keypad.h and LiquidCrystal.h Library. Provision is also
provided for adding a new library created by the user. In that case, the library needs to
be submitted to the Arduino forums and the library will be added to the software after
the developers have approved the library. Most of the libraries present in the IDE are
open sourced and written by the pro-users of the Arduino boards. The layout for the
sketch menu is as follows:

Figure 4.3: Software Analysis - Sketch Menu

The above image shows the options available in the sketch menu and also some
of the libraries available by default in the downloaded version of the software.

35
4.2.4 TOOLS MENU

Another important component of the Arduino IDE is the tools menu. The tools

menu provides the following main options:

 The board to which the code will be uploaded can be selected from this menu.

 The port on the computer to which the Arduino board is connected can be
selected from this menu.

The IDE provides support for nearly all the boards that are released by the
Arduino developers. The processor is automatically selected on the selection of the
board. Since the program is uploaded to the board via USB cable, we use specialised
ISP which has been specially developed for loading the programs into the Arduino
boards. It also provides the support for the Serial monitor and Serial plotter. Serial
monitor is used to record the incoming data sent through the serial port on Arduino.
This case applies when the Arduino is wirelessly communicating with some device like
Bluetooth in case of this project. Serial plotter is the new feature added into the Beta
mode which allows the user to graphically view the transmitted or received Serial data.

The layout of the tools menu with different boards supported is shown below:

Figure 4.4: Software Analysis - Tools Menu

36
4.2.5 HELP MENU

The help menu allows the users to refer some release notes about the software.

It redirects the user to the Arduino’s official website so that the user can trouble shoot
the software if there are any problems with the software. It helps any new user in getting
started with the Arduino IDE and the method of programing. It provides information
on the version of the software that is being used by the user. It notifies the user if there
are any updates for the libraries in the IDE or the IDE itself. Different guides are also
provided so that user can get acquainted with the software and begin the programming
part in the IDE.

This section completes the introduction to the IDE and also the different and
wide variety if features available in it. The coming section will give an idea about the
basic structure of the Arduino code.

4.3 CONNECTING THE ARDUINO BOARD TO COMPUTER


This section will help in understanding how the Arduino Board must be
connected to the computer and about uploading the program to the board . The steps
are as follows:

1. Get an Arduino or Genuino board and USB cable: The choice of


board depends on the the application that the user is developing using
Arduino. This project utilises the Arduino Mega 2560 R3 board.

2. Download and install the Arduino Software (IDE).

3. Connect the board: The USB connection with the PC is necessary to


program the board and not just to power it up. The Uno and Mega
automatically draw power from either the USB or an external power
supply. Connect the board to your computer using the USB cable. The
green power LED (labelled PWR) should go on.

4. Installing the board drivers: The Windows XP to Windows 10


Operating systems automatically detect the board and perform the
installation automatically. However, in some cases, we have .ZIP
libraries to be downloaded for that particular board. In that case these
are the steps to be followed for easier installation. The steps are as
follows:

37
 Click on the Start Menu, and open up the Control Panel.

 While in the Control Panel, navigate to System and Security.
Next, click on System. Once the System window is up, open the
Device Manager.

 Look under Ports (COM & LPT). You should see an open port
named "Arduino UNO (COMxx)". If there is no COM & LPT
section, look under "Other Devices" for "Unknown Device".

 Right click on the "Arduino UNO (COMxx)" port and choose
the "Update Driver Software" option.

 Next, choose the "Browse my computer for Driver software"
option.

 Finally, navigate to and select the driver file named
"arduino.inf", located in the "Drivers" folder of the Arduino
Software download (not the "FTDI USB Drivers" sub-
directory). If you are using an old version of the IDE (1.0.3 or
older), choose the Uno driver file named "Arduino UNO.inf"

 Windows will finish up the driver installation from there.

5. Launch the Arduino Software.

6. Test any example provided by the developers. Look for such sample
programs in the examples folder of Arduino directory.

7. Select the board and the COM port to enable the communication.

8. Load the program and observe the output.

4.4 ARDUINO PROGRAM STRUCTURE


The basic structure of the Arduino programming language is fairly simple and
runs in at least two parts. These two required parts, or functions enclose blocks of
statements.

The two required parts are as follows:

1. void setup()

2. void loop()

38
The void setup () part can be defined as the preparation to run the program .
This, in turn can be explained as follows:

 All the pin initialisations i.e. the functioning of the particular pin as the
input or output can be done in the setup () part of the program.

 The code which has to be executed once is always written in the setup()
part of the program.

 This part can also be used to perform the initialisation of the different
components like LEDS Serial communication.

For example, consider that the pin no. 9 must be initialised as output and pin
no. 10 as the input. As this is a one-time execution, this part can be done as follows:

 The pins can be declared outside of the setup function by using the
statement: const int pin = pin number;. The pin number can be anything
ranging from 0 to 53 in case of Arduino Mega.

 The pinMode statement is the used inside the setup() function in order
to initialise the pin as input or output. The syntax is as follows: pinMode
(pin number, INPUT) for initialisation of the pin as input or
pinMode(pin number, OUTPUT) for initialisation of the pin as output.

Note that, not only the pin initialisations, but all the parts of the program which
require a single time execution are written within the setup() function.

The loop () function is generally written after the setup () function . As the name
itself indicates, the statements written within the loop statement are executed
repeatedly. As a result, the way in which we want our prototype developed using
Arduino to run is coded within the loop() function. The loop() function can be used to
write statements for different operations such as reading inputs, triggering outputs and
many other functions. The loop() function is the core of the Arduino program and does
all the work. The statements written within the loop() function are responsible for
controlling the response of the Arduino Board.

This section completes the explanation of the basic program structure of the
Arduino. The upcoming section will discuss the basic concepts utilized in coding of the
project.

39
4.5 PROGRAMMING CONCEPTS USED
The following section will illustrate all the concepts that are used in our project.

4.5.1 VARIABLES

A variable is a way of naming and storing a numerical value for later use by the
program. As the name itself suggests, variables are numbers that can be continually
changed as opposed to constants whose value never changes. A variable need to be
declared and optionally assigned to the value needing to be stored. Once a variable has
been assigned or reassigned, user can test its value to see if it meets certain condition,
or you can use its value directly, Variables should be given descriptive names, to
enhance the readability of the code.

All variables have to be declared before they can be used. Declaring a variable
means defining its value type as in int, long, float etc. We can assign initial values to
the variables. The assignment of initial value is done only once in the program but can
be changed within the program by arithmetic operations and different assignments.

The variable declaration can be declared at the beginning of the program before
setup () or locally inside of the functions, and sometimes within a block of statements
such as loops. A global variable can be used by any function inside the program and the
local variable can be used by the function within which it has been declared.

For example, the variable named “vhldr” in the code is the global variable which
is used to store the value of home ldrs reading.

4.5.2 ARRAYS

An array is a collection of values that are accessed with the index number . Any
value in the array may be called upon by calling the name of the array and the index
number of the value . Arrays are always zero indexed, with the first value in the array
beginning at the index number 0. An array needs to be declared and optionally assigned
values before they can be used.

An array can be of any type either character arrays or integer arrays. Declaration
of the arrays of integer type is different from the character array. Number of elements
in the array can be known using the size of the array . To retrieve a value from the array,
assign a variable to the array and index position.

Arrays are often used in loops, similar to the way the code for this project
utilises it. In this project, we are not using arrays but this was given inorder to give a
brief explanation of Arduino programming:

4.5.3 USER DEFINED FUNCTIONS

A function is a block of code that has a name and a block of statements that are
executed when the function is called . The functions void setup () and void loop () have
already been discussed and other built in function are also available in the installer
package of the IDE.

40
Custom functions can be written to perform repetitive tasks and reduce clutter
in a program. Functions are declared by first declaring the function type. This is the
type of the value that has to be returned by the function, such as an int for the integer
type function. If no value is to be returned, the function can be termed as void function.
After type, declare the name given to the function and in parenthesis any parameters
being passed to the function.

4.5.4 FLOW CONTROL STATEMENTS

The code for this project utilises different control statements with the most
used statements being:

 If statement.

 If-else statement.

 For loop.

 While loop.

 Switch case.

The if statement tests whether a certain condition has been reached, such as an
analog value being above a certain number and executes any statements inside the brackets
if the statement is true, if false the program skips over the statement. Both if and if else
work the same way. The main usage of these statements in the code are for:

 Comparing the brightness offered by the four LDRs along each


direction.

 If the brightness among 1 direction is high, then decide upon whether
the should rotatealong which direction.

41
4.5.5 USAGE OF SERIAL PORT THROUGH PROGRAMMING

The meaning of enabling the Serial port is setting of the rate at which the
Arduino communicates with the wireless devices connected to it. To use the serial port
from the code, there are many functions available that come along with the installer
package. Note that, enabling the serial port does not require the usage of any inbuilt
library of Arduino.

The following functions are used to facilitate the usage of serial port. They are:

 Serial. begin (rate): This function call opens the Serial port and sets the
baud rate for transmission and reception of serial date. Default baud rate
is 9600, but Arduino supports baud rate up to 115200.

 Serial.available (): This function call gets the number of bytes (characters)
available for reading from the serial port. This is data that's already arrived
and stored in the serial receive buffer (which holds 64 bytes). The password
sent from the Bluetooth in this project is stored onto the serial buffer before
it is read by the statement Serial.read().

 Serial. Read (): This function reads the incoming data from the Serial port.
This is used to read the password from the Serial buffer into the array.

 Serial.print () or Serial.println (): As the name itself suggests, this
command performs the operation of reading the data to and from the
serial port.

42
CHAPTER 5
INTERFACING DIFFERENT COMPONENTS WITH
ARDUINO

5.1 LDR
A Light Dependent Resistor (LDR) or a photo resistor is a device whose resistivity is a
function of the incident electromagnetic radiation. Hence, they are light sensitive devices.
They are also called as photo conductors, photo conductive cells or simply photocells. They
are made up of semiconductor materials having high resistance. There are many different
symbols used to indicate a LDR, one of the most commonly used symbol is shown in the
figure below.

.
Fig 5.1 LDR circuit symbol
The following diagram shows you how to interface an ldr with arduino

Fig 5.2 interfacing LDR with Arduino

43
5.2 Interfacing LED with ARDUINO

It is a two-lead semiconductor light source. It is a p–n junction diode that emits light
when activated. When a suitable voltage is applied to the leads, electrons are able to
recombine with electron holes within the device, releasing energy in the form of photons.
This effect is called electroluminescence, and the color of the light (corresponding to the
energy of the photon) is determined by the energy band gap of the semiconductor. LEDs are
typically small (less than 1 mm2) and integrated optical components may be used to shape
the radiation pattern. The following diagram shows you the circuit symbol of a light emitting
diode

Fig 5.2.1 Light emitting diode

Fig 5.3 interfacing LED with Arduino

5.3 DC FAN
It is just a normal dc fan which you see in your normal life. Here we are using this dc fan to
show that we are rotating the dc fan based on the reading of the lm35.
The following diagram shows you how a dc fan looks

44
Fig 5.4 DC FAN
5.4 LM-35

LM35 is a precision IC temperature sensor with its output proportional to the


temperature (in oC). The sensor circuitry is sealed and therefore it is not subjected to
oxidation and other processes. With LM35, temperature can be measured more accurately
than with a thermistor. It also possesses low self-heating and does not cause more than 0.1 oC
temperature rise in still air.

Fig 5.5 Interfacing Arduino with LM35

5.5 L293D
L293D is a dual H-bridge motor driver integrated circuit (IC). Motor drivers act as
current amplifiers since they take a low-current control signal and provide a higher-current
signal. This higher current signal is used to drive the motors. The following diagram shows
you how to interface a hbridge and motors with Arduino.

45
Fig 5.6 interfacing L293D and dc motors with Arduino

46
CHAPTER-6
APPLICATIONS AND ADVANTAGES

6.1 ADVANTAGES & APPLICATIONS:

 Trackers generate more electricity than their stationary counterparts due to


increased direct exposure to solar rays. This increase can be as much as 10 to
25% depending on the geographic location of the tracking system.
 Higher degree of flexibility, allowing for a higher energy output on sunny days.
 Higher degree of accuracy in directional pointing
 Dual-axis trackers allow for two degrees of flexibility, offering a much wider range
of motion.
 The primary and secondary axes work together to allow these trackers to point the
solar panels at specific points in the sky.
 Solar trackers generate more electricity in roughly the same amount of space
needed for fixed-tilt systems, making them ideal for optimizing land usage.
 In certain states, some utilities offer Time of Use (TOU) rate plans for solar power,
which means the utility will purchase the power generated during the peak time of
the day at a higher rate. In this case, it is beneficial to generate a greater amount of
electricity during these peak times of the day.
 Using a tracking system helps maximize the energy gains during these peak time
periods.
 Advancements in technology and reliability in electronics and mechanics have
drastically reduced long-term maintenance concerns for tracking systems
 The most important advantage is the efficiency with which it converts the light inti
electricity, trackers are way ahead than the static panels because these can always
focus the direction which has most lighting causing in the generation of more
electricity.
 Solar panels are usually set up to be in full direct sunlight at the middle of the day,
facing south in the Northern Hemisphere, or facing north in the Southern
Hemisphere. Therefore, morning and evening sunlight hits the panels at an acute
angle and reduces the total amount of electricity which can be generated each day.
 A solar tracker is a device onto which solar panels are fitted which tracks the
motion of the sun across the sky, thus ensuring that the maximum amount of
sunlight strikes the panels throughout the day.
 When compared to the price of the PV solar panels, the cost of a solar tracker is
relatively low. We provide highly efficient, proprietary single and dual axis solar
tracking systems. Our single-axis solar trackers can typically increase electricity
generation by 30%, while our dual-axis.
 They can be used most effectively in areas with low horizons and locations that are
shade free from dawn to dusk each day. Throughout the year the tracking array will
be able to utilize the wide open access to gain every available electron from the
sun.
 This way, energy production is at an optimum and energy output is increased year
round.

47
 This is especially significant throughout the summer months with its long days of
sunlight available to capture and when, at many Northern latitudes, the sun rises in
the northeast and sets in the northwest, no energy will be lost.

 For those with limited space this means that a smaller array only needs to be
installed, a huge advantage for those smaller sites with only a small area to place
equipment; they will be able to produce maximum energy output but only need to
utilize one of the smaller solar home systems.

 The biggest application of this solar trackers is found in satellites where the panels
are rotated according to the direction of the maximum illuminated side so that it
can generate maximum power all the time which helps in running the satellite
correctly.

48
CHAPTER-7
7.APPENDIX

As explained above in the 4.4 Arduino program structure, program should be written
in the two predefined functions void setup () and void loop () except the global declarations

int LDR1= 4;
int LDR2= 5;
int LDR3= 6;
int LDR4= 7;
int M1D1 = 8;
int M1D2 = 9;
int M2D1 = 10;
int M2D2 = 11;
int ldr1State = 0;
int ldr2State = 0;
int ldr3State = 0;
int ldr4State = 0;
int hfan =2;
int hlm = A2;
int vhlm = 0;
int hldr =A1;
int vhldr =0;
int hled =12;
int l1d=0;
int l2d=0;
int l3d=0;
int l4d=0;
int temp =0;
void setup() {

Serial.begin(9600);

49
Serial.println("Program Start...");

pinMode(M1D1, OUTPUT);
pinMode(M1D2, OUTPUT);
pinMode(M2D1, OUTPUT);
pinMode(M2D2, OUTPUT);
pinMode(hfan, OUTPUT);
pinMode(hfan, OUTPUT);
pinMode(hled, OUTPUT);
pinMode(LDR1, INPUT);
pinMode(LDR2, INPUT);
pinMode(LDR3, INPUT);
pinMode(LDR4, INPUT);
pinMode(hldr, INPUT);
pinMode(hlm, INPUT);
}

void loop() {
// read the state of the LDR value:
ldr1State = digitalRead(LDR1);
ldr2State = digitalRead(LDR2);
ldr3State = digitalRead(LDR3);
ldr4State = digitalRead(LDR4);
vhldr = analogRead(hldr);
Serial.println("homeldrreading = ");
Serial.println(vhldr);
vhlm= analogRead(hlm)*0.48875;
Serial.println("homelm35reading");
Serial.println(vhlm);
if ( ldr1State == HIGH) {
Serial.println("LDR 1 HIGH");
digitalWrite(M2D1, HIGH);

50
delay(200);
digitalWrite(M2D1, LOW);
delay(300);
digitalWrite(M2D1, HIGH);
delay(200);
digitalWrite(M2D1, LOW);
delay(300);
digitalWrite(M2D1, HIGH);
delay(200);
digitalWrite(M2D1, LOW);

if ( ldr2State == HIGH) {
Serial.print("LDR 2 HIGH");
digitalWrite(M2D2, HIGH);
delay(200);
digitalWrite(M2D2, LOW);
delay(300);
digitalWrite(M2D2, HIGH);
delay(200);
digitalWrite(M2D2, LOW);
delay(300);
digitalWrite(M2D2, HIGH);
delay(200);
digitalWrite(M2D2, LOW);

51
if ( ldr3State == HIGH) {
Serial.print("LDR 3 HIGH");
digitalWrite(M1D1, HIGH);
delay(200);
digitalWrite(M1D1, LOW);
delay(400);
digitalWrite(M1D1, HIGH);
delay(200);
digitalWrite(M1D1, LOW);
delay(400);
digitalWrite(M1D1, HIGH);
delay(200);
digitalWrite(M1D1, LOW);
delay(400);
digitalWrite(M1D1, HIGH);
delay(200);
digitalWrite(M1D1, LOW);
delay(400);
digitalWrite(M1D1, HIGH);
delay(200);
digitalWrite(M1D1, LOW);
delay(400);
digitalWrite(M1D1, HIGH);
delay(200);
digitalWrite(M1D1, LOW);
delay(1000);
}
if ( ldr4State == HIGH)
{
Serial.print("LDR 4 HIGH");
digitalWrite(M1D2, HIGH);
delay(200);

52
digitalWrite(M1D2, LOW);
delay(400);
digitalWrite(M1D2, HIGH);
delay(200);
digitalWrite(M1D2, LOW);
delay(400);
digitalWrite(M1D2, HIGH);
delay(200);
digitalWrite(M1D2, LOW);
delay(400);
digitalWrite(M1D2, HIGH);
delay(200);
digitalWrite(M1D2, LOW);
delay(400);
digitalWrite(M1D2, HIGH);
delay(200);
digitalWrite(M1D2, LOW);
delay(400);
digitalWrite(M1D2, HIGH);
delay(200);
digitalWrite(M1D2, LOW);
delay(1000);
}
if(vhldr < 150)
{
digitalWrite(hled,HIGH);
delay(1000);
}
else
{
digitalWrite(hled,LOW);
delay(1000);

53
}
if (vhlm > 35)
{
digitalWrite (hfan, HIGH);
delay (1000);
}
else
{
digitalWrite (hfan, LOW);
delay (1000);
}
}

54
CHAPTER-8
RESULTS

The system is focusing on the controller design. The constructed system has been
tested and some data from hardware measurement have been collected and discussed. Typical
solar panel has been used and the purpose only to prove the designed system is able to
operate accordingly. Therefore, the surrounding effects, for instance, weather condition are
not seriously considered during hardware testing.

Misalignment angle % Power lost while not using tracker


1 0.015
3 0.14
8 1
25 8.3
30 13.4
45 30
75 72

Table 4 : Results

55
CHAPTER 9
CONCLUSION
The project “DUAL AXIS SOLAR TRACKING SYSTEM FOR SMART
HOMES” prototype model is successfully designed and tested. The designed system
focuses on designing controller part and the main concern is to design appropriate circuits
and the circuits supposed to be able to control DC-brushless motor rotation direction. The
system is able to track and follow Sunlight intensity in order to collect maximum solar power.
The uniqueness of developed system, motor speed is not critical consideration because the
DC-brushless motor offers low output rated speed and high output rated torque.
Therefore, any types of DC- motor can be used for this system regardless of motor
speed controller unit as long as the speed and torque of the motor are following the given
specification. The constructed system model can be applied in the residential area for
alternative electricity generation especially for non-critical and low power appliances and can
also be used in solar power plants. Very soon these solar trackers will play a key role in the
power generation sector especially in the countries like India which are facing a power
shortage because it always focuses the maximum illuminated side there by generating more
amount of power.

56

Vous aimerez peut-être aussi