load sharing final

64
   A Project report on INTELLIGENT REAL-TIME AUTOMATIC TRANSFORMER LOAD SHARING AND REMOTE CONTROLLING SYSTEM USING GSM MODEM  submitted in partial fulfilment of the requirement for the award of degree of BACHELOR OF TECHNOLOGY in ELECTRICAL & ELECTRONICS ENGINEERING by PRAVEEN DESAI 07BK1A0237 VIKAS VOOTURI 07BK1A0255 PRASHANTH KUMAR CH 07BK1A0236 Under the guidance of Mr. SURESH BABU(M. Tech.) Assistant Professor  DEPARTMENT OF ELECTRICAL & ELECTRONICS ENGINEERING ST.PETER’S ENGINEERING COLLEGE (Affiliated to Jawaharlal Nehru Technological University, Hyderabad) Opp Forest Academy, Dhulapally, Near Kompally, Medchal Mandal, A.P.

Upload: vikas-vooturi

Post on 13-Jul-2015

885 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 1/64

A Project report

on

INTELLIGENT REAL-TIME AUTOMATIC TRANSFORMERLOAD SHARING AND REMOTE CONTROLLING SYSTEM

USING GSM MODEM

submitted in partial fulfilment of the requirement for the award of

degree of

BACHELOR OF TECHNOLOGY

inELECTRICAL & ELECTRONICS ENGINEERING

by

PRAVEEN DESAI 07BK1A0237VIKAS VOOTURI 07BK1A0255PRASHANTH KUMAR CH 07BK1A0236

Under the guidance of

Mr. SURESH BABU(M. Tech.)

Assistant Professor

DEPARTMENT OF ELECTRICAL & ELECTRONICS ENGINEERING

ST.PETER’S ENGINEERING COLLEGE

(Affiliated to Jawaharlal Nehru Technological University, Hyderabad)Opp Forest Academy, Dhulapally, Near Kompally, Medchal Mandal, A.P.

Page 2: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 2/64

2011

Page 3: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 3/64

ST.PETER’S ENGINEERING COLLEGE

(Affiliated to Jawaharlal Nehru Technological University, Hyderabad)Opp Forest Academy, Dhulapally, Near Kompally, Medchal Mandal, A.P.

DEPARTMENT OF ELECTRICAL & ELECTRONICS ENGINEERING

CERTIFICATE This is to certify that the project entitled “INTELLIGENT REAL-TIME

AUTOMATIC TRANSFORMERLOAD SHARING AND REMOTE

CONTROLLING SYSTEM USING GSM MODEM” is being

submitted by

PRAVEEN DESAI 07BK1A0237VIKAS VOOTURI 07BK1A0255PRASHANTH KUMAR CH 07BK1A0236

in partial fulfilment of the requirements for the award of BACHELOR OF

TECHNOLOGY to JNTU, Hyderabad. This record is a bonafide work carried out by them under my guidance and supervision. The result embodied inthis project report has not been submitted to any other university or institute for the award of any degree of diploma.

Internal Guide External Guide

H. O. D.

Page 4: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 4/64

ACKNOWLEDGEMENT

I would like to express my gratitude to all the people behind thescreen who helped me to transform an idea into a real application.

I would like to express my heart-felt gratitude to my parents withoutwhom I would not have been privileged to achieve and fulfil mydreams. I am grateful to our principal, Mr. K.V.J RAO who mostably run the institution and has had the major hand in enabling me todo my project.

I profoundly thank Mr.GIRI PRASAD, Head of the Department of Electrical & Electronics Engineering who has been an excellent guideand also a great source of inspiration to my work.

I would like to thank my internal guide Mr. SURESH BABU for histechnical guidance, constant encouragement and support in carryingout my project at college.

I would also like to thank my external guide Mr.SANDEEP for histechnical guidance and support in carrying out my project at ORBIT

The satisfaction and euphoria that accompany the successfulcompletion of the taskwould be great but incomplete without themention of the people who made it possible with their constantguidance and encouragement crowns all the efforts with success. In

this context, I would like thank all the other staff members, bothteaching and non-teaching, who have extended their timely help andeased my task.

PRAVEEN DESAI 07BK1A0237

VIKAS VOOTURI 07BK1A0255PRASHANTH KUMAR CH 07BK1A0236

Page 5: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 5/64

ABSTRACT

Page 6: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 6/64

INTELLIGENT REAL-TIME AUTOMATIC

TRANSFORMER LOAD SHARING AND REMOTE

CONTROLLING SYSTEM USING GSM MODEM

In normal we used to control the industrial equipments by manual

operation. Hence it is to be updated step by step manually. It is overcome by a

new mode of communication which is used to control all those equipments

through load sharing mechanism by a single message from anywhere. GSM is

the most popular mobile phone system in the world which could be used for this

controlling operation from anywhere else.

GSM – Global System for Mobile Communication is used as a media which

is used to control and monitor the transformer load from anywhere by sending a

message. It has its own deterministic character. Thereby, here GSM is used to

monitor and control by sending a message through GSM modem. Hence no

need to waste time by manual operation and transportation. Hence it is

considered as highly efficient communication through the mobile which will beuseful in industrial controls, automobiles, and appliances which would be

controlled from anywhere else. It is also highly economic and less expensive;

hence GSM is preferred most for this mode of controlling.

The AT89S52 is the heart of this project. Here we are

receiving the data from GSM modem and is given to the micro

controller by serial communication through MAX 232,depending up on the information received it operates relay

control unit and is there by operating load bank. The relay

controlling unit is taking power supply with the help of load

sharing transformer by the help of Current Sensors.

Page 7: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 7/64

Title of the project : AUTOMATIC TRANSFORMER LOADSHARING

Domain : Electrical, Embedded Systems Design, Wireless

Software : Embedded C, Keil, Proload

Microcontroller : AT89S52

Power Supply : +5V, 750mA Regulated Power Supply

Display : LCD

LCD : HD44780 16-character, 2-line (16X2)

Communication Device : GSM modem

Crystal : 11.0592MHz

Applications : Electricity Generation stations, Industries

Page 8: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 8/64

INTRODUCTION

1.INTRODUCTION

1.1 MOTIVATION

Power travels from the power plant to house through an amazing system

called the power distribution grid. For power to be useful in a home or

business, it comes off the transmission grid and is stepped-down to the

distribution grid.This may happen in several phases. The place where the

Page 9: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 9/64

conversion from "transmission" to "distribution" occurs is in a power

substation. It has transformers that step transmission voltages (in the tens or

hundreds ofthousands of volts range) down to distribution voltages (typically

less than10,000 volts). It has a "bus" that can split the distribution power off

in multiple directions. It often has circuit breakers and switches so that thesubstation can be disconnected from the transmission grid or separate

distribution lines can be disconnected from transmission grid or separate

distribution lines can be disconnected from the substation when necessary.

In this project, a slave transformer in the case of shares the load of master

transformer over load and over temperature. A sensor circuit is designed to

log the data from the master transformer and if it is found to be in over loadcondition, immediately the slave transformer will be connected in parallel to

the master transformer and the load is shared.

1.2 PROBLEM DEFINATION

The existing system presently is done manually, where by which thereare possibilities for the transformer to get easily damaged hence this is a

heavy loss to any grid or industry.

If there’s heavy load suddenly and not spotted out the transformer gets

damaged and there are even chances for the equipment to get damaged.

For home applications to the heavy industries this paper can be a solution

for the protection

1.3 OBJECTIVE OF THE PROJECT

• This paper is a method for the automatic load sharing of the

transformers using a GSM modem

• A message regarding the sharing of the load by the transformers is

sent to the client’s mobile using the GSM

• Reasons for preference of this method

Page 10: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 10/64

1. Automated Load sharing of transformers

2. No manual errors

3. Fit and Forget system

4. Low cost and reliable circuit

1.1 ORGANISATION OF DOCUMENTATION

In this project documentation we have initially put the definition and

objective of the project as well as the design of the project which is

followed by the implementation and testing phases. Finally the project

has been concluded successfully and also the future enhancements of

the project were given in this documentation.

Page 11: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 11/64

HARDWAR

E

2.1 INTRODUCTION

In our project we propose to design an idea for load sharing of

distribution transformers using a microcontroller, here we are using two

transformers which are connected in parallel, one acts as the main transformer

and the other one acts as additional transformers. The load is shared by these

Page 12: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 12/64

transformers automatically with the help of microcontroller. Using this we are

going to monitor the consumed load current, voltage and temperature of

transformer. the project work has a very good practical value and is the much

sought after by the department of electricity and also by many industries in

power sector

Aim of the design is to develop a system based on Embedded micro

controller (8051), which is used for controlling the industrial equipments

through a single message from anywhere.

This project design makes use of 8051 micro controllers for

interfacing to various hardware interfaces. Technology today is seeing its

heights in all the areas, especially in the area of Embedded Systems. It is true

that every electronic gadget that is used in daily life right from a PC keyboard to

a refrigerator is an Embedded System. This itself shows how vastly the

technology is expanding. As the technology is improving day to day many

things of our daily life became so simple and easy.

The design is based on 8051 micro controller. The project has in it an

AT89S52 microcontroller, a GSM modem, current sensing circuits, the

controller receives the data from GSM Modem and sends to micro controller

through serial communication. Based upon the message received, micro

controller operates relay control unit and is there by operating load bank. The

relay controlling unit is taking power supply with the help of load sharing

transformer with the help of current sensors

Page 13: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 13/64

2.2 BLOCK DIAGRAM OF THE SYSTEM

Page 14: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 14/64

2.3 MAJOR COMPONENTS

2.3.1 MICROCONTROLLER AT89C52

Description

The AT89C52 is a low-power, high-performance CMOS 8-bit microcomputer with 8Kbytes of Flash programmable and erasable read only memory (PEROM). The deviceis manufactured using Atmel’s high-density non-volatile memory technology and iscompatible with the industry-standard MCS-51 instruction set and pin out. The on-chip Flashallows the program memory to be reprogrammed in-system or by a conventional non-volatilememory programmer. By combining a versatile 8-bit CPU with Flash on a monolithic chip,the Atmel AT89C52 is a powerful microcomputer which provides a highly-flexible and cost-effective solution to many embedded control applications.

Pin Configurations

Page 15: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 15/64

Pin Description

Port 0Port 0 is an 8-bit open-drain bi-directional I/O port. As an output port, each pincan sink eight TTL inputs. When 1s are written to port 0 pins, the pins can beused as highimpedance inputs.Port 0 may also be configured to be the multiplexed loworder address/data busduring accesses to external program and data memory. In this mode P0 hasinternal pullups.Port 0 also receives the code bytes during Flash programming, and outputs thecode bytes during program verification. External pullups are required during

program verification.Port 1Port 1 is an 8-bit bi-directional 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 pullupsand can be used as inputs. As inputs, Port 1 pins that are externally being pulledlow will source current (IIL) because of the internal pullups.

Port 1 also receives the low-order address bytes during Flash programming andverification.Port 2Port 2 is an 8-bit bi-directional 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 theyare 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) becauseof the internal pullups.Port 2 emits the high-order address byte during fetches from external programmemory and during accesses to external data memory that use 16-bit addresses

(MOVX @ DPTR). In this application, it uses strong internal pull-ups whenemitting 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 duringFlash programming and verification.Port 3Port 3 is an 8-bit bi-directional 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 theyare 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) becauseof the pullups. Port 3 also serves the functions of various special features of the

Page 16: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 16/64

AT89C52 as listed

Port 3 also receives some control signals for Flash programming andverification.RSTReset input. A high on this pin for two machine cycles while the oscillator isrunning resets the device.ALE/PROG

Address Latch Enable output pulse for latching the low byte of the addressduring 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 DataMemory. 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.

PSENProgram Store Enable is the read strobe to external program memory. When theAT89C52 is executing code from external program memory, PSEN is activatedtwice each machine cycle, except that two PSEN activations are skipped duringeach access to external data memory.EA/VPPExternal Access Enable. EA must be strapped to GND in order to enable thedevice to fetch code from external program memory locations starting at 0000Hup 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 programexecutions. This pin also receives the 12-volt programming enable voltage

Page 17: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 17/64

(VPP) during Flash programming, for parts that require 12-volt VPP.XTAL1Input to the inverting oscillator amplifier and input to the internal clock operating circuit.

XTAL2Output from the inverting oscillator amplifier.

Block Diagram

2.3.2 MAX 232

Page 18: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 18/64

The concept of serial communication is simple, in serial communication data is

sent one bit at a time. Serial communication requires only one line for the data;

second line for ground & possible a third line for clock. Although this is slower

than parallel communication, which allows the transmission of an entire byte at

once, it is simpler & requires less physical wires for communication so can be

used over longer distances

MAX 232

The Max 232 is a dual RS-232 receiver / transmitter that meets all EIA

RS232C specifications while using only a +5V power supply. It has 2 onboard

charge pump voltage converters which generate +10V and –10V power supplies

from a single 5V power supply. It has four level translators, two of which are

RS232 transmitters that convert TTL\ CMOS input levels into + 9V RS232

outputs. The other two level translators are RS232 receivers that convert RS232

inputs to 5V

TTL\CMOS output level. These receivers have a nominal threshold of

1.3V, a typical hysterics of 0.5V and can operate up to + 30V input.

1. Suitable for all RS232 communications.

2. +12V power supplies required.

3. Voltage quadruple for input voltage up to 5.5V (used in power supply Section

of computers, peripherals, and modems).

Three main sections of MAX232 are

1. A dual transmitter

2. A dual receiver

3. + or - 5V to + or - 10V dual charge pump voltage converter.

PIN DIAGRAM OF MAX 232

Page 19: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 19/64

TRANSMITTER SECTION:

Each of the two transmitters is a CMOS inverter powered by + or - 10V

internally generated supply. The input is TTL and CMOS compatible with a

logic threshold of about 26% of Vcc. The input if an unused transmitter section

can be left unconnected: an internal 400KW pull up resistor connected between

the transistor input and Vcc will pull the input high forming the unused

transistor output low.

The open circuit output voltage swing is guaranteed to meet the

RS232 specification + or - 5v output swing under the worst of both transmitter

driving the 3K Ω . Minimum load impedance, the Vcc input at 4.5V and

maximum allowable ambient temperature typical voltage with 5K Ω and Vcc =

+ or - 9 v.

The slow rate at output is limited to less than 30V/µ s and the powered

done output impedance will be a minimum of 300W with + or - 2V applied to

the output with Vcc = 0V.The outputs are short circuit protected and can be

short circuited to ground indefinitely.

RECEIVER SECTION

Page 20: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 20/64

The two receivers fully conform to RS232 specifications. They’re

input impedance is between 3K Ω either with or without 5V power applied and

their switching threshold is within the +3V of RS232 specification. To ensure

compatibility with either RS232 IIP or TTL/CMOS input. The MAX232

receivers have VIL of 0.8V and VIH of 2.4V the receivers have 0.5V of

hysterisis to improve noise rejection.

The TTL\CMOS compatible output of receiver will be low whenever the

RS232 input is greater than 2.4V. The receiver output will be high when input is

floating or driven between +0.8V and –30V.

2.3.3 RELAY

A relay is an electrical switch that opens and closes under the controlof another electrical circuit. In the original form, the switch is operated by anelectromagnet to open or close one or many sets of contacts. It was invented byJoseph Henry in 1835. Because a relay is able to control an output circuit of higher power than the input circuit, it can be considered to be, in a broad sense,a form of an electrical amplifier .

A simple electromagnetic relay, is an adaptation of an electromagnet. It

consists of a coil of wire surrounding a soft iron core, an iron yoke, which provides a low reluctance path for magnetic flux, a moveable iron armature, anda set, or sets, of contacts; two in the relay pictured. The armature is hinged tothe yoke and mechanically linked to a moving contact or contacts. It is held in

place by a spring so that when the relay is de-energised there is an air gap in themagnetic circuit. In this condition, one of the two sets of contacts in the relay

pictured is closed, and the other set is open. Other relays may have more or fewer sets of contacts depending on their function. The relay in the picture alsohas a wire connecting the armature to the yoke. This ensures continuity of the

circuit between the moving contacts on the armature, and the circuit track on thePrinted Circuit Board (PCB) via the yoke, which is soldered to the PCB.

When an electric current is passed through the coil, the resultingmagnetic field attracts the armature, and the consequent movement of themovable contact or contacts either makes or breaks a connection with a fixedcontact. If the set of contacts was closed when the relay was de-energised, thenthe movement opens the contacts and breaks the connection, and vice versa if the contacts were open. When the current to the coil is switched off, thearmature is returned by a force, approximately half as strong as the magneticforce, to its relaxed position. Usually this force is provided by a spring, but

gravity is also used commonly in industrial motor starters. Most relays are

Page 21: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 21/64

manufactured to operate quickly. In a low voltage application, this is to reducenoise. In a high voltage or high current application, this is to reduce arcing.

If the coil is energized with DC, a diode is frequently installed across the coil, todissipate the energy from the collapsing magnetic field at deactivation, which

would otherwise generate a voltage spike dangerous to circuit components.Some automotive relays already include that diode inside the relay case.Alternatively a contact protection network, consisting of a capacitor and resistor in series, may absorb the surge. If the coil is designed to be energized with AC,a small copper ring can be crimped to the end of the solenoid. This "shadingring" creates a small out-of-phase current, which increases the minimum pull onthe armature during the AC cycle.[1]

By analogy with the functions of the original electromagnetic device, a solid-state relay is made with a thyristor or other solid-state switching device. To

achieve electrical isolation an optocoupler can be used which is a light-emittingdiode (LED) coupled with a photo transistor.

2.3.4 MCT2E (OPTOCOUPLER)

DESCRIPTIONThe MCT2XXX series optoisolators consist of a gallium arsenide

infrared emitting diode driving a silicon phototransistor in a 6-pin dual in-line package.

Page 22: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 22/64

APPLICATIONS

• Power supply regulators• Digital logic inputs• Microprocessor inputs

2.2.5 LCD-016M002A

FEATURES• 5 x 8 dots with cursor • Built-in controller (KS 0066 or Equivalent)• + 5V power supply (Also available for + 3V)

• 1/16 duty cycle• B/L to be driven by pin 1, pin 2 or pin 15, pin 16 or A.K

Page 23: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 23/64

(LED)• N.V. optional for + 3V power supply

PIN DESCRIPTION

DISPLAY

2.3.5 GSM (Global System for Mobile)

Global System for Mobile (GSM) is a second generation cellular standarddeveloped to cater voice services and data delivery using digital modulation

The objective of security for GSM system is to make the system as secure as the

public switched telephone network. The use of radio at the transmission media

Page 24: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 24/64

allows a number of potential threats from eavesdropping the transmissions. It

was soon apparent in the threat analysis that the weakest part of the system was

the radio path, as this can be easily intercepted.

GSM provides a basic range of security features to ensure adequate protectionfor both the operator and customer. Over the lifetime of a system threat and

technology change, and so the security is periodically reviewed and changed.

The technical security features must be properly supported by procedures to

ensure complete security. The security provided by GSM is well in advance of

similar mobile radio systems, and should ensure that it remains at the front of

the field for some time to come.

However, it is vitally important that these capabilities are designed in from the

start, as they will have an impact on the system requirements. Business casesshould show the effect of fraud and the costs of protection.

Encryption of GSM

2.3.6 OTHER COMPONENTS

TRANSFORMERS

The transformer is a static electro-magnetic device that transforms one

alternating voltage (current) into another voltage (current). However, power

Page 25: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 25/64

remains the same during the transformation. Transformers play a major role in

the transmission and distribution of ac power.

Transformer works on the principle of mutual induction. A transformer consists

of laminated magnetic core forming the magnetic frame. Primary and secondary

coils are wound upon the two cores of the magnetic frame, linked by the

common magnetic flux. When an alternating voltage is applied across the

primary coil, a current flows in the primary coil producing magnetic flux in the

transformer core. This flux induces voltage in secondary coil.

ENERGY METER

The energy meter is an electrical measuring device, which is used to recordElectrical Energy Consumed over a specified period of time in terms of units. Inthis project the energy meter acts a s a current sensor for the two transformersEnergy meter is basically an assembly of electrical and mechanical components.The design of energy meter depends upon which rating of current and voltageupon meter has to work. The components like potential coils and current coilsare to be designed in accordance with customer's requirements. Other components like magnets, terminals, Disc and reading registration mechanism

are to be designed accordingly.

Page 26: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 26/64

2.4 Power Supply

Circuit Diagram

Power supply unit:

As we all know any invention of latest technology cannot be activated

without the source of power. So it this fast moving world we deliberately need a

proper power source which will be apt for a particular requirement. All the

electronic components starting from diode to Intel IC’s only work with a DC

supply ranging from -+5v to -+12v. We are utilizing for the same, the

cheapest and commonly available energy source of 230v-50Hz and stepping

down, rectifying, filtering and regulating the voltage. This will be dealt briefly

in the forth-coming sections.

Page 27: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 27/64

STEP DOWN TRANSFORMER:

When AC is applied to the primary winding of the power transformer it

can either be stepped down or up depending on the value of DC needed. In our

circuit the transformer of 230v/15-0-15v is used to perform the step down

operation where a 230V AC appears as 15V AC across the secondary winding.

One alteration of input causes the top of the transformer to be positive and the

bottom negative. The next alteration will temporarily cause the reverse. The

current rating of the transformer used in our project is 2A. Apart from stepping

down AC voltages, it gives isolation between the power source and power

supply circuitries.

RECTIFIER UNIT:

In the power supply unit, rectification is normally achieved using a solid

state diode. Diode has the property that will let the electron flow easily in one

direction at proper biasing condition. As AC is applied to the diode, electrons

only flow when the anode and cathode is negative. Reversing the polarity of

voltage will not permit electron flow.

A commonly used circuit for supplying large amounts of DC power is the

bridge rectifier. A bridge rectifier of four diodes (4*IN4007) are used to achieve

full wave rectification. Two diodes will conduct during the negative cycle and

the other two will conduct during the positive half cycle. The DC voltage

appearing across the output terminals of the bridge rectifier will be somewhatlass than 90% of the applied rms value. Normally one alteration of the input

voltage will reverse the polarities. Opposite ends of the transformer will

therefore always be 180 deg out of phase with each other.

For a positive cycle, two diodes are connected to the positive voltage at

the top winding and only one diode conducts. At the same time one of the other

two diodes conducts for the negative voltage that is applied from the bottom

winding due to the forward bias for that diode. In this circuit due to positive half

Page 28: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 28/64

cycleD1 & D2 will conduct to give 10.8v pulsating DC. The DC output has a

ripple frequency of 100Hz. Since each altercation produces a resulting output

pulse, frequency = 2*50 Hz. The output obtained is not a pure DC and therefore

filtration has to be done.

FILTERING UNIT:

Filter circuits which are usually capacitors acting as a surge arrester

always follow the rectifier unit. This capacitor is also called as a decoupling

capacitor or a bypassing capacitor, is used not only to ‘short’ the ripple with

frequency of 120Hz to ground but also to leave the frequency of the DC to

appear at the output. A load resistor R1 is connected so that a reference to the

ground is maintained. C1R1 is for bypassing ripples. C2R2 is used as a low pass

filter, i.e. it passes only low frequency signals and bypasses high frequency

signals. The load resistor should be 1% to 2.5% of the load.

1000f/25v: for the reduction of ripples from the pulsating.

10

f/25v : for maintaining the stability of the voltage at the load side.O, 1f : for bypassing the high frequency disturbances.

VOLTAGE REGULATORS:

The voltage regulators play an important role in any power supply unit.

The primary purpose of a regulator is to aid the rectifier and filter circuit in

providing a constant DC voltage to the device. Power supplies withoutregulators have an inherent problem of changing DC voltage values due to

variations in the load or due to fluctuations in the AC liner voltage. With a

regulator connected to the DC output, the voltage can be maintained within a

close tolerant region of the desired output. IC7812 and 7912 is used in this

project for providing +12v and –12v DC supply.

2.5 CONCLUSION

Page 29: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 29/64

In this phase we understand the components required for the project andthe block diagram needed to develop the project. Hence we are clear with therequirements thus we will proceed to the design phase followed by the

softwares required.

Page 30: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 30/64

DESIGN

3.DESIGN

3.1 INTRODUCTION

Page 31: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 31/64

Now , in this project we look into the designing of the circuit using the

mentioned components in the previous phase

3.2 BASICS

STRIP BOARD

Strip board has parallel strips of copper track on one side. The tracksare 0.1" (2.54mm) apart and there are holes every 0.1" (2.54mm).

Stripboard is used to make up permanent, soldered circuits. It is ideal for smallcircuits with one or two ICs (chips) but with the large number of holes it is veryeasy to connect a component in the wrong place. For large, complex circuits it is

usually best to use a printed circuit board (PCB) if you can buy or make one.Components are placed on the non-copper side, then the stripboard is turnedover to solder the component leads to the copper tracks.

Stripboard layouts are shown from the component side, so the tracks are out of sight under the board. Layouts are normally shown with the tracks runninghorizontally across the diagram.

Placing components on stripboard requires care. The large number of holesmeans it is very easy to make a mistake! For most small circuits the best methodis to very carefully place the IC holder(s) in the correct position and solder in

place. Then you can position all the other components relative to the ICholder(s).

SOLDERING

Soldering is a process in which two or more metal itemsare joined together by melting and flowing a filler metal intothe joint, the filler metal having a relatively low melting point.Soft soldering is characterized by the melting point of the fillermetal, which is below 400 °C (752 °F).[1] The filler metal used inthe process is called solder.

3.3 CIRCUIT DIAGRAM

Page 32: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 32/64

3.4 CONCLUSION

Page 33: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 33/64

In this way we can design the circuit of the project which is to beimplemented. Thus we have a clear picture of the project before themicrocontroller being coded. Hence any necessary enhancements can be made

during the phase and coding can be started

Page 34: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 34/64

SOFTWARES

4. SOFTWARES

Page 35: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 35/64

4.1 INTRODUCTION After finishing the design of the circuit we now move to the software

part which is the heart of this project for the Microcontroller. The coding of the

software made has to be programmed to the Microcontroller and then the project is implemented

4.2 SOFTWARES REQUIRED

4.2.1 KEIL SOFTWARE

Keil Compiler:

Keil is an IDE(Integrated Development Environment) which is used to develop

an application program , compile and run it Even the code can be debugged .It

is a simulator where we can check the application code even in the absence of

the hardware board.

Keil is also a cross compiler The process of development of the soft code on a

processor for a particular application and which can be implemented on the

target processor is known as Cross Development.

In our design the main heart of the hardware module is the micro controller

which is the programmable IC .The programming language used for developing

the software to the micro controller is Embedded C /Assembly. The KEIL cross

compiler is used to edit ,compile and debug this program Micro Flash

programmer is used for burning the developed code on Keil in to the micro

controller Chip.

Software Development Cycle

When you use the Keil Software tools, the project development cycle is roughly

the same as it is for any other software development project.

Page 36: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 36/64

1. Create a project, select the target chip from the device database, and

configure the tool settings.

2. Create source files in C or assembly.

3. Build your application with the project manager.

4. Correct errors in source files.

5. Test the linked application.

4.2.2 µVision2 IDE:

The µVision2 IDE combines project management, a rich-featured editor with

interactive error correction, option setup, make facility, and on-line help. Use

µVision2 to create your source files and organize them into a project that

defines your target application. µVision2 automatically compiles, assembles,

and links your embedded application and provides a single focal point for your

development efforts.

Page 37: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 37/64

C51 Compiler & A51 Assembler:

Source files are created by the µVision2 IDE and are passed to the C51Compiler or A51 assembler. The compiler and assembler process source files

and create relocatable object files.

The Keil C51 Compiler is a full ANSI implementation of the C programming

language that supports all standard features of the C language. In addition,

numerous features for direct support of the 8051 architecture have been added.

The Keil A51 macro assembler supports the complete instruction set of the 8051and all derivatives.

µVision2 Debugger

The µVision2 symbolic, source-level debugger is ideally suited for fast, reliable

program debugging. The debugger includes a high-speed simulator that let you

simulate an entire 8051 system including on-chip peripherals and external

hardware. The attributes of the chip you use are automatically configured when

you select the device from the Device Database.

The µVision2 Debugger provides several ways for you to test your programs on

real target hardware.

_ Install the MON51 Target Monitor on your target system and download your

program using the Monitor-51 interface built-in to the µVision2 Debugger.

_ Use the Advanced GDI interface to attach use the µVision2 Debugger front

end with your target system.

Page 38: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 38/64

µVision2 Integrated Development Environment

The µVision2 IDE is a Windows-based software development platform that

combines a robust editor, project manager, and make facility. µVision2 supports

all of the Keil tools for the 8051 including the C compiler, macro assembler,linker/locator, and object-HEX converter. µVision2 helps expedite the

development process of your embedded applications by providing the

following:

_ Full-featured source code editor,

_ Device database for configuring the development tool setting,

_ Project manager for creating and maintaining your projects,

_ Integrated make facility for assembling, compiling, and linking your

embedded applications,

_ Dialogs for all development tool settings,

_ True integrated source-level Debugger with high-speed CPU and peripheral

simulator,

_ Advanced GDI interface for software debugging in the target hardware and

for connection to Monitor-51,

_ Links to development tools manuals, device datasheets & user’s guides.

C51 Optimizing C Cross Compiler

The Keil C51 Cross Compiler is an ANSI C Compiler that was written

specifically to generate fast, compact code for the 8051 microcontroller family.

The C51 Compiler generates object code that matches the efficiency and speed

of assembly programming.

Using a high-level language like C has many advantages over assembly

language programming:

Page 39: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 39/64

_ Knowledge of the processor instruction set is not required. Rudimentary

knowledge of the memory structure of the 8051 CPU is desirable (but not

necessary).

_ Details like register allocation and addressing of the various memory types

and data types is managed by the compiler.

_ Programs get a formal structure (which is imposed by the C programming

language) and can be divided into separate functions. This contributes to source

code reusability as well as better overall application structure.

_ The ability to combine variable selection with specific operations improves

program readability.

_ Keywords and operational functions that more nearly resemble the human

thought process may be used.

_ Programming and program test time is drastically reduced.

_ The C run-time library contains many standard routines such as: formattedoutput, numeric conversions, and floating-point arithmetic.

_ Existing program parts can be more easily included into new programs

because of modular program construction techniques.

_ The language C is a very portable language (based on the ANSI standard) that

enjoys wide popular support and is easily obtained for most systems. Existing

program investments can be quickly adapted to other processors as

needed.

C51 Language Extensions

Page 40: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 40/64

Even though the C51 Compiler is ANSI-compliant, some extensions were

added to support the facilities of the 8051 microprocessor. The C51 Compiler

includes extensions for:

_ Data Types,

_ Memory Types,

_ Memory Models,

_ Pointers,

_ Reentrant Functions,

_ Interrupt Functions,

_ Real-Time Operating Systems,

_ Interfacing to PL/M and A51 source files.

Code Optimizations

The C51 Compiler is an aggressive optimizing compiler that takes numerous

steps to ensure that the code generated and output to the object file is the most

efficient (smallest and/or fastest) code possible. The compiler analyzes the

generated code to produce the most efficient instruction sequences. This ensures

that your C program runs as quickly and effectively as possible in the least

amount of code space.

The C51 Compiler provides nine different levels of optimizing. Each increasing

level includes the optimizations of levels below it. The following is a list of all

optimizations currently performed by the C51 Compiler.

General Optimizations

Page 41: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 41/64

_ Constant Folding: Constant values occurring in an expression or address

calculation are combined as a single constant.

_ Jump Optimizing: Jumps are inverted or extended to the final target address

when the program efficiency is thereby increased.

_ Dead Code Elimination: Code that cannot be reached (dead code) is removed

from the program.

_ Register Variables: Automatic variables and function arguments are located

in registers whenever possible. No data memory space is reserved for these

variables.

_ Parameter Passing Via Registers: A maximum of three function arguments

may be passed in registers.

_ Global Common Subexpression Elimination: Identical subexpressions or

address calculations that occur multiple times in a function are recognized and

calculated only once whenever possible.

_ Common Tail Merging: Common instruction blocks are merged together

using jump instructions.

_ Re-use Common Entry Code: Common instruction sequences are moved in

front of a function to reduce code size.

_ Common Block Subroutines: Multiple instruction sequences are packed into

subroutines. Instructions are rearranged to maximize the block size.

8051-Specific Optimizations

Page 42: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 42/64

_ Peephole Optimization: Complex operations are replaced by simplified

operations when memory space or execution time can be saved as a result.

_ Access Optimizing: Constants and variables are computed and included

directly in operations.

_ Extended Access Optimizing: The DPTR register is used as a register

variable for memory specific pointers to improve code density.

_ Data Overlaying: Function data and bit segments are OVERLAYABLE and

are overlaid with other data and bit segments by the BL51 linker.

_ Case/Switch Optimizing: Depending upon their number, sequence, and

location, switch and case statements may be optimized using a jump table or

string of jumps.

Options for Code Generation

_ OPTIMIZE(SIZE): Common C operations are replaced by subprograms.

Program code size is reduced at the expense of program speed.

_ OPTIMIZE(SPEED): Common C operations are expanded in-line. Program

speed is increased at the expense of code size.

_ NOAREGS: Absolute register access is not used. Program code is

independent of the register bank.

_ NOREGPARMS: Parameter passing is performed in local data segments

rather than dedicated registers. This is compatible with earlier versions of the

C51 Compiler, the PL/M-51 compiler, and the ASM-51 assembler.

Page 43: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 43/64

Debugging:

The C51 Compiler uses the Intel Object Format (OMF51) for object files

and generates complete symbol information. Additionally, the compiler can

include all the necessary information such as; variable names, function names,

line numbers, and so on to allow detailed and thorough debugging and analysis

with the µVision2 Debugger or any Intel-compatible emulators.

In addition, the OBJECTEXTEND control directive embeds additional

variable type information in the object file that allows type-specific display of

variables and structures when using certain emulators.

You should check with your emulator vendor to determine if it iscompatible with the Intel OMF51 object module format and if it can accept Keil

object modules.

A51 Macro Assembler

The A51 Assembler is a macro assembler for the 8051 microcontroller family.

It translates symbolic assembler language mnemonics into executable machine

code. The A51 Assembler allows you to define each instruction in an 8051

program and is used where utmost speed, small code size, and exact hardware

control is essential. The assembler’s macro facility saves development and

maintenance time since common sequences need only be developed once.

Page 44: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 44/64

Source-Level Debugging

The A51 Assembler generates complete line number, symbol, and typeinformation in the object file created. This allows exact display of program

variables in your debugger. Line numbers are used for source-level debugging

of your assembler programs with the µVision2 Debugger or third-party

emulator.

Functional Overview

The A51 Assembler translates an assembler source file into a relocatable object

module. It generates a listing file optionally with symbol table and cross

reference. The A51 Assembler supports two different macro processors:

_ The Standard Macro Processor is the easier macro processor to use. It

allows you to define and use macros in your 8051 assembly programs. The

standard macro syntax is compatible with that used in many other assemblers.

_ The Macro Processing Language (MPL) is a string replacement facility that

is fully compatible with the Intel ASM51 macro processor. MPL has several

predefined macro processor functions that perform many useful operations like

string manipulation or number processing. Another powerful feature of the A51

Assembler macro processors is conditional assembly depending on command

line directives or assembler symbols. Conditional assembly of sections of code

can help you achieve the most compact code possible. It also allows you to

generate different applications from one assembly source file.

ASSEMBLY VS C:

• The assembly code is difficult to read and maintain.

• The amount of code reusable from assembly code is very low.

•C programs are easy to read, understand, maintain , because it possesses

greater structure.

Page 45: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 45/64

• With C the programmer need not know the architecture of the processor.

• Code developed in C will be more portable to other systems rather than in

assembly.

Difference between Conventional C and Embedded C:

• Compliers for conventional C are TC, BC

• Compilers for Embedded C are keil µvision - 2 & 3, PIC C etc.

• Conventional C programs needs complier to compile the program & run it.

• The embedded C program needs a cross compiler to compile & generate HEX

code.

• The programs in C are basically processor dependent whereas Embedded C

programs are micro controller dependent.

•The C program is used for developing an application and not suitable for

embedded systems.

• The embedded C is an extension of the conventional C. i.e Embedded C has

all the features of normal C, but has some extra added features which are not

available in C.

• Many functions in C do not support Reentrant concept of functions.

•C is not memory specific. i.e variables cannot be put in the desired memorylocation but the location of variable can be found out.• In embedded C this can be done using specific inbuilt instructions.

Page 46: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 46/64

•C depends on particular processor or application.

• Embedded C is Controller or target specific.

• Embedded C allows direct communication with memory.

Why C for Micro controllers:

• Compatibility

• Direct access to hardware address

• Direct connection to interrupts

• Optimization consideration

• Development environment

• Reentrancy

Rules for developing Embedded C Program:

• Code Optimization.

1.Minimize local variables

If the number of local variables in a function is less, the compiler will be

able to fit them into registers. Hence, it will be avoiding frame pointer

operations on local variables that are kept on stack. This can result in

considerable improvement due to two reasons:

•All local variables are in registers so this improves performance over accessing

them from memory.

•If no local variables need to be saved on the stack, the compiler will not incur

the overhead of setting up and restoring the frame pointer.

Page 47: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 47/64

1.Declare local variables in the inner most scope

• Do not declare all the local variables in the outermost function scope.

• If local variables are declared in the inner most scope.

• If the parameter was declared in the outermost scope, all function calls would

have incurred the overhead of object .

• Place case labels in narrow range

• If the case labels are in a narrow range, the compiler does not generate a if-

else-if cascade for the switch statement.

• Instead, it generates a jump table of case labels along with manipulating the

value of the switch to index the table.

• This code generated is faster than if-else-if cascade code that is generated in

cases where the case labels are far apart.

• Also, performance of a jump table based switch statement is independent of

the number of case entries in switch statement.

Reduce the number of parameters

Function calls with large number of parameters may be expensive due to large

number of parameter pushes on stack on each call. For the same reason, avoid

Page 48: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 48/64

passing complete structures as parameters. Use pointers and references in such

cases.

Use references for parameter passing and return value for types bigger

than 4 bytes

Passing parameters by value results in the complete parameter being copied on

to the stack.

This is fine for regular types like integer, pointer etc.

These types are generally restricted to four bytes.

When passing bigger types, the cost of copying the object on the stack can be

prohibitive.

When the function exits the destructor will also be invoked.

Thus it is efficient to pass references as parameters. This way you save on the

overhead of a temporary object creation, copying and destruction. This

optimization can be performed easily without a major impact to the code by

replacing pass by value parameters by const references.

(It is important to pass const references so that a bug in the called function does

not change the actual value of the parameter.

Passing bigger objects as return values also has the same performance issues. A

temporary return object is created in this case too.

Page 49: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 49/64

•Use All the SFR’s in capital letters only.

•Reduce the warnings in the program.

•Make use of MACRO definitions in the program.

•Always define the variables in the code memory by using the keyword code in

declaration.

•Eg unsigned int code a[] = ;

•Always define as unsigned type of declaration.

•Make use of sbit definition for single bit declaration.

•Eg sbit rs = P3^6;

•Since these are not floating point co-processor, no decimal values can be given

as input to them.

• So we cannot define the above declaration as sbit rs = P3.6.

• The declaration like this below are invalid.

P3^6 = 0;

• P3^6 is bit addressable type & 0 is a 8 bit data which cannot be

stored in single bit.

• Permanent termination of the program is got by using while(1);

4.3 CONCLUSION

In this phase, we understand the software requirement specifications for theProject and the methods of using it for coding and programming the

Microcontroller and thus we will proceed to the next phase that is

Implementation

Page 50: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 50/64

IMPLEMENTATION

Page 51: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 51/64

5.IMPLEMENTATION

5.1 INTRODUCTION

The implementation part is the most important phase of the project. In this

phase, we code the entire project in the chosen software according to the designlaid during the previous phases.The code should be efficient in all terms like space, easy to update, etc. In thismanner, we can complete the coding part of the project and later it can be tested

5.2 CODING

#include <reg52.h>#include <stdio.h>

Page 52: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 52/64

#include <string.h>sbit rs=P1^0;//selecting cmd or display modesbit en=P1^2; //make lcd to excue a cmd or display a charactrer sbit relay=P1^3;

sfr lcd=0xa0; //a0 is ram address of port 2

void lcd_init();//initialize ur lcdvoid lcdcmd(unsigned char);//execute any cmdvoid lcddis(unsigned char);//display an ASCII chrcter void lcdstr(unsigned char *);//display a stringvoid del();//generate a delayvoid ser_ini();//initalize serial commvoid serstr(unsigned char *);//transmit a string to GSMvoid ser(unsigned char);//transmit a char to gsm

void msgsnd();//send the msg

unsigned int val=0;unsigned long res=0,cnt=0;float result=0;

bit first,msg;unsigned char i;

void pulse() interrupt 0relay=0;EA=0;TR0=0;if(first)

val=(TH0<<8|TL0);result=65536*cnt;result+=val;result*=1.085;

result=result/1000000;result=(((1000/result)*3600)/230);res=(unsigned long)result;TH0=0;TL0=0;cnt=0;elsefirst=1;TR0=1;EA=1;

Page 53: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 53/64

void cyc() interrupt 1

cnt++;

void main()unsigned char current[5];TMOD=0x21;//timer 1 in serial comm timer 0 in interruptlcd_init();IT0=1;//level triggering interruptIE=0x83;// enable global interrupt timer interrupt xerternal

interrupt

ser_ini();while (1)for (i=0;i<5;i++)current[i]=0;lcdcmd(0x01);sprintf(current,"%lu",res);EA=1;lcdstr("Current:-");while (!first);lcdstr(current);lcdstr("mA");static bit msg=0;if (res>1400)relay=1;

if(msg==0)msgsnd();msg=1;elserelay=0;msg=0;// if ((msg==1)&&(res>1400))// msgsnd();msg=0;

Page 54: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 54/64

void lcd_init()lcdcmd(0x38);//activate 5x8 matrixlcdcmd(0x01);//clear the screen

lcdcmd(0x06);//increment the cursor lcdcmd(0x0e);//dipslay the cursor void lcdcmd(unsigned char cmd)lcd=cmd;//port2 is equal to cmdrs=0;//cmd modeen=1;//enabledel();en=0;

void lcddis(unsigned char dis)lcd=dis;rs=1;//dis modeen=1;del();en=0;

void lcdstr(unsigned char *str)char i=0;while(str[i]!=0)lcddis(str[i++]);

void del()unsigned int i;for(i=0;i<10000;i++);

void ser_ini()SCON=0x50;//var baud rate enable receptionTH1=-3;//9600 bpsTR1=1;//enablew UART

Page 55: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 55/64

serstr("AT+CMGF=1\r");//message format=TEXT FORMATdel();while(RI)RI=0;del();serstr("AT+CPMS=\"SM\"\r");//sim memory message storagedel();while(RI)RI=0;del();

void serstr(unsigned char *str)unsigned char i=0;while (str[i]!=0)ser(str[i++]);

void ser(unsigned char tx)

SBUF=tx;while (!TI);TI=0;

void msgsnd()serstr("AT+CMGS=\"9703456607\"\r");del();del();serstr("The supply has been shared by two transformers");ser(0x1a);del();del();del();del();del();del();del();while (!RI);while(RI)RI=0;del();del();

5.3 METHODS OF IMPLEMENTATION

Open Keil IDE installed previously on your PC

Page 56: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 56/64

Create a New Project from Projet -> New -> uVision

Project

IDE will tell you to save the project and give it a

name. Now keil will ask you to choose your target

device. Choose your device AT89S52

Page 57: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 57/64

Now make a new empty file

Type in your source code in that empty file and save

this file as main.c

Add the main source file to your project by right

clicking on left side bar over "Source Group1"

Page 58: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 58/64

By default keil compiler do not generate intel hex file

on source compilation. So we need to configure it to

produce Hex file as output.

Check the Create hex file box

Page 59: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 59/64

Now you are ready to compile source and generate the

hex file.

The final output will look like this...

Now you can find the generated iHex file for the

project in the same directory as in project lies

Page 60: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 60/64

Program the code in uvision

5.4 CONCLUSION

In this way we implemented the code required for the project successfullywith the help of Keil Compiler and uvision to the Microcontroller.We now

proceed to the next step i.e testing , which is very important before deliveringthe project.

Page 61: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 61/64

TESTING

6.TESTING

Page 62: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 62/64

6.1 INTRODUCTION

Testing is a critical element for any project to be successful. Now the codeinterfaced into the Microcontroller is in the circuit this has to be tested so that

the load is shared by the transformer when it is high

6.2 STEPS

• Check that the whole setup is in OFF condition first

• Now turn on the supply and see that only one bulb is turned ON thisindicates that the load is low and the current is displayed on the LCD

• Now for this condition only one LED of Master transformer has to beturned on, this shows that the load is only through master transformer

• After this , turn on the second bulb too , this indicates that the load is highand the current is displayed on the LCD

• Now as the load is high the microcontroller trips on the relay and the loadis shared by the two transformers

• Now both the LED’s of transformers start glowing which indicates theload is being shared by both the transformers

• A message has to be sent to the mobile number saved in the programthrough GSM

• Thus the project is tested if the results satisfy the conditions

6.3 Testing Results

A good test has a high probability of finding an as yet undiscovered error.

Page 63: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 63/64

A successful test is one that uncovers an as yet undiscovered error.

6.4 CONCLUSION

In this way we also completed the testing phase of the project and ensured thatthe system is ready to go live.Thus we developed a system which automaticallyshares the load with two transformers when the load is high by which manyindustries and companies can run safely

Page 64: Load Sharing Final

5/12/2018 Load Sharing Final - slidepdf.com

http://slidepdf.com/reader/full/load-sharing-final 64/64

CONCLUSION