Académique Documents
Professionnel Documents
Culture Documents
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.
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.
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
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.
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).
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.
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
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:
2.1.2PIN DIAGRAM:
8
2.1.3 DESCRIPTION
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.
9
2.1.5 BLOCK DIAGRAM:
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.
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.
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
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
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.
13
current (dc) electricity. They can be connected in both series and parallel electrical
arrangements to produce any required voltage and current combination.
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 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
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 .
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.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.
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
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).
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
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.
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.
15
23
on the Processing programming environment, so students learning to
program in that environment will be familiar with how the Arduino IDE
works.
3.4.1 INTRODUCTION
24
started. The Mega is compatible with most shields designed for the Arduino
Duemilanove or Diecimila.
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
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:
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.
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.
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.
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.
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.
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).
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.
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.
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.
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.
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.
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.
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.
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:
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
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:
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.
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.
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.
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:
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
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
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
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
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.
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