63
CONTENT 1. ABSTRACT…………………………2 2. DESIGN PRINCIPLE…………….3 3. CIRCUIT DESCRIPTION a. Power Supply…………………………12 b. Motherboard………………………….15 c. LCD Display……………………………33 d. Relay & Buzzer Driver…………….42 e. Comparator Section………………..45 f. Neutral Tempering…………………..49 g. Opto Isolator………………………….51 4. FUTURE EXPANSION……………….53 5. CONCLUSION………………………….54 1

Pre paid energy meter

Embed Size (px)

DESCRIPTION

A project report on prepaid energy meter. It contains the effective use of power and hints in decreasing the losses suffered by the govt for power theft and debts of the consumer.

Citation preview

Page 1: Pre paid energy meter

CONTENT

1. ABSTRACT…………………………2

2. DESIGN PRINCIPLE…………….3

3. CIRCUIT DESCRIPTION

a. Power Supply…………………………12

b. Motherboard………………………….15

c. LCD Display……………………………33

d. Relay & Buzzer Driver…………….42 e. Comparator Section………………..45

f. Neutral Tempering…………………..49

g. Opto Isolator………………………….51

4. FUTURE EXPANSION……………….53

5. CONCLUSION………………………….54

1

Page 2: Pre paid energy meter

1. ABSTRACT

In the scenario of power crises it is very important to monitor power distribution at consumer

end. The maximum demand protection is very much required to limit the customer to connect

maximum load to the electrical connection given by the supply company. As excess connection

of load doctorates the distribution conditions and create unbalance loading also allied problems

such as negative phase sequence currents etc. In this project the maximum demand is limited to

a customer if the customer uses the load more then the allotted value for more then a pre

defined time then automatically the system disconnect the supply from the consumer. The Pre-

paid Energy Meter facilitate the customer to use the pre allotted energy quota and avoid

misuse and theft of energy.

2. DESIGN PRINCIPLE:

Energy meters, the only direct revenue interface between utilities and the consumers, have

undergone several advancements in the last decade. The conventional electro-mechanical

meters are being replaced with electronic meters to improve accuracy in meter reading. Asian

countries are currently looking to introduce prepaid electricity meters across their distribution

network, buoyed up by the success of this novel methodology in South Africa. The existing

inherent problems with the post-paid system and privatization of state held power distribution

companies are the major driving factors for this market in

Asia.

Over 40 countries have implemented prepaid meters in their

markets. In United Kingdom the system, has been in use for

well over 70 years with about 3.5 million consumers. The

2

Page 3: Pre paid energy meter

prepaid program in South Africa was started in 1992, since then they have installed over 6

million meters. Other African counties such as Sudan, Madagascar are following the South

African success. The concept has found ground in Argentina and New Zealand with few

thousands of installations.

The prepaid meters in the market today are coming up with smart cards to hold information on

units consumed or equivalent money value. When the card is inserted, the energy meter reads

it, connects the supply to the consumer loads, and debits the value. The meters are equipped

with light emitting diodes (LED) to inform consumers when 75 percent of the credit energy has

been consumed. The consumer then recharges the prepaid card from a sales terminal or

distribution point, and during this process any changes in the tariff can also be loaded in the

smart card. The concept of pre paid is one of the immerging fields for the paid service

providers. The concept becomes so popular because it has so many advantages. The services

like electricity, gas, water telephone etc are now days get privatized. The service provider

company some time incurs heavy losses due to non collection of bills. These service items

cannot be recovered from the user after providing so the concept of pre paid reduce risk and

increase profitability. Also the bill collection infrastructure is not necessary which intern

increase improve the efficiency of the service providing companies. The concept of pre paid

starts in the manual form by receiving advance deposits but now due to the revolution of IT

and electronics industry the manual recharging process is replaced with automatic and

electronic recharging. The recharging methods can be with wire based like telephone line and

also by using wireless technology like radio and blue tooth communication. The prepaid

system is designed with a smart technology using microcontroller and the recharging process

is by some method of communication.

3

Page 4: Pre paid energy meter

Benefits of Prepaid Meters

Improved operational efficiencies: The prepaid meters are likely to cut the cost of meter reading as no

meter readers are required. In addition, they eliminate administrative hassles associated with

disconnection and reconnection. Besides, going by South Africa’s experience, prepaid meters could

help control appropriation of electricity in a better way than conventional meters.

Reduced financial risks: Since the payment is up-front, it reduces the financial risk by improving the

cash flows and necessitates an improved revenue management system.

Better customer service: The system eliminates billing delay, removes cost involved in

disconnection/reconnection, enables controlled use of energy, and helps customers to save money

through better energy management.

In this project the Prepaid Energy meter can be charged from a remote by using a

mobile. Once the user feel to recharge The prepaid energy meter he can transfer the amount to

the service provider bank account and the service provider will make a call to the system and

log in to that and charge it by entering digits from its key pad. The recharging can be done

from any mobile set but the system access code must be put in to log into the energy meter.

This type of systems are now days getting popular and many popular and well known

companies make products and sale in the market.

Market Drivers

Power sector reforms: The upcoming competitive and customer focused deregulated power

distribution market will force the market participants to make the existing metering and billing process

more competent. This is likely to drive the prepaid market.

4

Page 5: Pre paid energy meter

Increasing non-technical losses: Metering errors, tampering with meters leading to low registration

and calibration related frauds are some of the key components of non-technical losses. India reports

greater than 10 percent of non-technical losses. It has been reported that prepaid meters control non-

technical losses better than conventional ones.

Opportunities in the emerging electrifying markets: Most of the Asian countries do not have 100

percent electrification; hence new markets are being created by the increasing generating capacity.

Prepaid systems can be more easily introduced in such new markets rather than the existing ones.

The Prepaid Energy meter is designed by using a 8 bit microcontroller. The

Microcontroller receive the pulse by interfacing optical pickups from a traditional

electromagnetic energy meter. The electrical Induction energy meter works with the

principle as follows,

CIRCUIT DESCRIPTION

a) POWER SUPPLY :-( +ve)

Circuit connection: - In this we are using Transformer (0-12) v, 1Amp, IC 7805 & 7812,

diodes IN 4007, LED & resistors.

Here 230V, 50 Hz ac signal is given as input to the primary of the transformer and the

secondary of the transformer is given to the bridge rectification diode. The o/p of the diode is

given as i/p to the IC regulator (7805 &7812) through capacitor (1000mf/35v). The o/p of the

IC regulator is given to the LED through resistors.

Circuit Explanations: - When ac signal is given to the primary of the transformer, due to the

magnetic effect of the coil magnetic flux is induced in the coil(primary) and transfer to the

secondary coil of the transformer due to the transformer action.” Transformer is an

5

Page 6: Pre paid energy meter

electromechanical static device which transformer electrical energy from one coil to another

without changing its frequency”. Here the diodes are connected in a bridge fashion. The

secondary coil of the transformer is given to the bridge circuit for rectification purposes.

During the +ve cycle of the ac signal the diodes D2 & D4 conduct due to the forward bias of

the diodes and diodes D1 & D3 does not conduct due to the reversed bias of the diodes.

Similarly during the –ve cycle of the ac signal the diodes D1 & D3 conduct due to the forward

bias of the diodes and the diodes D2 & D4 does not conduct due to reversed bias of the diodes.

The output of the bridge rectifier is not a power dc along with rippled ac is also present. To

overcome this effect, a capacitor is connected to the o/p of the diodes (D2 & D3). Which

removes the unwanted ac signal and thus a pure dc is obtained. Here we need a fixed voltage,

that’s for we are using IC regulators (7805 & 7812).”Voltage regulation is a circuit that

supplies a constant voltage regardless of changes in load current.” This IC’s are designed as

fixed voltage regulators and with adequate heat sinking can deliver output current in excess of

1A. The o/p of the bridge rectifier is given as input to the IC regulator through capacitor with

respect to GND and thus a fixed o/p is obtained. The o/p of the IC regulator (7805 & 7812) is

given to the LED for indication purpose through resistor. Due to the forward bias of the LED,

the LED glows ON state, and the o/p are obtained from the pin no-3.

6

Page 7: Pre paid energy meter

b) MOTHER BOARD

The motherboard of this project is designed with a MSC –51 core compatible micro controller.

The motherboard is designed on a printed circuit board, compatible for the micro controller.

This board is consisting of a socket for micro controller, input /output pull-up registers;

oscillator section and auto reset circuit.

7

LED

LED

1k

- +

IN4007 * 4

GND

9-0-9Vac/1Amp

1000uF/35V

7812

POWER SUPPLY

+5V

+12V230VAC

50Hz 2.2k

7805

0-12 V

Page 8: Pre paid energy meter

Micro controller core processor:

Introduction

Despite it’s relatively old age, the 89C51 is one of the most popular Micro controller in use

today. Many derivatives Micro controllers have since been developed that are based on--and

compatible with--the 8051. Thus, the ability to program an 89C51 is an important skill for

anyone who plans to develop products that will take advantage of Micro controller.

Many web pages, books, and tools are available for the 89C51 developer.

The 89C51 has three very general types of memory. To effectively program the 8051 it is

necessary to have a basic understanding of these memory types.

The memory types are illustrated in the following graphic. They are: On-Chip Memory,

External Code Memory, and External RAM.

On-Chip Memory refers to any memory (Code, RAM, or other) that physically exists on the

Microcontroller itself. On-chip memory can be of several types, but we'll get into that shortly.

8

Page 9: Pre paid energy meter

External Code Memory is code (or program) memory that resides off-chip. This is often in

the form of an external EPROM.

External RAM is RAM memory that resides off-chip. This is often in the form of standard

static RAM or flash RAM.

Code Memory

Code memory is the memory that holds the actual 8051 program that is to be run. This memory

is limited to 64K and comes in many shapes and sizes: Code memory may be found on-chip,

either burned into the Microcontroller as ROM or EPROM. Code may also be stored

completely off-chip in an external ROM or, more commonly, an external EPROM. Flash RAM

is also another popular method of storing a program. Various combinations of these memory

types may also be used--that is to say, it is possible to have 4K of code memory on-chip and

64k of code memory off-chip in an EPROM.

When the program is stored on-chip the 64K maximum is often reduced to 4k, 8k, or 16k. This

varies depending on the version of the chip that is being used. Each version offers specific

capabilities and one of the distinguishing factors from chip to chip is how much ROM/EPROM

space the chip has.

However, code memory is most commonly implemented as off-chip EPROM. This is

especially true in low-cost development systems and in systems developed by students.

Programming Tip: Since code memory is restricted to 64K, 89C51 programs are limited to

64K. Some assemblers and compilers offer ways to get around this limit when used with

9

Page 10: Pre paid energy meter

specially wired hardware. However, without such special compilers and hardware, programs

are limited to 64K.

External RAM

As an obvious opposite of Internal RAM, the 89C51 also supports what is called External

RAM.

As the name suggests, External RAM is any random access memory which is found off-chip.

Since the memory is off-chip it is not as flexible in terms of accessing, and is also slower. For

example, to increment an Internal RAM location by 1 requires only 1 instruction and 1

instruction cycle. To increment a 1-byte value stored in External RAM requires 4 instructions

and 7 instruction cycles. In this case, external memory is 7 times slower!

What External RAM loses in speed and flexibility it gains in quantity? While Internal RAM is

limited to 128 bytes (256 bytes with an 8052), the 8051 supports External RAM up to 64K.

Programming Tip: The 8051 may only address 64k of RAM. To expand RAM beyond this

limit requires programming and hardware tricks. You may have to do this "by hand" since

many compilers and assemblers, while providing support for programs in excess of 64k, do not

support more than 64k of RAM. This is rather strange since it has been my experience that

programs can usually fit in 64k but often RAM is what is lacking. Thus if you need more than

64k of RAM, check to see if your compiler supports it-- but if it doesn't, be prepared to do it by

hand.

On-Chip Memory

10

Page 11: Pre paid energy meter

As mentioned at the beginning of this chapter, the 89C51 includes a certain amount of on-chip

memory. On-chip memory is really one of two types: Internal RAM and Special Function

Register (SFR) memory. The layout of the 89C51's internal memory is presented in the

following memory map:

As is illustrated in this map, the 8051 has a bank of 128 bytes of Internal RAM. This Internal

RAM is found on-chip on the 8051 so it is the fastest RAM available, and it is also the most

flexible in terms of reading, writing, and modifying it’s contents. Internal RAM is volatile, so

when the 8051 is reset this memory is cleared.

The 128 bytes of internal ram is subdivided as shown on the memory map. The first 8 bytes

(00h - 07h) are "register bank 0". By manipulating certain SFRs, a program may choose to use

register banks 1, 2, or 3. These alternative register banks are located in internal RAM in

addresses 08h through 1Fh. We'll discuss "register banks" more in a later chapter. For now it is

sufficient to know that they "live" and are part of internal RAM.

11

Page 12: Pre paid energy meter

Bit Memory also lives and is part of internal RAM. We'll talk more about bit memory very

shortly, but for now just keep in mind that bit memory actually resides in internal RAM, from

addresses 20h through 2Fh.

The 80 bytes remaining of Internal RAM, from addresses 30h through 7Fh, may be used by

user variables that need to be accessed frequently or at high-speed. This area is also utilized by

the Microcontroller as a storage area for the operating stack. This fact severely limits the

8051’s stack since, as illustrated in the memory map, the area reserved for the stack is only 80

bytes--and usually it is less since this 80 bytes has to be shared between the stack and user

variables.

SFR Descriptions

There are different special function registers (SFR) designed in side the 89C51 micro

controller. In this micro controller all the input , output ports, timers interrupts are controlled

by the SFRs. The SFR functionalities are as follows.

This section will endeavor to quickly overview each of the standard SFRs found in the above

SFR chart map. It is not the intention of this section to fully explain the functionality of each

SFR--this information will be covered in separate chapters of the tutorial. This section is to just

give you a general idea of what each SFR does.

P0 (Port 0, Address 80h, Bit-Addressable): This is +input/output port 0. Each bit of this SFR

corresponds to one of the pins on the Microcontroller. For example, bit 0 of port 0 is pin P0.0,

bit 7 is pin P0.7. Writing a value of 1 to a bit of this SFR will send a high level on the

corresponding I/O pin whereas a value of 0 will bring it to a low level.

12

Page 13: Pre paid energy meter

Programming Tip: While the 8051 has four I/O port (P0, P1, P2, and P3), if your hardware

uses external RAM or external code memory (i.e., your program is stored in an external ROM

or EPROM chip or if you are using external RAM chips) you may not use P0 or P2. This is

because the 8051 uses ports P0 and P2 to address the external memory. Thus if you are using

external RAM or code memory you may only use ports P1 and P3 for your own use.

SP (Stack Pointer, Address 81h): This is the stack pointer of the Microcontroller. This SFR

indicates where the next value to be taken from the stack will be read from in Internal RAM. If

you push a value onto the stack, the value will be written to the address of SP + 1. That is to

say, if SP holds the value 07h, a PUSH instruction will push the value onto the stack at address

08h. This SFR is modified by all instructions which modify the stack, such as PUSH, POP,

LCALL, RET, RETI, and whenever interrupts are provoked by the Microcontroller.

Programming Tip: The SP SFR, on startup, is initialized to 07h. This means the stack will

start at 08h and start expanding upward in internal RAM. Since alternate register banks 1, 2,

and 3 as well as the user bit variables occupy internal RAM from addresses 08h through 2Fh, it

is necessary to initialize SP in your program to some other value if you will be using the

alternate register banks and/or bit memory. It's not a bad idea to initialize SP to 2Fh as the first

instruction of every one of your programs unless you are 100% sure you will not be using the

register banks and bit variables.

DPL/DPH (Data Pointer Low/High, Addresses 82h/83h): The SFRs DPL and DPH work

together to represent a 16-bit value called the Data Pointer. The data pointer is used in

operations regarding external RAM and some instructions involving code memory. Since it is

13

Page 14: Pre paid energy meter

an unsigned two-byte integer value, it can represent values from 0000h to FFFFh (0 through

65,535 decimal).

Programming Tip: DPTR is really DPH and DPL taken together as a 16-bit value. In reality,

you almost always have to deal with DPTR one byte at a time. For example, to push DPTR

onto the stack you must first push DPL and then DPH. You can't simply plush DPTR onto the

stack. Additionally, there is an instruction to "increment DPTR." When you execute this

instruction, the two bytes are operated upon as a 16-bit value. However, there is no instruction

that decrements DPTR. If you wish to decrement the value of DPTR, you must write your own

code to do so.

PCON (Power Control, Addresses 87h): The Power Control SFR is used to control the

8051's power control modes. Certain operation modes of the 8051 allow the 8051 to go into a

type of "sleep" mode, which requires much, less power. These modes of operation are

controlled through PCON. Additionally, one of the bits in PCON is used to double the effective

baud rate of the 8051's serial port.

TCON (Timer Control, Addresses 88h, Bit-Addressable): The Timer Control SFR is used

to configure and modify the way in which the 8051's two timers operate. This SFR controls

whether each of the two timers is running or stopped and contains a flag to indicate that each

timer has overflowed. Additionally, some non-timer related bits are located in the TCON SFR.

These bits are used to configure the way in which the external interrupts are activated and also

contain the external interrupt flags which are set when an external interrupt has occurred.

14

Page 15: Pre paid energy meter

TMOD (Timer Mode, Addresses 89h): The Timer Mode SFR is used to configure the mode

of operation of each of the two timers. Using this SFR your program may configure each timer

to be a 16-bit timer, an 8-bit auto reload timer, a 13-bit timer, or two separate timers.

Additionally, you may configure the timers to only count when an external pin is activated or

to count "events" that are indicated on an external pin.

TL0/TH0 (Timer 0 Low/High, Addresses 8Ah/8Ch): These two SFRs, taken together,

represent timer 0. Their exact behavior depends on how the timer is configured in the TMOD

SFR; however, these timers always count up. What is configurable is how and when they

increment in value.

TL1/TH1 (Timer 1 Low/High, Addresses 8Bh/8Dh): These two SFRs, taken together,

represent timer 1. Their exact behavior depends on how the timer is configured in the TMOD

SFR; however, these timers always count up. What is configurable is how and when they

increment in value.

P1 (Port 1, Address 90h, Bit-Addressable): This is input/output port 1. Each bit of this SFR

corresponds to one of the pins on the Microcontroller. For example, bit 0 of port 1 is pin P1.0,

bit 7 is pin P1.7. Writing a value of 1 to a bit of this SFR will send a high level on the

corresponding I/O pin whereas a value of 0 will bring it to a low level.

SCON (Serial Control, Addresses 98h, Bit-Addressable): The Serial Control SFR is used to

configure the behavior of the 8051's on-board serial port. This SFR controls the baud rate of

the serial port, whether the serial port is activated to receive data, and also contains flags that

are set when a byte is successfully sent or received.

15

Page 16: Pre paid energy meter

Programming Tip: To use the 8051's on-board serial port, it is generally necessary to

initialize the following SFRs: SCON, TCON, and TMOD. This is because SCON controls the

serial port. However, in most cases the program will wish to use one of the timers to establish

the serial port's baud rate. In this case, it is necessary to configure timer 1 by initializing TCON

and TMOD.

SBUF (Serial Control, Addresses 99h): The Serial Buffer SFR is used to send and receive

data via the on-board serial port. Any value written to SBUF will be sent out the serial port's

TXD pin. Likewise, any value which the 8051 receives via the serial port's RXD pin will be

delivered to the user program via SBUF. In other words, SBUF serves as the output port when

written to and as an input port when read from.

P2 (Port 2, Address A0h, Bit-Addressable): This is input/output port 2. Each bit of this SFR

corresponds to one of the pins on the Microcontroller. For example, bit 0 of port 2 is pin P2.0,

bit 7 is pin P2.7. Writing a value of 1 to a bit of this SFR will send a high level on the

corresponding I/O pin whereas a value of 0 will bring it to a low level.

Programming Tip: While the 8051 has four I/O port (P0, P1, P2, and P3), if your hardware

uses external RAM or external code memory (i.e., your program is stored in an external ROM

or EPROM chip or if you are using external RAM chips) you may not use P0 or P2. This is

because the 8051 uses ports P0 and P2 to address the external memory. Thus if you are using

external RAM or code memory you may only use ports P1 and P3 for your own use.

16

Page 17: Pre paid energy meter

IE (Interrupt Enable, Addresses A8h): The Interrupt Enable SFR is used to enable and

disable specific interrupts. The low 7 bits of the SFR are used to enable/disable the specific

interrupts, where as the highest bit is used to enable or disable ALL interrupts. Thus, if the high

bit of IE is 0 all interrupts are disabled regardless of whether an individual interrupt is enabled

by setting a lower bit.

P3 (Port 3, Address B0h, Bit-Addressable): This is input/output port 3. Each bit of this SFR

corresponds to one of the pins on the Micro controller. For example, bit 0 of port 3 is pin P3.0,

bit 7 is pin P3.7. Writing a value of 1 to a bit of this SFR will send a high level on the

corresponding I/O pin whereas a value of 0 will bring it to a low level.

17

Page 18: Pre paid energy meter

18

Page 19: Pre paid energy meter

Auto reset Circuit :

RST10uF

22pF

22pF

8.2k

4 - 12Mhz

VCC=+5vdcAT89C51

9

1819

2930

31

12345678

2122232425262728

1011121314151617

3938373635343332

RST

XTAL2XTAL1

PSENALE/PROG

EA/VPP

P1.0P1.1P1.2P1.3P1.4P1.5P1.6P1.7

P2.0/A8P2.1/A9P2.2/A10P2.3/A11P2.4/A12P2.5/A13P2.6/A14P2.7/A15

P3.0/RXDP3.1/TXDP3.2/INT0P3.3/INT1P3.4/T0P3.5/T1

P3.6/WRP3.7/RD

P0.0/AD0P0.1/AD1P0.2/AD2P0.3/AD3P0.4/AD4P0.5/AD5P0.6/AD6P0.7/AD7

MICROCONTROLLER

The auto reset circuit is a RC network as shown in the mother board circuit diagram. A

capacitor of 1-10mfd is connected in series with a 8k2 resister the R-C junction is connected to

the micro controller pin –9 which is reset pin. The reset pin is one when ever kept high( logic

1) the programme counter (PC) content resets to 0000h so the processor starts executing the

programme. from that location. When ever the system is switched ON the mother board gets

power and the capacitor acts as short circuit and the entire voltage appears across the resistor,

so the reset pin get a logic 1 and the system get reset, whenever it is being switched ON.

19

Page 20: Pre paid energy meter

Pull-UP Resisters :

AT89C51

9

1819

2930

31

12345678

2122232425262728

1011121314151617

3938373635343332

RST

XTAL2XTAL1

PSENALE/PROG

EA/VPP

P1.0P1.1P1.2P1.3P1.4P1.5P1.6P1.7

P2.0/A8P2.1/A9P2.2/A10P2.3/A11P2.4/A12P2.5/A13P2.6/A14P2.7/A15

P3.0/RXDP3.1/TXDP3.2/INT0P3.3/INT1P3.4/T0P3.5/T1

P3.6/WRP3.7/RD

P0.0/AD0P0.1/AD1P0.2/AD2P0.3/AD3P0.4/AD4P0.5/AD5P0.6/AD6P0.7/AD7

10k

PORT-0

VCC=+5V

The PORT0 and PORT2 of the MCS-51 architecture is of open collector type so on writing

logic 0 the pins are providing a perfect ground potential. Where as on writing logic 1 the port

pins behaves as high impedance condition so putting a pull-up resister enables the port to

provide a +5volt( logic 1). Port1 and Port3 are provided with internal pull-ups. A pull-up

resister is normally a 10K resistance connected from the port pin to the Vcc (+5) volt.

Crystal Oscillator

20

Page 21: Pre paid energy meter

The 8051 family microcontroller contains an inbuilt crystal oscillator, but the crystal has to be

connected externally. This family of microcontroller can support 0 to 24MHz crystal and two

numbers of decoupling capacitors are connected as shown in the figure. These capacitors are

decouples the charges developed on the crystal surface due to piezoelectric effect. These

decoupling capacitors are normally between 20pf to 30pf. The clock generator section is

designed as follows,

The Microcontroller design consist of two parts

1) Hardware.

2) Software.

HARDWARE: The controller operates on +5 V dc, so the regulated + 5v is supplied to

pin no. 40 and ground at pin no. 20. The controller is used here need not required to handle

high frequency signals, so as 4 MHz crystal is used for operating the processor. The pin no. 9 is

supplied with a +5V dc through a push switch. To reset the processor .As prepare codes are

store in the internal flash memory the pin no. 31 is connected to + Vcc

21

Page 22: Pre paid energy meter

Port assignment:-

Port P0.0 to P0.7 is used as LCD data bus.

Port P2.0 is connected to RS

Port P2.1 is connected to R/W

Port P2.2 is connected to EN

Port P3.0 is used as input port from the phase tampering section.

Port P3.1 is used as input port from the neutral tampering section.

Port P3.2 (INT0) is connected to input from maximum demand section.

Port P3.4 is connected to input from opto slot.

Port P3.5 is connected to the input from maximum demand section.

Port P3.6 is connected to Relay driver section.

Port P3.7 is connected to Buzzer Driver.

SOFTWARE:

Algorithm

1. The controller continuously scans the ports receiving inputs from maximum

demand section and optical pickup section.

2. If the optical pickup receives a pulse then the counter increments and display

the unit consumed in the LCD display. The count is compared to display the

warning for recharging.

3. After finishing up the units the tripping relay is activated to disconnect the

power.

22

Page 23: Pre paid energy meter

4. If the maximum demand section gives a pulse then it activates the tripling

mechanism.

5. The controller rechecks continuously the maximum demand section and regain

the power when load is reduced.

23

Page 24: Pre paid energy meter

10uFRST

AT89C51

9

1819

2930

31

12345678

2122232425262728

1011121314151617

3938373635343332

RST

XTAL2XTAL1

PSENALE/PROG

EA/VPP

P1.0P1.1P1.2P1.3P1.4P1.5P1.6P1.7

P2.0/A8P2.1/A9P2.2/A10P2.3/A11P2.4/A12P2.5/A13P2.6/A14P2.7/A15

P3.0/RXDP3.1/TXDP3.2/INT0P3.3/INT1P3.4/T0P3.5/T1

P3.6/WRP3.7/RD

P0.0/AD0P0.1/AD1P0.2/AD2P0.3/AD3P0.4/AD4P0.5/AD5P0.6/AD6P0.7/AD7

22pF

22pFVCC=+5V

4MHz

BITSLCD CONTROL

BITS

NU COMP..

LCD DATA

8.2k

MD COMP..

OPTO-SLOTMD COMP..

PH COMP

RELAY DRIVERBUZZER DRIVER

MOTHER BOARD

24

Page 25: Pre paid energy meter

c) LCD DISPLAY

THE PRINCIPLES OF LCD TECHNOLOGY

In this section, we will explain everything ranging from the properties of liquid crystal

molecules to the basic principle of display technology by using TN type liquid crystals as an

example.

The parallel arrangement of liquid crystal molecules along grooves

When coming into contact with grooved surface in a fixed direction, liquid crystal molecules

line up parallelly along the grooves.

Natural state

25

Page 26: Pre paid energy meter

When liquid crystals are sandwiched

between upper and lower plates, they line-

up with grooves pointing in directions 'a'

and 'b,' respectively

The molecules along the upper plate point in direction 'a'

and those along the lower plate in direction 'b,' thus forcing

the liquid crystals into a twisted structural arrangement./

(figure shows a 90-degree twist) (TN type liquid crystal)

Light travels through the spacing of the molecular arrangement

The light also "twists" as it passes through the twisted liquid crystals

Light passes through liquid crystals, following the direction in

which the molecules are arranged. When the molecule

arrangement is twisted 90 degrees as shown in the figure, the

light also twists 90 degrees as it passes through the liquid

crystals.

26

Page 27: Pre paid energy meter

Light bends 90 degrees as it follows the twist of the molecules

Molecules rearrange themselves when voltage is applied

When voltage is applied to the liquid crystal structure, the twisted light passes straight through.

The molecules in liquid crystals are easily rearranged by applying voltage or another external

force. When voltage is applied, molecules rearrange themselves vertically (along with the

electric field) and light passes straight through along the arrangement of molecules.

Blocking light with two polarizing filters

When voltage is applied to a combination of two polarizing filters and twisted liquid crystal, it

becomes a LCD display.

27

Page 28: Pre paid energy meter

Light passes when two polarizing filters are arranged with polarizing axes as shown above,

left.

Light is blocked when two polarizing filters are arranged with polarizing axes as shown above,

right.

TN type LCDs

A combination of polarizing filters and twisted liquid crystal creates a liquid crystal display.

28

Page 29: Pre paid energy meter

When two polarizing filters are arranged along perpendicular polarizing axes, light entering

from above is

re-directed 90 degrees along the helix arrangement of the liquid crystal molecules so that it

passes through the lower

When voltage is applied, the liquid crystal molecules straighten out of their helix pattern and

stop redirecting the angle of the light, thereby preventing light from passing through the lower

filter.

This figure depicts the principle behind typical twisted nematic (TN) liquid crystal displays. In

a TN type LCD, liquid crystals in which the molecules form a 90-degree twisted helix, are

sandwiched between two polarizing filters. When no voltage is applied, light passes; when

voltage is applied, light is blocked and the screen appears black. In other words, the voltage

acts as a trigger causing the liquid crystals to function like the shutter of a camera.

LCD panel consists of two patterned glass panels in which crystal is filled under vacuum. The

thickness of glass varies according to end use. Most of the LCD modules have glass thickness

in the range of 0.70 to 1.1mm

Normally these liquid crystal molecules are placed between glass plates to form a spiral

staircase to twist the twist the light. Light entering the top plate twist 900 before entering the

bottom plate. Hence the LCDs are also called as optical switches. These LCD cannot display

any information directly. These act as an interface between electronics and electronics circuit

to give a visual output.

29

Page 30: Pre paid energy meter

Technology: - The liquid crystal display (LCD), as the name suggests is a technology based

on the use of liquid crystal. It is a transparent material but after applying voltage it becomes

opaque. This property is the fundamental operating principle of LCDs.

An LCD consists of two-glass panel with a cavity in between. The panels are sealed together.

The inner surface of glass is coated with transparent material to form characters or symbols for

display. The most common type of liquid crystal used is ‘nematis’. In this type of crystal the

long rod type molecules are arranged in parallel. It changes the optical characteristics with

change in direction by applying voltage to it.

There are two common type of LCDs which use this material. They are :

1. TN (Twisted nematic):-The twisted nematic field effect mode arranges the liquid

crystal molecules by controlling their movement Witt electric voltage soaks twist

them by 900 in the direction for their thickness. It controls the light passing through

the polarized placed on the two plates of the LCD by controlling the movements of

the liquid crystal molecules. Almost all the medium and small type segment LCD

are these types. Hence this type is most common type used.

2. STN (Super twisted nematic) While the TN mode arranges the liquid crystal

molecule by twisting them by 900 the STN effect mode arranges them by giving a

still larger twist and provides a display by refringence effect of the liquid crystal.

The LCD structure in STN mode is same as that in TN mode. But as it has a

different arrangement of liquid crystal, and by bi-refringence effect of liquid crystal.

The LCD structure in STN mode is same as that in TN mode but as it has a different

arrangement of liquid crystal and bi-refringence effect there is a colour in display

30

Page 31: Pre paid energy meter

and also a background colour. In STN mode, a wide viewing angle is obtained. The

STN mode also offers a high contrast display compare to the TN mode. This mode

is widely used in large size full dot-matrix LCD modules. For colours it has

multiple modes depending on the combination of the polarized and retardation film.

Energy consumption: - LCD normally requires very little energy to operate typically 5A

to 25A at five volts (per square inch) for a display. In addition, auxiliary lighting will require

supplementary energy. ALL LCD require a pure AC drive voltage. Inadvertent DC voltage,

such as DC component in an AC signal, can significantly reduce the life of LCDs and must be

limited to 50mv DC.

Direct drive: - Direct drive, static or simplex drive, means that each segment of the LCD

has an independent connection to the driver. Direct drive LCD has the highest contrast over the

widest temperature ranges. They are widely used in outdoor application. Direct drives typically

requires drive frequency between 30HZ and 60HZ frequency. Frequency below 30HZ will

flicker the display. While frequency above 60HZ will excessive current draw in the circuit.

This is very important for battery mode operation. If voltage frequency across the limit then

LCD ’Off’ segments can be come in adherently energized. This partial activation of segment is

known as cross talk or ghosting.

LCD is available in a verity of model having one to four rows of 8 to 20 characters each. A

display with two rows of 16 characters is used for this example project. Almost all aspects of

the design can be used with other model of LCD, since the internal structure of the various

LCD models are almost same, differencing only in the number of driver chips used. The

display module is powered from a 5 V supply.

31

Page 32: Pre paid energy meter

Connecting an LCD to a micro controller is very simple, requiring either bit or an 8-bit bus. A

4-bit interface saves I/O pins but requires that the command and data be split into 4-bit pieces,

which are sent one after the other. Thus the saving in I/O lines comes at the price of more

complicated software. To simplify understanding of the software the example uses a 8-bit

interface. Three control lines are required in addition to the data line.

The voltage at the V0 pin adjusts the contrast of the display. Normally this voltage is provided

by an adjustable voltage divider.

The control line E (Enable) enables or disables the display. When the display is enabling it

monitors the value of the other two control lines and interprets the data lines accordingly.

When the display is disabled it ignores the status of the other two control lines and places its

data line drivers in a high impedance state (tri-state). The data bus can then be used for other

purpose. The control line R/W (Read /Write) determines weather data is read from or written to

the LCD. Finally, the RS (Register select) line distinguishes between commands and display

characters.

LCD Controller device characteristics

The HD44780 contains 80 bytes of internal RAM called Data display RAM (DDR) that is used

for presentation of characters in the LCD. The size of the DDR is independent of the LCD

configuration (number of rows and character). For an LCD having two rows of characters, the

leftmost character in the first row is assigned to address 0 of the DDR. Each following

character position in the first display row is assigned to the next following address in turn until

the 40th character location reached, which is assigned to DDR address 27 hex. The character

locations in the second row of the display are assigned to DDR address 40 hex through 67 hex.

32

Page 33: Pre paid energy meter

If for example a character is to be written to the third position from the left in the second row

of the display, it must be written to DDR, so that for example with a display, it must be written

to DDR location 42hex.If the LCD module displays fewer than 40 characters per row, then

these are mapped into a ‘window’ within the DDR, so that for example with a display of 16

characters per line only 16 of the 40 available DDR locations per line can be displayed at one

time. The HD44780 supports commands to move this window to the left or to the right to allow

various regions of the DDR to be displayed.

In additions to the DDR the HD44780 has a character genator ROM (CGROM) and a

character-generator RAM (CGRAM). The CG ROM contains the dot-matrix patterns for the

standard (fixed) character set, while the CGRAM allows the user to program additional

character. Either eight4 X 7-point or four 5 X 10-point characters may be stored on the

CGRAM.

33

Page 34: Pre paid energy meter

P0.2

C

LED+R/W

VCC=+5V

P0.1

L

LED-

P0.0

DB7

10k

P0.5

DB2

1k

LIQUID CRYSTAL DISPLAY

10E

EN

P0.6

DB3

P0.7

BC557

P2.2

GND

P2.1

Vcc

MICROCONTROLLER

D

DB4

DB5

P2.0

DB1

DB0

CON.

DB6

P0.4

VCC=+5V

RS

P0.3

34

Page 35: Pre paid energy meter

d) RELAY DRIVER & BUZZER DRIVER

Relay section is designed to operate and drive the relays .The relays used here having

following specifications.

Operating voltage = 12V DC

Coil resistance = 60

Capacity of contact point = 25A, 230V

Type = single contact

NO/NC

The relay requires 12 volts and current= 12 volt/60 = 500mA. The driver now require for

driving this relay must be designed for translating the TTL logic value into 12 volts and

500mA current.

The Microcontroller cannot provide this much of current. In normal practice, it desirable to

draw 60 to 600A current from the Microcontroller, as the output to load current requirement

is very high a transistor driver is required. This driver circuit is configured with a integrated

Darlington pair of transistors (TIP122). The common emitter amplification factor is

approximately 200x50 for TIP 122. The load current is considered about 40mA then, the base

current will be around = 500/(200x50)= 500x10-3/(200x50) = 50 micro A.

In this arrangement the base current is design for200 micro Amp.

Appling KVL,

5-Rb Ib-0.7-0.7=0

Rb= 22k( max)

Rb= 2.2k

35

Page 36: Pre paid energy meter

Whenever the relay driver section receives a signal from the controller, the driver transistor

driven into saturation, on removal of signal the driver transistor will be driven into cut-off.

BUZZER DRIVER

This section interfaces one audible piezo electric buzzer with the controller. The controller

activates the buzzer whenever there is any fault appears in any of the channel. This buzzer

driver section is also one darling ton pair integrated circuit. A single transistor BC547 is used

for this purpose

PIEZO ELECRTIC BUZZER:

It is a device that converts electrical signal to an audible signal (sound signal).The

Microcontroller cannot drive directly to the buzzer, because the Microcontroller cannot give

sufficient current to drive the buzzer for that we need a driver transistor (BC547), which will

give sufficient current to the buzzer. Whenever a signal received to the base of the transistor

through a base resistance (1.5k) is high, the transistor comes to saturation condition i.e. ON

condition thus the buzzer comes to on condition with a audible sound. Similarly, whenever the

signal is not received to the base of the transistor, thus the transistor is in cut-off state i.e. is in

OFF state thus the buzzer does not gets activated

36

Page 37: Pre paid energy meter

P3.6

VCC=+12V

1.5k

BUZZER & RELAY DRIVER

P3.7

BC5471.5k

VCC=+12V

RELAY

BC547

37

Page 38: Pre paid energy meter

e) COMPARATOR SECTION: -

In this section our aim is to detect the line voltage varying current.

Introduction:

This section is configured with a quad comparator LM393 (is a dual comparator integrated

circuit. All the comparators are receiving a common input signal from the signal conditioning

section. The comparator is designed with hysterias, to avoid fluctuation at the equal set values.

All the four comparators are set with different reference value; each corresponds to a particular

current value. Whenever the input to this comparator from the signal section, gives beyond the

set value, then the comparator toggles. As the input is given at the non–inverting terminal as

the output of the comparator goes to positive saturation voltage. As the reference voltage are

set in a increasing order, When the comparator set for highest value is driven into positive

saturation. All the comparator must be driven into saturation. So LED s connected to the each

comparator section indicates the level of different parameter.

The line voltage (230vac) coming from the mains is given to the one end of primary of the

current transformer-1 and another end through a load (1KW) of the one end and another end to

the another current transformer-2 primary and another end to the neutral. That current/voltage

is step down at the secondary winding of the current transformer due to the mutual induction. If

the load varies, the step down voltage also varies in accordance with the input voltage. Due to

the mutual induction of the transformer, if the primary winding of the transformer voltage is

more the flux induced is more and the secondary voltage is more. Similarly, if the primary

winding of the transformer voltage is less the flux induced is less and the secondary voltage is

less. In this way under/over voltage occurs. At present we cant vary the line voltage manually,

38

Page 39: Pre paid energy meter

for that we needs to vary the load to vary manually. But in our project we can vary the

current/voltage by converting it to AC to DC voltage.The above figure shows a half-wave

rectifier, in which it will converts ac to dc voltage. We can vary the voltage with the variable

load resistance (10k) by varying the load resistance we can make under/over voltage manually;

otherwise we have to vary the line voltage.

Operation: The output of the signal sampling voltage (3v) goes to the input of both of

the comparator. In the first comparator we have set the voltage say 3.5Vto the non-inverting

terminal. In this case non-inverting terminal is greater than the inverting terminal. That means

output of the first comparator is LOW. At present under temperature cant be done because the

room temperature will be always available If we wants to do under temperature, we have to

vary or change the set point which is connected to the inverting terminal of that comparator.

Similarly, for the second comparator we have set the voltage say 4V to the inverting terminal.

In this case inverting terminal is greater than the non-inverting terminal that means output of

the second comparator is HIGH.

If the voltage increases, the corresponding voltage will increase say 4.5V. That voltage

goes to the input of both of the comparator. In the first comparator we have set the voltage say

3.5Vto the non-inverting terminal. In this case inverting terminal is greater than the non-

inverting terminal. That means output of the first comparator is HIGH this means that over

temperature has occurred. Similarly, for the second comparator we have set the voltage say 4V

to the inverting terminal. In this case non- inverting terminal is greater than the inverting

terminal that means output of the second comparator is LOW.

That output signal is not compatible with the -controller because as we know that the

controller takes input signal as 5V and gives output as 5V. For this reason we needs a signal

39

Page 40: Pre paid energy meter

conditioning circuit which is given in the below figure-2. That output signal is compatible with

the controller because the current will flows from the collector of the transistor whenever the

base voltage is high due to the transistor action. Similarly the output is low in the absence of

the input signal to the signal conditioning circuit from the comparators.

BC5471.5k

10k

(1:0)

VCC= +5vVCC= +5v

(1:1)

INPUT

1.5k

SIGNAL CONDITIONING

OUTPUT

10kOUTPUT

BC547

INPUT

in our section we are using fig1: 0, whenever the base voltage is HIGH the transistor comes to

saturation condition i.e. the emitter current flows to the collector which gives a low voltage at

the output corresponding to GND. The output is taken from the collector junction through a

current limiting resistance and the output signal is given to the - controller or any other

circuit which needs a compatible (5V/0V) voltage. Similarly, whenever the base voltage is

LOW the collector current flows from the Collector junction of the transistor, which gives a

high voltage at the output corresponding to Vcc. The output is taken from the emitter junction

through a current limiting resistance and the output signal is given to the - controller or any

other circuit which needs a compatible (5V/0V) voltage.

40

Page 41: Pre paid energy meter

15k

10k

VCC= +12v

470E

1.5k

P3.1

10k

CT - 02

+

-

LM393

6

57

84

-

+LM393

3

21

84

1.5k

P3.5

BC547

10k

470EP3.2

10k

VCC= +5v

68k

PHASE LED

1.5k

BC547

COMPARATOR & SIGNALCONDITIONING

10k

OUTPUT-2

15k

VCC= +5v

VCC= +5v

VCC= +5v

68k

68k

10k

BC547

15k

1.5k

BC547

VCC= +5v

CT - 01

P3.0

10k

-

+

LM393

3

21

84

BC547

VCC= +5v

10k

BC547

NEUTRAL LED

VCC= +5v

BC547

470E

10k

M.D LED

10k

f) NEUTRAL TAMPERING:

41

Page 42: Pre paid energy meter

This is a very important and useful facility to restrict the Energy theft. In this section two

numbers of CT (Current Transformer) is connected before and after the load i.e. one CT at the

phase and other at the neutral. The voltage output of the CT is converted into DC using a half

wave rectifier filtered with an electrolytic capacitor. The DC voltage produced in this manner

adjusted to a level by using a voltage divider. Using two resistances in series forms the voltage

divider, R1 (Fixed) R2 (Variable) the voltage outpu(Vs) is adjusted normally for a value

bellow 5volt. While designing the voltage divider the care is taken to allow maximum 1mA

current to the ground also the required voltage for sampling is also important.

I= V/(R1+R2) =1m…………………………….(1)

Vs = IxR2…..…………………………………..(2)

R1 is assumed and R2 is decided for nearest available values.

The voltage sampled feed to two comparators, the comparator set values are kept as low as

possible, normally adjusted between 0v to 0.5 volt. If there is current in the CT then the CT

out put feed to the comparator (Vs) drives the comparator into saturation. There are two

comparator connected to the phase and neutral, if the system is normal the it is understood the

phase current and neutral currents are same so both the comparator outputs are high. If any user

uses the phase and run the load using the earth instead of using the neutral then the and

comparator outputs are no longer remains high but the phase comparator output is high the

neutral comparator output becomes low. When this combination is feed to the microcontroller

after signal conditioning the microcontroller understands this as a fault condition.

42

Page 43: Pre paid energy meter

C.T- 01

C.T- 02

10K

CURRENT SAMPLING CKT

C NC

N

L1

P3.6

ENERGY METER

L2

COMP..-2

1000WLOAD

100uF

S2

10K

P

RELAYTIP122

10K

100uF

IN4007

IN4007VCC=+12V

S1

1.5k

10K

COMP..-1

g) OPTO-ISOLATOR:

43

Page 44: Pre paid energy meter

Introduction:

The device is a simple isolating opt coupler show two other types of opt coupler. The device

shown in Fig is known as a slotted opt coupler. And has a slot moulded into the package

between the LED light source and the phototransistor light sensor.

Here, light can normally pass from the LED to Q1 without significant attenuation by the slot.

The optocoupling can, however, be completely blocked by placing an opaque object in the slot.

The slotted opt coupler can thus be used in a variety of presence detecting applications,

including end-of-tape detection, limit switching, and liquid-level detection.

An opt Isolator is a device containing an infrared LED and a matching phototransistor,

mounted close together (optically coupled) within a light-excluding package as shown in below

figure.

VCC

R1

2

1

U2

MCT2E

1

2

5

4

SW1

1 2

R2

2

1

Here sw1 is normally open, so zero current flows through the LED: Q1 is thus in darkness and

also passes zero current, so zero output voltage appears across R2. When sw1 is closed,

however current flows through the LED via R1, thus illuminating Q1 and causing it to generate

an R2 output voltage. The R2 output voltage can thus be controlled via the R1 input current,

even though R1 and R2 are fully isolated electrically.In practice, the device can be used to

44

Page 45: Pre paid energy meter

optocouple either digital or analogue signals, and can provide hundreds or thousands of volts of

isolation between the input and output circuits.

FUTURE EXPANSION:

This project can be expanded in the following directions.

1. The electromagnetic induction meter can be replaced with a Electronic meter.

2. Remote recharging can be implemented through telephone line or wireless network.

3. The protection against the power theft and energy meter tampering can incorporate

in this project.

4. A mini printer can be interfaced to get a printed bill or details of billing.

5. Software can be modified to view the balance on request.

CONCLUSION

This project is performing satisfactory function in laboratory condition. The device designed is

used in conjunction with an Induction Energy meter. With minor modification in the software

and hardware this system can be used for field application.

45

Page 46: Pre paid energy meter

46