You are on page 1of 42

SMART GRID WITH AUTO PROTECTION

Project Report ON
Smart Grid Protection
And auto security
System

CONTENTS
1. ABSTRACT
2.INTRODUCTION
1

SMART GRID WITH AUTO PROTECTION

3. COMPONENTS USED AND ITS DESCRIPTION

Transformer

Transistor

Resistor

Voltage Regulator

Capacitor

Diode

Liquid crystal Display(LCD)

Microcontroller

Relay

IR SENSOR

Buzzer

Potentiometer

4. SCHEMATIC DESCRIPTION

Block diagram

5. CIRCUIT DESCRIPTION
2.2.1 Power supply
2.2.2 Microcontroller
2.2.3 LCD
2.2.4 Circuit operation

6.

UTILITY AND ADVANTAGES

7.

CONCLUSION AND FUTURE PROSPECTIVE

8.

REFERENCES

ABSTRACT

SMART GRID WITH AUTO PROTECTION


The development and implementation of a smart grid for power supply is one of the pressing
issues in modern energy economy, given high national priority and massive investments,
2

SMART GRID WITH AUTO PROTECTION

although the entire subject is still in its infancy stage. The smart grid delivers electricity from
producers to consumers using two-way digital technology, and allows control of appliances
in the consumers' houses and of machines in factories to save energy, while reducing costs
and increasing reliability and transparency. Such a modern electricity network is promoted by
many governments as a way of handling energy independence, global warming and security
of supply.
A smart grid includes an intelligent monitoring system that keeps track of all the electricity
that flows in the system. So in our project there will be two system through which when there is a
visitors entry in the grid, then our microcontroller sense that and counts visitors by means of a IR
sensor. Then if there is an over voltage occurs in the grid then our microcontroller senses that and
trips the whole feeder by help of a relay.

2. INTRODUCTION:

An Embedded System is a combination of computer hardware and software, and perhaps additional
mechanical or other parts, designed to perform a specific function. An embedded system is a
microcontroller-based, software driven, reliable, real-time control system, autonomous, or human or
network interactive, operating on diverse physical variables and in diverse environments and sold into
a competitive and cost conscious market.

Our system has the following characteristics:


Automatic load cutoff during loaded condition
Counts the no of visitors present in the grid

SMART GRID WITH AUTO PROTECTION

We have used ATMEGA16 controller here to control all the functions in the system. We are using
relays here to control the power and to power load shedding purpose.

3.1

TRANSFORMER:

SMART GRID WITH AUTO PROTECTION

Transformer is the electrical device that converts one voltage to another with little loss of power.
Transformers work only with AC. There are two types of transformers as Step-up and Step-down
transformer. Step-up transformers increase voltage, step-down transformers reduce voltage. Most
power supplies use a step-down transformer to reduce the dangerously high mains voltage to a safer
low voltage.
Here a step down transformer is used to get 5V AC from the supply
i.e.230V AC. Step down
transformers are designed to reduce electrical voltage. Their primary voltage is greater than their
secondary voltage. This kind of transformer "steps down" the voltage applied to it. For instance, a step
down transformer is needed to use a 110v product in a country with a 220v supply. Step down
transformers convert electrical voltage from one level or phase configuration usually down to a lower
level. They can include features for electrical isolation, power distribution, and control and
instrumentation applications. Step down transformers typically rely on the principle of magnetic
induction between coils to convert voltage and/or current levels. Step down transformers are made
from two or more coils of insulated wire wound around a core made of iron. When voltage is applied to
one coil (frequently called the primary or input) it magnetizes the iron core, which induces a voltage in
the other coil, (frequently called the secondary or output). The turns ratio of the two sets of windings
determines the amount of voltage transformation.

OPERATING PRINCIPLE:

The transformer is based on two principles: first, that an electric current can produce a magnetic
field (electromagnetism) 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.
An ideal transformer is shown in the above figure. Current passing through the primary coil creates
a magnetic field. The primary and secondary coils are wrapped around a core of very high magnetic
5

SMART GRID WITH AUTO PROTECTION

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 .

3.2 TRANSISTORS:

A transistor is a semiconductor device commonly used to amplify or switch electronic signals. A


transistor is made of a solid piece of a semiconductor material, with at least three terminals for
connection to an external circuit. A voltage or current applied to one pair of the transistor's terminals
changes the current flowing through another pair of terminals. Because the controlled
(output) power can be much more than the c o n t r o l l i n g ( i n p u t ) p o w e r , t h e t r a n s i s t o r
p r o v i d e s o f a s i g n a l . Transistor can be regarded as a type of switch, as can many electronic
component. There are two main types NPN and PNP .In this fire alarm circuit we are used the NPN
type transistor. A transistor have three leads mainly base, emitter, collector. The base lead mainly
used to activate the transistor. The collector is the positive lead and the emitter is the negative lead.
The below fig. shows a NPN transistor.

S o m e transistors are packaged individually but most are found in circuits. The transistor is the
fundamental building block of modern electronic devices, and its presence is ubiquitous in modern
electronic systems.
In this fire alarm circuit we are used three transistors BC548,BC558, SL100B. SL100B is a special
type transistor.
6

SMART GRID WITH AUTO PROTECTION

SL100B is a general purpose medium power NPN transistor. It is mostly used as a switch in common
emitter configuration .For switching application SL100 is biased in such a way that it remains fully
on if there is a signal at its base .In the absence of base signal it gets turned off completely. The
emitter leg of SL100 is indicated by protruding edge in the transistor case. The base is nearest to
emitter while collector lies at other extreme of the casing.
TRANSISTOR WORKING:

NPN TRANSISTOR OPERATION:


Just as in the case of the PN junction diode, the N material comprising the two end sections of the
NPN transistor contains a number of free electrons, while the center P section contains an excess
number of holes. The action at each junction between these sections is the same as that previously
described for the diode; that is, depletion regions develop and the junction barrier appears. To use the
7

SMART GRID WITH AUTO PROTECTION

transistor as an amplifier, each of these junctions must be modified by some external bias voltage. For
the transistor to function in this capacity, the first PN junction (emitter-base junction) is biased in the
forward, or low-resistance, direction. At the same time the second PN junction (base-collector
junction) is biased in the reverse, or high-resistance, direction. A simple way to remember how to
properly bias a transistor is to observe the NPN or PNP elements that make up the transistor.

WORKING OF PNP TRANSISTOR:


The PNP transistor works essentially the same as the NPN transistor. However, since the emitter,
base, and collector in the PNP transistor are made of materials that are different from those used in the
NPN
transistor, different current carriers flow in the PNP unit. The majority current carriers in the PNP
transistor are holes. This is in contrast to the NPN transistor where the majority current carriers are
electrons. To support this different type of current (hole flow), the bias batteries are reversed for the
PNP transistor. A typical bias setup for the PNP transistor is shown in figure 2-8. Notice that the
procedure used earlier to properly bias the NPN transistor also applies here to the PNP transistor. The
first letter (P) in the PNP sequence indicates the polarity of the voltage required for the emitter
(positive), and the second letter (N) indicates the polarity of the base voltage (negative). Since the
base-collector junction is always reverse biased, then the opposite polarity voltage (negative) must be
used for the collector. Thus, the base of the PNP transistor must be negative with respect to the
emitter, and the collector must be more negative than the base. Remember, just as in the case of the
NPN transistor, this difference in supply voltage is necessary to have current flow (hole flow in the
case of the PNP transistor) from the emitter to the collector. Although
hole flow is the predominant type of current flow in the PNP transistor, hole flow only takes place
within the transistor itself, while electrons flow in the external circuit. However, it is the internal hole
flow that leads to electron flow in the external wires connected to the transistor.

SMART GRID WITH AUTO PROTECTION

The basic requirements for a biasing circuit are


(a) Establish the operating point in the centre of the active region of the characteristics, so that
applying input signal the instantaneous Q point does not move.
(b) Stabilize the collector current against temperature variations.
(c) Make the operating point independent of the transistor parameters so that it does not shift when the
transistor is replaced by another of the same type in the circuit.
APPLICATIONS OF TRANSISTOR:
These are used in communications, control systems, consumer applications (like TV, mobile
phones, audio), transport applications, aerospace, military, switching, industrial systems, security,
digital systems, computer equipment, power supplies, inverters etc.

3.3 RESISTORS:

Resister is an electrical component that limits or regulates the flow of electrical current in an
electronic circuit. Resisters can also be used to provide a specific voltage for an active device such as

SMART GRID WITH AUTO PROTECTION

transistor. It is a two terminal component that produces a voltage across its terminals that
is proportional t o t h e electric current through it in accordance with Ohm's law:
V = IR
Resistors are elements of electrical networks and electronic circuits and are ubiquitous in
most electronic equipment. Practical resistors can be made of various compounds and
films, as well as resistance wire (wire made of a high-resistivity alloy ,such as nickel/chrome).The
primary characteristics of a resistor are the resistance, the tolerance, maximum working
voltage and the power rating. Resistors can be integrated into hybrid and printed circuits, a s
w e l l a s integrated circuits. S i z e , a n d p o s i t i o n o f l e a d s ( o r terminals) are
relevant to equipment designers; resistors must be physically large enough not to overheat when
dissipating their power.
There are eight resisters R1 to R8 are used in this circuit of different value. The resistance value can
differ from one another by means of colzor coding technique. Colour coding technique can be
described as follows;

Then a potential difference is required between the two terminals of a resistor for current to flow. This
potential difference balances out the energy lost. When used in DC circuits the potential difference,
also known as a resistors voltage drop, is measured across the terminals as the circuit current flows
through the resistor.
Most resistors are linear devices that produce a voltage drop across themselves when an electrical
current flow through them because they obey Ohm's Law and different values of resistance produces
different values of current or voltage. This can be very useful in Electronic circuits by controlling or
reducing either the current flow or voltage produced across them.

10

SMART GRID WITH AUTO PROTECTION

There are many thousands of different Types of Resistors and are produced in a variety of forms
because their particular characteristics and accuracy suit certain areas of application, such as High
Stability, High Voltage, High Current etc, or are used as general purpose resistors where their
characteristics are less of a problem. Some of the common characteristics associated with the humble
resistor are; Temperature Coefficient, Voltage Coefficient, Noise, Frequency Response, Power as well
as Temperature Rating, Physical Size and Reliability.
Resistors are broadly classified into 3 types based on composition. These are described below.
Carbon Resistors are the most common type of Composition Resistors. Carbon resistors are a cheap
general purpose resistor used in electrical and electronic circuits. Their resistive element is
manufactured from a mixture of finely ground carbon dust or graphite (similar to pencil lead) and a
non-conducting ceramic (clay) powder to bind it all together.
The generic term "Film Resistor" consist of Metal Film, Carbon Film and Metal Oxide Film resistor
types, which are generally made by depositing pure metals, such as nickel, or an oxide film, such as
tin-oxide, onto an insulating ceramic rod or substrate.
Another type of resistor, called a Wire wound Resistor, is made by winding a thin metal alloy wire
(Nichrome) or similar wire onto an insulating ceramic former in the form of a spiral helix similar to
the film resistor above. These types of resistors are generally only available in very low ohmic high
precision values due to the gauge of the wire and number of turns possible on the former making them
ideal for use in measuring circuits and Whetstone bridge type applications.

3.4 VOLTAGE REGULATION


Voltage regulators produce fixed DC output voltage from variable DC (a small amount of AC on it).
Normally we get fixed output by connecting the voltage regulator at the output of the filtered DC. It
can also used in circuits to get a low DC voltage from a high DC voltage (for example we use 7805 to
get 5V from 12V). There are two types of voltage regulators
1. fixed voltage regulators (78xx, 79xx)
2. Variable voltage regulators (LM317)
In fixed voltage regulators there is another classification
1. Positive voltage regulators
2. Negative voltage regulators
POSITIVE VOLTAGE REGULATORS:
This includes 78xx voltage regulators. The most commonly used ones are 7805 and 7812. 7805 gives
fixed 5V DC voltage if input voltage is in (7.5V-20). You may sometimes have questions like, what
happens if input voltage is <7.5 V or some 3V, the answer is that regulation won't be proper. Suppose
if input is 6V then output may be 5V or 4.8V, but there are some parameters for the voltage regulators
like maximum output current capability, line regulation etc. won't be proper. Remember that
electronics components should be used in the proper voltage and current ratings as specified in
datasheet. You can work without following it, but you won't be able to get some parameters of the
component.

11

SMART GRID WITH AUTO PROTECTION

NEGATIVE VOLTAGE REGULATORS:


Mostly available negative voltage regulators are of 79xx family. The mainly available 79xx IC's are
7905,7912 1.5A output current ,short circuit protection, ripple rejection are the other features of 79xx
IC's.

Many of the fixed voltage regulators have 3 leads and look like power transistors, such as the 7805
(+5V 1A) regulator shown on the above. If adequate heat sinking is provided then it can deliver up to
maximum 1A current.For 7805 IC, for an input of 10v the minimum output voltage is 4.8V and the
maximum output voltage is 5.2V. The typical dropout voltage is 2V. . T h e s e I C s h a v e internal
thermal shutdown and short circuit current limiting.

3.5 CAPACITORS:

A device used to store an electric charge consisting of one or more pairs of conductor separated by an
insulator. The capacitance is the amount of electric charge stored in the capacitor at a voltage of
1volt.The capacitance is measured in the unit of farad. The capacitor disconnects current in dc circuit
and short circuits current in ac circuit. In fire alarm circuit polarized and ceramic capacitor is used.
There are three capacitors are used in this circuit.one is 10microfarad 16volt,means its capacitance is
10 microfarad at 16 volt. similarly other two are .04microfarad and .01microfarad at 63volt.
A capacitor is a passive component consisting of a pair of conductor separated by a dielectric.
When a voltage potential difference exists between the conductors, an electric field is present
in
the
dielectric.
This
field
stores
energy
a n d p r o d u c e s a m e c h a n i c a l f o r c e b e t w e e n t h e p l a t e s . T h e e f f e c t i s g r e a t e s t be
tween wide, flat, parallel, narrowly separated conductors. An ideal capacitor is characterized by a
single constant value, capacitance, which is measured in farads. This is the ratio of the electric charge
on each conductor to the potential difference between them. In practices; the dielectric
material which placed in place between the plates passes a small amount of leakage
12

SMART GRID WITH AUTO PROTECTION

current. Capacitors are widely used in electronic circuits to block the flow of direct current while
allowing alternating current to pass, to filter out interference, to smooth the output of power supplies,
and for many other purposes.
WORKING OF CAPACITOR:
A capacitor consists of two metal plates which are separated by a non-conducting substance or
dielectric. Take a look at the figure given below to know about dielectric in a capacitor.

Though any non-conducting substance can be used as a dielectric, practically some special materials
like porcelain, mylar, teflon, mica, cellulose and so on. A capacitor is defined by the type of dielecric
selected.

It

also

defines

the

application

of

the

capacitor.

According to the size and type of dielectric used, the capacitor can be used for high-voltage as well as
low-voltage

applications.

For applications in radio tuning circuits air is commonly used as the dielectric. for applications in
timer circuits mylar is used as the dielectric. For high voltage applications glass is normally used. For
application

in

X-ray

and

MRI

machines,

ceramic

is

mostly

preferred.

The metal plates are separated by a distance d, and a dielectric material is separately placed in
between

the

plates.

The dielectric constant of the dielectric material is equal to the dielectric of air.The dielectric material
is the main substance that helps in storing the electrical energy.
ADVANTAGES:

Since the capacitor can discharge in a fraction of a second, it has a very large advantage.
Capacitors are used for appliances which require high speed use like in camera flash and laser
techniques.

Capacitors are used to remove ripples by removing the peaks and filling in the valleys.

A capacitor allows ac voltage to pass through and blocks dc voltage. This has been used in many
electronic applications.

3.6 DIODE:

13

SMART GRID WITH AUTO PROTECTION

In this circuit one diode is present. A PN junction diode is formed by combining a p type
semiconductor with n type semiconductor .It has the property of offering a low resistance to current
flow in one direction and is the main component used in rectifying circuits. PN junction diodes are
mainly manufactured using Germanium and silicon semiconductor material. It contains two mobile
charge carrier holes and electrons. In electronics a diode is a two-terminal electronic component
which conducts electric current asymmetrically or unidirectionally; that is, it conducts current more
easily in one direction than in the opposite direction. The term usually refer to
semiconductor Diode.
The most common function of a diode is to allow an electric current in one direction (called the
forward direction) while blocking current in the opposite direction(the reverse direction). Thus, the
diode can be thought of as an electronic version of a check valve. This unidirectional behaviour is
called rectification, and is used to convert alternating current to direct current, and remove modulation
from radio signals in radio receivers.
DIODE WORKING PRINCIPLE:
A pn junction diode is made of a crystal of semiconductor. Impurities are added to it to create a
region on one side that contains negative charge carriers (electrons), called n-type semiconductor, and
a region on the other side that contains positive charge carriers (holes), called p-type semiconductor.
When two materials i.e. n-type and p-type are attached together, a momentary flow of electrons occur
from n to p side resulting in a third region where no charge carriers are present. It is called Depletion
region due to the absence of charger carrier (electrons and holes in this case). The diode's terminals
are attached to each of these regions. The boundary between these two regions, called a pn junction,
is where the action of the diode takes place. The crystal allows electrons to flow from the N-type side
(called the cathode) to the P-type side (called the anode), but not in the opposite direction.
A semiconductor diodes behavior in a circuit is given by its currentvoltage characteristic, or IV
graph (see graph below). The shape of the curve is determined by the transport of charge carriers
through the so-called depletion layer or depletion region that exists at the pn junction between
differing semiconductors. When a pn junction is first created, conduction-band (mobile) electrons
from the N-doped region diffuse into the P-doped region where there is a large population of holes
(vacant places for electrons) with which the electrons "recombine". When a mobile electron
recombines with a hole, both hole and electron vanish, leaving behind an immobile positively charged
donor (dopant) on the N side and negatively charged acceptor (dopant) on the P side. The region
around the pn junction becomes depleted of charge carriers and thus behaves as an insulator.
However, the width of the depletion region (called the depletion width) cannot grow without limit.
For each electronhole pair that recombines, a positively charged dopant ion is left behind in the Ndoped region, and a negatively charged dopant ion is left behind in the P-doped region. As
recombination proceeds more ions are created, an increasing electric field develops through the

14

SMART GRID WITH AUTO PROTECTION

depletion zone that acts to slow and then finally stop recombination. At this point, there is a "built-in"
potential across the depletion zone.

If an external voltage is placed across the diode with the same polarity as the built-in potential, the
depletion zone continues to act as an insulator, preventing any significant electric current flow (unless
electron/hole pairs are actively being created in the junction by, for instance, light. see photodiode).
This is the reverse bias phenomenon. However, if the polarity of the external voltage opposes the
built-in potential, recombination can once again proceed, resulting in substantial electric current
through the pn junction (i.e. substantial numbers of electrons and holes recombine at the junction).
For silicon diodes, the built-in potential is approximately 0.7 V (0.3 V for Germanium and 0.2 V for
Scottky). Thus, if an external current is passed through the diode, about 0.7 V will be developed
across the diode such that the P-doped region is positive with respect to the N-doped region and the
diode is said to be "turned on" as it has a forward bias.

3 . 7 RECTIFIERS
A rectifier is a circuit that converts AC signals to DC. A rectifier circuit is made using diodes. There
are two types of rectifier circuits as Half-wave rectifier and Full-wave rectifier depending upon the
DC signal generated.

15

SMART GRID WITH AUTO PROTECTION

Half-wave Rectifier: It is the rectifier circuit that rectifies only half part of the AC signal. It uses only
a single diode. It only uses only positive part of the AC signal to produce half-wave varying DC and
produce gaps when the AC is negative.

Full-wave Rectifier: It is also called as Bridge Rectifier. A bridge rectifier can be made using four
individual diodes, but it is also available in special packages containing the four diodes required. It is
called a full-wave rectifier because it uses the total AC wave (both positive and negative sections).

16

SMART GRID WITH AUTO PROTECTION

SMOOTHING
Smoothing is performed by a large value electrolytic capacitor connected across the DC supply to act
as a reservoir, supplying current to the output when the varying DC voltage from the rectifier is falling.
The diagram shows the unsmoothed varying DC (dotted line) and the smoothed DC (solid line). The
capacitor charges quickly near the peak of the varying DC, and then discharges as it supplies current to
the output. Here a capacitor of 330uF is used as a smoothing circuit.

17

SMART GRID WITH AUTO PROTECTION

3.8 LIGHT EMITTING DIODE


One red led is used in fire alarm circuit .A led is a semiconductor light source. LEDs are used as
indicator lampsin many devices .LEDs emitted low intensity red light ,but modern versions are
available across the visible ,ultraviolet and infrared wavelength with very brightness.When a led is
forward biased,electrones are able to recombine with electron holes within the device ,releasing
energy in form of photons.The fig of one LED is shown below.

3.10

MICROCONTROLLER

18

SMART GRID WITH AUTO PROTECTION

Microcontroller can be termed as a system on chip computer which includes number of peripherals
like RAM, EEPROM, Timers etc., required to perform some predefined task.

Does this mean that the microcontroller is another name for a computer? The answer is NO!
The computer on one hand is designed to perform all the general purpose tasks on a single machine
like you can use a computer to run a software to perform calculations or you can use a computer to
store some multimedia file or to access internet through the browser, whereas the microcontrollers are
meant to perform only the specific tasks, for e.g., switching the AC off automatically when room
temperature drops to a certain defined limit and again turning it ON when temperature rises above the
defined limit.
There are number of popular families of microcontrollers which are used in different applications as
per their capability and feasibility to perform the desired task, most common of these are 8051, AVR
and PIC microcontrollers. In this article we will introduce you with AVR family of microcontrollers.
History of AVR
AVR was developed in the year 1996 by Atmel Corporation. The architecture of AVR was developed
by Alf-Egil Bogen and Vegard Wollan. AVR derives its name from its developers and stands for AlfEgilBogen VegardWollan RISC microcontroller, also known as Advanced Virtual RISC. The
AT90S8515 was the first microcontroller which was based on AVR architecture however the first
microcontroller to hit the commercial market was AT90S1200 in the year 1997.
AVR microcontrollers are available in three categories:
1. Tiny AVR Less memory, small size, suitable only for simpler applications
2. Mega AVR These are the most popular ones having good amount of memory (up to 256
KB), higher number of inbuilt peripherals and suitable for moderate to complex applications.
3. Xmega AVR Used commercially for complex applications, which require large program
memory and high speed.
The following table compares the above mentioned AVR series of microcontrollers:
19

SMART GRID WITH AUTO PROTECTION

Series Name

Pins

Flash Memory

Special Feature

TinyAVR

6-32

0.5-8 KB

Small in size

MegaAVR

28-100

4-256KB

Extended peripherals

XmegaAVR

44-100

16-384KB

DMA , Event System included

Whats special about AVR?


They are fast: AVR microcontroller executes most of the instructions in single execution cycle.
AVRs are about 4 times faster than PICs; they consume less power and can be operated in different
power saving modes. Lets do the comparison between the three most commonly used families of
microcontrollers.

8051

PIC

AVR

SPEED

Slow

Moderate

Fast

MEMORY

Small

Large

Large

ARCHITECTURE

CISC

RISC

RISC

ADC

Not Present

Inbuilt

Inbuilt

Timers

Inbuilt

Inbuilt

Inbuilt

PWM Channels

Not Present

Inbuilt

Inbuilt

AVR is an 8-bit microcontroller belonging to the family of Reduced Instruction Set Computer
(RISC). In RISC architecture the instruction set of the computer are not only fewer in number but
also simpler and faster in operation. The other type of categorization is CISC (Complex Instruction
Set Computers). We will explore more on this when we will learn about the architecture of AVR
microcontrollers in following section.
Lets see what this entire means. What is 8-bit? This means that the microcontroller is capable of
transmitting and receiving 8-bit data. The input/output registers available are of 8-bits. The AVR
families controllers have register based architecture which means that both the operands for an
operation are stored in a register and the result of the operation is also stored in a register. Following
figure shows a simple example performing OR operation between two input registers and storing the
value in Output Register.

20

SMART GRID WITH AUTO PROTECTION

The CPU takes values from two input registers INPUT-1 and INPUT-2, performs the logical
operation and stores the value into the OUTPUT register. All this happens in 1 execution cycle.
In our journey with the AVR we will be working on Atmega16 microcontroller, which is a 40-pin IC
and belongs to the mega AVR category of AVR family. Some of the features of Atmega16 are:

16KB of Flash memory

1KB of SRAM

512 Bytes of EEPROM

Available in 40-Pin DIP

8-Channel 10-bit ADC

Two 8-bit Timers/Counters

One 16-bit Timer/Counter

4 PWM Channels

21

SMART GRID WITH AUTO PROTECTION

In System Programmer (ISP)

Serial USART

SPI Interface

Digital to Analog Comparator.

Architecture of AVR
The AVR microcontrollers are based on the advanced RISC architecture and consist of 32 x 8-bit
general purpose working registers. Within one single clock cycle, AVR can take inputs from two
general purpose registers and put them to ALU for carrying out the requested operation, and transfer
back the result to an arbitrary register. The ALU can perform arithmetic as well as logical operations
over the inputs from the register or between the register and a constant. Single register operations like
taking a complement can also be executed in ALU. We can see that AVR does not have any register
like accumulator as in 8051 family of microcontrollers; the operations can be performed between any
of the registers and can be stored in either of them.
AVR follows Harvard Architecture format in which the processor is equipped with separate memories
and buses for Program and the Data information. Here while an instruction is being executed, the next
instruction is pre-fetched from the program memory.

Since AVR can perform single cycle execution, it means that AVR can execute 1 million instructions
per second if cycle frequency is 1MHz. The higher is the operating frequency of the controller, the
higher will be its processing speed. We need to optimize the power consumption with processing
speed and hence need to select the operating frequency accordingly.

There are two flavors for Atmega16 microcontroller:


1.

Atmega16:- Operating frequency range is 0 16 MHz

2.

Atmega16L:- Operating frequency range is 0 8 MHz

22

SMART GRID WITH AUTO PROTECTION

If we are using a crystal of 8 MHz = 8 x 106 Hertz = 8 Million cycles, then AVR can execute 8
million instructions.
Naming Convention.!
The AT refers to Atmel the manufacturer, Mega means that the microcontroller belong to Mega AVR
category, 16 signifies the memory of the controller, which is 16KB.

Architecture Diagram: Atmega16


Following points explain the building blocks of Atmega16 architecture:
I/O Ports: Atmega16 has four (PORTA, PORTB, PORTC and PORTD) 8-bit input-output
ports.
Internal Calibrated Oscillator: Atmega16 is equipped with an internal oscillator for driving
its clock. By default Atmega16 is set to operate at internal calibrated oscillator of 1 MHz The
maximum frequency of internal oscillator is 8Mhz. Alternatively, ATmega16 can be operated
using an external crystal oscillator with a maximum frequency of 16MHz. In this case you
need to modify the fuse bits. (Fuse Bits will be explained in a separate tutorial).
ADC Interface: Atmega16 is equipped with an 8 channel ADC (Analog to Digital
Converter) with a resolution of 10-bits. ADC reads the analog input for e.g., a sensor input
and converts it into digital information which is understandable by the microcontroller.
Timers/Counters: Atmega16 consists of two 8-bit and one 16-bit timer/counter. Timers are
useful for generating precision actions for e.g., creating time delays between two operations.
Watchdog Timer: Watchdog timer is present with internal oscillator. Watchdog timer
continuously monitors and resets the controller if the code gets stuck at any execution action
for more than a defined time interval.
Interrupts: Atmega16 consists of 21 interrupt sources out of which four are external. The
remaining are internal interrupts which support the peripherals like USART, ADC, and Timers
etc.

23

SMART GRID WITH AUTO PROTECTION

USART: Universal Synchronous and Asynchronous Receiver and Transmitter interface is


available for interfacing with external device capable of communicating serially (data
transmission bit by bit).
General Purpose Registers: Atmega16 is equipped with 32 general purpose registers which
are coupled directly with the Arithmetic Logical Unit (ALU) of CPU.
ISP: AVR family of controllers have In System Programmable Flash Memory which can be
programmed without removing the IC from the circuit, ISP allows to reprogram the controller
while it is in the application circuit.

DAC: Atmega16 is also equipped with a Digital to Analog Converter (DAC) interface which
can be used for reverse action performed by ADC. DAC can be used when there is a need of
converting a digital signal to analog signal.

Memory: Atmega16 consist of three different memory sections:


1. Flash EEPROM: Flash EEPROM or simple flash memory is used to store the program
dumped or burnt by the user on to the microcontroller. It can be easily erased electrically as a
single unit. Flash memory is non-volatile i.e., it retains the program even if the power is cut-off.
Atmega16 is available with 16KB of in system programmable Flash EEPROM.
2. Byte Addressable EEPROM: This is also a non volatile memory used to store data like
values of certain variables. Atmega16 has 512 bytes of EEPROM; this memory can be useful
for storing the lock code if we are designing an application like electronic door lock.
3. SRAM: Static Random Access Memory, this is the volatile memory of microcontroller i.e.,
data is lost as soon as power is turned off. Atmega16 is equipped with 1KB of internal SRAM.
A small portion of SRAM is set aside for general purpose registers used by CPU and some for
the peripheral subsystems of the microcontroller.

24

SMART GRID WITH AUTO PROTECTION

SPI: Serial Peripheral Interface, SPI port is used for serial communication between two devices
on a common clock source. The data transmission rate of SPI is more than that of USART.
TWI: Two Wire Interface (TWI) can be used to set up a network of devices, many devices can be
connected over TWI interface forming a network, the devices can simultaneously transmit and receive
and have their own unique address.

PIN DIAGRAM:

Pin Descriptions
VCC:Digital supply voltage.
GND:Ground.
25

SMART GRID WITH AUTO PROTECTION

Port A (PA7...PA0)
:Port A serves as the analog inputs to the A/D Converter.Port A also serves as
an 8-bit bi-directional I/O port, if the A/D Converter is not used. Port pins can provide internal pull-up
resistors (selected for each bit). The Port A output buffers have symmetrical drive characteristics with
both high sink and source capability. When pins PA0 to PA7 are used as inputs and are externally
pulled low, they will source current if the internal pull-up resistors are activated. The Port A pins are
tri-stated when a reset condition becomes active, even if the clock is not running.
Port B (PB7...PB0):Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected
for each bit). The Port B output buffers have symmetrical drive characteristics with both high sink and
source capability. As inputs, Port B pins that are externally pulled low will source current if the pullup resistors are activated. The Port B pins are tri-stated when a reset condition becomes active, even if
the clock is not running.
Port C (PC7...PC0):Port C is an 8-bit bi-directional I/O port with internal pull-up resistors (selected
for each bit). The Port C output buffers have symmetrical drive characteristics with both high sink and
source capability. As inputs, Port C pins that are externally pulled low will source current if the pullup resistors are activated. The Port C pins are tri-stated when a reset condition becomes active, even if
the clock is not running. If the JTAG interface is enabled, the pull-up resistors on pins PC5 (TDI),
PC3 (TMS) and PC2(TCK) will be activated even if a reset occurs.
Port D (PD7...PD0):Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected
for each bit). The Port D output buffers have symmetrical drive characteristics with both high sink and
source capability. As inputs, Port D pins that are externally pulled low will source current if the pullup resistors are activated. The Port D pins are tri-stated when a reset condition becomes active, even if
the clock is not running.
RESET:Reset Input. A low level on this pin for longer than the minimum pulse length will generate a
reset, even if the clock is not running. Shorter pulses are not guaranteed to generate a reset.
XTAL1:Input to the inverting Oscillator amplifier and input to the
circuit.

internal

clock

operating

XTAL2:Output from the inverting Oscillator amplifier.


AVCC: AVCC is the supply voltage pin for Port A and the A/D Converter. It should be externally
connected to VCC, even if the ADC is not used. If the ADC is used, it should be connected to VCC
through a low-pass filter.
AREF:AREF is the analog reference pin for the A/D Converter.

16X2 ALPHANUMERIC LCD


LCD display:

26

SMART GRID WITH AUTO PROTECTION

The display used here is 16x2 LCD (Liquid Crystal Display); this means 16 characters per line by 2 lines. A
very popular standard exists which allows us to communicate with the vast majority of LCDs regardless of their
manufacturer. The standard is referred to as HD44780U, which refers to the controller chip which receives data
from an external source (in this case, the Atmega16) and communicates directly with the LCD. The 44780
standard requires 3 control lines as well as either 4 or 8 I/O lines for the data bus. Here we are using 8-bit mode
of LCD, i.e., using 8-bit data bus.
Control & Data pins
The three control lines are referred to as EN, RS, and RW.
The EN line is called "Enable." This control line is used to tell the LCD that we are sending it data. To send data
to the LCD, our program should make sure this line is low (0) and then set the other two control lines and/or put
data on the data bus. When the other lines are completely ready, bring EN high (1) and wait for the minimum
amount of time required by the LCD datasheet (this varies from LCD to LCD), and end by bringing it low (0)
again.
The RS line is the "Register Select" line. When RS is low (0), the data is to be treated as a command or special
instruction (such as clear screen, position cursor, etc.). When RS is high (1), the data being sent is text data
which should be displayed on the screen. For example, to display the letter "T" on the screen you would set RS
high.
The RW line is the "Read/Write" control line. When RW is low (0), the information on the data bus is being
written to the LCD. When RW is high (1), the program is effectively querying (or reading) the LCD. Only one
instruction ("Get LCD status") is a read command. All others are write commands--so RW will almost always
be low.
In our case of an 8-bit data bus, the lines are referred to as DB0, DB1, DB2, DB3, DB4, DB5, DB6, and DB7.
These pins should be connected to any port of the microcontroller.
The figure below is to show the pin diagram of before mentioned LCD.

27

SMART GRID WITH AUTO PROTECTION

RELAY:
A relay is an electrically operated switch. Current flowing through the coil of the relay creates a magnetic
field which attracts a lever and changes the switch contacts. The coil current can be on or off so relays have two
switch positions and they are double throw (changeover) switches.
Relays allow one circuit to switch a second circuit which can be completely separate from the first. For example
a low voltage battery circuit can use a relay to switch a 230V AC mains circuit. There is no electrical connection
inside the relay between the two circuits; the link is magnetic and mechanical.
The coil of a relay passes a relatively large current, typically 30mA for a 12V relay, but it can be as much as
100mA for relays designed to operate from lower voltages. Most ICs (chips) cannot provide this current and a
transistor is usually used to amplify the small IC current to the larger value required for the relay coil. The

28

SMART GRID WITH AUTO PROTECTION

maximum output current for the popular 555 timer IC is 200mA so these devices can supply relay coils directly
without amplification.
Relays are usually SPDT or DPDT but they can have many more sets of switch contacts, for example relays
with 4 sets of changeover contacts are readily available. For further information about switch contacts and the
terms used to describe them please see the page on switches.
Most relays are designed for PCB mounting but you can solder wires directly to the pins providing you take care
to avoid melting the plastic case of the relay.
The supplier's catalogue should show you the relay's connections. The coil will be obvious and it may be
connected either way round. Relay coils produce brief high voltage 'spikes' when they are switched off and this
can destroy transistors and ICs in the circuit. To prevent damage you must connect a protection diode across the
relay coil.
The animated picture shows a working relay with its coil and switch contacts. You can see a lever on the left
being attracted by magnetism when the coil is switched on. This lever moves the switch contacts. There is one
set of contacts (SPDT) in the foreground and another behind them, making the relay DPDT.
The relay's switch connections are usually labeled COM, NC and NO:

COM = Common, always connect to this, it is the moving part of the switch.
NC = Normally Closed, COM is connected to this when the relay coil is off.
NO = Normally Open, COM is connected to this when the relay coil is on.
Connect to COM and NO if you want the switched circuit to be on when the relay coil is on.
Connect to COM and NC if you want the switched circuit to be on when the relay coil is off.

Protection diodes for relays

29

SMART GRID WITH AUTO PROTECTION

Transistors and ICs must be protected from the brief high voltage produced when a relay coil is switched off.
The diagram shows how a signal diode (e.g. 1N4148) is connected 'backwards' across the relay coil to provide
this protection.

Current flowing through a relay coil creates a magnetic field which collapses suddenly when the current is
switched off. The sudden collapse of the magnetic field induces a brief high voltage across the relay coil which
is very likely to damage transistors and ICs. The protection diode allows the induced voltage to drive a brief
current through the coil (and diode) so the magnetic field dies away quickly rather than instantly. This prevents
the induced voltage becoming high enough to cause damage to transistors and ICs.

Relays and transistors compared


Like relays, transistors can be used as an electrically operated switch. For switching small DC currents (< 1A) at
low voltage they are usually a better choice than a relay. However transistors cannot switch AC or high voltages
(such as mains electricity) and they are not usually a good choice for switching large currents (> 5A). In these
cases a relay will be needed, but note that a low power transistor may still be needed to switch the current for the
relay's coil! The main advantages and disadvantages of relays are listed below:
Advantages of relays:

Relays can switch AC and DC, transistors can only switch DC.
Relays can switch high voltages, transistors cannot.
Relays are a better choice for switching large currents (> 5A).
Relays can switch many contacts at once.

30

SMART GRID WITH AUTO PROTECTION

Disadvantages of relays:
Relays are bulkier than transistors for switching small currents.
Relays cannot switch rapidly (except reed relays), transistors can switch many times
Relays use more power due to the current flowing through their coil.
Relays require more current than many ICs can provide, so a low power transistor
needed to switch the current for the relay's coil.

per second.
may

be

POTENTIOMETER:
Variable resistors let you dial in a specific resistance. The actual range of resistance is determined by
the upward value of the potentiometer. Potentiometers are thus marked with this upward value, such as 10K,
50K, 100K, 1M, and so forth. For example, a 50K potentiometer will let you dial in any resistance from 0 to
50,000 ohms. Note that the range is approximate only.
Potentiometers are of either the dial or slide type, as shown in Fig. 5-8. The dial type is the most familiar and is
used in such applications as television volume controls and electric blanket thermostat controls. The rotation of
the dial is nearly 360, depending on which potentiometer you use. In one extreme, the resistance through the
potentiometer (or pot) is zero; in the other extreme, the resistance is the maximum value of the component.

Some projects require precision potentiometers. These are referred to as multi-turn potsor trimmers.
Instead of turning the dial one complete rotation to change the resistance from, say, 0 to 10,000 ohms, a multiturn pot requires you to rotate the knob 3, 5, 10, even 15 times to span the same range. Most are designed to be
mounted directly on the printed circuit board. If you have to adjust them, you will need a screwdriver or plastic
tool.

IR SENSOR:
DEFINITION
IR stands for Infra Red. Infrared detectors/sensors are transducers of radiant energy.IR Sensor is a
sensor that sends and detects IR Radiation/Signals. Infrared radiation is the portion of electromagnetic
spectrum having wavelengths longer than visible light wavelengths, but smaller than microwaves, i.e.,
the region roughly from 0.75m to 1000 m is the infrared region. Infrared waves are invisible to
human eyes. The wavelength region of 0.75m to 3 m is called near infrared, the region from 3 m to

31

SMART GRID WITH AUTO PROTECTION

6 m is called mid infrared and the region higher than 6 m is called far infrared. (The demarcations are
not rigid; regions are defined differently by many).

Visible: 0.3 1.0 m;


Near-IR: 1.0 5.2 m;
Mid-IR : 8 25 m;
Far-IR: 25 1000 m; airborne, space

TYPES OF IR SENSORS:
1.
Active IR Sensors:
Active IR Sensors are the type of IR Sensors that employs an IR source & IR detectors (emitter &
receiver). They operate by transmitting energy from either a light emitting diode (LED) or a laser diode.
A phototransistor is used as an active IR detector. In these types of IR sensors, the LED or laser diode
illuminates the target, and the reflected energy is focused onto a detector. Photoelectric cells,
Photodiode or phototransistors are generally used as detectors. The measured data is then processed
using various signal-processing algorithms to extract the desired information.
Active IR detectors provide count, presence, speed, and occupancy data
in both night and day
operation.
2.
Passive IR Sensors:
These are basically IR detectors; they dont use any IR source. These form the major class of IR
sensors/detectors.
A passive infrared system detects energy emitted by objects in the field of view and may use signalprocessing algorithms to extract the desired information. It does not emit any energy of its own for the
purposes of detection. Passive infrared systems can detect presence, occupancy, and count.
32

SMART GRID WITH AUTO PROTECTION

Type of IR Sensor required in the project


Active IR Sensors- Reflectance Sensors
This type of sensors house both an IR source and an IR detector in a single housing in such a way that
light from emitter LED bounces off an external object and is reflected into a detector. Amount of light
reflected into the detector depends upon the reflectivity of the surface.

This principle is used in intrusion detection, object detection (measure the presence of an object in the
sensors FOV), barcode decoding, and surface feature detection (detecting features painted, taped, or
otherwise marked onto the floor), wall tracking (detecting distance from the wall), etc.
It can also be used to scan a defined area; the transmitter emits a beam of light into the scan zone, the
reflected light is used to detect a change in the reflected light thereby scanning the desired zone.
It consist of a pair of IR sensors
-Transmitter
- Receiver
The transmitter transmits the IR signals & the receiver receives the IR signal.

33

SMART GRID WITH AUTO PROTECTION

Transmitter:

Transmitter = LED (Light Emitting Diode)

It is similar to normal LEDs but emit infra-red light its glow can be seen

with a digital camera or mobile phone camera.


Receiver:

Receiver = Photodiode/IR Transistor.

A photodiode is a diode that conducts only when light falls on it

WORKING PRINCIPLE

34

SMART GRID WITH AUTO PROTECTION

CONNECTIONS

35

SMART GRID WITH AUTO PROTECTION

APPLICATIONS:

Robotics Line follower, Obstacle detector, Edge detector

Vehicle crash detection

Speed measurement of motors

Space expeditions applications

Military Applications

General uses as in Shop Door sensor, Anti-theft alarm, Appliance control

system

36

SMART GRID WITH AUTO PROTECTION

BLOCK DIAGRAM:

POWER
SUPPLY
POTENTIOMETERS

LOAD

RELAY

MICRO
CONTROLLER

LCD

ATMEGA 16

IR SENSOR

Buzzer

IR SENSOR

5.1. POWER SUPPLY:


Description:
Power supply is the circuit from which we get a desired dc voltage to run the other circuits. The voltage
we get from the main line is 230V AC but the other components of our circuit require 5V DC. Hence a step-

37

SMART GRID WITH AUTO PROTECTION

down transformer is used to get 12V AC which is later converted to 12V DC using a rectifier. The output of
rectifier still contains some ripples even though it is a DC signal due to which it is called as Pulsating DC. To
remove the ripples and obtain smoothed DC power filter circuits are used. Here a capacitor is used. The 12V DC
is rated down to 5V using a positive voltage regulator chip 7805. Thus a fixed DC voltage of 5V is obtained.
A 5V regulated supply is taken as followed:

Fig.5.1.Power supply block


Each of the blocks is described in more detail below:

Transformer - steps down high voltage AC mains to low voltage AC.

Rectifier - converts AC to DC, but the DC output is varying.

Smoothing - smoothes the DC from varying greatly to a small ripple.

Regulator - eliminates ripple by setting DC output to a fixed voltage.

5.2. MICROCONTROLLER CIRCUIT:


The output of the power supply is connected to the PIN-10(Vcc) & PIN-30(AVcc) of the ATMega-16
microcontroller. The PIN-10&PIN-30 are connected by the wires.PIN-11 & PIN-31 is grounded. PIN-12 & PIN13 are connected to the crystal oscillator. There are four ports in ATMega16 microcontroller. Here port-B is
used for programming purpose, port-C is used for timer/counter purpose & port-D is used for serial
communication. The microcontroller circuit is interfaced with the LCD, GSM-module & the relay driver. The
microcontroller circuit is the heart of the system because it performs all the tasks and gives specific commands
in order to control the devices. This happens due to the software burnt inside the microcontroller. When the
microcontroller circuit powered on it gets the commands from the GSM module in SMS form. This SMS is
decoded by the microcontroller .After decoding the SMS it sends the controlled instruction to the relay driver in
order to operate the devices. One output is connected to the LCD to display the status of the devices whether it
is in ON/OFF mode. After controlling the devices it sends its acknowledgement to the GSM module. Hence the
overall control action is done by the microcontroller circuit without which the devices cant be controlled.
5.3. Liquid crystal display (LCD):

38

SMART GRID WITH AUTO PROTECTION

The liquid crystal display (LCD) is interfaced with the microcontroller circuit in order to display the status of
the devices. Here we used a 16 pins LCD.Its PIN-1 & PIN-16 are grounded. PIN-2 is connected with 5v DC
supply voltage. PIN-1 is connected to the PIN-11, PIN-2 is connected to the PIN-10, PIN-4 is connected to the
PIN-22, PIN-5 is connected to the PIN-23, and PIN-6 is connected to the PIN-24 of the microcontroller
circuit.PIN-7, 8,9,10,11,12,13 & 14are data pins. When PIN-6 is high it enables to access to LCD & when low it
disabled to access the LCD.When PIN-5 is in logic zero the message will be displayed on the LCD. It means
this line determines the direction of data between the LCD and microcontroller. When it is low, data is written to
the LCD. When it is high, data is read from the LCD.

Embedded C:
What is an embedded system?
An embedded system is an application that contains at least one programmable computer and
which is used by individuals who are, in the main, unaware that the system is computer-based.
Which programming language should you use?
Having decided to use an AVR processor as the basis of your embedded system, the next key decision
that needs to be made is the choice of programming language. In order to identify a suitable language
for embedded systems, we might begin by making the following observations:

Computers (such as microcontroller, microprocessor or DSP chips) only accept instructions in


machine code (object codes). Machine code is, by definition, in the language of the
computer, rather than that of the programmer. Interpretation of the code by the programmer is
difficult and error prone.

All software, whether in assembly, C, C++, Java or Ada must ultimately be translated into
machine code in order to be executed by the computer.

Embedded processors like the AVR have limited processor power and very limited
memory available: the language used must be efficient.

The language chosen should be in common use.

Summary of C language Features:

It is mid-level, with high-level features (such as support for functions and modules), and lowlevel features (such as good access to hardware via pointers).

39

SMART GRID WITH AUTO PROTECTION

It is very efficient.

It is popular and well understood.

Even desktop developers who have used only Java or C++ can soon understand C syntax.

Good, well-proven compilers are available for every embedded processor (8-bit to 32-bit or
more).

Basic C program structure:

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //Basic blank C program that does nothing


// Includes
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #include <avr/io.h>

// SFR declarations

Void main (void)


{
While (1);
{
Body of the loop

// Infinite loop

}
}

// match the braces

UTILITY:

This system is very useful in industrial applications for load managing purpose.

ADVANTAGES:

This is a very efficient and economical system.


The control commands can be given easily through potentiometers.
Its system efficiency is very high.
This system is very safe.

40

SMART GRID WITH AUTO PROTECTION

CONCLUSION AND FUTURE PROSPECTIVE:


Embedded system is a latest technology in now days which we used in our project for controlling the
Substations.

We have used microcontroller in our project to control all the functions and we have interfaced relay,
potentiometers to control the network. So this is a very efficient system.
By doing this project we have been acquainted with the controller working and their programming to
make the system working.

41

SMART GRID WITH AUTO PROTECTION

REFERENCES
Adler, R. B., A. C. Smith, and R. L. Longani: Introduction to Semiconductor Physics,
vol. 1, p. 78, Semiconductor Electronics Education Comitee, John Wiley & Sons, Inc.,
New York ,1964.
Stout, M. B.: Analysis of Rectifier Circuits, Elec. Eng., vol. 54, September, 1935.
Jacob Millman Christos C. Halkias.: Electronic Devices And Circuits, Tata McGraw-Hill
Publishing Company Ltd. Sep, 2003.
Sawhney, A.K.: Electrical and Electronic Measurements and Instruments, Dhanpat Rai
& Co. 2003

Journal of Electronics Manufacturing (JEM)


Editor-in-Chief,Paul P. Conway
Wolfson School of Mechanical & Manufacturing Engineering

Practical electronic for u

42

You might also like