Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 116

DISTRIBUTION TRANSMISSION LINE VOLTAGE

MONITORING AND ALERT SYSTEM

ABSTRACT

In three phase equipment’s, if supply voltage is low in any of the one phase and you if you wish
to run all the equipment properly. This equipment will help you to rescue this situation. However
proper rating fuse need to be used in three phase i.e. R, Y, and B inputs lines. Where the correct
voltage is available that time. Other low voltage phase shift to correct voltage in same manner, to
run all the equipment on the single phase in the building. The circuit consist of relay comparator,
transformer.

Phase absence is a very common and severe problem in any industry, home or office. Many
times one or two phases may not be live in three phase supply. Because of this, many times,
some electrical appliances will be on in one room and OFF in another room. This creates a big
disturbance to our routine work.

Power Failure is common problem. it hampers the production of industry , construction work of
new plants and building . It is often noticed that power interruption in distribution system is
about 70% for single phase faults while other two phases are in normal condition. Thus, in any
commercial or domestic power supply system where 3 phases is available, an automatic phase
selector system is required for uninterrupted power to critical loads in the event of power failure
in any phase. There is no requirement of backup power supply in that case. also there is no time
consumption as the phase is changed automatically within a few seconds.
INTRODUCTION

Now, in 21st century, fully world is of automation, and it is the time we must think of
microcontroller to control. All automatic controller like remote controller, hand held
communication devices, automatic and semiautomatic washing machine, automobile indicating
and measuring instruments have its application in each. The project described here being also a
microcontroller based project used for automatic phase changer. The Arduino Uno is a
microcontroller board based on the ATmega328 (datasheet). It has 14 digital input/output pins
(of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz ceramic resonator, a USB
connection, a power jack, an ICSP header, and a reset button. It contains everything needed to
support the microcontroller; simply connect it to a computer with a USB cable or power it with a
AC-to-DC adapter or battery to get started. The Uno differs from all preceding boards in that it
does not use the FTDI USB-to-serial driver chip. Instead, it features the Atmega16U2
(Atmega8U2 up to version R2) programmed as a USB-to-serial converter.

The microcontroller used for this project is Atmega 328. Now a days many times out of three
phases one of the phase cut’s off and the circuit breaker trips at that time the MSEB Operator has
to operate it manually by turning on the at the time of office hours at that time the hooter shouts
and gives us an alert. Keeping in mind the day to day life of human being, the circumstances
which occur due to power instability issues we decided to design such a system which would
overcome this issues ultimately and help to reduce human efforts too. Secondly in order to
overcome the various phase change issue and avoid damages in industries and automation area
plus hospitals & airports
PROBLEM STATEMENT

In our daily life our focus was to modify the system which can minimize the circumstances or
difficulties in person life. In 21st century of modern science and technology there was one thing
in mind that to develop a system which can be applied for several application in our daily life. So
our concept of automatic phase changer was selected, which can be used in 3 phase application.
If there is low voltage in any two phase and want to work all equipment in normal voltage. Our
project will solve this problems.
EXISTING SYSTEM

There is the switch box which separate the source between MSEB supply and generator. When
there is electricity supply from MSEB supply someone goes to change the generator line. And
thus the electricity supply restore and off the generator and change the supply line from
generator to MSEB supply As said in solution it reduces the manpower in using energy for
starting generator and switching over from public supply.
PROPOSED SYSTEM

This project is designed to check the availability of any live phase, and the load will be
connected to the particular live phase only. Even a single phase is available, and then also, the
load will be in ON condition. This project is designed with ARDUINO UNO MCU. This
controller continuously checks for live condition of all phases connected to it, and the controller
connects the load to the active phase using a Relay. This relay is driven with a transistor. If two
or three phases are live, the load will be connected to phase I only. An LCD is provided to
display the status of the phase condition. Contrast control preset is given for LCD contrast
control. This project uses regulated 12V, 500mA power supply. 7805 three terminal voltage
regulator is used for voltage regulation. Bridge type full wave rectifier is used to rectify the ac
out put of secondary of 230/12V step down transformer.
AIM & OBJECTIVE

 Main aim of project is automatic phase switch which give input as 230v ac to input power
to single phase output application.
 To design system which does not require backup like generator.
 To design system which operate automatically.
 To implement system which work uninterrupted power for critical Loads in power
failure condition.
LITERATURE SURVEY

1. DESIGN AND IMPLEMENTATION OF AUTOMATIC THREE PHASE CHANGER


USING LM324 QUAD INTEGRATED CIRCUIT

Author :- Oduobuk, E. J., Ettah, E. B. , Ekpenyong, E. E.

Design and implementation of an automatic three phase changer using LM324 quad
integrated circuit was carried out. The system was designed and simulated using
(Multisim). The circuit components were mounted a Vero board. LM324 integrated
circuit (comparator) and 2N2222 transistors were used as active components alongside
other passive components. Result shows that, when the three phase a.c inputs: Red phase
( ), yellow phase ( ) and blue phase ( ) from public utility supply was fed to the system,
the system compared the inputs with regard to phase imbalances, and the input with the
highest voltage appears across the output. It also changes over from one phase to another
immediately the circuit senses further phase imbalance.

2. AUTOMATIC PHASE CHANGER


Author :- Bhanu Bhawesh

In three-phase applications, if low voltage is available in any one or two phases, and you
want your equipment to work on normal voltage, this circuit will solve your problem.
However, a proper-rating fuse needs to be used in the input lines (R, Y and B) of each
phase. The circuit provides correct voltage in the same power supply lines through relays
from the other phase where correct voltage is available. Using it you can operate all your
equipment even when correct voltage is available on a single phase in the building.
The circuit is built around a transformer, comparator, transistor and relay. Three identical
sets of this circuit, one each for three phases, are used.The mains power supply phase R is
stepped down by transformer X1 to deliver 12V, 300 mA, which is rectified by diode D1
and filtered by capacitor C1 to produce the operating voltage for the operational amplifier
(IC1). The voltage at inverting pin 2 of operational amplifier IC1 is taken from the
voltage divider circuit of resistor R1 and preset resistor VR1. VR1 is used to set the
reference voltage according to the requirement. The reference voltage at non-inverting
pin 3 is fixed to 5.1V through zener diode ZD1. The phase voltage is compared against
the reference voltage and if the phase voltage is low the relay trips and shifts the load to
other phase.

3. Design of Automatic Phase Selector from Any Available Three Phase Supply
Author :- Ayan Ghosh, Shamik Chattaraj, Snehashis Das, Kaustav Mallick
Power failure is a common problem. It hampers the production of industry, construction
work of new plants and buildings. It can be overcome by using a backup power supply
such as a generator. But it is cost effective and also time consuming as certain time is
required to switch on the generator manually. It is often noticed that power interruption in
distribution system is about 70% for single phase faults while other two phases are in
normal condition. Thus, in any commercial or domestic power supply system where 3
phases is available, an automatic phase selector system is required for uninterrupted
power to critical loads in the event of power failure in any phase. There is no requirement
of backup power supply in that case. Also there is no time consumption as the phase is
changed automatically within a few seconds. The main aim of this paper is to present the
real idea of an automatic phase switch for 220V to 240V alternating current. Although,
there are many designs that can perform almost similar functions like, single phase
change-over switches, two phase automatic transfer switch and three phase automatic
change-over switch, but this model is about an automatic phase switchover (phase
selector) which is designed for only three phase A.C input power to single phase output
applications.
METHODOLOGY

 We implement system automatic active phase selector. This project divided into
three parts input section controlling section and output section.
 In input section we continuously check three phase. we check in this section if
any phase absence
 In controlling section microcontroller continuously take output from input section
 For different condition of input microcontroller send different signal to output
section.
 In output If no phase absence load in output will on first phase.
 If any phase absence load in output shift to live phase with the help of
microcontroller through relay circuit.
BLOCK DIAGRAM

BLOCK DIAGRAM DESCRIPTION

 In this project we continuously on Load using three phase .


 If all phase are present microcontroller turn on Load on phase 1.at that on LCD display as
“Phase 1 selected ”
 If first phase absence, Load automatically shift to phase 2 with the help of relay circuit.
 Same if first two phase absent microcontroller shift that load to phase 3 with the help of
rely circuit.
 System will display selected phase on LCD.
 This project uses regulated 5v, 750mA power supply. 7805, a three terminal voltage
regulator is used for voltage regulation. Bridge type full wave rectifier is used to rectify
the ac output of secondary of 230/12v step down transformer.

CIRCUIT DIAGRAM
POWER SUPPLY

HARDWARE REQUIREMENT

 8051 Microcontroller
 LCD Display
 Relay circuit
 Load
 Step Down Transformers.
 Comparators.
 Switching Devices.

SOFTWARE REQUIREMENT

 Keil IDE
 Flash Magic
 Proteus
1. MICROCONTROLLER 8051

Pin diagram

Microprocessors and microcontrollers are widely used in embedded systems products.


Microcontroller is a programmable device. A microcontroller has a CPU in addition to a fixed
amount of RAM, ROM, I/O ports and a timer embedded all on a single chip. The fixed amount
of on-chip ROM, RAM and number of I/O ports in microcontrollers makes them ideal for many
applications in which cost and space are critical.The Intel 8052 is Harvard architecture, single
chip microcontroller (µC) which was developed by Intel in 1980 for use in embedded systems. It
was popular in the 1980s and early 1990s, but today it has largely been superseded by a vast
range of enhanced devices with 8052-compatible processor cores that are manufactured by more
than 20 independent manufacturers including Atmel, Infineon Technologies and Maxim
Integrated Products.8052 is an 8-bit processor, meaning that the CPU can work on only 8 bits of
data at a time. Data larger than 8 bits has to be broken into 8-bit pieces to be processed by the
CPU. 8052 is available in different memory types such as UV-EPROM, Flash and NV-RAM.

The present project is implemented on Keil uVision. In order to program the device, proload tool
has been used to burn the program onto the microcontroller. The features, pin description of the
microcontroller and the software tools used are discussed in the following sections.

FEATURES

• Compatible with MCS-51® Products

• 8K Bytes of In-System Programmable (ISP) Flash Memory

– Endurance: 1000 Write/Erase Cycles

• 4.0V to 5.5V Operating Range

• Fully Static Operation: 0 Hz to 33 MHz

• Three-level Program Memory Lock

• 256 x 8-bit Internal RAM

• 32 Programmable I/O Lines

• Three 16-bit Timer/Counters

• Eight Interrupt Sources

• Full Duplex UART Serial Channel

• Low-power Idle and Power-down Modes

• Interrupt Recovery from Power-down Mode

• Watchdog Timer

• Dual Data Pointer


DESCRIPTION

The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K bytes of


in-system programmable Flash memory. The device is manufactured using Atmel’s high-density
nonvolatile memory technology and is compatible with the industry- standard 80C51 instruction
set and pin out. The on-chip Flash allows the program memory to be reprogrammed in-system or
by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with in-
system programmable Flash on a monolithic chip, the Atmel AT89S52 is a powerful
microcontroller which provides a highly-flexible and cost-effective solution to many embedded
control applications.

The AT89S52 provides the following standard features: 8K bytes of Flash, 256 bytes of RAM,
32 I/O lines, Watchdog timer, two data pointers, three 16-bit timer/counters, a six-vector two-
level interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry. In
addition, the AT89S52 is designed with static logic for operation down to zero frequency and
supports two software selectable power saving modes.

The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port, and interrupt
system to continue functioning. The Power-down mode saves the RAM contents but freezes the
oscillator, disabling all other chip functions until the next interrupt or hardware reset.
PIN DESCRIPTION

VCC

Supply voltage.

GND

Ground

Port 0

Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each pin can sink eight
TTL inputs. When 1s are written to port 0 pins, the pins can be used as high impedance inputs.
Port 0 can also be configured to be the multiplexed low order address/data bus during accesses to
external program and data memory. In this mode, P0 has internal pull-ups. Port 0 also receives
the code bytes during Flash programming and outputs the code bytes during program
verification. External pull-ups are required during program verification.

Port 1

Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 1 output buffers can
sink/source four TTL inputs. When 1s are written to Port 1 pins, they are pulled high by the
internal pull-ups and can be used as inputs. As inputs, Port 1 pins that are externally being pulled
low will source current (IIL) because of the internal pull-ups. In addition, P1.0 and P1.1 can be
configured to be the timer/counter 2 external count input (P1.0/T2) and the timer/counter 2
trigger input (P1.1/T2EX), respectively, as shown in the following table. Port 1 also receives the
low-order address bytes during Flash programming and verification.
Port 2

Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 2 output buffers can
sink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled high by the
internal pull-ups and can be used as inputs. As inputs, Port 2 pins that are externally being pulled
low will source current (IIL) because of the internal pull-ups. Port 2 emits the high-order address
byte during fetches from external program memory and during accesses to external data memory
that uses 16-bit addresses (MOVX @ DPTR). In this application, Port 2 uses strong internal pull-
ups when emitting 1s. During accesses to external data memory that uses 8-bit addresses
(MOVX @ RI), Port 2 emits the contents of the P2 Special Function Register. Port 2 also
receives the high-order address bits and some control signals during Flash programming and
verification.

Port 3

Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 3 output buffers can
sink/source four TTL inputs. When 1s are written to Port 3 pins, they are pulled high by the
internal pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled
low will source current (IIL) because of the pull-ups. Port 3 also serves the functions of various
special features of the AT89S52, as shown in the following table. Port 3 also receives some
control signals for Flash programming and verification.
RST

Reset input. A high on this pin for two machine cycles while the oscillator is running resets the
device. This pin drives High for 96 oscillator periods after the Watchdog times out. The DISRTO
bit in SFR AUXR (address 8EH) can be used to disable this feature. In the default state of bit
DISRTO, the RESET HIGH out feature is enabled.

ALE/PROG

Address Latch Enable (ALE) is an output pulse for latching the low byte of the address during
accesses to external memory. This pin is also the program pulse input (PROG) during Flash
programming. In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator
frequency and may be used for external timing or clocking purposes. Note, however, that one
ALE pulse is skipped during each access to external data memory. If desired, ALE operation can
be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only during a
MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting the ALE-disable
bit has no effect if the microcontroller is in external execution mode.

PSEN

Program Store Enable (PSEN) is the read strobe to external program memory. When the
AT89S52 is executing code from external program memory, PSEN is activated twice each
machine cycle, except that two PSEN activations are skipped during each access to external data
memory.

EA/VPP

External Access Enable. EA must be strapped to GND in order to enable the device to fetch code
from external program memory locations starting at 0000H up to FFFFH. Note, however, that if
lock bit 1 is programmed, EA will be internally latched on reset.

EA should be strapped to VCC for internal program executions. This pin also receives the 12-
volt programming enable voltage (VPP) during Flash programming.

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock operating circuit.

XTAL2

Output from the inverting oscillator amplifier

XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier that can be
configured for use as an on-chip oscillator, as shown in Figure. Either a quartz crystal or ceramic
resonator may be used. To drive the device from an external clock source, XTAL2 should be left
unconnected while XTAL1 is driven, as shown in the below figure. There are no requirements on
the duty cycle of the external clock signal, since the input to the internal clocking circuitry is
through a divide-by-two flip-flop, but minimum and maximum voltage high and low time
specifications must be observed.

Fig: Oscillator Connections

C1, C2 = 30 pF ± 10 pF for Crystals

= 40 pF ± 10 pF for Ceramic Resonators


Fig: External Clock Drive Configuration

8052 MICROCONTROLLER MEMORY ORGANIZATION

The microcontroller memory is divided into Program Memory and Data Memory. Program
Memory (ROM) is used for permanent saving program being executed, while Data Memory
(RAM) is used for temporarily storing and keeping intermediate results and variables. Depending
on the model in use (still referring to the whole 8052 microcontroller family) at most a few Kb of
ROM and 128 or 256 bytes of RAM can be used. However…

All 8052 microcontrollers have 16-bit addressing bus and can address 64 kb memory. It is
neither a mistake nor a big ambition of engineers who were working on basic core development.
It is a matter of very clever memory organization which makes these controllers a real
“programmers’ tidbit“.

Program Memory

The oldest models of the 8052 microcontroller family did not have any internal program
memory. It was added from outside as a separate chip. These models are recognizable by their
label beginning with 803 (for ex. 8031 or 8032). All later models have a few Kbytes ROM
embedded, Even though it is enough for writing most of the programs, there are situations when
additional memory is necessary. A typical example of it is the use of so called lookup tables.
They are used in cases when something is too complicated or when there is no time for solving
equations describing some process. The example of it can be totally exotic (an estimate of self-
guided rockets’ meeting point) or totally common (measuring of temperature using non-linear
thermo element or asynchronous motor speed control). In those cases all needed estimates and
approximates are executed in advance and the final results are put in the tables (similar to
logarithmic tables).
How does the microcontroller handle external memory depend on the pin EA logic state?

EA=0In this case, internal program memory is completely ignored, only a program stored in
external memory is to be executed.
EA=1In this case, a program from built-in ROM is to be executed first (to the last location).
Afterwards, the execution is continued by reading additional memory.

in both cases, P0 and P2 are not available to the user because they are used for data and address
transmission. Besides, the pins ALE and PSEN are used too.
Data Memory

As already mentioned, Data Memory is used for temporarily storing and keeping data and
intermediate results created and used during microcontroller’s operating. Besides, this
microcontroller family includes many other registers such as: hardware counters and timers,
input/output ports, serial data buffers etc. The previous versions have the total memory size of
256 locations, while for later models this number is incremented by additional 128 available
registers. In both cases, these first 256 memory locations (addresses 0-FFh) are the base of the
memory. Common to all types of the 8052 microcontrollers. Locations available to the user
occupy memory space with addresses from 0 to 7Fh. First 128 registers and this part of RAM is
divided in several blocks.

The first block consists of 4 banks each including 8 registers designated as R0 to R7. Prior to
access them, a bank containing that register must be selected. Next memory block (in the range
of 20h to 2Fh) is bit- addressable, which means that each bit being there has its own address
from 0 to 7Fh. Since there are 16 such registers, this block contains in total of 128 bits with
separate addresses (The 0th bit of the 20h byte has the bit address 0 and the 7th bit of the 2Fh
byte has the bit address 7Fh). The third groups of registers occupy addresses 2Fh-7Fh (in total of
80 locations) and does not have any special purpose or feature.

Additional Memory Block of Data Memory

In order to satisfy the programmers’ permanent hunger for Data Memory, producers have
embedded an additional memory block of 128 locations into the latest versions of the 8052
microcontrollers. Naturally, it’s not so simple…The problem is that electronics performing
addressing has 1 byte (8 bits) on disposal and due to that it can reach only the first 256 locations.
In order to keep already existing 8-bit architecture and compatibility with other existing models a
little trick has been used.
Using trick in this case means that additional memory block shares the same addresses with
existing locations intended for the SFRs (80h- FFh). In order to differentiate between these two
physically separated memory spaces, different ways of addressing are used. A direct addressing
is used for all locations in the SFRs, while the locations from additional RAM are accessible
using indirect addressing.

How to extend memory?

In case on-chip memory is not enough, it is possible to add two external memory chips with
capacity of 64Kb each. I/O ports P2 and P3 are used for their addressing and data transmission.
From the users’ perspective, everything functions quite simple if properly connected because the
most operations are performed by the microcontroller itself. The 8052 microcontroller has two
separate reading signals RD#(P3.7) and PSEN#. The first one is activated byte from external data
memory (RAM) should be read, while another one is activated to read byte from external
program memory (ROM). These both signals are active at logical zero (0) level. A typical
example of such memory extension using special chips for RAM and ROM is shown on the
previous picture. It is called Hardward architecture.

Even though the additional memory is rarely used with the latest versions of the
microcontrollers, it will be described here in short what happens when memory chips are
connected according to the previous scheme. It is important to know that the whole process is
performed automatically, i.e. with no intervention in the program.

 When the program during execution encounters the instruction which resides in external
memory (ROM), the microcontroller will activate its control output ALE and set the first
8 bits of address (A0-A7) on P0. In this way, IC circuit 74HCT573 which "lets in" the
first 8 bits to memory address pins is activated.
 A signal on the pin ALE closes the IC circuit 74HCT573 and immediately afterwards 8
higher bits of address (A8-A15) appear on the port. In this way, a desired location in
additional program memory is completely addressed. The only thing left over is to read
its content.
 Pins on P0 are configured as inputs, the pin PSEN is activated and the microcontroller
reads content from memory chip. The same connections are used both for data and lower
address byte.

Similar occurs when it is a needed to read some location from external Data Memory. Now,
addressing is performed in the same way, while reading or writing is performed via signals
which appear on the control outputs RD or WR.

Addressing

While operating, processor processes data according to the program instructions. Each
instruction consists of two parts. One part describes what should be done and another part
indicates what to use to do it. This later part can be data (binary number) or address where the
data is stored. All 8052 microcontrollers use two ways of addressing depending on which part of
memory should be accessed:

Direct Addressing

On direct addressing, a value is obtained from a memory location while the address of that
location is specified in instruction. Only after that, the instruction can process data (how depends
on the type of instruction: addition, subtraction, copy…). Obviously, a number being changed
during operating a variable can reside at that specified address. For example:

Since the address is only one byte in size ( the greatest number is 255), this is how only the first
255 locations in RAM can be accessed in this case the first half of the basic RAM is intended to
be used freely, while another half is reserved for the SFRs.

Indirect Addressing
On indirect addressing, a register which contains address of another register is specified in the
instruction. A value used in operating process resides in that another register. For example:

Only RAM locations available for use are accessed by indirect addressing (never in the SFRs).
For all latest versions of the microcontrollers with additional memory block (those 128 locations
in Data Memory), this is the only way of accessing them. Simply, when during operating, the
instruction including “@” sign is encountered and if the specified address is higher than 128 (7F
hex.), the processor knows that indirect addressing is used and jumps over memory space
reserved for the SFRs.

On indirect addressing, the registers R0, R1 or Stack Pointer are used for specifying 8-bit
addresses. Since only 8 bits are available, it is possible to access only registers of internal RAM
in this way (128 locations in former or 256 locations in latest versions of the microcontrollers). If
memory extension in form of additional memory chip is used then the 16-bit DPTR Register
(consisting of the registers DPTRL and DPTRH) is used for specifying addresses. In this way it
is possible to access any location in the range of 64K.
SFRs (Special Function Registers)

SFRs are a kind of control table used for running and monitoring microcontroller’s operating.
Each of these registers, even each bit they include, has its name, address in the scope of RAM
and clearly defined purpose ( for example: timer control, interrupt, serial connection etc.). Even
though there are 128 free memory locations intended for their storage, the basic core, shared by
all types of 8052 controllers, has only 21 such registers. Rest of locations areintensionally left
free in order to enable the producers to further improved models keeping at the same time
compatibility with the previous versions. It also enables the use of programs written a long time
ago for the microcontrollers which are out of production now.

A Register (Accumulator)
This is a general-purpose register which serves for storing intermediate results during operating.
A number (an operand) should be added to the accumulator prior to execute an instruction upon
it. Once an arithmetical operation is preformed by the ALU, the result is placed into the
accumulator. If a data should be transferred from one register to another, it must go through
accumulator. For such universal purpose, this is the most commonly used register that none
microcontroller can be imagined without (more than a half 8052 microcontroller's instructions
used use the accumulator in some way).

B Register

B register is used during multiply and divide operations which can be performed only upon
numbers stored in the A and B registers. All other instructions in the program can use this
register as a spare accumulator (A).

During programming, each of registers is called by name so that their exact address is not so
important for the user. During compiling into machine code (series of hexadecimal numbers
recognized as instructions by the microcontroller), PC will automatically, instead of registers’
name, write necessary addresses into the microcontroller.
R Registers (R0-R7)

This is a common name for the total 8 general purpose registers (R0, R1, R2 ...R7). Even they
are not true SFRs, they deserve to be discussed here because of their purpose. The bank is active
when the R registers it includes are in use. Similar to the accumulator, they are used for
temporary storing variables and intermediate results. Which of the banks will be active depends
on two bits included in the PSW Register. These registers are stored in four banks in the scope of
RAM.
2. LIQUID CRYSTAL DISPLAY:

LCD stands for Liquid Crystal Display. LCD is finding wide spread use replacing LEDs (seven
segment LEDs or other multi segment LEDs) because of the following reasons:

1. The declining prices of LCDs.


2. The ability to display numbers, characters and graphics. This is in contrast to LEDs,
which are limited to numbers and a few characters.
3. Incorporation of a refreshing controller into the LCD, thereby relieving the CPU of the
task of refreshing the LCD. In contrast, the LED must be refreshed by the CPU to keep
displaying the data.
4. Ease of programming for characters and graphics.

These components are “specialized” for being used with the microcontrollers, which
means that they cannot be activated by standard IC circuits. They are used for writing
different messages on a miniature LCD.

Pin Logic
Function Name Description
Number State
Ground 1 Vss - 0V

Power supply 2 Vdd - +5V


A

Contrast 3 Vee - 0 – Vdd


mod
D0 – D7 are interpreted as el
0
4 RS commands desc
1
D0 – D7 are interpreted as data ribe
d
Write data (from controller to
here
0 LCD)
Control of 5 R/W is
1 Read data (from LCD to
operating for
controller)
its

0 Access to LCD disabled low


1 Normal operating pric
6 E
From 1 to Data/commands are transferred to e
0 LCD and
grea
7 D0 0/1 Bit 0 LSB t
poss
8 D1 0/1 Bit 1
ibilit
9 D2 0/1 Bit 2 ies
most
10 D3 0/1 Bit 3 freq
Data / commands
uent
11 D4 0/1 Bit 4
ly
12 D5 0/1 Bit 5 used
in
13 D6 0/1 Bit 6
prac

14 D7 0/1 Bit 7 MSB tice.


It is
based on the HD44780 microcontroller (Hitachi) and can display messages in two lines with
16 characters each. It displays all the alphabets, Greek letters, punctuation marks,
mathematical symbols etc. In addition, it is possible to display symbols that user makes up
on its own. Automatic shifting message on display (shift left and right), appearance of the
pointer, backlight etc. are considered as useful characteristics.

Pins Functions

There are pins along one side of the small printed board used for connection to the
microcontroller. There are total of 14 pins marked with numbers (16 in case the
background light is built in). Their function is described in the table below:

LCD screen:

LCD screen consists of two lines with 16 characters each. Each character consists of
5x7 dot matrix. Contrast on display depends on the power supply voltage and whether
messages are displayed in one or two lines. For that reason, variable voltage 0-Vdd is
applied on pin marked as Vee. Trimmer potentiometer is usually used for that purpose.
Some versions of displays have built in backlight (blue or green diodes). When used during
operating, a resistor for current limitation should be used (like with any LE diode).

LCD Basic Commands:

All data transferred to LCD through outputs D0-D7 will be interpreted as commands or
as data, which depends on logic state on pin RS:

RS = 1 - Bits D0 - D7 are addresses of characters that should be displayed. Built in


processor addresses built in “map of characters” and displays corresponding symbols. Displaying
position is determined by DDRAM address. This address is either previously defined or the
address of previously transferred character is automatically incremented.

RS = 0 - Bits D0 - D7 are commands which determine display mode. List of commands


which LCD recognizes are given in the table below:

Execution
Command RS RW D7 D6 D5 D4 D3 D2 D1 D0
Time

Clear display 0 0 0 0 0 0 0 0 0 1 1.64mS

Cursor home 0 0 0 0 0 0 0 0 1 x 1.64mS

Entry mode set 0 0 0 0 0 0 0 1 I/D S 40uS

Display on/off control 0 0 0 0 0 0 1 D U B 40uS

Cursor/Display Shift 0 0 0 0 0 1 D/C R/L x x 40uS

Function set 0 0 0 0 1 DL N F x x 40uS

Set CGRAM address 0 0 0 1 CGRAM address 40uS

Set DDRAM address 0 0 1 DDRAM address 40uS

Read “BUSY” flag


0 1 BF DDRAM address -
(BF)

Write to CGRAM or
1 0 D7 D6 D5 D4 D3 D2 D1 D0 40uS
DDRAM
Read from CGRAM
1 1 D7 D6 D5 D4 D3 D2 D1 D0 40uS
or DDRAM

List of commands which LCD recognizes

I/D 1 = Increment (by 1) R/L 1 = Shift right

0 = Decrement (by 1) 0 = Shift left

S 1 = Display shift on DL 1 = 8-bit interface

0 = Display shift off 0 = 4-bit interface

D 1 = Display on N 1 = Display in two lines

0 = Display off 0 = Display in one line

U 1 = Cursor on F 1 = Character format 5x10 dots

0 = Cursor off 0 = Character format 5x7 dots

B 1 = Cursor blink on D/C 1 = Display shift

0 = Cursor blink off 0 = Cursor shift

LCD Connection:

Depending on how many lines are used for connection to the microcontroller, there
are 8-bit and 4-bit LCD modes. The appropriate mode is determined at the beginning of
the process in a phase called “initialization”. In the first case, the data are transferred
through outputs D0-D7 as it has been already explained. In case of 4-bit LED mode, for the
sake of saving valuable I/O pins of the microcontroller, there are only 4 higher bits (D4-D7)
used for communication, while other may be left unconnected.
Consequently, each data is sent to LCD in two steps: four higher bits are sent first
(that normally would be sent through lines D4-D7), four lower bits are sent afterwards.
With the help of initialization, LCD will correctly connect and interpret each data received.
Besides, with regards to the fact that data are rarely read from LCD (data mainly are
transferred from microcontroller to LCD) one more I/O pin may be saved by simple
connecting R/W pin to the Ground. Such saving has its price. Even though message
displaying will be normally performed, it will not be possible to read from busy flag since it
is not possible to read from display.

LCD Initialization:

Once the power supply is turned on, LCD is automatically cleared. This process
lasts for approximately 15mS. After that, display is ready to operate. The mode of
operating is set by default. This means that:
1. Display is cleared
2. Mode
DL = 1 Communication through 8-bit interface
N = 0 Messages are displayed in one line
F = 0 Character font 5 x 8 dots

3. Display/Cursor on/off
D = 0 Display off
U = 0 Cursor off
B = 0 Cursor blink off
4. Character entry
ID = 1 Addresses on display are automatically incremented by 1
S = 0 Display shift off

Automatic reset is mainly performed without any problems. Mainly but not always!
If for any reason power supply voltage does not reach full value in the course of 10mS,
display will start perform completely unpredictably. If voltage supply unit can not meet
this condition or if it is needed to provide completely safe operating, the process of
initialization by which a new reset enabling display to operate normally must be applied.
Algorithm according to the initialization is being performed depends on whether
connection to the microcontroller is through 4- or 8-bit interface. All left over to be done
after that is to give basic commands and of course- to display messages.

SPECIFICATION

 Display :- 16 Char* 2 Lines


 Controller:-LSI HD44780 IN BUILT
 Power Supply :- + 5v Dc
 Display Color :-Gray
 Weight :- 35g
RELAYS:

A relay is an electrically controllable switch widely used in industrial controls, automobiles


and appliances.

The relay allows the isolation of two separate sections of a system with two different voltage
sources i.e., a small amount of voltage/current on one side can handle a large amount of
voltage/current on the other side but there is no chance that these two voltages mix up.

Operation:

When a current flow through the coil, a magnetic field is created around the coil i.e., the
coil is energized. This causes the armature to be attracted to the coil. The armature’s contact acts
like a switch and closes or opens the circuit. When the coil is not energized, a spring pulls the
armature to its normal state of open or closed. There are all types of relays for all kinds of
applications.

Fig: Relay Operation and use of protection diodes


Transistors and ICs must be protected from the brief high voltage 'spike' produced when the
relay coil is switched off. The above diagram shows how a signal diode (eg 1N4148) is
connected across the relay coil to provide this protection. The diode is connected 'backwards' so
that it will normally not conduct. Conduction occurs only when the relay coil is switched off, at
this moment the current tries to flow continuously through the coil and it is safely diverted
through the diode. Without the diode no current could flow and the coil would produce a
damaging high voltage 'spike' in its attempt to keep the current flowing.
TRANSISTOR DRIVER CIRCUIT:

An SPDT relay consists of five pins, two for the magnetic coil, one as the common
terminal and the last pins as normally connected pin and normally closed pin. When the current
flows through this coil, the coil gets energized. Initially when the coil is not energized, there will
be a connection between the common terminal and normally closed pin. But when the coil is
energized, this connection breaks and a new connection between the common terminal and
normally open pin will be established. Thus when there is an input from the microcontroller to
the relay, the relay will be switched on. Thus when the relay is on, it can drive the loads
connected between the common terminal and normally open pin. Therefore, the relay takes 5V
from the microcontroller and drives the loads which consume high currents. Thus the relay acts
as an isolation device.

Digital systems and microcontroller pins lack sufficient current to drive the relay. While the
relay’s coil needs around 10milli amps to be energized, the microcontroller’s pin can provide a
maximum of 1-2milli amps current. For this reason, a driver such as a power transistor is placed
in between the microcontroller and the relay.
LIQUID CRYSTAL DISPLAY:

LCD stands for Liquid Crystal Display. LCD is finding wide spread use replacing LEDs (seven
segment LEDs or other multi segment LEDs) because of the following reasons:

5. The declining prices of LCDs.


6. The ability to display numbers, characters and graphics. This is in contrast to LEDs,
which are limited to numbers and a few characters.
7. Incorporation of a refreshing controller into the LCD, thereby relieving the CPU of the
task of refreshing the LCD. In contrast, the LED must be refreshed by the CPU to keep
displaying the data.
8. Ease of programming for characters and graphics.
POWER SUPPLY

RESISTOR:

Resistors "Resist" the flow of electrical current. The higher the value of resistance (measured
in ohms) the lower the current will be. Resistance is the property of a component which restricts
the flow of electric current. Energy is used up as the voltage across the component drives the
current through it and this energy appears as heat in the component.

Colour Code:
CAPACITOR:

Capacitors store electric charge. They are used with resistors in timing circuits because it
takes time for a capacitor to fill with charge. They are used to smooth varying DC supplies by
acting as a reservoir of charge. They are also used in filter circuits because capacitors easily pass
AC (changing) signals but they block DC (constant) signals.

Circuit symbol:

Electrolytic capacitors are polarized and they must be connected the correct wayround, at least
one of their leads will be marked + or -.

Examples:

DIODES:

Diodes allow electricity to flow in only one direction. The arrow of the circuit symbol shows
the direction in which the current can flow. Diodes are the electrical version of a valve and early
diodes were actually called valves.

Circuit symbol:

Diodes must be connected the correct way round, the diagram may be labeled a or + for anode
and k or - for cathode (yes, it really is k, not c, for cathode!). The cathode is marked by a line
painted on the body. Diodes are labeled with their code in small print; you may need a
magnifying glass to read this on small signal diodes.
Example:

LIGHT-EMITTING DIODE (LED):


The longer lead is the anode (+) and the shorter lead is the cathode (&minus). In the schematic
symbol for an LED (bottom), the anode is on the left and the cathode is on the right. Light
emitting diodes are elements for light signalization in electronics.

They are manufactured in different shapes, colors and sizes. For their low price, low
consumption and simple use, they have almost completely pushed aside other light sources-
bulbs at first place.
It is important to know that each diode will be immediately destroyed unless its current is
limited. This means that a conductor must be connected in parallel to a diode. In order to
correctly determine value of this conductor, it is necessary to know diode’s voltage drop in
forward direction, which depends on what material a diode is made of and what colors it is.
Values typical for the most frequently used diodes are shown in table below: As seen, there are
three main types of LEDs. Standard ones get full brightness at current of 20mA. LowCurrent
diodes get full brightness at ten time’s lower current while Super Bright diodes produce more
intensive light than Standard ones.

Since the 8051 microcontrollers can provide only low input current and since their pins
are configured as outputs when voltage level on them is equal to 0, direct confectioning to LEDs
is carried out as it is shown on figure (Low current LED, cathode is connected to output pin).

Switches and Pushbuttons:

A push button switch is used to either close or open an electrical circuit depending on the
application. Push button switches are used in various applications such as
industrial equipment control handles, outdoor controls, mobile communication terminals, and
medical equipment, and etc. Push button switches generally include a push button disposed
within housing. The push button may be depressed to cause movement of the push button
relative to the housing for directly or indirectly changing the state of an electrical contact to open
or close the contact. Also included in a pushbutton switch may be an actuator, driver, or plunger
of some type that is situated within a switch housing having at least two contacts in
communication with an electrical circuit within which the switch is incorporated.
Typical actuators used for contact switches include spring loaded force cap actuators that
reciprocate within a sleeve disposed within the canister. The actuator is typically coupled to the
movement of the cap assembly, such that the actuator translates in a direction that is parallel with
the cap. A push button switch for a data input unit for a mobile communication device such as a
cellular phone, a key board for a personal computer or the like is generally constructed by
mounting a cover member directly on a circuit board. Printed circuit board (PCB) mounted
pushbutton switches are an inexpensive means of providing an operator interface on industrial
control products. In such push button switches, a substrate which includes a plurality of movable
sections is formed of a rubber elastomeric. The key top is formed on a top surface thereof with a
figure, a character or the like by printing, to thereby provide a cover member. Push button
switches incorporating lighted displays have been used in a variety of applications. Such
switches are typically comprised of a pushbutton, an opaque legend plate, and a back light to
illuminate the legend plate.

Block Diagram For Regulated Power Supply (RPS):

Figure: Power Supply


Transformer

A transformer is a device that transfers electrical energy from one circuit to another through
inductively coupled conductors—the transformer's coils. A varying current in the first or primary
winding creates a varying magnetic flux in the transformer's core, and thus a varying magnetic
field through the secondary winding. This varying magnetic field induces a varying
electromotive force (EMF) or "voltage" in the secondary winding. This effect is called mutual
induction.

Figure: Transformer Symbol

(or)

Transformer is a device that converts the one form energy to another form of energy like a
transducer.

Figure: Transformer
Basic Principle

A transformer makes use of Faraday's law and the ferromagnetic properties of an iron core to
efficiently raise or lower AC voltages. It of course cannot increase power so that if the voltage is
raised, the current is proportionally lowered and vice versa.

Figure: Basic Principle


Transformer Working

A transformer consists of two coils (often called 'windings') linked by an iron core, as shown in
figure below. There is no electrical connection between the coils; instead they are linked by a
magnetic field created in the core.

Figure: Basic Transformer

Transformers are used to convert electricity from one voltage to another with minimal loss of
power. They only work with AC (alternating current) because they require a changing magnetic
field to be created in their core. Transformers can increase voltage (step-up) as well as reduce
voltage (step-down).

Alternating current flowing in the primary (input) coil creates a continually changing magnetic
field in the iron core. This field also passes through the secondary (output) coil and the changing
strength of the magnetic field induces an alternating voltage in the secondary coil. If the
secondary coil is connected to a load the induced voltage will make an induced current flow. The
correct term for the induced voltage is 'induced electromotive force' which is usually abbreviated
to induced e.m.f.

The iron core is laminated to prevent 'eddy currents' flowing in the core. These are currents
produced by the alternating magnetic field inducing a small voltage in the core, just like that
induced in the secondary coil. Eddy currents waste power by needlessly heating up the core but
they are reduced to a negligible amount by laminating the iron because this increases the
electrical resistance of the core without affecting its magnetic properties.

Transformers have two great advantages over other methods of changing voltage:

1. They provide total electrical isolation between the input and output, so they can be safely
used to reduce the high voltage of the mains supply.
2. Almost no power is wasted in a transformer. They have a high efficiency (power out /
power in) of 95% or more.

Classification of Transformer

 Step-Up Transformer
 Step-Down Transformer

Step-Down Transformer

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 turn’s ratio of the two sets of windings determines the amount of
voltage transformation.
Figure: Step-Down Transformer

An example of this would be: 100 turns on the primary and 50 turns on the secondary, a ratio of
2 to 1.

Step down transformers can be considered nothing more than a voltage ratio device.

With step down transformers the voltage ratio between primary and secondary will mirror the
"turn’s ratio" (except for single phase smaller than 1 kva which have compensated secondary). A
practical application of this 2 to 1 turn’s ratio would be a 480 to 240 voltage step down. Note that
if the input were 440 volts then the output would be 220 volts. The ratio between input and
output voltage will stay constant. Transformers should not be operated at voltages higher than
the nameplate rating, but may be operated at lower voltages than rated. Because of this it is
possible to do some non-standard applications using standard transformers.

Single phase step down transformers 1 kva and larger may also be reverse connected to step-
down or step-up voltages. (Note: single phase step up or step down transformers sized less than 1
KVA should not be reverse connected because the secondary windings have additional turns to
overcome a voltage drop when the load is applied. If reverse connected, the output voltage will
be less than desired.)

Step-Up Transformer

A step up transformer has more turns of wire on the secondary coil, which makes a larger
induced voltage in the secondary coil. It is called a step up transformer because the voltage
output is larger than the voltage input.
Step-up transformer 110v 220v design is one whose secondary voltage is greater than its primary
voltage. This kind of transformer "steps up" the voltage applied to it. For instance, a step up
transformer is needed to use a 220v product in a country with a 110v supply.

A step up transformer 110v 220v converts alternating current (AC) from one voltage to another
voltage. It has no moving parts and works on a magnetic induction principle; it can be designed
to "step-up" or "step-down" voltage. So a step up transformer increases the voltage and a step
down transformer decreases the voltage.

The primary components for voltage transformation are the step up transformer core and coil.
The insulation is placed between the turns of wire to prevent shorting to one another or to
ground. This is typically comprised of Mylar, nomex, Kraft paper, varnish, or other materials. As
a transformer has no moving parts, it will typically have a life expectancy between 20 and 25
years.

Figure: Step-Up Transformer


Applications:

Generally these Step-Up Transformers are used in industries applications only.

Types of Transformer

Mains Transformers

Mains transformers are the most common type. They are designed to reduce the AC mains
supply voltage (230-240V in the UK or 115-120V in some countries) to a safer low voltage.
The standard mains supply voltages are officially 115V and 230V, but 120V and 240V are the
values usually quoted and the difference is of no significance in most cases.

Figure: Main Transformer

To allow for the two supply voltages mains transformers usually have two separate primary coils
(windings) labeled 0-120V and 0-120V. The two coils are connected in series for 240V (figure
2a) and in parallel for 120V (figure 2b). They must be wired the correct way round as shown in
the diagrams because the coils must be connected in the correct sense (direction):
Most mains transformers have two separate secondary coils (e.g. labeled 0-9V, 0-9V) which may
be used separately to give two independent supplies, or connected in series to create a centre-
tapped coil (see below) or one coil with double the voltage.

Some mains transformers have a centre-tap halfway through the secondary coil and they are
labeled 9-0-9V for example. They can be used to produce full-wave rectified DC with just two
diodes, unlike a standard secondary coil which requires four diodes to produce full-wave
rectified DC.

A mains transformer is specified by:

1. Its secondary (output) voltages Vs.


2. Its maximum power, Pmax, which the transformer can pass, quoted in VA (volt-amp). This
determines the maximum output (secondary) current, Imax...

...where Vs is the secondary voltage. If there are two secondary coils the maximum
power should be halved to give the maximum for each coil.
3. Its construction - it may be PCB-mounting, chassis mounting (with solder tag
connections) or toroidal (a high quality design).

Audio Transformers

Audio transformers are used to convert the moderate voltage, low current output of an audio
amplifier to the low voltage, high current required by a loudspeaker. This use is called
'impedance matching' because it is matching the high impedance output of the amplifier to the
low impedance of the loudspeaker.

Figure: Audio transformer


Radio Transformers

Radio transformers are used in tuning circuits. They are smaller than mains and audio
transformers and they have adjustable ferrite cores made of iron dust. The ferrite cores can be
adjusted with a non-magnetic plastic tool like a small screwdriver. The whole transformer is
enclosed in an aluminum can which acts as a shield, preventing the transformer radiating too
much electrical noise to other parts of the circuit.

Figure: Radio Transformer

Turns Ratio and Voltage

The ratio of the number of turns on the primary and secondary coils determines the ratio of the
voltages...

...where Vp is the primary (input) voltage, Vs is the secondary (output) voltage, Np is the number
of turns on the primary coil, and Ns is the number of turns on the secondary coil.

Diodes
Diodes allow electricity to flow in only one direction. The arrow of the circuit symbol shows the
direction in which the current can flow. Diodes are the electrical version of a valve and early
diodes were actually called valves.

Figure: Diode Symbol

A diode is a device which only allows current to flow through it in one direction. In this
direction, the diode is said to be 'forward-biased' and the only effect on the signal is that there
will be a voltage loss of around 0.7V. In the opposite direction, the diode is said to be 'reverse-
biased' and no current will flow through it.

3.2.2 Rectifier

The purpose of a rectifier is to convert an AC waveform into a DC waveform (OR) Rectifier


converts AC current or voltages into DC current or voltage. There are two different rectification
circuits, known as 'half-wave' and 'full-wave' rectifiers. Both use components called diodes to
convert AC into DC.

The Half-wave Rectifier

The half-wave rectifier is the simplest type of rectifier since it only uses one diode, as shown in
figure.
Figure: Half Wave Rectifier

Figure 2 shows the AC input waveform to this circuit and the resulting output. As you can see,
when the AC input is positive, the diode is forward-biased and lets the current through. When
the AC input is negative, the diode is reverse-biased and the diode does not let any current
through, meaning the output is 0V. Because there is a 0.7V voltage loss across the diode, the
peak output voltage will be 0.7V less than Vs.

Figure: Half-Wave Rectification


While the output of the half-wave rectifier is DC (it is all positive), it would not be suitable as a
power supply for a circuit. Firstly, the output voltage continually varies between 0V and Vs-
0.7V, and secondly, for half the time there is no output at all.

The Full-wave Rectifier

The circuit in figure 3 addresses the second of these problems since at no time is the output
voltage 0V. This time four diodes are arranged so that both the positive and negative parts of the
AC waveform are converted to DC. The resulting waveform is shown in figure 4.

Figure: Full-Wave Rectifier


Figure: Full-Wave Rectification

When the AC input is positive, diodes A and B are forward-biased, while diodes C and D are
reverse-biased. When the AC input is negative, the opposite is true - diodes C and D are
forward-biased, while diodes A and B are reverse-biased.

While the full-wave rectifier is an improvement on the half-wave rectifier, its output still isn't
suitable as a power supply for most circuits since the output voltage still varies between 0V and
Vs-1.4V. So, if you put 12V AC in, you will 10.6V DC out.
Capacitor Filter

The capacitor-input filter, also called "Pi" filter due to its shape that looks like the Greek letter
pi, is a type of electronic filter. Filter circuits are used to remove unwanted or undesired
frequencies from a signal.

Figure: Capacitor Filter

A typical capacitor input filter consists of a filter capacitor C1, connected across the rectifier
output, an inductor L, in series and another filter capacitor connected across the load.

1. The capacitor C1 offers low reactance to the AC component of the rectifier output while
it offers infinite reactance to the DC component. As a result the capacitor shunts an
appreciable amount of the AC component while the DC component continues its journey
to the inductor L
2. The inductor L offers high reactance to the AC component but it offers almost zero
reactance to the DC component. As a result the DC component flows through the
inductor while the AC component is blocked.
3. The capacitor C2 bypasses the AC component which the inductor had failed to block. As
a result only the DC component appears across the load RL.

Figure: Centered Tapped Full-Wave Rectifier with a Capacitor Filter


Voltage Regulator

A voltage regulator is an electrical regulator designed to automatically maintain a constant


voltage level. It may use an electromechanical mechanism, or passive or active electronic
components. Depending on the design, it may be used to regulate one or more AC or DC
voltages. There are two types of regulator are they.

 Positive Voltage Series (78xx) and


 Negative Voltage Series (79xx)

78xx:
’78’ indicate the positive series and ‘xx’ indicates the voltage rating. Suppose 7805 produces the
maximum 5V.’05’indicates the regulator output is 5V.

79xx:
’78’ indicate the negative series and ‘xx’ indicates the voltage rating. Suppose 7905
produces the maximum -5V.’05’indicates the regulator output is -5V.

These regulators consists the three pins there are

Pin1: It is used for input pin.

Pin2: This is ground pin for regulator

Pin3: It is used for output pin. Through this pin we get the output.

Figure: Regulator
SOFTWARE DESCRIPTION

1. KEIL IDE

ABOUT KEIL:-

1. Click on the Keil u Vision4 Icon on Desktop

2. .The following fig will appear

3. Click on the Project menu from the title bar

4. Then Click on New Project


5. Save the Project by typing suitable project name with no extension in u r own folder
sited in either C:\ or D:\
6. Then Click on Save button above.
7. Select the component for u r project. i.e. Atmel……
8. Click on the + Symbol beside of Atmel
9. Select AT89S52 as shown below
10.Then Click on “OK”
11.The Following fig will appear

12.Then Click either YES or NO………mostly “NO”


13.Now your project is ready to USE
14.Now double click on the Target1, you would get another option “Source group 1” as shown in
next page.
15. Click on the file option from menu bar and select “new”
16.The next screen will be as shown in next page, and just maximize it by double clicking on
its blue boarder.

17.Now start writing program in either in “C” or “ASM”


18.For a program written in Assembly, then save it with extension “. asm” and for “C”
based program save it with extension “ .C”
19.Now right click on Source group 1 and click on “Add files to Group Source”
20. Now you will get another window, on which by default “C” files will appear.
20.Now select as per your file extension given while saving the file
21.Click only one time on option “ADD”
22.Now Press function key F7 to compile. Any error will appear if so happen.

23.If the file contains no error, then press Control+F5 simultaneously.

24.The new window is as follows


25.Then Click “OK”

26.Now Click on the Peripherals from menu bar, and check your required port as shown in
fig below
27.Drag the port a side and click in the program file.
28.Now keep Pressing function key “F11” slowly and observe.
29.You are running your program successfully
2. FLASH MAGIC

Introduction Of Flash Magic

NXP Semiconductors produce a range of Microcontrollers that feature both on-chip Flash
memory and the ability to be reprogrammed using In-System Programming technology.

Flash Magic is Windows software from the Embedded Systems Academy that allows easy access
to all the ISP features provided by the devices. These features include

 Erasing the Flash memory (individual blocks or the whole device)

 Programming the Flash memory

 Modifying the Boot Vector and Status Byte

 Reading Flash memory

 Performing a blank check on a section of Flash memory

 Reading the signature bytes

 Reading and writing the security bits

 Direct load of a new baud rate (high speed communications)

 Sending commands to place device in Boot loader mode

Flash Magic provides a clear and simple user interface to these features. Under Windows, only
one application may have access the COM Port at any one time, preventing other applications
from using the COM Port.Magic only obtains access to the selected COM Port when ISP
operations are being performed. This means that other applications that need to use the COM
Port, such as debugging tools, may be used while Flash Magic is loaded.
Screenshot of Flash Magic Window

The window is divided up into five sections. Work your way from section 1 to section 5 to
program a device using the most common functions.

At the very bottom left of the window is an area where progress messages will be displayed and
at the very bottom right is where the progress bar is displayed. In between the messages and the
progress bar is a count of the number of times the currently selected hex file has been
programmed since it was last modified or selected.
Just above the progress information Embedded Hints are displayed. These are rotating Internet
links that you can click on to go to a web page using your default browser.

Menus

There are five menus, File, ISP, Options, Tools and Help.
The File menu provides access to loading and saving Hex Files, loading and saving settings files
and exiting the application.

The Options menu allows access to the advanced options and includes an item to reset all
options.

The ISP menu provides access to the less commonly used ISP features.
The Tools menu provides features that support the operation and use of Flash Magic.
The Help menu contains items that link directly to useful web pages and also open the Help
About window showing the version number.

Tooltips

Throughout the Flash Magic user interface extensive use has been made of tooltips. These are
small text boxes that appear when you place the pointer over something and keep it still for a
second or two.
Note that tooltips do not appear for items that are disabled (grayed out).

Saving Options

The options in the main window and the Advanced Options window are automatically saved to
the registry whenever Flash Magic is closed. This removes the need for an explicit save
operation. When Flash Magic is restarted the main window and the Advanced Options window
will appear as you left it, so you do not have to repeatedly make the same selections every time
you start the application. If you wish to reset the options to the original defaults then choose
Reset from the Options menu.

FIVE STEP PROGRAMMING

For each step there is a corresponding section in the main window as described in the User
Interface Tour.
Step 1 – Connection Settings

Before the device can be used the settings required to make a connection must be specified.

COM Port Settings

Select the desired COM port from the drop down list or type the desired COM port directly into
the box. If you enter the COM port yourself then you must enter it in one of the following
formats

 COM n
 n

Any other format will generate an error. So if you want to use COM 5 (which is not present on
the drop down list) you can directly type in either “COM 5” or “5”.
Baud Rate Settings
Select the baud rate to connect at. Try a low speed first. The maximum speed that can be used
depends on the crystal frequency on your hardware. You can try connecting at higher and higher
speeds until connections fail. Then you have found the highest baud rate to connect at.
Alternatively, some devices support high speed communications.

Device Selection
Select the device being used from the drop down list. Ensure you select the correct one as
different devices have different feature sets and different methods of setting up the serial
communications.

Interface Selection
Select the interface being used, if any. An interface is a device that connects between your PC
and the target hardware. If you simply have a serial cable or USB to serial cable connecting your
COM port to the target hardware, then you can choose "None (ISP)". Choosing the correct
interface will automatically configure Flash Magic for that interface, along with enabling and
disabling the relevant features.

Oscillator Frequency
Enter the oscillator frequency used on the hardware. Do not round the frequency, instead enter it
as precisely as possible. Some devices do not require the oscillator frequency to be entered, so
this field will not be displayed.
Once the options are set ensure the device is running the on-chip Boot loader if you are using a
manual ISP entry method.
Note that the connection settings affect all ISP features provided by Flash Magic.
Step 2 – Erasing

This step is optional, however if you attempt to program the device without first erasing at least
one Flash block, then Flash Magic will warn you and ask you if you are sure you want to
program the device.

 Select each Flash block that you wish to erase by clicking on its name.
 If you wish to erase all the Flash then check that option.
 If you want to check to erase a Flash block and all the Flash then the Flash block will not
be individually erased.
 If you wish to erase only the Flash blocks used by the hex file you are going to select,
then check that option.

For most devices erasing all the Flash also results in the Boot Vector and Status Byte being set to
default values, which ensure that the Boot loader will be executed on reset, regardless of the state
of the PSEN pin or other hardware requirements.
Only when programming a Hex File has been completed will the Status Byte be set to 00H to
allow the code to execute.
This is a safeguard against accidentally attempting to execute when the Flash is erased.
On some devices erasing all the Flash will also erase the security bits. This will be indicated by
the text next to the Erase all Flash option.
On some devices erasing all the Flash will also erase the speed setting of the device (the number
of clocks per cycle) setting it back to the default.This will be indicated by the text next to the
Erase all Flash option.

Step 3 – Selecting the Hex File


This step is optional. If you do not wish to program a Hex File then do not select one.

You can either enter a path name in the text box or click on the Browse button to select a Hex
File by browsing to it.
Also you can choose Open… from the File menu.
Note that the Hex file is not loaded or cached in any way. This means that if the Hex File is
modified, you do not have to reselect it in Flash Magic. Every time the Hex File is programmed
it is first re-read from the location specified in the main window.
The date the Hex file was last modified is shown in this section. This information is updated
whenever the hex file is modified. The hex file does not need to be reselected.
Clicking on more info or choosing Information… from the File menu will display additional
information about the Hex file.
The information includes the range of Flash memory used by the Hex file, the number of bytes of
Flash memory used and the percentage of the currently selected device that will be filled by
programming the Hex file.
If the device supports programming and execution from RAM, for example the ARM devices,
then the hex file may contain records for the RAM.
First the flash will be programmed followed by the RAM. Programs loaded into RAM via a hex
file may be executed using such features as the Go option.

Step 4 – Options
Flash Magic provides various options that may be used after the Hex File has been programmed.
This section is optional; however verify After Programming, Fill Unused Flash and Gen Block
Checksums may only be used if a Hex File is selected (and therefore being programmed), as they
all need to know either the Hex File contents or memory locations used by the Hex File.

Verify After Programming


Checking the Verify after Programming option will result in the data contained in the Hex File
being read back from Flash and compared with the Hex File after programming. This helps to
ensure that the Hex File was correctly programmed. If the device does not support verifying then
this item will be disabled.
Fill Unused Flash

Checking the Fill Unused Flash option will result in every memory location not used by the Hex
File being programmed with the value that sets all the bits to a programmed state.
Once a location has been programmed with this feature it cannot be reprogrammed with any
other value, preventing someone from programming the device with a small program to read out
the contents of Flash or altering the application’s operation.

General Block Checksums


Checking the Gen Block Checksums option will instruct Flash Magic to program the highest
location in every Flash block used by the Hex File with a special “checksum adjuster value”.
This value ensures that when a checksum is calculated for the whole Flash Block it will equal
55H, providing the contents of the Flash block have not be altered or corrupted. Please refer to
the Block Checksums section for more information.

Execute option
Checking the Execute option will cause the downloaded firmware to be executed automatically
after the programming is complete. Note that this will not work if using the Hardware Reset
option or a device that does not support this feature.

Step 5 – Performing the Operations


Step 5 contains a Start button.
Clicking the Start button will result in all the selected operations in the main window taking
place. They are:
 Erasing Flash
 Programming the Hex File
 Verifying the Hex File
 Filling Unused Flash
 Generating Checksums
 Programming the clocks bit
 Programming the Security Bits
 Executing the firmware

Once started the progress information and a progress bar will be displayed at the bottom of the
main window.
In addition the Start button will change to a cancel button. Click on the cancel button to cancel
the operation.
Note that if you cancel during erasing all the Flash, it may take a few seconds before the
operation is cancelled.
Once the operations have finished the progress information will briefly show the message
“Finished”.
The Programmed Count shown next to the progress bar will increment. This shows the total
number of times the hex file has been programmed.
Modifying the hex file or selecting another hex file will reset the count.
Alternatively, right-clicking over the count provides a menu with the option to immediately reset
the count.
-
3. PROTEUS

What Is Proteus ??

Basically PROTEUS is also a simulating software but it helps you attach many
components with the 8051. Like resistors, capacitors, LEDs, LCDs, keypads, ICs etc. and
these are just few that I have named in general. It has a complete library and you will find
everything that you will ever need. You can design your complete circuit and then
simulate it to view the final output. This means that after perfecting your project on the
programming side in KEIL, you'll need to simulate it on PROTEUS to determine the
output of the hardware components and change it if need be. This will completely ensure
your project's success.

USING PROTEUS

PROTEUS is designed to be user-friendly and you will get the hold of it instantly. There is no
need to worry about some complex configuration / settings prior to simulation. Here are the basic
steps.

 Place your components from the library


 Connect them accordingly
 Load HEX file (if 8051 is involved)
 Simulate the circuit

UNDERSTAND EACH STEP IN DETAIL

1. PLACING COMPONENTS

 Click the "Pick from library (P)" button as shown in the figure
 Select any category
 Select item from the list
 Click OK

 After selecting component, click anywhere in the design area to select it and then click
again to place it

2. CONNECTING COMPONENTS

 Place all the required components


 Connect the desired nodes by clicking at starting and ending points
3. LOAD HEX FILE

 Double click the 8051 component to open its properties


 Browse for the HEX file as shown and select it

And don't worry, in PROTEUS, there is no need to provide the RESET circuit or crystal
oscillator to the microcontroller. It will work just fine even without it. The frequency can be
adjusted in the properties window as well.
4. SIMULATING THE CIRCUIT

 The controls at the left-bottom corner will help you simulate the circuit in real time

The above picture is the complete circuitry for testing an LED on P2.0 like toggling (ON / OFF)
through programming but we will get to that part later on. At this point, you will just see the
LED glow if you have programmed it to be always ON.
Like this developer done design on Proteus before starts working on Hardware.
PCB DESIGN

A printed circuit board (PCB) mechanically supports and electrically connects electronic
components using conductive tracks, pads and other features etched from copper
sheets laminated onto a non-conductive substrate. Components – capacitors, resistors or active
devices – are generally soldered on the PCB. Advanced PCBs may contain components
embedded in the substrate.

PCBs can be single sided (one copper layer), double sided (two copper layers) or multi-
layer (outer and inner layers). Conductors on different layers are connected with vias. Multi-
layer PCBs allow for much higher component density.

FR-4 glass epoxy is the primary insulating substrate. A basic building block of the PCB is an FR-
4 panel with a thin layer of copper foil laminated to one or both sides. In multi-layer boards
multiple layers of material are laminated together.

Printed circuit boards are used in all but the simplest electronic products. Alternatives to PCBs
include wire wrap and point-to-point construction. PCBs require the additional design effort to
lay out the circuit, but manufacturing and assembly can be automated. Manufacturing circuits
with PCBs is cheaper and faster than with other wiring methods as components are mounted and
wired with one single part. A minimal PCB with a single component used for easier modeling is
called breakout board.

When the board has no embedded components it is more correctly called a printed wiring
board (PWB) or etched wiring board. However, the term printed wiring board has fallen into
disuse. A PCB populated with electronic components is called a printed circuit
assembly (PCA), printed circuit board assembly or PCB assembly (PCBA). The IPC preferred
term for assembled boards is circuit card assembly (CCA),[2] and for assembled backplanes it
is backplane assemblies. The term PCB is used informally both for bare and assembled boards.
Express PCB is a free CAD software , specially designed to help us to create printed circuit
board. Express PCB is the program that will be used to design printed circuits boards and
Express SCH is a program that can be used do design a circuit diagram ( to draw circuits) ..

Steps To Start With Express SCH

Step 1- Select the Components

Begin your schematic by placing the components. Select the parts from the Component
Manager dialog box. Express SCH includes a large library with hundreds of component symbols
(ICs, resistors, capacitors…) that you can use to draw your electronic circuits.

Step 2- Position the Components


Drag each component to the desired location on the page. The Snap to grid feature makes it easy
to neatly align the symbols. If all of the components do not fit on a single page, add additional
sheets. All the sheets of a schematic are linked together and saved in one file.

Step 3- Add the Wires

Now draw the wires to connect the parts together. Add each wire by clicking on a component’s
pin, then dragging the wire to the pin it connects to.

Step 4- Edit the Schematic


Making changes to a schematic is simple using standard commands such as Copy, Cut and Paste.
Rearranging the components is easy by dragging them with the mouse. Wires always stay
connected to their pins, even when you move things around
Step 5- Link the Schematic and PCB

After you complete your schematic, it can be linked to your circuit board layout file.
This image of the ExpressPCB layout program shows how it guides you in designing your board
by highlighting in blue the pins that should be wired together.
Steps To Start With Express PCB

Step 1- Select the Components

Begin your layout by adding the components. Select the parts from the Component Manager
dialog box. Many components (such as connectors) include Digi-key part numbers to make
ordering easy.
Step 2:- Position the Components

Drag each component to the desired location on your board. The Snap to grid feature makes it
easy to neatly align the parts.

Step 3 :-Add the Traces

Now add each trace by clicking on the pin of a component and dragging the trace to another pin.
If you link your schematic file to the PCB, then the Express PCB program highlights the pins
that should be wired together in blue.
Step 4- Edit the Layout

Making changes is simple using standard commands such as Copy, Cut and Paste. Rearrange the
parts by dragging them with the mouse. Traces always stay connected to their pins, even when
you move things around. You can set the properties of items in your layout by double-clicking
on them. For example, double-click on a trace to change its layer or width.

Step 5:-

Completing PCB layout in Express PCB.


BOARD LAYOUT

1. 8051 development Board


2. LCD Display
3. Power supply circuit
ALGORITHM

STEP 1:- Power Up hardware.

STEP 2:- Initialize hardware Module.

STEP 3:-Display On LCD as “ACTIVE PHASE SELECTOR”

STEP 4:- if all phase are active by default load shifted to R phase.

STEP 5:- if R phase is absent then load shifted to Y phase

STEP 6:- if both R and Y phase are absent then load shifted to B phase.

STEP 7:- if all phases are absent by default load will off.
FLOWCHART

START

Power Up Hardware

Initialize Hardware Module

Display On LCD “ACTIVE PHASE


SELECTOR”

Microcontroller continuously check for

phase

If all NO
phases are A
present??

YES

By default R phase is selected


Step 1:

NO
If Y & B
phases are B
absent??

YES

By default R phase is selected

Step 2:

NO
If B & R
phases are C
absent??

YES

By default Y phase is selected


Step 3:

NO
If Y & R
phases are D
absent??

YES

By default B phase is selected

Step 4:

If All
phases are
absent??

YES

By default load will off.


CONCLUSION

In this system we automatically shift phase if any phase absence .

It tested on hardware with some trial n error conditions.

We make some truth table for it n using truth table we checking failure condition & depend on
that condition we shift phase automatically.

The system operates smoothly as expected. It is reliable, durable and portable. The cost involved
in developing it, makes it much more affordable than comparable product.
FUTURE SCOPE

 In future for enhance system we add some module.


 Like we can add GSM module in system.
 Whenever load fails we send message through GSM to respected person mobile no also
we send location using GPS module.
ADVANTAGE

 Automatic Switching Of The Load Will Decrease Human Errors.

 Controller Will See That The Load Is Balanced At Every Instant Of Time.

 The Switching Time Is Less Because Of Which The Fault Duration On The System Is
Very Less.
APPLICATIONS:

 Can be used in industries and commercial complexes

 Can be used near distribution transformers to switch the load between phases
automatically.
 Hospitals
 Colleges
 Home
REFERENCES

[1] Steven M. Hietpas, Mark Naden,”Automatic Voltage regulator


using an AC Voltage-Voltage Converter,” IEEE Transaction on
Industrial Application, Vol 36,no 1, January-February 2000.
[2] Gua-Kiang Hung, Chih- chang Chang, “Automatic Phase Shift
Method for Islanding Detection of Grid –Connected Photovoltaic
Inverters,” IEEE Transaction On Energy conversion, Vol.18.No.1,
March 2003.
[3] Erika Twining, “Grid Current Regulation Of A Three Phase
Voltage Source Inverter With an LCL Input Filter,” Transaction
On Power Electronic, Vol .18, No .3 May 2003.
[4] Mariusz Malinowski and Jasinski Marek,”Simple Direct Power
Control Of Three Phase PWM Rectifier Using Space Vector
Modulation (DPC-SVM),“ IEEE Transaction on Industrial Electronic
, Vol.51,No.2,April 2004

[5].Himadri Sil “Design Of Automatic Phase Selector From Any Available Three Phase With
The Use Of Logic Gate And Relay Driver” Ijiet , June 2016 .

[6].Bhanu Bhawesh “Automatic Phase Changer” minor report on Automatic phase changer.

[7].Oduobuk, E. J., Ettah, E. B. , Ekpenyong, E. E. “Design And Implementation Of


Automatic Three Phase Changer Using Lm324 Quad Integrated Circuit” International
Journal of Engineering and Technology Research Vol. 2, No. 4, April 2014.

[8].en.wikipedia.org/

You might also like