+ All Categories
Home > Documents > Doc1.docx

Doc1.docx

Date post: 29-Jan-2016
Category:
Upload: rani-sul
View: 217 times
Download: 0 times
Share this document with a friend
Popular Tags:
106
CAPACITIVE LOAD BANKS FOR POWER FACTOR CORRECTION WITH AUTOMATIC AND MANUAL MODE SETTING ABSTRACT The Purpose of this paper is implementing a new technology for power factor improvement of 3 phase induction motor as well as for single phase induction motor , as improvement of power factor is necessary for industrial as well as domestic areas & to make power factor as close as unity without facing penalty from electrical distributers. As we know in industries most of motor which is usually used is induction motor and induction motor having low power factor also. Home appliances which are generally used are generally having low power factor. Hence there is need of power factor improvement in case of household appliances as well as in industrial purpose. Induction motor is most widely used motors in industries .As name of this motor specifies this motor having low power factor. Hence there is need of power factor improvement. The power factor correction of electrical loads is a problem common to all industrial companies. Earlier the power factor correction was done by adjusting the capacitive bank manually [1]. The automated power factor corrector (APFC) using capacitive load bank is helpful in providing the power factor correction. Proposed automated project involves measuring the power factor value from the load using microcontroller. The design of this auto-adjustable power factor correction is to ensure the entire power system always preserving unity power
Transcript
Page 1: Doc1.docx

CAPACITIVE LOAD BANKS FOR POWER FACTOR CORRECTION WITH

AUTOMATIC AND MANUAL MODE SETTING

ABSTRACT

The Purpose of this paper is implementing a new technology for power factor improvement of 3

phase induction motor as well as for single phase induction motor , as improvement of power

factor is necessary for industrial as well as domestic areas & to make power factor as close as

unity without facing penalty from electrical distributers. As we know in industries most of motor

which is usually used is induction motor and induction motor having low power factor also.

Home appliances which are generally used are generally having low power factor. Hence there is

need of power factor improvement in case of household appliances as well as in industrial

purpose. Induction motor is most widely used motors in industries .As name of this motor

specifies this motor having low power factor. Hence there is need of power factor improvement.

The power factor correction of electrical loads is a problem common to all industrial companies.

Earlier the power factor correction was done by adjusting the capacitive bank manually [1]. The

automated power factor corrector (APFC) using capacitive load bank is helpful in providing the

power factor correction. Proposed automated project involves measuring the power factor value

from the load using microcontroller. The design of this auto-adjustable power factor correction is

to ensure the entire power system always preserving unity power factor. The software and

hardware required to implement the suggested automatic power factor correction scheme are

explained and its operation is described. APFC thus helps us to decrease the time taken to correct

the power factor which helps to increase the efficiency. In a purely resistive ac circuit, voltage

and current waveforms are in phase, changing polarity at the same instant in each cycle. Where

reactive loads are present, such as with capacitors or inductors, energy storage in the loads result

in a time difference between the current and voltage waveforms. This stored energy returns to the

source and is not available to do work at the load. a circuit with a low power factor will have

thus higher currents to transfer a given quantity of real power than a circuit with a high power

factor.

Page 2: Doc1.docx

INTRODUCTION

An embedded system is a combination of software and hardware to perform a

dedicated task. Some of the main devices used in embedded products

are Microprocessorsand Microcontrollers. Microprocessors are commonly referred to 

as general purpose processors as they simply accept the inputs, process it and give the output.

In contrast, a microcontroller not only accepts the data as inputs but also manipulates it,

interfaces the data with various devices, controls the data and thus finally gives the result. Majority of the

loads in the industries are highly inductive in nature such as induction motors, AC/DC drives,

welding machines, arc furnaces, fluorescent Lightings, electronic controls and computers. There

may be a few resistive loads for heaters and incandescent bulbs. Very rarely industries may have

capacitive loads such as synchronous motors . Net industrial load is highly inductive causing a

very poor lagging power factor. If this poor power factor is left uncorrected, the industry will

require a high maximum demand from Electricity Board and also will suffer a penalty for poor

power factor. Standard practice is to connect power capacitors in the power system at appropriate

places to compensate the inductive nature of the load. Any motor that operates on alternating

current requires apparent power, but apparent power is addition of active power and reactive

power. Active power is the power which is actually consumed by the load. Reactive power is the

power demanded by the load and returned to the power source. The simplest way to specify

power factor is ―POWER FACTOR is the ratio between the useful (true) power whose unit is

KW to the total (apparent) power whose unit is KVA consumed by an A.C electrical equipment

or motor‖. Power factor is a measure of how effectively electrical power is used to perform an

useful work. The ideal power factor is unity or one. If power factor is less than one it means that

excess power is required to perform or achieve the actual work.

Page 3: Doc1.docx

LITERATURE SURVEY

An electrical load that operates on alternating current requires apparent power, which consists of

real power plus reactive power. Real power is the power actually consumed by the load. Reactive

power is repeatedly demanded by the load and returned to the power source, and it is the cyclical

effect that occurs when alternating current passes through a load that contains a reactive

component. The presence of reactive power causes the real power to be less than the apparent

power, and so, the electric load has a power factor of less than 1. The reactive power increases

the current flowing between the power source and the load, which increases the power losses

through transmission and distribution lines. This results in operational and financial losses for

power companies.

OBJECTIVES

The aim of this project is to find a good solution to high energy consumption by industries,

through a sustainable development of automatic system that corrects low power factor. The

advantages of correcting power factor reduced demand charges, increased load carrying

capabilities in existing circuits, improved voltage and reduced power system loses. Specific

Objectives 5 In light of the above objective, specific objectives of the study are as follows:

Develop a prototype of an automatic power factor corrector with microcontroller as the brain of

the control system. The overall purpose is to improve low power factor, improve energy

consumption by industries, improve stability and efficiency of the transmission network.

Though correction of power factor is very old practice, we have considered the work done in

recent years in our Thesis. Many of the authors below have suggested and prescribe many ways

of power factor correction but this work concentrates on Barsoum model: We have considered

the work done in the previous years, starting from 1988. Sharkawi et al. proposed a continuing

effort to develop an effective, reliable, and inexpensive adaptive power factor controller (APFC).

The APFC was able to compensate adaptively the reactive power of rapidly varying loads

without adding harmonics or transients to the power system. Based on thousands of hours of

field operation, the APFC had substantially modified to improve its reliability and effectiveness.

(Sharkawi et al. 1988)

Page 4: Doc1.docx

METHODOLOGY

The aim is to monitor the power factor continuously and in the event of change in power factor,

which usually result in the demand of higher current a correction action is initialized to

compensate for this difference by continuous changing variable capacitors value through

switching process. The overall system requires only one PIC chip, a few power electronic

components and bank of capacitors.

Page 5: Doc1.docx

BLOCK DIAGRAM

Page 6: Doc1.docx

DESCRIPTION

This project provides continuous power factor correction using capacitive bank loading. Power

factor is a measure of how effectively you are using electricity. Various types of power are at

work to provide us with electrical energy. Improving the PF can maximize current-carrying

capacity, improve voltage to equipment, reduce power losses, and lower electric bills. The

simplest way to improve power factor is to add PF correction capacitors to the electrical system.

PF correction capacitors act as reactive current generators. They help offset the non-working

power used by inductive loads, thereby improving the power factor. The interaction between PF

capacitors and specialized equipment, such as variable speed drives, requires a well designed

system.

PF correction capacitors can switch on every day when the inductive equipment starts. The most

practical and economical power factor correction device is the capacitor. It improves the power

factor because the effects of capacitance are exactly opposite from those of inductance.

In this project, the capacitors can be connected using manual switches in manual operation mode.

In automatic mode, the capacitors are connected through electromagnetic relay with predefined

time delay to demonstrate the power factor correction practically.

AT89S52 MCU is used to control the switching relays. 16X2 alphanumeric LCD is used to

display the status. This project uses regulated 5V, 750mA power supply. 7805 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.

The power factor of an ac electric power system is defined as the ratio of the real power to the

apparent power, and is a number between 0 and 1. Real power is the capacity of the electric load

for performing work in a particular time. Apparent power is the product of the current and

voltage of the electric load. Due to energy stored in the load and returned to the source, or due to

a non-linear load that distorts the wave shape of the current drawn from the source, the apparent

Page 7: Doc1.docx

power can be greater than the real power. Low-power-factor loads increase losses in a power

distribution system and result in increased energy costs.

Power Factor Power factor is an energy concept that is related to power flow in electrical

systems. To understand power factor, it is helpful to understand three different types of power in

electrical systems. Real Power is the power that is actually converted into useful work for

creating heat, light and motion. Real power is measured in kilowatts (kW)q and is totalized by

the electric billing meter in kilowatt-hours (kWH). An example of real power is the useful work

that directly turns the shaft of a motor. Reactive Power is the power used to sustain the

electromagnetic field in inductive and capacitive equipment. It is the non- working power

component. Reactive power is measured in kilovolt-amperes reactive (kVAR). Reactive power

does not appear on the customer billing statement. Total Power or Apparent power is the

combination of real power and reactive power. Total power is measured in kilovolt-amperes

(kVA) and is totalized by the electric billing meter in kilovolt-ampere-hours (kVAH). Power

factor (PF) is defined as the ratio of real power to total power, and is expressed as a percentage

(%). Power factor = Real Power (kWH) Total Power (kVAH) x 100.

Power Factor Correction Power factor correction is the process of compensating for the lagging

current by creating a leading current by connecting capacitors to the supply. A sufficient

capacitance can be connected so that the power factor is adjusted to be as close to unity as

possible. Power factor correction (PFC) is a system of counteracting the undesirable effects of

electric loads that create a power factor that is less than one (1). Power factor correction may be

applied either by an electrical power transmission utility to improve the stability and efficiency

of the transmission network or, correction may be installed by individual electrical customers to

reduce the costs charged to them by their electricity service provider .

Page 8: Doc1.docx

An electrical load that operates on alternating current requires apparent power, which consists of

real power and reactive power. Real power is the power actually consumed by the load. Reactive

power is repeatedly demanded by the load and returned to the power source, and it is the cyclical

effect that occurs when alternating current passes through a load that contains a reactive

component. The presence of reactive power causes the real power to be less than the apparent

power, so the electric load has a power factor of less than one. The reactive power increases the

current flowing between the power source and the load, which increases the power losses

through transmission and distribution lines. This results in operational and financial losses for

power companies. Therefore, power companies require their customers, especially those with

large loads, to maintain their power factors above a specified amount especially around ally 0.90

or higher, or be subject to additional charges. Electrical engineers involved with the generation,

transmission, distribution and consumption of electrical power have an interest in the power

factor of loads because power factors affect efficiencies and costs for both the electrical power

industry and the consumers. In addition to the increased operating costs, reactive power can

require the use of wiring, switches, circuit breakers, transformers and transmission lines with

higher current capacities.

Capacitor A capacitor (originally known as condenser) is a passive two-terminal electrical

component used to store energy in an electric field. The forms of practical capacitors vary

widely, but all contain at least two electrical conductors separated by a dielectric (insulator); for

example, one common construction consists of metal foils separated by a thin layer of insulating

film. Capacitors are widely used as parts of electrical circuits in many common electrical

devices. When there is a potential difference (voltage) across the conductors, a static electric

field develops across the dielectric, causing positive charge to collect on one plate and 24

negative charge on the other plate. Energy is stored in the electrostatic field. An ideal capacitor is

characterized by a single constant value, capacitance, measured in farads. This is the ratio of the

electric charge on each conductor to the potential difference between them. The capacitance is

greatest when there is a narrow separation between large areas of conductor; hence capacitor

conductors are often called plates, referring to an early means of construction. In practice, the

dielectric between the plates passes a small amount of leakage current and also has an electric

Page 9: Doc1.docx

field strength limit, resulting in a breakdown voltage, while the conductors and leads introduce

an undesired inductance and resistance. Capacitors are widely used in electronic circuits for

blocking direct current while allowing alternating current to pass, in filter networks, for

smoothing the output of power supplies, in the resonant circuits that tune radios to particular

frequencies, in electric power transmission systems for stabilizing voltage and power flow, and

for many other purposes. Capacitors also require reactive power to operate. However, capacitors

and inductors have an opposite affect on reactive power. The power factors for capacitors are

leading. Therefore capacitors are installed to counteract the effect of reactive power used by

inductive equipment. (Hammond, P 1964).

Uses of Automatic Power Factor Capacitors

When the load conditions and power factor in a facility change frequently, the demand for power

factor improving capacitors also changes frequently. In order to assure that the proper amount of

power factor capacitor kVARs are always connected to the system (without over-correcting), an

Automatic Type Capacitor System should be used for applications involving multiple loads. A

microcontroller automatic compensation system is formed by: 26 • Some sensors detecting

current and voltage signals; • An intelligent unit that compares the measured power factor with

the desired one and operates the connection and disconnection of the capacitor banks with the

necessary reactive power (power factor regulator); • An electric power board comprising

switching and protection devices; • Some capacitor banks.

Potential Sources of Harmonics

• Switched mode power supplies

• Dimmer‗s

• Current Regulators

• Frequency Converters.

• Voltage source inverters with pulse width modulated converters.

Page 10: Doc1.docx

• Low power consumption lamps.

• Electrical arc-furnaces.

• Arc welding machines.

• Induction motors with irregular magnetizing current associated with saturation of the iron.

• All equipment with built-in switching devices or with internal loads with nonlinear

voltage/current characteristics.

Page 11: Doc1.docx

HARDWARE REQUIREMENT

AT89S52 MICROCONTROLLER

MICROCONTROLLERS:

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.

Page 12: Doc1.docx

FEATURES

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

• 4.0V to 5.5V Operating Range

• Fully Static Operation: 0 Hz to 33 MHz

• 256 x 8-bit Internal RAM

• 32 Programmable I/O Lines

• Three 16-bit Timer/Counters

• Full Duplex UART Serial Channel

• Low-power Idle and Power-down Modes

• Interrupt Recovery from Power-down Mode

• Watchdog Timer

• Dual Data Pointer

• Power-off Flag

Page 13: Doc1.docx

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 pinout. 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.

Page 14: Doc1.docx

PIN CONFIGURATIONS

Page 15: Doc1.docx
Page 16: Doc1.docx

PIN DESCRIPTION

Page 17: Doc1.docx

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 pullups. Port 0 also receives the

code bytes during Flash programming and outputs the code bytes during program verification.

External pullups are required during program verification.

Port 1

Port 1 is an 8-bit bidirectional I/O port with internal pullups. 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 pullups 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 pullups. 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.

Page 18: Doc1.docx

Port 2

Port 2 is an 8-bit bidirectional I/O port with internal pullups. 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 pullups 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 pullups. Port 2 emits the high-order address

byte during fetches from external program memory and during accesses to external data memory

that use 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 use 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 pullups. 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 pullups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled

low will source current (IIL) because of the pullups. 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.

Page 19: Doc1.docx

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

Page 20: Doc1.docx

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

Page 21: Doc1.docx

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

Page 22: Doc1.docx

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-

Page 23: Doc1.docx

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?

Page 24: Doc1.docx

EA=0 In this case, internal program memory is completely ignored, only a program stored in

external memory is to be executed.

EA=1 In 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.

Page 25: Doc1.docx

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.

Page 26: Doc1.docx

Fig: Microcontroller internal structure

Page 27: Doc1.docx
Page 28: Doc1.docx

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

Page 29: Doc1.docx

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 microcon troller

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:

Page 30: Doc1.docx

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.

Page 31: Doc1.docx

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 are intensionally 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)

Page 32: Doc1.docx

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)

Page 33: Doc1.docx

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.

Description:

The AT89S52 is a low-voltage, high-performance CMOS 8-bit microcomputer with 4K

bytes of Flash programmable memory. The device is manufactured using Atmel’s high-density

nonvolatile memory technology and is compatible with the industry-standard MCS-51

instruction set. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel

AT89S52 is a powerful microcomputer, which provides a highly flexible and cost-effective

solution to many embedded control applications.

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

Page 34: Doc1.docx

functioning. The power-down mode saves the RAM contents but freezes the oscillator disabling

all other chip functions until the next hardware reset.

Machine cycle for the 8052

The CPU takes a certain number of clock cycles to execute an instruction. In the 8052 family,

these clock cycles are referred to as machine cycles. The length of the machine cycle depends on

the frequency of the crystal oscillator. The crystal oscillator, along with on-chip circuitry,

provides the clock source for the 8052 CPU.

The frequency can vary from 4 MHz to 30 MHz, depending upon the chip rating and

manufacturer. But the exact frequency of 11.0592 MHz crystal oscillator is used to make the

8052 based system compatible with the serial port of the IBM PC.

In the original version of 8052, one machine cycle lasts 12 oscillator periods. Therefore, to

calculate the machine cycle for the 8052, the calculation is made as 1/12 of the crystal frequency

and its inverse is taken.

HARDWARE EXPLANATION:

Page 35: Doc1.docx

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:

Page 36: Doc1.docx

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 way round, 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.

Page 37: Doc1.docx

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.

Lighemitting 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.

Page 38: Doc1.docx

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. Low Current

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 a 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.

Page 39: Doc1.docx

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

Page 40: Doc1.docx

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

Page 41: Doc1.docx

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

Page 42: Doc1.docx

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

Page 43: Doc1.docx

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.

Page 44: Doc1.docx

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.

Page 45: Doc1.docx

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

Page 46: Doc1.docx

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):

Page 47: Doc1.docx

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.

Page 48: Doc1.docx

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

Page 49: Doc1.docx

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

Page 50: Doc1.docx

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.

Page 51: Doc1.docx

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.

Page 52: Doc1.docx

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.

Page 53: Doc1.docx

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.

Page 54: Doc1.docx

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.

Page 55: Doc1.docx

Figure: Regulator

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.

A model described here is for its low price and great possibilities most frequently used in

practice. 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,

Page 56: Doc1.docx

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:

FunctionPin

NumberName

Logic

StateDescription

Ground 1 Vss - 0V

Power supply 2 Vdd - +5V

Contrast 3 Vee - 0 - Vdd

Control of

operating

4 RS0

1

D0 – D7 are interpreted as

commands

D0 – D7 are interpreted as data

5 R/W0

1

Write data (from controller to

LCD)

Read data (from LCD to

controller)

6 E

0

1

From 1 to

0

Access to LCD disabled

Normal operating

Data/commands are transferred

to LCD

Data / 7 D0 0/1 Bit 0 LSB

8 D1 0/1 Bit 1

Page 57: Doc1.docx

commands

9 D2 0/1 Bit 2

10 D3 0/1 Bit 3

11 D4 0/1 Bit 4

12 D5 0/1 Bit 5

13 D6 0/1 Bit 6

14 D7 0/1 Bit 7 MSB

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).

Page 58: Doc1.docx
Page 59: Doc1.docx

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:

Command RS RW D7 D6 D5 D4 D3 D2 D1 D0Execution

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 (BF) 0 1 BF DDRAM address -

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

Page 60: Doc1.docx

DDRAM

Read from CGRAM or

DDRAM1 1 D7 D6 D5 D4 D3 D2 D1 D0 40uS

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

Page 61: Doc1.docx

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.

Page 62: Doc1.docx

Fig: Procedure on 8-bit initialization.

Page 63: Doc1.docx

SOFTWARE REQUIREMENT

INTRODUCTION TO KEIL SOFTWARE

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

Page 64: Doc1.docx

5. Save the Project by typing suitable project name with no extension in u r own folder

sited in either C:\ or D:\

Page 65: Doc1.docx

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

Page 66: Doc1.docx

9. Select AT89S52 as shown below

Page 67: Doc1.docx

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.

Page 68: Doc1.docx

15. Click on the file option from menu bar and select “new”

Page 69: Doc1.docx

16. The next screen will be as shown in next page, and just maximize it by double

clicking on its blue boarder.

Page 70: Doc1.docx

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”

Page 71: Doc1.docx

19. Now right click on Source group 1 and click on “Add files to Group Source”

Page 72: Doc1.docx

20. Now you will get another window, on which by default “C” files will appear.

Page 73: Doc1.docx

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.

Page 74: Doc1.docx

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

Page 75: Doc1.docx

27. Drag the port a side and click in the program file.

Page 76: Doc1.docx

28. Now keep Pressing function key “F11” slowly and observe.

29. You are running your program successfully

Page 77: Doc1.docx

PROLOAD:

Proload is a software which accepts only hex files. Once the machine code is converted

into hex code, that hex code has to be dumped into the microcontroller placed in the programmer

kit and this is done by the Proload. Programmer kit contains a microcontroller on it other than the

one which is to be programmed. This microcontroller has a program in it written in such a way

that it accepts the hex file from the keil compiler and dumps this hex file into the microcontroller

which is to be programmed. As this programmer kit requires power supply to be operated, this

power supply is given from the power supply circuit designed above. It should be noted that this

programmer kit contains a power supply section in the board itself but in order to switch on that

power supply, a source is required. Thus this is accomplished from the power supply board with

an output of 12volts or from an adapter connected to 230 V AC.

Steps to work with Proload:

1. Install the Proload Software in the PC.

2. Now connect the Programmer kit to the PC (CPU) through serial cable.

3. Power up the programmer kit from the ac supply through adapter.

4. Now place the microcontroller in the GIF socket provided in the programmer kit.

5. Click on the Proload icon in the PC. A window appears providing the information like

Hardware model, com port, device type, Flash size etc. Click on browse option to select

the hex file to be dumped into the microcontroller and then click on “Auto program” to

program the microcontroller with that particular hex file.

6. The status of the microcontroller can be seen in the small status window in the bottom of

the page.

7. After this process is completed, remove the microcontroller from the programmer kit and

place it in your system board. Now the system board behaves according to the program

written in the microcontroller.

Page 78: Doc1.docx

APPLICATIONS

a) General purpose switching and amplification

b) Induction motor, transformer power factor correction

ADVANTAGES

1. Rduced demand charges

2. Increased load carrying capabilities in existing circuits

3. Improved voltage

4. Reduced power system loses

5. Reduction in system losses, and the losses in the cables, lines, and feeder circuits and

therefore lower cable sizes could be opted for.

6. Improved system voltages, thus enable maintaining rated voltage to motors, pumps and

other equipment. The voltage drop in supply conductors is a resistive loss, and wastes

power heating the conductors. Improving the power factor, especially at the motor

terminals, can improve the efficiency by reducing the line current and the line losses.

7. Improved voltage regulation.

8. Increased system capacity, by release of KVA capacity of transformers and cables for the

same KW, thus permitting additional loading without immediate expansion.

9. Efficiency increases due to Reduction of power consumption.

10. Due to reduced power consumption their will be Less greenhouse gases

11. Reduction of electricity bills

12. Extra KVA available from the same existing supply

13. Reduction of I²R losses in transformers and distribution equipment

Page 79: Doc1.docx

CONCLUSION

Designing a good microcontroller based power factor corection device to help improve power

factor, reduce high current drawn form the system and also reduce harmonic in the system.

Improving the efficiency of the system and reducing high electricity tariffs. It is applicable on a

commercial sinlge phase system.

Expected Outcome Of The Project And Possible Usage The expected out come of this project is

to measuring the power factor value and to improve power factor using capacitor bank and

reduce current draw by the load using microcontroller and proper algorithm to turn on capacitor

automatically, determine and trigger sufficient switching of capacitor in order to compensate

excessive reactive components, thus bringing power factor near to unity and remove harmonics

in the system there by improving the efficiency of the system and reducing the electricity bill.

This paper deals with advance method of power factor correction by using microcontroller. As

Switching of capacitors are done automatically hence we get more accurate result, Power factor

correction techniques makes system stable and due to improvement in power factor its efficiency

also increases. Power factor correction scheme can be applied to industries, power systems as

well as in house hold purpose. The use of microcontroller reduces the costs. By using

microcontroller multiple parameters can be controlled and the use of extra hard wares such as

timer, RAM, ROM and input output ports reduces. Before APFC Circuit insertion

FUTURE SCOPE

The automotive power factor correction using capacitive load banks is very efficient as it

reduces the cost by decreasing the power drawn from the supply. As it operates automatically,

manpower are not required and this Automated Power factor Correction using capacitive load

banks can be used for the industries purpose in the future. In future PWM techniques can be

employed in this scheme. Along with power factor correction also speed control can be done in

future. In future, Work can be done for harmonics reduction.

Page 80: Doc1.docx

REFERENCES

[1] en.wikipedia.org/wiki/Power_factor_correcti on

[2] Jones, L. D.; Blackwell, D. (1983) “Energy Saver Power Factor Controller for Synchronous

Motors”, IEEE Transactions on Power Apparatus and Systems, Volume: 5, Issue: 5, Pages:

1391-1394.

[3] Keith Harker (1998). “Power System Commissioning and Maintenance practice.” London:

Institution of Electrical Engineers.

[4] Stephen, J. C. (1999). “Electric Machinery and Power System Fundamentals.” 3rd.ed. United

State of America: McGraw-Hill Companies, Inc

[5] Oscar García, Member, IEEE, José A. Cobos, Member, IEEE, Roberto Prieto, Member,

IEEE, Pedro Alou, and Javier Uceda, Senior Member, IEEE “Single Phase Power Factor

Correction: A Survey.” IEEE TRANSACTIONS ON POWER ELECTRONICS, VOL. 18, NO.

3, MAY 2003.

[6] Anagha Soman, Assistant Professor, Pranjali Sonje, Pursuing M-Tech, Bharati Vidyapeeth

University college of Engineering, Pune “Power Factor Correction Using PIC Microcontroller”,

International Journal of Engineering and Innovative Technology (IJEIT) Volume 3, Issue 4,

October 2013.

[7] Jaehong Hahn, Student Member, IEEE, Prasad N. Enjeti, Fellow, IEEE, and Ira J.Pitel,

Fellow, IEEE ―A New Three-Phase Power-Factor Correction (PFC) Scheme Using Two Single-

Page 81: Doc1.docx

Phase PFC Modules” IEEE TRANSACTIONS ON INDUSTRY APPLICATIONS, VOL. 38,

NO. 1, JANUARY/FEBRUARY 2002 123.


Recommended