You are on page 1of 50

CHAPTER III

PROJECT DESCRIPTION
BLOCK DIAGRAM

ROBOT UNIT
INTERFACIING DRIVER MOTOR
INTERFACING PIR

INTERFACING GSM
POWER SUPPLY SOURCE:

Step Down Bridge Filter Regulator


section
Transformer Rectifier Circuit

Automatic mains changeover switch for uninterrupted power supply is an integral part of
the power control process, allowing smooth and immediate transfer of electrical current between
multiple sources and the load. Here we are using two transformers TF1 (Main transformer) and
TF2 (Backup transformer). The transfers switch senses when utility power is interrupted, and
starts up the transformer TF2 which acts as a backup transformer. If the utility power remains
absent, the transfer switch disconnects the load from the utility and connects it to the
Transformer TF2, restoring electricity to the load. The transfer switch continues to monitor
utility power, and when it is restored, switches the load from the Transformer TF2 back to the
Main transformer TF1. Once the Transformer TF2 is disconnected, it goes through a cool-down
routine and is automatically shut down.

The present system is designed around two transformers. One transformer (TF1) is used
as the main supply and the other transformer (TF2) is used in the place of the generator (for
demo purpose). These two transformers are connected with the relay which is controlled by the
embedded controller. The loads are connected to the main line (TF1) and as well as to the TF2.
Initially TF1 is connected to the load, the loads run with this power. Due to any reason
this power is interrupted, then it is identified by the controller and it immediately switches ON to
the TF2 through the relay. The controller continuously monitors the TF1 (main line). When it
finds the power on it again switches the loads connection to the main line.

A power supply is a device that supplies electric power to an electrical load. The term is
most commonly applied to electric power converters that convert one form of electrical energy to
another, though it may also refer to devices that convert another form of energy (mechanical,
chemical, solar) to electrical energy. A regulated power supply is one that controls the output
voltage or current to a specific value; the controlled value is held nearly constant despite
variations in either load current or the voltage supplied by the power supply's energy source.

Every power supply must obtain the energy it supplies to its load, as well as any energy it
consumes while performing that task, from an energy source. Depending on its design, a power
supply may obtain energy from:

 Electrical energy transmission systems. Common examples of this include power


supplies that convert AC line voltage to DC voltage.
 Energy storage devices such as batteries and fuel cells.
 Electromechanical systems such as generators and alternators.
 Solar power.

A power supply may be implemented as a discrete, stand-alone device or as an integral device


that is hardwired to its load. Examples of the latter case include the low voltage DC power
supplies that are part of desktop computers and consumer electronics devices.

TRANSFORMER

A transformer is a static electrical device that transfers energy by inductive

coupling between its winding circuits. A varying current in the primary winding
creates a varying magnetic flux in the transformer's core and thus a varying

magnetic flux through the secondary winding. This varying magnetic flux induces

a varying electromotive force (emf) or voltage in the secondary winding.

Transformers range in size from thumbnail-sized units hidden inside

microphones to units weighing hundreds of tons interconnecting the power grid. A

wide range of transformer designs are used in electronic and electric power

applications. Transformers are essential for the transmission, distribution, and

utilization of electrical energy.

The transformer is based on two principles: first, that an electric current can

produce a magnetic field and second that a changing magnetic field within a coil of

wire induces a voltage across the ends of the coil (electromagnetic induction).

Changing the current in the primary coil changes the magnetic flux that is

developed. The changing magnetic flux induces a voltage in the secondary coil.

Referring to the basic transformer in the figure below, current passing

through the primary coil creates a magnetic field. The primary and secondary coils

are wrapped around a core of very high magnetic permeability, such as iron, so that

most of the magnetic flux passes through both the primary and secondary coils.
If a load is connected to the secondary winding, the load current and voltage

will be in the directions indicated, given the primary current and voltage in the

directions indicated (each will be AC in practice).

The ideal transformer model assumes that all flux generated by the primary

winding links all the turns of every winding, including itself. In practice, some flux

traverses paths that take it outside the windings.[46] Such flux is termed leakage

flux, and results in leakage inductance in series with the mutually coupled

transformer windings. Leakage flux results in energy being alternately stored in

and discharged from the magnetic fields with each cycle of the power supply. It is

not directly a power loss (see Stray losses below), but results in inferior voltage

regulation, causing the secondary voltage to not be directly proportional to the

primary voltage, particularly under heavy load.


Transformers are therefore normally designed to have very low leakage

inductance. Nevertheless, it is impossible to eliminate all leakage flux because it

plays an essential part in the operation of the transformer. The combined effect of

the leakage flux and the electric field around the windings is what transfers energy

from the primary to the secondary.

In some applications increased leakage is desired, and long magnetic paths,

air gaps, or magnetic bypass shunts may deliberately be introduced in a

transformer design to limit the short-circuit current it will supply. Leaky

transformers may be used to supply loads that exhibit negative resistance, such as

electric arcs, mercury vapor lamps, and neon signs or for safely handling loads that

become periodically short-circuited such as electric arc welders.

Air gaps are also used to keep a transformer from saturating, especially

audio-frequency transformers in circuits that have a DC component flowing

through the windings.

Knowledge of leakage inductance is for example useful when transformers

are operated in parallel. It can be shown that if the percent impedance (Z) and

associated winding leakage reactance-to-resistance (X/R) ratio of two transformers

were hypothetically exactly the same, the transformers would share power in

proportion to their respective volt-ampere ratings (e.g. 500 kVA unit in parallel
with 1,000 kVA unit, the larger unit would carry twice the current). However, the

impedance tolerances of commercial transformers are significant.

Cicuit Diagram:

The ideal condition assumptions are:

 The windings of the transformer have negligible resistance thus there is no


copper loss in the winding, no voltage drop
 Flux is confined within the core. Therefore, it is the same flux that links both
the windings
 Permeability of the core is infinitely high which implies that a very small
mmf (current) is required to set up the flux
 The core does not incur any hysteresis or eddy current loss. Hence, no core
losses

Consider the ideal, lossless, perfectly-coupled transformer shown in the circuit


diagram at right having primary and secondary windings with NP and NS turns,
respectively.

Energy losses:

An ideal transformer would have no energy losses, and would be 100% efficient.
In practical transformers, energy is dissipated in the windings, core, and
surrounding structures. Larger transformers are generally more efficient, and those
rated for electricity distribution usually perform better than 98%.

Transformer losses arise from:


Winding joule losses

Current flowing through winding conductors causes joule heating. As


frequency increases, skin effect and proximity effect causes winding
resistance and, hence, losses to increase.

Core losses

1. Hysteresis losses

Each time the magnetic field is reversed, a small amount of energy is lost
due to hysteresis within the core. According to Steinmetz's formula, the heat
energy due to hysteresis is given by

, and,

hysteresis loss is thus given by

where, f is the frequency, η is the hysteresis coefficient and βmax is the


maximum flux density, the empirical exponent of which varies from about
1.4 to 1 .8 but is often given as 1.6 for iron.

2. Eddy current losses

Ferromagnetic materials are also good conductors and a core made from
such a material also constitutes a single short-circuited turn throughout its
entire length. Eddy currents therefore circulate within the core in a plane
normal to the flux, and are responsible for resistive heating of the core
material. The eddy current loss is a complex function of the square of supply
frequency and inverse square of the material thickness.[31] Eddy current
losses can be reduced by making the core of a stack of plates electrically
insulated from each other, rather than a solid block; all transformers
operating at low frequencies use laminated or similar cores.

3. Stray losses

Leakage inductance is by itself largely lossless, since energy supplied to its


magnetic fields is returned to the supply with the next half-cycle. However,
any leakage flux that intercepts nearby conductive materials such as the
transformer's support structure will give rise to eddy currents and be
converted to heat. There are also radiative losses due to the oscillating
magnetic field but these are usually small.

4. Mechanical vibration and audible noise transmission

In addition to magnetostriction, the alternating magnetic field causes


fluctuating forces between the primary and secondary windings. This energy
incites vibration transmission in interconnected metalwork, thus amplifying
audible transformer hum.

Core form and shell form transformers:

Closed-core transformers are constructed in 'core form' or 'shell form'. When


windings surround the core, the transformer is core form; when windings are
surrounded by the core, the transformer is shell form. Shell form design may be
more prevalent than core form design for distribution transformer applications due
to the relative ease in stacking the core around winding coils. Core form design
tends to, as a general rule, be more economical, and therefore more prevalent, than
shell form design for high voltage power transformer applications at the lower end
of their voltage and power rating ranges (less than or equal to, nominally, 230 kV
or 75 MVA). At higher voltage and power ratings, shell form transformers tend to
be more prevalent. Shell form design tends to be preferred for extra high voltage
and higher MVA applications because, though more labor intensive to
manufacture, shell form transformers are characterized as having inherently better
kVA-to-weight ratio, better short-circuit strength characteristics and higher
immunity to transit damage.
Types:

1. Autotransformer: Transformer in which part of the winding is common to


both primary and secondary circuits.
2. Capacitor voltage transformer: Transformer in which capacitor divider is
used to reduce high voltage before application to the primary winding.
3. Distribution transformer, power transformer: International standards
make a distinction in terms of distribution transformers being used to
distribute energy from transmission lines and networks for local
consumption and power transformers being used to transfer electric
energy between the generator and distribution primary circuits.
4. Phase angle regulating transformer: A specialised transformer used to
control the flow of real power on three-phase electricity transmission
networks.
5. Scott-T transformer: Transformer used for phase transformation from
three-phase to two-phase and vice versa.
6. Polyphase transformer: Any transformer with more than one phase.
7. Grounding transformer: Transformer used for grounding three-phase
circuits to create a neutral in a three wire system, using a wye-delta
transformer, or more commonly, a zigzag grounding winding.
8. Leakage transformer: Transformer that has loosely coupled windings.
9. Resonant transformer: Transformer that uses resonance to generate a
high secondary voltage.
10.Audio transformer: Transformer used in audio equipment.
11.Output transformer: Transformer used to match the output of a valve
amplifier to its load.
12.Instrument transformer: Potential or current transformer used to
accurately and safely represent voltage, current or phase position of high
voltage or high power circuits.

REGULATED POWER SUPPLY

A regulated power supply is an embedded circuit, or stand alone unit, the function of
which is to supply a stable voltage (or less often current), to a circuit or device that must be
operated within certain power supply limits. The output from the regulated power supply may be
alternating or unidirectional, but is nearly always DC (Direct Current). The type of stabilization
used may be restricted to ensuring that the output remains within certain limits under various
load conditions, or it may also include compensation for variations in its own supply source. The
latter is much more common today.

The variable dc power supply and the main working principle of this project is
full wave rectification which is done by bridge configuration in which we are using 4 diodes
which rectifies the output of the step-down transformer which step-down the 220 AC
v to 9 AC volts .here we are using a voltage regulator which give constant voltage, here
we are using 7805 which give 5 volts .

Now the main task is to get variable output for this we use the pair of voltage divider
resistors to increase the output of the regulator and in which of resistance is variable so when we
increase or d e cr e as e t h e v al u e o f t h a t r esi st o r t h e o ut p ut v ol t a g e o f t h e
r e gu l a t o r wi l l a l s o change and we get a range of 5 to 12 v , here we can’t get less than 5
volts because of this is the output of the regulator In this circuit we use three capacitor , c1 and
c2are use to get constant input to the regulator moreover it also help to reduce the
sharp peaks in the output connect the 0.27uF capacitor to close to the input of the
regulator and the 10uf capacitor to the output because these capacitor reduce the noise
and also help to reduce the ripples produce by the regulator so that regulated output has less
ripples.

POWER SUPPLY CIRCUIT:


This section gives an overview of the whole circuitry and hardware involved in the project. The
aim of the project is to protect the failing or damage of transformers having applied more loads
on it and to share these overloads with another transformer. In this project we are giving power
supply to all units, it basically consists of a Transformer to step down the 230V ac to 18V ac
followed by diodes. Here diodes are used to rectify the ac to dc. After rectification the obtained
rippled dc is filtered using a capacitor Filter. A positive voltage regulator is used to regulate the
obtained dc voltage. But here in this project two power supplies are used one is meant to supply
operating voltage for Microcontroller and the other is to supply control voltage for Relays

In this project, we are using two transformers instead of one transformer. Whenever
applying the more loads on one transformer exceeding the particular limit then it will not broke
down but the excess load must be shared by the another transformer. Therefore, no failure of
transformers will occurs.

Relay:
A relay is an electrically operated switch. Many relays use an electromagnet to operate a
switching mechanism mechanically, but other operating principles are also used. Relays are used
where it is necessary to control a circuit by a low-power signal (with complete electrical isolation
between control and controlled circuits), or where several circuits must be controlled by one
signal. The first relays were used in long distance telegraph circuits, repeating the signal coming
in from one circuit and re-transmitting it to another. Relays were used extensively in telephone
exchanges and early computers to perform logical operations.

A type of relay that can handle the high power required to directly control an electric
motor or other loads is called a contactor. Solid-state relays control power circuits with no
moving parts, instead using a semiconductor device to perform switching. Relays with calibrated
operating characteristics and sometimes multiple operating coils are used to protect electrical
circuits from overload or faults; in modern electric power systems these functions are performed
by digital instruments still called "protective relays".

Basic Design and Operation:

A simple electromagnetic relay consists of a coil of wire wrapped around a soft iron core,
an iron yoke which provides a low reluctance path for magnetic flux, a movable iron armature,
and one or more sets of contacts (there are two in the relay pictured). The armature is hinged to
the yoke and mechanically linked to one or more sets of moving contacts.
It is held in place by a spring so that when the relay is de-energized there is an air gap in
the magnetic circuit. In this condition, one of the two sets of contacts in the relay pictured is
closed, and the other set is open. Other relays may have more or fewer sets of contacts depending
on their function. The relay in the picture also has a wire connecting the armature to the yoke.
This ensures continuity of the circuit between the moving contacts on the armature, and the
circuit track on the printed circuit board (PCB) via the yoke, which is soldered to the PCB.

When an electric current is passed through the coil it generates a magnetic field that
activates the armature, and the consequent movement of the movable contact(s) either makes or
breaks (depending upon construction) a connection with a fixed contact. If the set of contacts
was closed when the relay was de-energized, then the movement opens the contacts and breaks
the connection, and vice versa if the contacts were open. When the current to the coil is switched
off, the armature is returned by a force, approximately half as strong as the magnetic force, to its
relaxed position. Usually this force is provided by a spring, but gravity is also used commonly in
industrial motor starters. Most relays are manufactured to operate quickly. In a low-voltage
application this reduces noise; in a high voltage or current application it reduces arcing.

When the coil is energized with direct current, a diode is often placed across the coil to
dissipate the energy from the collapsing magnetic field at deactivation, which would otherwise
generate a voltage spike dangerous to semiconductor circuit components. Some automotive
relays include a diode inside the relay case.
Alternatively, a contact protection network consisting of a capacitor and resistor in series
(snubber circuit) may absorb the surge. If the coil is designed to be energized with alternating
current (AC), a small copper "shading ring" can be crimped to the end of the solenoid, creating a
small out-of-phase current which increases the minimum pull on the armature during the AC
cycle.[1]

A solid-state relay uses a thyristor or other solid-state switching device, activated by the
control signal, to switch the controlled load, instead of a solenoid. An optocoupler (a light-
emitting diode (LED) coupled with a photo transistor) can be used to isolate control and
controlled circuits.

Types of Relay:

 Latching relay
 Read relay
 Mercury-wetted relay
 Mercury relay
 Polarized relay
 Machine tool relay

 Ratchet relay
 Coaxial relay
 Contactor
 Solid state relay
 Solid state contactor relay
 Overload protection relay
 Vacuum relay
Pole and Throw:

Since relays are switches, the terminology applied to switches is also applied to relays; a relay
switches one or more poles, each of whose contacts can be thrown by energizing the coil in one
of three ways:

 Normally-open (NO) contacts connect the circuit when the relay is activated; the circuit
is disconnected when the relay is inactive. It is also called a Form A contact or "make"
contact. NO contacts may also be distinguished as "early-make" or NOEM, which means
that the contacts close before the button or switch is fully engaged.
 Normally-closed (NC) contacts disconnect the circuit when the relay is activated; the
circuit is connected when the relay is inactive. It is also called a Form B contact or
"break" contact. NC contacts may also be distinguished as "late-break" or NCLB, which
means that the contacts stay closed until the button or switch is fully disengaged.
 Change-over (CO), or double-throw (DT), contacts control two circuits: one normally-
open contact and one normally-closed contact with a common terminal. It is also called a
Form C contact or "transfer" contact ("break before make"). If this type of contact
utilizes a "make before break" functionality, then it is called a Form D contact.

The following designations are commonly encountered:

 SPST – Single Pole Single Throw. These have two terminals which can be connected or
disconnected. Including two for the coil, such a relay has four terminals in total. It is
ambiguous whether the pole is normally open or normally closed. The terminology
"SPNO" and "SPNC" is sometimes used to resolve the ambiguity.
 SPDT – Single Pole Double Throw. A common terminal connects to either of two others.
Including two for the coil, such a relay has five terminals in total.
 DPST – Double Pole Single Throw. These have two pairs of terminals. Equivalent to two
SPST switches or relays actuated by a single coil. Including two for the coil, such a relay
has six terminals in total. The poles may be Form A or Form B (or one of each).
 DPDT – Double Pole Double Throw. These have two rows of change-over terminals.
Equivalent to two SPDT switches or relays actuated by a single coil. Such a relay has
eight terminals, including the coil.

Applications:

Relays are used for:

 Amplifying a digital signal, switching a large amount of power with a small operating
power. Some special cases are:
o A telegraph relay, repeating a weak signal received at the end of a long wire
o Controlling a high-voltage circuit with a low-voltage signal, as in some types of
modems or audio amplifiers,
o Controlling a high-current circuit with a low-current signal, as in the starter
solenoid of an automobile.

 Detecting and isolating faults on transmission and distribution lines by opening and
closing circuit breakers (protection relays),Switching to a standby power supply.
An infrared sensor is an electronic device, which emits in order to sense
some aspects of the surroundings. An IR sensor can measure the heat of an object
as well as detects the motion. These types of sensors measures only infrared
radiation, rather than emitting it that is called as a passive IR sensor. Usually in the
infrared spectrum, all the objects radiate some form of thermal radiations. These
types of radiations are invisible to our eyes, that can be detected by an infrared
sensor. The emitter is simply an IR LED (Light Emitting Diode) and the detector is
simply an IR photodiode which is sensitive to IR light of the same wavelength as
that emitted by the IR LED. When IR light falls on the photodiode, The resistances
and these output voltages, change in proportion to the magnitude of the IR light
received.
LCD (liquid crystal display):

LCD stands for liquid crystal display. They come in many sizes 8x1 , 8x2 , 10x2 , 16x1 ,
16x2 , 16x4 , 20x2 , 20x4 ,24x2 , 30x2 , 32x2 , 40x2 etc. Many multinational companies
like Philips Hitachi Panasonic make their own special kind of LCD’s to be used in their products.
All the LCD’s performs the same functions (display characters numbers special
characters ASCII characters etc).Their programming is also same and they all have same 14 pins
(0-13) or 16 pins (0 to 15). Eight (8) of them all are data pins that takes data from the external
unit and display it on the screen. One vcc takes 5 volts to turn on the LCD and GND a ground
and one is contrast (we use it to set the contract colour of the alphabets (with respect to LCD)
that appears on the LCD).

LCD (Liquid Crystal Display) screen is an electronic display module and find a wide
range of applications. A 16x2 LCD display is very basic module and is very commonly used in
various devices and circuits. These modules are preferred over seven segments and other multi
segment LEDs. The reasons being: LCDs are economical; easily programmable; have no
limitation of displaying special & even custom characters (unlike in seven segments),
animationsand so on.

A 16x2 LCD means it can display 16 characters per line and there are 2 such lines. In this
LCD each character is displayed in 5x7 pixel matrix. This LCD has two registers, namely,
Command and Data.
The command register stores the command instructions given to the LCD. A command is
an instruction given to LCD to do a predefined task like initializing it, clearing its screen, setting
the cursor position, controlling display etc. The data register stores the data to be displayed on
the LCD. The data is the ASCII value of the character to be displayed on the LCD. Click to learn
more about internal structure of a LCD.

PIN DIAGRAM:

Circuit diagram:
The renaming three are very important pins RS (register set), RW(read write), and EN(enable
signal).
RS(register set):
Is used to distinguish between commands and data. When it is 1 it means that some data
is coming to LCD (by data i mean some characters or ASCII characters) and when it is 0 it
means that some command is approaching to LCD from external unit (usually a micro
controller) by commands i mean that a instruction for LCD is coming for example move cursor
one step back or forward turn on or off cursor etc.
RW(read-write):
This pin most often remains 0 because when it is 0 it means we are writing to LCD
module writing anything data or command. When it is 1 it means we are reading from LCD.
EN(Enable signal):
This enable signal is very important. When it is 1 it provides an extra beem to LCD to
display the character that the data pins are caring. After displaying the character it then comes
back to normal state 0. Two extra pins on some LCD are for background display one pin
represents background display apply 5 volts to turn on background display or 0 volts to turn off
background display.
The data which we send to our LCD can be any alphabet (small or big), digit or ASCII character.
We cannot send an integer,float,long,double type data to LCD because LCD is designed
to display a character only. The 8 data pins on LCD carries only ASCII 8-bit code of the
character to LCD. However we can convert our data in character type array and send one by one
our data to LCD. Data can be sent using 8-bit 0r 4-bit mode. If 4-bit mode is used, two nibbles of
data (First high four bits and then low four bits with an E Clock pulse with each nibble) are sent
to complete a full eight-bit transfer.8-bit mode is best used when speed is required in an
application and at least ten I/O pins are available. 4-bit mode requires a minimum of six bits. In
4-bit mode, only the top 4 data bits (DB4-7) are used.

LCD Commands:

The command 0x30 means we are setting 8-bit mode LCD having 1 line and we
are initializing it to be 5x7 character display. Now this 5x7 is something which everyone should
know what it stands for. Usually the characters are displayed on LCD in 5x8 matrices form.
Where 5 is total number of coulombs and is number of rows. Thus the above 0x30 command
initializes the LCD to display character in 5 coulombs and 7 rows the last row we usually leave
for our cursor to move or blink etc.
 The command 0x38 means we are setting 8-bit mode LCD having two lines and
character shape between 5x7 matrixes.
 The command 0x20 means we are setting 4-bit mode LCD having 1 line and
character shape between 5x7 matrixes.
 The command 0x28 means we are setting 4-bit mode LCD having 2 lines and
character shape between 5x7 matrixes.
 The command 0x06 is entry mode it tells the LCD that we are going to use you.
 The command 0x08 display cursor off and display off but without clearing DDRAM
contents.
 The command 0x0E displays cursor on and dispaly on.
 The command 0x0c display on cursor off(displays cursor off but the text will appear
on LCD)
 The command 0x0F dispaly on cursor blink (text will appear on screen and cursor
will blink).
 The command 0x18 shift entire dispaly left (shift whole off the text on the particular
line to its left).
 The command 0x1C shift entire dispaly right (shift whole off the text on the particular
line to its right).
 The command 0x10 Moves cursor one step left or move cursor on step ahead to left
whenever new character is displayed on the screen.
 The command 0x14 Moves cursor one step right or move cursor on step ahead to
right whenever new character is displayed on the screen.
 The command 0x01 clear all the contents of the DDRAM and also clear the LCD
removes all the text from the screen.
 The command 0x80 initialize the cursor to the first position means first line first
matrix (start point) now if we add 1 in 0x80+1=0x81 the cursor moves to second
matrix for example 16x1 LCD displays 16 characters only the first will appear on
0x80 second 0x81 third 0x82 and so on until last the 16 once on address 0xFF.


Analog to Digital Convertor:

An analog-to-digital converter (abbreviated ADC, A/D or A to D) is a device that


converts a continuous physical quantity (usually voltage) to a digital number that represents the
quantity's amplitude.

The conversion involves quantization of the input, so it necessarily introduces a small


amount of error. Instead of doing a single conversion, an ADC often performs the conversions
("samples" the input) periodically. The result is a sequence of digital values that have converted
a continuous-time and continuous-amplitude analog signal to a discrete-time and discrete-
amplitude digital signal.

An ADC is defined by its bandwidth (the range of frequencies it can measure) and its
signal to noise ratio (how accurately it can measure a signal relative to the noise it introduces).
The actual bandwidth of an ADC is characterized primarily by its sampling rate, and to a lesser
extent by how it handles errors such as aliasing. The dynamic range of an ADC is influenced by
many factors, including the resolution (the number of output levels it can quantize a signal to),
linearity and accuracy (how well the quantization levels match the true analog signal) and jitter
(small timing errors that introduce additional noise). The dynamic range of an ADC is often
summarized in terms of its effective number of bits (ENOB), the number of bits of each measure
it returns that are on average not noise. An ideal ADC has an ENOB equal to its resolution.
ADCs are chosen to match the bandwidth and required signal to noise ratio of the signal to be
quantized. If an ADC operates at a sampling rate greater than twice the bandwidth of the signal,
then perfect reconstruction is possible given an ideal ADC and neglecting quantization error. The
presence of quantization error limits the dynamic range of even an ideal ADC, however, if the
dynamic range of the ADC exceeds that of the input signal, its effects may be neglected resulting
in an essentially perfect digital representation of the input signal.

An ADC may also provide an isolated measurement such as an electronic device that
converts an input analog voltage or current to a digital number proportional to the magnitude of
the voltage or current. However, some non-electronic or only partially electronic devices, such as
rotary encoders, can also be considered ADCs. The digital output may use different coding
schemes. Typically the digital output will be a two's complement binary number that is
proportional to the input, but there are other possibilities. An encoder, for example, might output
a Gray code.

Electrical Symbol:
Commercial analog-to-digital converters

Commercial ADCs are usually implemented as integrated circuits.

Most converters sample with 6 to 24 bits of resolution, and produce fewer than 1 megasample
per second. Thermal noise generated by passive components such as resistors masks the
measurement when higher resolution is desired. For audio applications and in room
temperatures, such noise is usually a little less than 1 μV (microvolt) of white noise. If the MSB
corresponds to a standard 2 V of output signal, this translates to a noise-limited performance that
is less than 20~21 bits, and obviates the need for any dithering. As of February 2002, Mega- and
giga-sample per second converters are available. Mega-sample converters are required in digital
video cameras, video capture cards, and TV tuner cards to convert full-speed analog video to
digital video files.

Commercial converters usually have ±0.5 to ±1.5 LSB error in their output.

In many cases, the most expensive part of an integrated circuit is the pins, because they make the
package larger, and each pin has to be connected to the integrated circuit's silicon. To save pins,
it is common for slow ADCs to send their data one bit at a time over a serial interface to the
computer, with the next bit coming out when a clock signal changes state, say from 0 to 5 V.
This saves quite a few pins on the ADC package, and in many cases, does not make the overall
design any more complex (even microprocessors which use memory-mapped I/O only need a
few bits of a port to implement a serial bus to an ADC).

Commercial ADCs often have several inputs that feed the same converter, usually through an
analog multiplexer. Different models of ADC may include sample and hold circuits,
instrumentation amplifiers or differential inputs, where the quantity measured is the difference
between two voltages.

Applications:

1. Music recording:

Analog-to-digital converters are integral to current music reproduction technology. People


produce much music on computers using an analog recording and therefore need analog-to-
digital converters to create the pulse-code modulation (PCM) data streams that go onto compact
discs and digital music files.

The current crop of analog-to-digital converters utilized in music can sample at rates up to 192
kilohertz. Considerable literature exists on these matters, but commercial considerations often
play a significant role. Most[citation needed]
high-profile recording studios record in 24-bit/192-
176.4 kHz pulse-code modulation (PCM) or in Direct Stream Digital (DSD) formats, and then
downsample or decimate the signal for Red-Book CD production (44.1 kHz) or to 48 kHz for
commonly used for radio and television broadcast applications.

2. Digital signal processing:

People must use ADCs to process, store, or transport virtually any analog signal in digital form.
TV tuner cards, for example, use fast video analog-to-digital converters. Slow on-chip 8, 10, 12,
or 16 bit analog-to-digital converters are common in microcontrollers. Digital storage
oscilloscopes need very fast analog-to-digital converters, also crucial for software defined radio
and their new applications.

3. Scientific instruments:

Digital imaging systems commonly use analog-to-digital converters in digitizing pixels.

Some radar systems commonly use analog-to-digital converters to convert signal strength to
digital values for subsequent signal processing. Many other in situ and remote sensing systems
commonly use analogous technology.
The number of binary bits in the resulting digitized numeric values reflects the resolution, the
number of unique discrete levels of quantization (signal processing). The correspondence
between the analog signal and the digital signal depends on the quantization error. The
quantization process must occur at an adequate speed, a constraint that may limit the resolution
of the digital signal.

Many sensors produce an analog signal; temperature, pressure, pH, light intensity etc. All these
signals can be amplified and fed to an ADC to produce a digital number proportional to the input
signal.

BUZZER:
A buzzer or beeper (BUZZERS) is a signaling device, usually electronic, typically used
in automobiles, household appliances such as a microwave oven, or game shows. It most
commonly consists of a number of switches or sensors connected to a control unit that
determines if and which button was pushed or a preset time has lapsed, and usually illuminates a
light on the appropriate button or control panel, and sounds a warning in the form of a
continuous or intermittent buzzing or beeping sound. Initially this device was based on an
electromechanical system which was identical to an electric bell without the metal gong (which
makes the ringing noise). Often these units were anchored to a wall or ceiling and used the
ceiling or wall as a sounding board. Another implementation with some AC-connected devices
was to implement a circuit to make the AC current into a noise loud enough to drive a
loudspeaker and hook this circuit up to a cheap 8-ohm speaker.
Nowadays, it is more popular to use a ceramic-based piezoelectric sounder which makes
a high-pitched tone. Usually these were hooked up to "driver" circuits which varied the pitch of
the sound or pulsed the sound on and off.
A Piezo buzzer is made from two conductors that are separated by Piezo crystals. When a
voltage is applied to these crystals, they push on one conductor and pull on the other. The result
of this push and pull is a sound wave. These buzzers can be used for many things, like signaling
when a period of time is up or making a sound when a particular button has been pushed. The
process can also be reversed to use as a guitar pickup. When a sound wave is passed, they create
an electric signal that is passed on to an audio amplifier.

Circuit Diagram:
The simple buzzer circuit described here actually works in a quite unique way. Instead of the
normal working concept employed by other forms of oscillators which require resistor and
capacitor networks for generating the oscillations, this circuit use inductive feedback for the
required operations.
Referring to the above simple piezo buzzer circuit we find that the transistor T1 along with the
inductor forms the heart of the circuit. Basically the coil which is specifically called the buzzer
coil, is in fact positioned for amplifying the created oscillations while the actual feed back is
provided by the center tap of the three terminal piezo element used for the present application.

When a voltage is introduced in the circuit, the transistor conducts, operating the piezo element
across the buzzer coil, however this also leads to the grounding of the base of the transistor
through the center tap of the piezo element, this instantly switches off the transistor and in turn
the piezo also switches off, releasing the base of the transistor. The transistor reverts to its
original state and the cycle repeats, generating oscillations or the required “buzzing” frequency.
The center tap from the piezo transducer plays an important role in sustaining the oscillations
and therefore in this particular design we need a three terminal piezo rather than a two terminal
one. The oscillations produced at the collector of the transistor is dumped into the coil, saturating
the coil with magnetic inductions. The coil kicks back the stored energy during the oscillations,
magnifying the generated AC across it. This stepped up AC is applied across the anode and the
cathode of the piezo element, which starts vibrating sharply according the pitch of the frequency,
generating a shrill, ear piercing sound in the air. However to make the sound audible at
maximum intensity, the piezo transducer needs to be stuck or installed in a special way inside its
housing.
For this particular application the piezo element needs to be stuck at the base of its housing
which must consist of a hole having a diameter of about 7 mm. The piezo element cannot be
stuck directly over the base of the housing, rather it must stuck and positioned over a soft, pure
rubber ring, having diameter 30 % less than that of the piezo transducer.
Only if the above fixing procedure is followed, the buzzer will sound, otherwise the sound may
get choked and fail to reproduce.

APPLICATIONS:
 Annunciator panels
 Electronic metronomes
 Game shows
 Microwave ovens and other household appliances
 Sporting events such as basketball games

PIR Sensor:
A motion detector is a device that detects moving objects, particularly
people. A motion detector is often integrated as a component of a system that
automatically performs a task or alerts a user of motion in an area. Motion
detectors form a vital component of security, automated lighting control, home
control, energy efficiency, and other useful systems.

An electronic motion detector contains a motion sensor that transforms the


detection of motion into an electric signal. This can be achieved by measuring
optical changes in the field of view. Most inexpensive motion detectors can detect
up to 15 feet (5 meters). Specialized systems are more expensive but have much
longer ranges. Tomographic motion detection systems can cover much larger areas
because the signals penetrate walls and obstructions.
A motion detector may be connected to a burglar alarm that is used to alert
the home owner or security service after it detects motion. Such a detector may
also trigger a red light camera. Motion detectors have found great application in
domestic and commercial applications. Some of these applications include motion-
activated outdoor lighting systems, motion sensor street lamps and motion sensor
lanterns.
Principle:
The principal methods by which motion can be electronically identified
are optical detection and acoustical detection. Infrared light or laser technology
may be used for optical detection. Motion detection devices, such as PIR motion
detectors, have a sensor that detects a disturbance in the infrared spectrum, such as
a person or an animal. Once detected, an electronic signal can activate an alarm or
a camera that can capture an image or video of the motioner.[3] [4]
The chief applications for such detection are (a) detection of unauthorized
entry, (b) detection of cessation of occupancy of an area to extinguish lighting and
(c) detection of a moving object which triggers a camera to record subsequent
events. The motion detector is thus a linchpin of electronic security systems, but is
also a valuable tool in preventing the illumination of unoccupied spaces. [5]
A simple algorithm for motion detection by a fixed camera compares the
current image with a reference image and simply counts the number of
different pixels. Since images will naturally differ due to factors such as varying
lighting, camera flicker, and CCD dark currents, pre-processing is useful to reduce
the number of false positive alarms.
More complex algorithms are necessary to detect motion when the camera
itself is moving, or when the motion of a specific object must be detected in a field
containing other movement which can be ignored. An example might be a painting
surrounded by visitors in an art gallery.

There are four types of sensors used in motion sensor spectrum:


Passive infrared (PIR)
Passive infrared sensors detect a person's body heat as it changes against the
background of the room. No energy is emitted from the sensor, thus the
name "passive infrared" (PIR).
Ultrasonic
Sends out pulses of ultrasonic waves (acoustic sound waves above the
frequency that a human can hear) and measures the reflection off a moving
object. Motion causes the frequency of the reflected wave to change
(Doppler Effect).
Microwave
A microwave sensor sends out electromagnetic pulses and measures the
changes in frequency (Doppler) due to reflection off a moving object.
Tomographic motion detector
Tomographic motion detection systems sense disturbances to radio waves as
they pass from node to node of a mesh network. They have the ability to
detect over complete areas because they can sense through walls and
obstructions.

Motion can be detected by:

1. Infrared (Passive and active sensors)


2. Optics (video and camera systems)
3. Radio Frequency Energy (radar, microwave and tomographic motion
detection)
4. Sound (microphones and acoustic sensors)
5. Vibration (triboelectric, seismic, and inertia-switch sensors)
6. Magnetism (magnetic sensors and magnetometers)

ARDUINO MICROCONTROLLER
The Arduino microcontroller is an easy to use yet powerful single board
computer that has gained considerable traction in the hobby and professional
market. The Arduino is open-source, which means hardware is reasonably priced
and development software is free. This guide is for students in ME 2011, or
students anywhere who are confronting the Arduino for the first time. For
advanced Arduino users, prowl the web; there are lots of resources.
The Arduino project was started in Italy to develop low cost hardware for
interaction design. An overview is on the Wikipedia entry for Arduino. The
Arduino hardware comes in several flavors. In the United States, Sparkfun
(www.sparkfun.com) is a good source for Arduino hardware. The Arduino board,
you can write programs and create interface circuits to read switches and other
sensors, and to control motors and lights with very little effort. Many of the
pictures and drawings in this guide were taken from the documentation on the
Arduino site, the place to turn if you need more information. The Arduino section
covers more on interfacing the Arduino to the real world.

The Duemilanove board features an Atmel ATmega328 microcontroller operating at


5 V with 2 Kb of RAM, 32 Kb of flash memory for storing programs and 1 Kb of
EEPROM for storing parameters. The clock speed is 16 MHz, which translates to
about executing about 300,000 lines of C source code per second. The board has 14
digital I/O pins and 6 analog input pins. There is a USB connector for talking to the
host computer and a DC power jack for connecting an external 6-20 V power source,
for example a 9 V battery, when running a program while not connected to the host
computer. Headers are provided for interfacing to the I/O pins using 22 g solid wire or
header connectors.

An Arduino board historically consists of an Atmel 8-, 16- or 32-


bit AVR microcontroller (although since 2015 other makers' microcontrollers have
been used) with complementary components that facilitate programming and
incorporation into other circuits. An important aspect of the Arduino is its standard
connectors, which lets users connect the CPU board to a variety of interchangeable
add-on modules known as shields.

Some shields communicate with the Arduino board directly over various pins,
but many shields are individually addressable via an I²C serial bus—so many shields
can be stacked and used in parallel. Prior to 2015 Official Arduinos had used the
AtMel megaAVR series of chips, specifically
the ATmega8, ATmega168, ATmega328, ATmega1280, and ATmega2560 and in
2015 units by other manufacturers were added. A handful of other processors have
also been used by Arduino compatibles. Most boards include a 5 V linear
regulator and a 16 MHz crystal oscillator (or ceramic resonator in some variants),
although some designs such as the LilyPad run at 8 MHz and dispense with the
onboard voltage regulator due to specific form-factor restrictions.

An Arduino's microcontroller is also pre-programmed with a boot loader that


simplifies uploading of programs to the on-chip flash memory, compared with other
devices that typically need an external programmer. This makes using an Arduino
more straightforward by allowing the use of an ordinary computer as the programmer.
Currently, optiboot bootloader is the default bootloader installed on Arduino UNO.

At a conceptual level, when using the Arduino integrated development


environment, all boards are programmed over a serial connection. Its implementation
varies with the hardware version. Some serial Arduino boards contain a level shifter
circuit to convert between RS-232 logic levels and TTL-level signals. Current
Arduino boards are programmed via Universal Serial Bus (USB), implemented using
USB-to-serial adapter chips such as the FTDI FT232.

Some boards, such as later-model Uno boards, substitute the FTDI chip with a
separate AVR chip containing USB-to-serial firmware, which is reprogrammable via
its own ICSP header. Other variants, such as the Arduino Mini and the unofficial
Boarduino, use a detachable USB-to-serial adapter board or cable, Bluetooth or other
methods, when used with traditional microcontroller tools instead of the Arduino IDE,
standard AVR ISP programming is used.

The Arduino board exposes most of the microcontroller's I/O pins for use by
other circuits. The Diecimila, Duemilanove, and current Uno provide 14 digital I/O
pins, six of which can produce pulse-width modulated signals, and six analog inputs,
which can also be used as six digital I/O pins. These pins are on the top of the board,
via female 0.10-inch (2.5 mm) headers. Several plug-in application shields are also
commercially available.
The Arduino Nano, and Arduino-compatible Bare Bones Board[9] and Boarduino
boards may provide male header pins on the underside of the board that can plug
into solderless breadboards.

There are many Arduino-compatible and Arduino-derived boards. Some are


functionally equivalent to an Arduino and can be used interchangeably. Many enhance
the basic Arduino by adding output drivers, often for use in school-level education to
simplify the construction of buggies and small robots. Others are electrically
equivalent but change the form factor, sometimes retaining compatibility with shields,
sometimes not. Some variants use completely different processors, with varying levels
of compatibility.

Digital Pins
In addition to the specific functions listed below, the digital pins on an
Arduino board can be used for general purpose input and output via the pinMode(),
digitalRead(), and digitalWrite() commands. Each pin has an internal pull-up
resistor which can be turned on and off using digitalWrite() (w/ a value of HIGH or
LOW, respectively) when the pin is configured as an input. The maximum current
per pin is 40 mA.

Serial: 0 (RX) and 1 (TX).


Used to receive (RX) and transmit (TX) TTL serial data. On the Arduino
Diecimila, these pins are connected to the corresponding pins of the FTDI USB-to-
TTL Serial chip. On the Arduino BT, they are connected to the corresponding pins
of the WT11 Bluetooth module. On the Arduino Mini and LilyPad Arduino, they
are intended for use with an external TTL serial module (e.g. the Mini-USB
Adapter). External Interrupts: 2 and 3. 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: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite()
function. On boards with an ATmega8, PWM output is available only on pins 9,
10, and 11.
BT Reset: 7. (Arduino BT-only) Connected to the reset line of the bluetooth
module.
SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI
communication, which, although provided by the underlying hardware, is not
currently included in the Arduino language.
LED: 13. On the Diecimila and LilyPad, 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.
Analog Pins
In addition to the specific functions listed below, the analog input pins
support 10-bit analog-to-digital conversion (ADC) using the analogRead()
function. Most of the analog inputs can also be used as digital pins: analog input 0
as digital pin 14 through analog input 5 as digital pin 19. Analog inputs 6 and 7
(present on the Mini and BT) cannot be used as digital pins.
I2C: 4 (SDA) and 5 (SCL). Support I2C (TWI) communication using the Wire
library .
Power Pins
VIN (sometimes labelled "9V"). 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.
Note that different boards accept different input voltages ranges, please see
the documentation for your board. Also note that the LilyPad has no VIN pin and
accepts only a regulated input. 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. (Diecimila-only) A 3.3 volt supply generated by the on-board FTDI
chip. GND. Ground pins.
Other Pins
AREF. Reference voltage for the analog inputs. Used with analogReference().
Reset. (Diecimila-only) Bring this line LOW to reset the microcontroller.Typically
used to add a reset button to shields which block the one on the board.
SOFTWARE DESCRIPTION

ARDUINO

Arduino is a cross-platform IDE that works in conjunction with an Arduino


controller in order to write, compile and upload code to the board.The software
provides support for a wide array of Arduino boards, including Arduino Uno,
Nano, Mega, Esplora, Ethernet, Fio, Pro or Pro Mini, as well as LilyPad Arduino.

The universal languages for Arduino are C and C++, thus the software is fit for
professionals who are familiar with these two. Features such as syntax
highlighting, automatic indentation and brace matching makes it a modern
alternative to other IDEs.Wrapped inside a streamlined interface, the software
features both the looks and the functionality that appeal to Arduino developers,
paving the way to a successful output via the debugging modules.

All of its features are hosted inside a few buttons and menus that are easy to
navigate and understand, especially for professional programmers. Also, the built-
in collection of examples might be of great help for Arduino first timers.Provided
that you’ve connected the Arduino board to the computer and installed all the
necessary drivers, one of the first steps we see fit is to choose the model you’ll be
working with using the Tools menu of the application.

Then, you can start writing the programs using the comfortable environment
that Arduino offers. The program includes a rich array of built-in libraries such as
EEPROM, Firmata, GSM, Servo, TFT, WiFI, etc, but adding your own is also
possible. Designs can be verified and compiled, with an error log displayed in the
lower part of the UI that allows you to review the code.

If the debugging process returns no errors, you can start the upload process
and have your program delivered to the board so you can proceed with further
testing.All in all, Arduino comes across as an extremely useful asset, providing the
essentials that Arduino developers need in order to streamline the testing process.

Arduino is an open-source computer hardware and software company,


project and user community that designs and manufacturesmicrocontroller-based
kits for building digital devices and interactive objects that can sense and control
objects in the physical world. The project is based on microcontroller board
designs, manufactured by several vendors, using various microcontrollers. These
systems provide sets of digital and analog I/O pins that can be interfaced to various
expansion boards ("shields") and other circuits.

The boards feature serial communications interfaces, including USB on


some models, for loading programs from personal computers. For programming
the microcontrollers, the Arduino project provides an integrated development
environment (IDE) based on the Processing project, which includes support for
the C and C++ programming languages.

The first Arduino was introduced in 2005, aiming to provide an inexpensive


and easy way for novices and professionals to create devices that interact with their
environment using sensors and actuators. Common examples of such devices
intended for beginner hobbyists include simple robots, thermostats, and motion
detectors. Arduino boards are available commercially in preassembled form, or
as do-it-yourself kits. The hardware design specifications are openly available,
allowing the Arduino boards to be manufactured by anyone.

Arduino programs may be written in any programming language with a


compiler that produces binary machine code. Atmel provides a development
environment for their microcontrollers, AVR Studio and the newer Atmel Studio.
The Arduino project provides the Arduino integrated development
environment (IDE), which is a cross-platform application written inJava. It
originated from the IDE for the Processing programming language project and
the Wiring project. It is designed to introduce programming to artists and other
newcomers unfamiliar with software development. It includes a code editor with
features such assyntax highlighting, brace matching, and automatic indentation,
and provides simple one-click mechanism for compiling and loading programs to
an Arduino board. A program written with the IDE for Arduino is called a
"sketch".

The Arduino IDE supports the C and C++ programming languages using
special rules of code organization. The Arduino IDE supplies a software
library called "Wiring" from the Wiring project, which provides many common
input and output procedures. A typical Arduino C/C++ sketch consists of two
functions that are compiled and linked with a program stub main () into an
executable cyclic program:

 setup(): a function that runs once at the start of a program and that can initialize
settings.
 loop(): a function called repeatedly until the board powers off.

After compilation and linking with the GNU tool chain, also included with
the IDE distribution, the Arduino IDE employs the programavrdude to convert the
executable code into a text file in hexadecimal coding that is loaded into the
Arduino board by a loader program in the board's firmware

ARDUINO BUILD PROCESS

OVERVIEW
A number of things have to happen for your Arduino code to get onto the
Arduino board. First, the Arduino environment performs some small
transformations to make sure that the code is correct C or C++ (two common
programming languages). It then gets passed to a compiler (avr-gcc), which turns
the human readable code into machine readable instructions (or object files). Then,
your code gets combined with (linked against), the standard Arduino libraries that
provide basic functions like digitalWrite() or Serial.print().
The result is a single Intel hex file, which contains the specific bytes that
need to be written to the program memory of the chip on the Arduino board. This
file is then uploaded to the board: transmitted over the USB or serial connection
via the bootloader already on the chip or with external programming hardware.

Multi-file sketches
A sketch can contain multiple files (tabs). To manage them, click on the
right-facing arrow just above the scroll bar near the top of the environment. Tabs
have one of four extensions: no extension, .c, .cpp, or .h (if you provide any other
extension, the period will be converted to an underscore). When your sketch is
compiled, all tabs with no extension are concatenated together to form the "main
sketch file". Tabs with .c or .cpp extensions are compiled separately. To use tabs
with a .h extension, you need to #include it (using "double quotes" not <angle
brackets.

The Arduino environment performs a few transformations to your main


sketch file (the concatenation of all the tabs in the sketch without extensions)
before passing it to the avr-gcc compiler.First, #include "Arduino.h", or for
versions less than 1.0, #include "WProgram.h" is added to the top of your sketch.
This header file (found in <ARDUINO>/hardware/cores/<CORE>/) includes all
the defintions needed for the standard Arduino core.

Next, the environment searches for function definitions within your main
sketch file and creates declarations (prototypes) for them. These are inserted after
any comments or pre-processor statements (#includes or #defines), but before any
other statements (including type declarations). This means that if you want to use a
custom type as a function argument, you should declare it within a separate header
file. Also, this generation isn't perfect: it won't create prototypes for functions that
have default argument values, or which are declared within a namespace or class.

TARGETS
The Arduino environment supports multiple target boards with different
chips (currently, only AVRs), CPU speeds, or bootloaders. These are defined in a
board preferences file. Relevant variables include:

<BOARD>.name: the name to display in the Boards menu

<BOARD>.build.mcu: the microcontroller on the board (normally "atmega8" or


"atmega168").

<BOARD>.f_cpu: the clock speed at which the microcontroller operates (normally


"16000000L", or, for an ATmega168running on its internal clock, "8000000L").

<BOARD>.core: which sub-directory of the hardware/cores/ directory to link


sketches against (normally "arduino").

Also useful is this setting in the main preferences.txt file:

build.verbose: whether or not to print debugging messages while building a sketch


(e.g. "false"). If true, will print the complete command line of each external
command executed as part of the build process.

Note: that in Arduino 0004 and later, build.extension is unused - the main sketch
file is always treated as a .cpp file.
Build process
Sketches are compiled by avr-gcc.

The include path includes the sketch's directory, the target directory
(<ARDUINO>/hardware/core/<CORE>/) and the avr include directory
(<ARDUINO>/hardware/tools/avr/avr/include/), as well as any library directories
(in <ARDUINO>/hardware/libraries/) which contain a header file which is
included by the main sketch file.

When you verify a sketch, it is built in a temporary directory in the system temp
directory (e.g. /tmp on the Mac). When you upload it, it is built in the applet/
subdirectory of the sketch's directory (which you can access with the "Show Sketch
Folder" item in the "Sketch" menu).

The .c and .cpp files of the target are compiled and output with .o extensions
to this directory, as is the main sketch file and any other .c or .cpp files in the
sketch and any .c or .cpp files in any libraries which are #included in the sketch.
These .o files are then linked together into a static library and the main sketch file
is linked against this library. Only the parts of the library needed for your sketch
are included in the final .hex file, reducing the size of most sketches.

The .hex file is the final output of the compilation which is then uploaded to
the board. During a "Verify" the .hex file is written to /tmp (on Mac and Linux) or
\Documents and Settings\<USER>\Local Settings\Temp (on Windows). During
upload, it's written to the applet sub-directory of the sketch directory (which you
can open with the "Show Sketch Folder" item in the Sketch menu).

Upload process
Sketches are uploaded by avrdude. The upload process is also controlled by
variables in the boards and main preferences files. Those in the boards file include:

<BOARD>.upload. Protocol: the protocol that avrdude should use to talk to the
board (typically "stk500").

<BOARD>.upload. Speed: the speed (baud rate) avrdude should use when
uploading sketches (typically "19200").

<BOARD>.upload.maximum_size: the maximum size for a sketch on the board


(dependent on the chip and the size of the boot loader).

You might also like