Upload
gadde39
View
187
Download
7
Tags:
Embed Size (px)
DESCRIPTION
prepaid energy meter project documentation
Citation preview
PREPAID ENERGY METER WITH TARIFF INDICATOR
A PROJECT REPORT
Submitted byG.VIJAYA KRISHNA
M.DURGA PRASAD
J.VISHNU VARDHAN REDDY
K.VINEELA CHANDRIKA
in partial fulfillment for the award of the degree
of
BACHELOR OF TECHNOLOGY
In
ELECTRICAL & ELECTRONICS ENGINEERINGUnder the guidance
Of
Mr.J.S.S.Kalyan, M.Tech
Assistant Professor
USHA RAMA COLLEGE OF ENGINEERING & TECHNOLOGYOn NH-5, Telaprolu, Near Gannavaram, Unguturu (M), Krishna Dist. A.P.-521 109
Approved by AICTE, New Delhi
Affiliated to
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY KAKINADA
KAKINADA, A.P - 533 003
APRIL 2012
USHA RAMA COLLEGE OF ENGINEERING & TECHNOLOGYOn NH-5, Telaprolu, Near Gannavaram, Unguturu (M), Krishna Dist. A.P.-521 109
approved by AICTE, New Delhi, India.
Affiliated to
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY KAKINADA
KAKINADA, A.P – 533 005
BONAFIDE CERTIFICATE
Certified that this project report”PREPAID ENERGY METER WITH TARIFF INDICATOR” is the bonafide work of G.VIJAYA KRISHNA , M.DURGA PRASAD , J.VISHNU VARDHAN REDDY & K.VINEELA CHANDRIKA registration numbers 08NG1A0239 , 08NG1A0206, 08NG1A0259 & 08NG1A0240 who carried out the project work under my supervision.
Mr. Ravi Kumar Jujjuvarapu, M.Tech, (Ph.D) PROJECT GUIDE
HEAD OF THE DEPARTMENT-EEE Mr. J.S.S.Kalyan, M.Tech
Assistant Professor
SIGNATURE
EXTERNAL EXAMINER
AKNOWLEDGEMENT
We feel privileged to express our deepest sense of gratitude and sincere
thanks to our project guide CH.KALYAN SIR for his excellent guidance
throughout our project work. His prompt and kind help led to the completion of the
dissertation work.
We would also like to thank our H.O.D. J.RAVI KUMAR SIR
for approving our project and giving us ideas regarding the project.We also wish to
thank them for their patience and co-operation, which proved beneficial for us.
We owe a substantial share of our success to the whole faculty and staff
members of Electrical & Electronics Engineering Department, which provided us
the requisite facilities required to complete the project work.
Finally, we wish to express our sincere appreciation and thanks to our
college library and all those who have guided and helped us directly or indirectly
for accomplishing our goal.
REGARDS:
G.VIJAYA KRISHNA(08NG1A0239)
M.DURGA PRASAD(08NG1A0206)
J.VISHNU VARDHAN REDDY(08NG1A0259)
K.VINEELA CHANDRIKA(08NG1A0240)
ABSTRACT Indian power sector is facing serious problem of lean revenue collection as against
energy supplied due to energy thefts and network losses. All the steps taken so far,
regarding the improvement of the revenue collection did not yield satisfactory
results. It is reported that the most faulty sub system is the metering and meter
reading system.
The traditional billing systems are discrete, inaccuratecostly,
slow,and lack flexibility as well as reliability. Therefore, several attempts were
made to automate the billing systems. Even though accurate and fast readings are
obtained, bill payment is still performed based on the old billing procedure. They
require an individual/agent to physically come and take down the readings and
report to house hold/office the amount one has to pay.
Here we are designing and developing a
pre-paid energy metering system with tariff idicator which provides both the
suppliers and the consumers with better services regarding this meter billing and
payment problems.The metering equipment and smart card technology, allows the
power utility to save time and money while providing a new payment option for the
customer.
This is a very good microcontroller based
application. This unit will accept the number of units recharged by the concerned
department person, counts the number of units consumed by the customer and as
soon as the customer exceeds the recharged amount, it will disconnect the power
supply to the customer until the next recharge.
TABLE OF CONTENTS
CHAPTER TITLE PAGE NO
1. INTRODUCTION -
1.1 INTRODUCTIO -
1.2Thesis -
2. HARDWARE DESCRIPTION -
2.1.EEPROM -
2.2.MICROCONTROLLER -
2.3.ENERGY METER -
2.4.REAL TIME CLOCK -
2.5.LCD DISPLAY -
2.6.BUZZER -
2.7.POWER SUPPLY -
2.8.RELAY DRIVER -
2.9.CARD READER -
2.10.DIODE -
2.11.CAPACITOR -
2.12.RESISTOR -
2.13.REGULATOR -
2.14.TRANSFORMER -
2.15.RELAY -
2.16.OPTOCOUPLER -
3. BLOCK DIAGRAM&CICUIT DIAGRAM -
CHAPTER TITLE PAGE NO
4. BENEFITS OF PREPAID ENERGY METER -
5. ADVANTAGES OF PREPAID ENERGY METER -
6. SOFTWARE DESCIPTION&PROGRAM -
7. FUTURE SCOPE &CONCLUSION -
8. REFERENCE -
CHAPTER-1
INTRODUCTION
1.1Introduction on our project:
The Electrical metering instrument technology has come a long
way from what it Was more than 100 years ago. From the original bulky meters
with heavy magnets and coils, there have been many innovations that have
resulted in size & weight reduction in addition to improvement in features and
specifications. Resolution and accuracy of the meter have seen substantial
improvements over the years. Introduction of the digital meter in the later part of
last century has completely changed the way Electrical parameters are measured.
Starting with Voltmeters & Ammeters, the digital meter has conquered the entire
spectrum of measuring instruments due to their advantages like ease of reading,
better resolution and rugged construction. Of particular significance is the
introduction of the Electronic Energy Meter in the mid eighties. Now a days, the
energy consumption and energy distribution has became a big subject for
discussion because of huge difference in energy production and consumption. In
this regard, energy consumers are facing so many problems due to the frequent
power failures; another important reason for power cuts is due to the un-limited
energy consumption of rich people. In this aspect, to minimize the power cuts and
to distribute the energy equally to all areas, some restriction should have over the
power consumption of each and every energy consumer, and according to that the
Government should implement a policy, by introducing Autonomous Energy
Meters everywhere in domestic sector. Hence, the need has come to think on this
line and a solution has to be emerged out.
Electrical Metering Instrument Technology
Today the metering instrument technology grown up significantly, such
that the Consumed energy can be calculated mathematically, displayed, data can be
stored, data can be transmitted, etc. Presently the microcontrollers are playing
major role in metering instrument technology. The present project work is
designed to collect the consumed energy data of a particular energy consumer
through wireless communication system (without going to consumer house), the
system can be called as automatic meter reading (AMR) system. The Automatic
Meter readingsystem is intended to remotely collect the meter readings of a
locality using a communication system, without persons physically going and
reading the meters visually.
Details About Electronic Energy Meter
The following are the advantages of electronic energy meter:
Accuracy
While electromechanical meters are normally available with Class 2
accuracy, Electronic meters of Class 1 accuracy are very common.
Low Current Performance
Most of the electromechanical meters tend to run slow after a few years
and stoprecording at low loads typically below 40% of their basic current. This is
due to increased friction at their bearings. This results in large losses in revenue
since most of the residential consumers will be running at very low loads for
almost 20 hours in a day. Electronic meters record consistently and accurately even
at 5% of their basic current. Also they are guaranteed to start recording energy at
0.4% of their basic current.
Low Voltage Performance
Most of the mechanical meters become inaccurate at voltages below
75% of ratedvoltage whereas electronic meters record accurately even at 50% of
rated voltage. This is a major advantage where low voltage problem is very
common.
Installation
The mechanical meter is very sensitive to the position in which it is
installed. If it is not mounted vertically, it will run slow, resulting in revenue loss.
Electronic meters are not sensitive
Tamper
The mechanical meters can be tampered very easily even without
disturbing the Wiring either by using an external magnet or by inserting a thin film
into the meter to touch the rotating disc. In addition to these methods, in the case
of a single-phase meter, there are more than 20 conditions of external wiring that
can make the meter record less. In the case of 3 Phase meter, external wiring can
be manipulated in 4 ways to make it slow. Hence, any of these methods cannot
tamper electronic meters. Moreover they can detect the tampering of meter by
using LED.
New Features
Electronic meters provide many new features like prepaid
metering and remote Metering that can improve the efficiency of the utility.
Remote Metering of Energy Meters
The introduction of electronic energy meters for electrical energy
metering hasresulted in various improvements in the operations of utilities apart
from the increase in revenue due to better recording of energy consumption. One
such additional benefit is the possibility of reading the meters automatically using
meter-reading instruments even without going near the meter. Meter reading
instruments (MRI) are intelligent devices with built in memory and keyboard. The
meter reader can download the energy consumption and related information from
the electronic meter into the meter reading instrument either by connecting the
MRI physically to the meter using their communication ports or by communicating
with the meter from a distance using Radio Frequency (RF) communication media.
RF communication method is similar to a cordless telephone, which is quite
common these days. The meter and the MRI are provided with an antenna. When
the meter reader presses a button on the MRI, it communicates with the meter
through RF and asks for all the data that are preset. The meter responds with all
relevant data like meter identification number, cumulative energy consumed till
that time etc. After reading many meters like that in one MRI, the meter reader can
go to the office and transfer all these data into a computer, which will have all
these data for the previous billing period. Using these two data, the computer
calculates the consumption for the current billing period and prepares the bill for
each consumer.
The use of RF communication enables the utility to install the meters
on top of theelectric pole out of reach of the consumers thereby eliminating
chances of tamper of the meter. Frequencies in the range of 400 MHz to 900
MHzare commonly used for this purpose. However other frequencies can also be
used. If the distance between meter and MRI is of the order of 10 or 15 meters, this
communication can be achieved using low power transmitters at reasonable costs.
Power line carrier communication is another method of remote metering. In this
method, the meter data is transferred to an MRI or computer by using the power
line itself as the medium of transmission. This solution is generally cheaper than
RF but needs good quality power lines to avoid loss of data. This method is more
attractive for limited distance communication. Third medium of communication
possible is telephone line. This is viable only for industrial meters like the
Trivector meter because of the cost of Modems required and the need for a
telephone line, which may not be available in every house. This medium has the
advantage of unlimited distance range. Remote metering is typically not a default
option, but something provided for selected customers. The preferred customer
base may include suspicious clients or those located very close to others, such as in
a high-rise building. In the latter case, tens or hundreds of meters may use RF to
send billing data to a common collector unit, which then decodes the data with
microcontrollers or computers.
PREPAYMENT METERING
Yet another advantage of the electronic meter is the possibility of
introducing Prepaid metering system. Prepaid metering system is the one in which
the consumer pays money in advance to the utility and then feeds this information
into his meter. The meter then updates the credit available to the consumer and
starts deducting his consumption from available credit. Once the credit reaches a
minimum specified value, meter raises an alarm. If the credit is completely
exhausted, the meter switches off the loads of the consumer. Main advantage of this system is that the utility can eliminate
meter readers. Another benefit is that they get paid in advance. The consumer
benefits due to elimination of penalty for late payment. Also it enables him to plan
his electricity bill expenses in a better manner. Due tothe intelligence built in into
the electronic meters, introduction of prepaid metering becomes much easier than
in the case of electromechanical meters.
Prepaid Energy Metering
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 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 ofinstallations.
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.
1.2THESIS: The thesis explains the implementation of ”prepaid energy meter with
tariff indicator “ .The organization of thesis is expalind here.
Chapter1:Introduction about prepaid energy meter.It gives over all information
about prepaid energy meter
Chapter2:presents the hard ware description.where all components which are used
in project are brefily described.
Chapter3:presents about block diagram &circuit diagram.
Chapter4:presents the benefits of prepaid energy meter.
Chapter5:presents the advantages of perpaid energy meter.
Chapter6:it consists of brief note on software and program used in our project
Chapter7:It gives the future scope and conclusion.
CHAPTER-2
HARDWARE DESCRIPTION
COMPONENTS USED IN OUR PROJECT ARE AS FOLLOWS:
2.1EEPROM(24C02):-
AT24C02 is an electrically erasable and programmable ROM. It
Has a 2Kbits of memory size arranged in 32 pages of 8 byte each. There are 256
(32 x 8) words each of one byte. The data is transferred and received serially
throughserial data (SDA) pin.
The SCL is clock input and is used to synchronize EEPROM with
microcontroller for various operations. When data is to be read or write, first a start
condition is created followed by device address, byte address and the data itself.
Finally a stop condition is provided. The start condition occurs when SDA and
SCL get high to low simultaneously. The stop condition is when SDA remains low
while SCL goes from high to low. The data is read or written between the start and
stop conditions on every transition of SCL from high to low. For more details on
different operations and addressing, refer interfacing 24C02 with 8051.
A total of eight EEPROMs can be connected through a bus. There are
three address pins in AT24C02 for selecting a particular chip. The device can be
addressed serially by the software. It makes use of an internal register of the
EEPROM whose 4 MSB bits are 1010, the next three are the EEPROM address
bits and the LSB signifies whether data is to be read or written. This last bit is 1 for
write and 0 for read operation.
For example, if in an EEPROM all address bits are grounded, then
for write operation a hex value 0xA1 (1010 0001) will be sent. Here 000, in last
bits, addresses the EEPROM and 1 in LSB indicates a write operation. Similarly
for read operation the device address to be sent is 0xA0 (1010 0000). Next, the
byte or page address is sent followed by the data byte. This data byte is to be
written on or read by the microcontroller.
FEATURES:
• Low-voltage and Standard-voltage Operation– 2.7 (VCC = 2.7V to 5.5V)– 1.8 (VCC = 1.8V to 5.5V)
• Internally Organized 128 x 8 (1K), 256 x 8 (2K), 512 x 8 (4K),1024 x 8 (8K) or 2048 x 8 (16K)
• Two-wire Serial Interface
• Schmitt Trigger, Filtered Inputs for Noise Suppression
• Bidirectional Data Transfer Protocol
• 100 kHz (1.8V) and 400 kHz (2.7V, 5V) Compatibility
• Write Protect Pin for Hardware Data Protection
• 8-byte Page (1K, 2K), 16-byte Page (4K, 8K, 16K) Write Modes
• Partial Page Writes Allowed
• Self-timed Write Cycle (5 ms max)
• High-reliability– Endurance: 1 Million Write Cycles– Data Retention: 100 Years
• Automotive Devices Available
• 8-lead JEDEC PDIP, 8-lead JEDEC SOIC, 8-lead Ultra Thin Mini-MAP (MLP 2x3), 5-lead
SOT23, 8-lead TSSOP and 8-ball dBGA2 Packages
• Die Sales: Wafer Form, Waffle Pack and Bumped Wafers
PIN DIAGARAM
PINS DESCRIPTION:
Figure shows pin Description of 24c02 EEPROM IC.
SERIAL CLOCK (SCL): The SCL input is used to positive edge clock data into each EEPROM
device and negative edge clock data out of each device.
SERIAL DATA (SDA): The SDA pin is bidirectional for serial data transfer. This pin is open-
drain driven and may be wire-ORed with any number of other open-drain or
open-collector devices.
DEVICE/PAGE ADDRESSES (A2, A1, A0): The A2, A1 and A0 pins are device address inputs that are hard wired
for the AT24C02. As many as eight 1K/2K devices may be addressed on a single
bus system (device addressing is discussed in detail underthe Device Addressing
section).
WRITE PROTECT (WP): The AT24C02 has a Write Protect pin that provides hardware data
protection. The Write Protect pin allows normal Read/Write operations when
connected to ground (GND). When the Write Protect pin is connected to VCC, the
write protection feature is enabled and operates. WP pin status Part of Array
Protected 24c02 .At VCC Full (2K) Array. At GND Normal Read/Write
Operations. The ST24C02A is a 2k bit electrically erasable programmable memory,
organized as 256x8 bits. The memory is compatible with I2C bus standard,two
data bus and serial clock. The STA240C2A carries a built in a bit unique device
information code corresponding to the I2C bus definition. This is used together
with a 3-bit chip enable input to form a 7-bit memory select signal. In this way up
to 8 ST24C02A’S may be connected to the I2C bus and selected individually.
The ST24C02A behaves as a slave device in the I2C protocol with all
memory operations synchronized by the serial clock. Read and write operations are
initiated by start condition generated by the bus master. The start condition is
followed by a stream of 7 device select bit plus one read/write bit and terminated
by an acknowledge bit. When writing data to the memory it respond to the 8 bits
received by asserting an acknowledge bit during the ninth bit time. Data transfers
are terminated with a stop conditions.
OPERATING MODES:- There are both read and write modes. Each is entered by the correct
sequence of serial bits sent to the device on the SDA line. For some write modes
the status of the mode input is also used to set the operating mode. The 8bits sent
after a start condition are made up of a bits that identify the device type, 3 chip
enable bits and one direction indicator bit. Whether the controller wants to read
from the device or write to the device is decided by the very first byte sent to it on
the SDA line. The last bit of very first sent to E2PROM is directional indicator. If
this bit is ‘Zero’ the direction of data flow is from controller to the E2PROM and if
‘One’ it is from E2PROM to the controller. Following are the different modes for
reading or writing from the E2PROM.
1). Byte Write: - In this mode a device select is sent with the R/W bit at ‘0’ followed
by the address of the byte. This is followed by the 8 bit data to be written during
the programmingcycle.
2). Multi byte Write And Page Write: - In these modes up to 4 or 8 bytes respectively may be written
in one programming cycle. Multi-byte write mode is activated when the mode pin
is at V/H level and page write when mode is at V/L. A device select is sent with
the R/W bit at ‘0’ followed by the data bytes to write. The bytes are written in the
programming cycle 8 bytes written in the page write mode must have the same five
upper address bits
3). Current Address: In this mode device select is sent with the R/W bit at ‘1’. The
address of various byte accessed is automatically incremented and the new byte
read.
4). Random Address Read: - This mode allows random access to the memory. A device select is sent
with R/W bit at ‘0’ (write) followed by the address .Then a new start condition is
forced with the same device select is sent with the R/W bit at ‘1’ (read) and the
byte is read.
5). Sequential Read: - This mode starts with either a current address or random address read
sequence it reads consecutive bytes as long as the bus master acknowledges each
one without generating a stop condition.
Device operation based on I2c protocol : The 24C02 family uses two I/O lines for interfacing: SCL
(Serial Clock) and SDA (Serial Data). SCL edges have different functions,
depending on whether a device is being read from or written to. When clocking
data into the device, the positive edges of the clock latch the data. The negative
clock edges clock data out of the device. The SDA signal is bi-directional, and is
physically an open-drain so that multiple EEPROMs or other devices can share the
pin. Both SCL and SDA must be pulled high externally. The protocol used by the
EEPROM is based in part on an ACK (acknowledge) bit sent by the EEPROM, if
the data sent to it has been received. All addresses and data are sent in 8-bit words.
The EEPROM sends the ACK as a low bit period during the ninth clock cycle. The
EEPROM looks for specific transitions on the SCL and SDA pins to qualify READ
and WRITE. Data on the SDA pin may change only during the time SCL is low.
Data changes during SCL high periods indicate a START or STOP condition. A
START condition is a high-to-low transition of SDA with SCL high. All data
transfers must begin with a START condition. A STOP condition is a low-to-high
transition of SDA with SCL high. All data transfers must end with a STOP
condition. After a READ, the STOP places the EEPROM in a standby power
mode. Refer to Figure 1 for START and STOP conditions. Figure 1. START and
STOP conditions.
Device Addressing The 24C02 has 3 physical pins, designated A2, A1, and A0, which
are tied to logic 1 or 0 levels. This allows eight unique hardware addresses, so that
up to eight 24C02s can share the SCL and SDA lines without conflict. There is an
internal address comparator that looks for a match between the address sent by the
master controller and the 24C02's unique 7-bit address, determined in part by A2,
A1, and A0. Refer to Table 1below. Table 1. 24C02 Device Address
MSB LSB1 0 1 0 A2 A1 A0 R/~W
The device address is sent immediately after a START condition. The first four
bits are the sequence "1010", which is a simple "noise filter" which prevents a
random noise burst on the lines from accessing the device. The last bit sent is a 1
for READ and a 0 for WRITE. The code example below is for random
READ/WRITE operations. The part can also perform Page Write/Sequential Read
with slight code modifications. See the 24C02 data sheet for more information.
Byte Write to Memory:
The Byte Write sequence is shown in Figure 2. After receiving a START
condition and a device address, the EEPROM sends an ACK if the device address
matches its own unique address. The MAX7651 waits for the ACK and aborts
communication if it is not present. Next, an 8-bit byte address is sent, followed by
another ACK. The MAX7651 then sends the 8-bit data byte, waits for the third
ACK, and sends a STOP condition.
WRITE operation. It is important to note that after the STOP condition is received, the
EEPROM internally waits for the data to be stored into its internal memory array.
This can take as long as 10ms. The 24C02 will ignore attempted accesses while the
internal EEPROM is being programmed. The part can be polled for completion of
the internal write cycle. This involves sending another START condition (also
called a REPEATED START), followed by the device address byte. Note, in this
case, thereis no STOP condition sent. The EEPROM will send an ACK if the
internal programming cycle is completed. The MAX7651 can also be programmed
to wait10ms before proceeding.
Hardware connection EEPROM is based on i2c protocol ,two wired serial
protocol. For that we need two pins. We use p3.6 for SCL and p3.7 for SDA .
a0,a1,a2 are address lines to select EEPROM chip. That is hard wired and fix for
each EEPROM. To send address, data, start-stop condition data we use SCL and
SDA.
2.2MICROCONTROLLER(AT89S52):-
Description :-
The AT89S52 is a low-power, high-performance CMOS 8-
bit microcontroller with 8K bytes of in-system programmable Flash memory. The
device is manufactured using Atmel’s high-density nonvolatile memory
technology and is compatible with the indus-try-standard 80C51 instruction set and
pinout. The on-chip Flash allows the program memory to be reprogrammed in-
system or by a conventional nonvolatile memory pro-grammer. By combining a
versatile 8-bit CPU with in-system programmable Flash on a monolithic chip, the
Atmel AT89S52 is a powerful microcontroller which provides a highly-flexible
and cost-effective solution to many embedded control applications. The AT89S52 provides the following standard features:
8K bytes of Flash, 256 bytes of RAM, 32 I/O lines, Watchdog timer, two data
pointers, three 16-bit timer/counters, a six-vector two-level interrupt architecture, a
full duplex serial port, on-chip oscillator, and clock circuitry. In addition, the
AT89S52 is designed with static logic for operation down to zero frequency and
supports two software selectable power saving modes. The Idle Mode stops the
CPU while allowing the RAM,timer/counters, serial port, and interrupt system to
continue functioning. The Power-down mode saves the RAM con-tents but freezes
the oscillator, disabling all other chip functions until the next interrupt or hardware
reset.
FEARTURES:
Compatible with MCS-51 Products
8K Bytes of In-System Programmable (ISP) Flash Memory
Endurance: 1,000 Write/Erase Cycles
4.0V to 5.5V Operating Range
Fully Static Operation: 0 Hz to 33 MHz
Three-level Program Memory Lock
256 x 8-bit Internal RAM
32 Programmable I/O Lines
Three 16-bit Timer/Counters
Interrupt Recovery from Power-down Mode
Eight Interrupt Sources
Full Duplex UART Serial Channel
Low-power Idle and Power-down Modes
PIN DIAGRAM
Vital role of Micro controller-AT89S52:
1) It will acts a master to communicate with memory
2) Whenever command is sent to reset the memory ,controller resets the memory
3) Controller takes the pulses from the energy meter and increments the Unit which
depends upon the calculations and stores in memory.
4) Microcontroller also switches off the energy meter whenever the command is
sent from the server. This happens when the owner has not paid the bill.
BLOCK DIAGRAM
ARCHITECHTURE OF MICROCONTROLLER AT89S52
DEVICE OPERATION:
CLOCK and DATA TRANSITIONS: The SDA pin is normally pulled high with
an external device. Data on the SDA pin may change only during SCL low time
periods. Data changes during SCL high periods will indicate a start or stop
condition as defined below.
Figure : Data validity
START CONDITION: A high-to-low transition of SDA with SCL high is a start
condition which must precede any other command.
STOP CONDITION: A low-to-high transition of SDA with SCL high is a stop
condition. After a read sequence, the stop command will place the EEPROM in a
standby power mode .
Figure : Start & Stop condition
ACKNOWLEDGE: All addresses and data words are serially transmitted to and
from the EEPROM in 8-bit words. The EEPROM sends a zero to acknowledge that
it has received each word. This happens during the ninth clock cycle.
Figure : Acknowledge
STANDBY MODE: The AT24C01A/02/04/08A/16A features a low-power
standby mode which is enabled: (a) upon power-up and (b) after the receipt of the
STOP bit and the completion of any internal operations.
MEMORY RESET: After an interruption in protocol, power loss or system reset,
any 2-wire part can be reset by following these steps:
1. Clock up to 9 cycles.
2. Look for SDA high in each cycle while SCL is high.
3. Create a start condition.
Device Addressing
The 1K, 2K, 4K, 8K and 16K EEPROM devices all require an 8-bit
device address word following a start condition to enable the chip for a read or
write operation .The device address word consists of a mandatory one, zero
sequence for the first four most significant bits as shown. This is common to all the
EEPROM devices. The next 3 bits are the A2, A1 and A0 device address bits for
the 1K/2K EEPROM. These 3 bits must compare to their corresponding hard-
wired input pins. The 4K EEPROM only uses the A2 and A1 device address bits
with the third bit being a memory page address bit. The two device address bits
must compare to their corresponding hard-wired input pins. The A0 pin is no
connect. The 8K EEPROM only uses the A2 device address bit with the next 2 bits
being for memory page addressing. The A2 bit must compare to its corresponding
hard-wired input pin. The A1 and A0 pins are no connect. The 16K does not use
any device address bits but instead the 3 bits are used for memory page addressing.
These page addressing bits on the 4K, 8K and 16K devices should be considered
the most significant bits of the data word address which follows. The A0, A1 and
A2 pins are no connect. The eighth bit of the device address is the read/write
operation select bit. A read operation is initiated if this bit is high and a write
operation is initiated if this bit is low. Upon a compare of the device address, the
EEPROM will output a zero. If a compare is not made, the chip will return to a
standby state.
Figure: Device Addressing
Write Operations
BYTE WRITE: A write operation requires an 8-bit data word address following
the device address word and acknowledgment. Upon receipt of this address, the
EEPROM will again respond with a zero and then clock in the first 8-bit data
word. Following receipt of the 8-bit data word, the EEPROM will output a zero
and the addressing device, such as a microcontroller, must terminate the write
sequence with a stop condition. At this time the EEPROM enters an internally
timed write cycle, tWR, to the nonvolatile memory. All inputs are disabled during
this write cycle and the EEPROM will not respond until the write is complete.
Figure : Byte Write
PAGE WRITE: The 1K/2K EEPROM is capable of an 8-byte page write, and the
4K, 8K and 16K devices are capable of 16-byte page writes. A page write is
initiated the same as a byte write, but the microcontroller does not send a stop
condition after the first data word is clocked in. Instead, after the EEPROM
acknowledges receipt of the first data word, the microcontroller can transmit up to
seven (1K/2K) or fifteen (4K, 8K, 16K) more data words. The EEPROM will
respond with a zero after each data word received. The microcontroller must
terminate the page write sequence with a stop condition.
The data word address lower three (1K/2K) or four (4K, 8K, 16K) bits are
internally incremented following the receipt of each data word. The higher data
word address bits are not incremented, retaining the memory page row location.
When the word address, internally generated, reaches the page boundary, the
following byte is placed at the beginning of the same page. If more than eight
(1K/2K) or sixteen (4K, 8K, 16K) data words are transmitted to the EEPROM, the
data word address will “roll over” and previous data will be overwritten.
ACKNOWLEDGE POLLING: Once the internally timed write cycle has started
and the EEPROM inputs are disabled, acknowledge polling can be initiated. This
involves sending a start condition followed by the device address word. The
read/write bit is representative of the operation desired. Only if the internal write
cycle has completed will the EEPROM respond with a zero allowing the read or
write sequence to continue.
Read Operations
Read operations are initiated the same way as write operations with the
exception that the read/write select bit in the device address word is set to one.
There are three read operations:
CURRENT ADDRESS READ: The internal data word address counter maintains
the last address accessed during the last read or write operation, incremented by
one. This address stays valid between operations as long as the chip power is
maintained. The address “roll over” during read is from the last byte of the last
memory page to the first byte of the first page. The address “roll over” during write
is from the last byte of the current page to the first byte of the same page. Once the
device address with the read/write select bit set to one is clocked in and
acknowledged by the EEPROM, the current address data word is serially clocked
out. The microcontroller does not respond with an input zero but does generate a
following stop condition
RANDOM READ: A random read requires a “dummy” byte write sequence to
load in the data word address. Once the device address word and data word address
are clocked in and acknowledged by the EEPROM, the microcontroller must
generate another start condition.
The microcontroller now initiates a current address read by sending a device
address with the read/write select bit high. The EEPROM acknowledges the device
address and serially clocks out the data word. The microcontroller does not
respond with a zero but does generate a following stop condition.
SEQUENTIAL READ: Sequential reads are initiated by either a current address
read or a random address read. After the microcontroller receives a data word, it
responds with an acknowledge. As long as the EEPROM receives an acknowledge,
it will continue to increment the data word address and serially clock out sequential
data words. When the memory address limit is reached, the data word address will
“roll over” and the sequential read will continue. The sequential read operation is
terminated when the microcontroller does not respond with a zero but does
generate a following stop condition.
Figure : Current Address Read
Figure : Random Read
Figure : Sequential Read
2.3SINGLE PHASE ENERGY METER:
An electric meter or energy meter is a device that measures the
amount of electrical energy supplied to or produced by a residence, business or
machine.
The most common type is a kilowatt hour meter. When used in electricity
retailing, the utilities record the values measured by these meters to generate an
invoice for the electricity. They may also record other variables including the time
when the electricity was used.
Modern electricity meters operate by continuously measuring the
instantaneous voltage (volts) and current (amperes) and finding the product of
these to give instantaneous electrical power (watts) which is then integrated against
time to give energy used (joules, kilowatt-hours etc). The meters fall into two basic
categories, electromechanical and electronic.
Electromechanical meters The most common type of electricity meter is the Thomson or
electromechanical induction watt-hour meter, invented by Elihu Thomson in
1888.
Technology
The electromechanical induction meter operates by counting the
revolutions of an aluminum disc which is made to rotate at a speed proportional to
the power. The number of revolutions is thus proportional to the energy usage. It
consumes a small amount of power, typically around 2 watts.
The metallic disc is acted upon by two coils. One coil is connected in
such a way that it produces a magnetic flux in proportion to the voltage and the
other produces a magnetic flux in proportion to the current. The field of the voltage
coil is delayed by 90 degrees using a lag coil. [1]This produces eddy currents in the
disc and the effect is such that a force is exerted on the disc in proportion to the
product of the instantaneous current and voltage. A permanent magnet exerts an
opposing force proportional to the speed of rotation of the disc - this acts as a brake
which causes the disc to stop spinning when power stops being drawn rather than
allowing it to spin faster and faster. This causes the disc to rotate at a speed
proportional to the power being used. The type of meter described above is used on a single-phase AC
supply. Different phase configurations use additional voltage and current coils.
Reading
The aluminum disc is supported by a spindle which has a worm gear which
drives the register. The register is a series of dials which record the amount of
energy used. The dials may be of the cyclometer type, an odometer-like display
that is easy to read where for each dial a single digit is shown through a window in
the face of the meter, or of the pointer type where a pointer indicates each digit. It
should be noted that with the dial pointer type, adjacent pointers generally rotate in
opposite directions due to the gearing mechanism. The amount of energy represented by one revolution of the disc is
denoted by the symbol Kh which is given in units of watt-hours per revolution. The
Single phase energy meter
value 7.2 is commonly seen. Using the value of Kh, one can determine their power
consumption at any given time by timing the disc with a stopwatch. If the time in
seconds taken by the disc to complete one revolution is t, then the power in watts is
. For example, if Kh = 7.2, as above, and one revolution took place in 14.4 seconds,
the power is 1800 watts. This method can be used to determine the power
consumption of household devices by switching them on one by one.
Most domestic electricity meters must be read manually, whether by a
representative of the power company or by the customer. Where the customer
reads the meter, the reading may be supplied to the power company by telephone,
post or over the internet. The electricity company will normally require a visit by a
company representative at least annually in order to verify customer-supplied
readings and to make a basic safety check of the meter.
Accuracy In an induction type meter, creep is a phenomenon that can adversely affect
accuracy, that occurs when the meter disc rotates continuously with potential
applied and the load terminals open circuited. A test for error due to creep is called
a creep test.
2.4REAL TIME CLOCK (DS1307):
DESCRIPTION:
The DS1307 serial real-time clock (RTC) is a low-power, full binary-
Coded decimal (BCD) clock/calendar plus 56 bytes of NV SRAM. Address and
data are transferred serially through an I²C, bidirectional bus. The clock/calendar
provides seconds, minutes, hours, day, date, month, and year information. The end
of the month date is automatically adjusted for months with fewer than 31 days,
Including corrections for leap year. The clock operates in either the 24-hour or 12-
hour format with AM/PM indicator. The DS1307 has a built-in power-sense circuit
that detects power failures and automatically switches to the backup supply.
Timekeeping operation continues while the part operates from the backup supply.
KEY FEATURES:
Real-Time Clock (RTC) Counts Seconds, Minutes, Hours, Date of the Month,
Month, Day of the week, and Year with Leap-Year Compensation Valid Up to
2100
56-Byte, Battery-Backed, General-Purpose RAM with Unlimited Writes I²C Serial Interface Programmable Square-Wave Output Signal Automatic Power-Fail Detect and Switch Circuitry Consumes Less than 500nA in Battery-Backup Mode with Oscillator Running Optional Industrial Temperature Range: -40°C to +85°C Available in 8-Pin Plastic
DIP or SO
DIAGRAM:
2.5 LCD DISPLAY:
For display purpose we are using a 16x2 character LCD. The display
contains 14 pins , in which 1st and 2nd pins are the GND and VCC respectively.
The 3rd pin VEE determines the contrast of the display. For adjusting the contrast, a
variable resistor is used in between the VCC and GND and output is connected to
the VEE. RS, R/W, and E control lines are directly connected to the
microcontroller’s P1.3, P1.4 and P1.5 respectively. The data line D0 to D7 is
connected to the P0. SinceP0 lacks the internal pull up resistor; an external array of
8 resistors (10K) is used as the pull up. The LCD module contains an internal
LCD backlight, which is normally a LED based. For controlling the backlight, the
pin is connected the microcontroller’s P2.7 pin. The port pin is configured as
sinking mode.
LCD PIN DESCRIPTION
The LCD discuss in this section has the most common connector used for the
Hitatchi 44780 based LCD is 14 pins in a row and modes of operation and how to
program andinterface with microcontroller is describes in this section.
LCD DISPLAY
VCC, VSS, VEE
The voltage VCC and VSS provided by +5V and ground respectively while VEE is
used for controlling LCD contrast. Variable voltage between Ground and Vcc is
used to specify the contrast (or "darkness") of the characters on the LCD screen.
RS (register select)
There are two important registers inside the LCD. The RS pin is used for their
selection asfollows. If RS=0, the instruction command code register is selected,
then allowing to user to send a command such as clear display, cursor at home etc..
If RS=1, the data register is selected, allowing the user to send data to be displayed
on the LCD.
R/W (read/write)
The R/W (read/write) input allowing the user to write information from it. R/W=1,
when it read and R/W=0, when it writing.
EN (enable)
The enable pin is used by the LCD to latch information presented to its data pins.
When data is supplied to data pins, a high power, a high-to-low pulse must be
applied to this pin in order to for the LCD to latch in the data presented at the data
pins.
D0-D7 (data lines)
The 8-bit data pins, D0-D7, are used to send information to the LCD or read the
contents of the LCD’s internal registers. To displays the letters and numbers, we
send ASCII codes for the letters A-Z, a-z, and numbers 0-9 to these pins while
making RS =1. There are also command codes that can be sent to clear the display
or force the cursor to the home position or blink the cursor. We also use RS =0 to
check the busy flag bit to see if the LCD is ready to receive the information. The
busy flag is D7 and can be read when R/W =1 and RS =0, as follows: if R/W =1
and RS =0, when D7 =1(busy flag =1), the LCD is busy taking care of internal
operations and will not accept any information. When D7 =0, the LCD is ready to
receive new information
INTERFACING OF MICRO CONTROLLER WITH LCD DISPLAY:
In most applications, the "R/W" line is grounded. This simplifies the
applicationbecause when data is read back, the microcontroller I/O pins have to be
alternated between input and output modes. In this case, "R/W" to ground and just
wait the maximum amount of time for each instruction (4.1 msecs for clearing the
display or moving the cursor/display to the "home position", 160 usecs for all other
commands) and also the application software is simpler, it also frees up a
microcontroller pin for other uses. Different LCD execute instructions at different
rates and to avoid problems later on (such as if the LCD is changed to a slower
unit). Before sending commands or data to the LCD module, the Module must be
initialized. Once the initialization is complete, the LCD can be written to with data
or instructions as required. Each character to display is written like the control
bytes, except that the "RS" line is set. During initialization, by setting the "S/C" bit
during the "Move Cursor/Shift Display" command, after each character is sent to
the LCD, the cursor built into the LCD will increment to the next position (either
right or left). Normally, the "S/C" bit is set (equal to ".
2.6BUZZER:
The Buzzer driver is a simple transistor based circuit designed to
drive a buzzer. The circuit consists of a NPN transistor BC548. The base of the
BC548 is connected to the microcontroller pin 17(P3.7) through a 560Ω resistor.
The 5V supply is connected to the collector pin through the buzzer. When the
microcontroller puts a HIGH on the p3.7, the transistor will be in ON state and as a
result, the Buzzer beeps. When the pin LOW, transistor goes to OFF state and the
buzzer is also in OFF state.
2.7Power Supply
The power supply is designed with the normal transformer
based supply. The 230V AC line voltage is step down to the 9V AC using a step
down transformer. The step downed voltage is driven to a full wave bridge
rectifier, which consists of 4 1N4007 diodes (D1-D4). The DC voltage from the
rectifier is connected through a capacitor C1, 1000uF. The capacitor acts as a filter
by removing the ripples/ ac contents in the supply. The filter voltage is connected
to the 1st pin of the LM7805, a 5V regulator IC. The regulated 5V out is taken from
the 3rd pin and used for the systems power supply. Capacitors C2 and C16 are used
as second stage filter for removing the transients from the supply. A LED is
connected through a resistor for the indication of the power.
2.8Relay Driver IC ULN2003 :
The ULN2003 is a monolithic high voltage and high current
Darlington transistor arrays. It consists of seven NPN darlington pairs that features
high-voltage outputs with common-cathode clamp diode for switching inductive
loads. The collector-current Rating of a single darlington pair is 500mA. The
darlington pairs May be paralleled for higher current capability. Applications
include Relay drivers, hammer drivers, lamp drivers, display drivers (LED gas
discharge), line drivers, and logic buffers. The ULN2003 has a 2.7k series base
resistor for each Darlington pair for operation directly with TTL or 5VCMOS
devices.
Features:
500mA rated collector current (Single output)
High-voltage outputs: 50V
Inputs compatible with various types of logic.
Relay driver application
Role of Relay Driver:
1) To control the triggering of the Relay
ULN 2003 –Seven Darlington Array:
DESCRIPTION The ULN2003 is a monolithic high voltage and high current Darlington
transistor arrays. It consists of seven NPN darlington pairs that features high-
voltage outputs with common-cathode clamp diode for switching inductive loads.
The collector-currentrating of a single darlington pair is 500mA. The darlington
pairsmay be parrlleled for higher current capability. Applications include relay
drivers,hammer drivers, lampdrivers,display drivers(LED gas discharge),line
drivers, and logic buffers. The ULN2003 has a 2.7kseries base resistor for each
darlington pair for operation directly with TTL or 5V CMOS
FEATURES
* 500mA rated collector current(Single output)
* High-voltage outputs: 50V
* Inputs compatibale with various types of logic.
* Relay driver application
Pin diagram of ULN2003:
2.9CARD READER:
A card reader is a data input device that reads data from a card-shaped storage
medium. A smart card reader is an electronic device that reads smart cards.
Some keyboards have a built-in card reader. There are external devices and
internal drive bay card reader devices for PC. Some laptops have a built-in smart
card reader. External devices may have keyboard to enter PIN or other
information. Those devices usually are called "card readers with PIN pad". Some
laptops have a flash upgradeable firmware. The card reader supplies the integrated
circuit on the smart card with electricity. Communication is done via protocols and
you can read and write to a fixed address on the card.
2.10DIODE:
In electronics, a diode is a two-terminal device ( thermionic diodes may
also have one or two ancillary terminals for a heater).Diodes have two active
electrodes between which the signal of interest may flow, and most are used for
their unidirectional electric current property. The varicap diode is used as an
electrically adjustable capacitor.
The directionality of current flow most diodes exhibit is sometimes
generically called the rectifying property. The most common function of a diode is
to allow an electric current to pass in one direction (called the forward biased
condition) and to block the current in the opposite direction (the reverse biased
condition). Thus, the diode can be thought of as an electronic version of a check
valve.
Various types of diodes
Real diodes do not display such a perfect on-off directionality but have a more
complex non-linear electrical characteristic, which depends on the particular type
of diode technology. Diodes also have many other functions in which they are not
designed to operate in this on-off manner.
Semiconductor diodes
Most modern diodes are based on semiconductor p-n junctions. In a p-n
diode, conventional current can flow from the p-type side (the anode) to the n-type
side (the cathode), but cannot flow in the opposite direction. Another type of
semiconductor diode, the Schottky diode, is formed from the contact between a
metal and a semiconductor rather than by a p-n junction.
Current–voltage characteristic
A semiconductor diode's current–voltage characteristic, or I–V curve, is
related to the transport of carriers through the so-called depletion layer or depletion
region that exists at the p-n junction between differing semiconductors. When a p-n
junction is first created, conduction band (mobile) electrons from the N-doped
region diffuse into the P-doped region where there is a large population of holes
(places for electrons in which no electron is present) with which the electrons
"recombine". When a mobile electron recombines with a hole, both hole and
electron vanish, leaving behind an immobile positively charged donor on the N-
side and negatively charged acceptor on the P-side. The region around the p-n
junction becomes depleted of charge carriers and thus behaves as an insulator.
V-I Characteristics of P-N Junction Diode
However, the depletion width cannot grow without limit. For each
electron-hole pair that recombines, a positively-charged dopant ion is left behind in
the N-doped region, and a negatively charged dopant ion is left behind in the P-
doped region. As recombination proceeds and more ions are created, an increasing
electric field develops through the depletion zone which acts to slow and then
finally stop recombination. At this point, there is a "built-in" potential across the
depletion zone.
If an external voltage is placed across the diode with the same polarity as
the built-in potential, the depletion zone continues to act as an insulator, preventing
any significant electric current flow. This is the reverse bias phenomenon.
However, if the polarity of the external voltage opposes the built-in potential,
recombination can once again proceed, resulting in substantial electric current
through the p-n junction. For silicon diodes, the built-in potential is approximately
0.6 V. Thus, if an external current is passed through the diode, about 0.6 V will be
developed across the diode such that the P-doped region is positive with respect to
the N-doped region and the diode is said to be "turned on" as it has a forward bias.
A diode’s I–V characteristic can be approximated by four regions of
operation (see the figure at right).At very large reverse bias, beyond the peak
inverse voltage or PIV, a process called reverse breakdown occurs which causes a
large increase in current that usually damages the device permanently. The
avalanche diode is deliberately designed for use in the avalanche region. In the
zener diode, the concept of PIV is not applicable. A zener diode contains a heavily
doped p-n junction allowing electrons to tunnel from the valence band of the p-
type material to the conduction band of the n-type material, such that the reverse
voltage is "clamped" to a known value (called the zener voltage), and avalanche
does not occur. Both devices, however, do have a limit to the maximum current
and power in the clamped reverse voltage region. Also, following the end of
forward conduction in any diode, there is reverse current for a short time. The
device does not attain its full blocking capability until the reverse current ceases.
The second region, at reverse biases more positive than the PIV, has only
a very small reverse saturation current. In the reverse bias region for a normal P-N
rectifier diode, the current through the device is very low (in the µA range).The
third region is forward but small bias, where only a small forward current is
conducted.
As the potential difference is increased above an arbitrarily defined "cut-
in voltage" or "on-voltage" or "diode forward voltage drop (Vd)", the diode current
becomes appreciable (the level of current considered "appreciable" and the value
of cut-in voltage depends on the application), and the diode presents a very low
resistance.
Types of semiconductor diode
There are several types of junction diodes, which either emphasize a
different physical aspect of a diode often by geometric scaling, doping level,
choosing the right electrodes, are just an application of a diode in a special circuit,
or are really different devices like the Gunn and laser diode and the MOSFET:
Symbol of Diode
Normal (p-n) diodes, which operate as described above, are usually made of doped
silicon or, more rarely, germanium. Before the development of modern silicon
power rectifier diodes, cuprous oxide and later selenium was used; its low
efficiency gave it a much higher forward voltage drop (typically 1.4–1.7 V per
“cell”, with multiple cells stacked to increase the peak inverse voltage rating in
high voltage rectifiers), and required a large heat sink (often an extension of the
diode’s metal substrate), much larger than a silicon diode of the same current
ratings would require. The vast majority of all diodes are the p-n diodes found in
CMOS integrated circuits, which include two diodes per pin and many other
internal diodes.
Avalanche diodes
Diodes that conduct in the reverse direction when the reverse bias voltage
exceeds the breakdown voltage. These are electrically very similar to Zener diodes,
and are often mistakenly called Zener diodes, but break down by a different
mechanism, the avalanche effect.
Tunnel diodes:
These have a region of operation showing negative resistance caused by
quantum tunneling, thus allowing amplification of signals and very simple bistable
circuits. These diodes are also the type most resistant to nuclear radiation.
Symbol of Tunnel Diode
Gunn diodes
These are similar to tunnel diodes in that they are made of materials such
as GaAs or InP that exhibit a region of negative differential resistance. With
appropriate biasing, dipole domains form and travel across the diode, allowing
high frequency microwave oscillators to be built
Light-emitting diodes (LEDs)
In a diode formed from a direct band-gap semiconductor, such as
gallium arsenide, carriers that cross the junction emit photons when they
recombine with the majority carrier on the other side. Depending on the material,
wavelengths (or colors) from the infrared to the near ultraviolet may be produced.
Symbol of LED
Laser diodes
When an LED-like structure is contained in a resonant cavity formed by
polishing the parallel end faces, a laser can be formed. Laser diodes are commonly
used in optical storage devices and for high speed optical communication.
Photodiodes
All semiconductors are subject to optical charge carrier generation. This
is typically an undesired effect, so most semiconductors are packaged in light
blocking material. Photodiodes are intended to sense light(photodetector), so they
are packaged in materials that allow light to pass, and are usually PIN (the kind of
diode most sensitive to light).
Symbol of Photo diode
Varactor diodes
These are used as voltage-controlled capacitors. These are important in PLL
(phase-locked loop) and FLL (frequency-locked loop) circuits, allowing tuning
circuits, such as those in television receivers, to lock quickly, replacing older
designs that took a long time to warm up and lock.
Symbol of Varactor diode
Zener diodes
Diodes that can be made to conduct backwards. This effect, called Zener
breakdown, occurs at a precisely defined voltage, allowing the diode to be used as
a precision voltage reference. In practical voltage reference circuits Zener and
switching diodes are connected in series and opposite directions to balance the
temperature coefficient to near zero.
Symbol of Zener diode
RECTIFIER DIODE:
These diodes are used diodes are used to convert AC to DC these are used as half
wave rectifier to full wave rectifier.
FEATURE
Low forward voltageHigh current capabilityLow leakage currentHigh surge capabilityLow cost
Rectifier diode
2.11CAPACITOR:
A capacitor is a passive electrical component that can store energy in the
electric field between a pair of conductors (called "plates"). The process of storing
energy in the capacitor is known as "charging", and involves electric charges of
equal magnitude, but opposite polarity, building up on each plate. A capacitor's
ability to store charge is measured by its capacitance, in units of farads.
Capacitors are often used in electric and electronic circuits as energy-
storage devices. They can also be used to differentiate between high-frequency and
low-frequency signals. This property makes them useful in electronic filters.
Practical capacitors have series resistance, internal leakage of charge, series
inductance and other non-ideal properties not found in a theoretical, ideal,
capacitor.
THEORY OF OPERATION
A capacitor consists of two conductive electrodes, or plates, separated by
a dielectric, which prevents charge from moving directly between the plates.
Charge may however move from one plate to the other through an external circuit,
such as a battery connected between the terminals.
Dielectric is placed between two conducting plates, each of area A and with a
separation of d.
When any external connection is removed, the charge on the plates
persists. The separated charges attract each other, and an electric field is present
between the plates. The simplest practical capacitor consists of two wide, flat,
parallel plates separated by a thin dielectric layer.
CAPACITANCE
A capacitor's ability to store charge is measured by its capacitance
‘C’, the ratio of the amount of charge stored on each plate to the voltage:
For an ideal parallel plate capacitor with a plate area ‘A’ and a plate separation ‘d’:
In SI units, a capacitor has a capacitance of one farad when one coulomb
of charge stored on each plate causes a voltage difference of one volt between its
plates. Since the farad is a very large unit, capacitance is usually expressed in
microfarads (µF), nanofarads (nF), or picofarads (pF). In general, capacitance is
greater in devices with large plate areas, separated by small distances. When a
dielectric is present between two charged plates, its molecules become polarized
and reduce the internal electric field and hence the voltage. This allows the
capacitor to store more charge for a given voltage, so a dielectric increases the
capacitance of a capacitor, by an amount given by the dielectric constant, , of the
material.
ELECTROLYTIC CAPACITORS
Electrolytic capacitors are the most popular type for values greater than
about 1 microfarad. Electrolytic capacitors are constructed using a thin film of
oxide on an aluminium foil. An electrolyte is used to make contact with the other
plate. The two plates are wound around on one another and then placed into a can
that is often aluminium.
Electrolytic Capacitors
Electrolytic capacitors are polarised, and care should be taken to ensure
they are placed in circuit the correct way round. If they are connected incorrectly
they can be damaged, and in some extreme instances they can explode. Electrolytic
capacitors have a wide tolerance. Typically the value of the component may be
stated with a tolerance of -50% +100%. Despite this they are widely used in audio
applications as coupling capacitors, and in smoothing applications for power
supplies.
Electrolytic capacitors are available in both leaded and surface
mount formats. The surface mount electrolytic capacitors are available in
rectangular packages whereas the leaded versions are normally contained in a
tubular aluminium can, each end being marked to show its polarity.
CERAMIC CAPACITOR
Ceramic capacitors are normally used for radio frequency and some audio
applications. Ceramic capacitors range in value from figures as low as a few
picofarads to around 0.1 microfarads. In view of their wide range and suitability
for RF applications they are used for coupling and decoupling applications in
particular. Here these ceramic capacitors are by far the most commonly used type
being cheap and reliable and their loss factor is particularly low although this is
dependent on the exact dielectric in use. Their stability and tolerance is not nearly
as good as silver mica types, but their cost is much less. In view of their
constructional properties, these capacitors are widely used both in leaded and
surface mount formats.
There are a number of dielectrics that can be used with
ceramic capacitors. For low values a dielectric designated "C0G" is normally used.
This has the lowest dielectric constant but gives the highest stability and lowest
loss. Where higher values are required in a given size, a dielectric with a higher
dielectric constant must be used. Types with designations X7R and for higher
values, Z5U are used, however their stability and loss are not as good as the
capacitors made with C0G dielectric.
SILVER MICA CAPACITOR
Silver mica capacitors are not as widely used these days as they used to
be. However these electronic components can still be obtained and are used where
stability of value is of the utmost importance and where low loss is required. In
view of this one of their major uses is within the tuned elements of circuits like
oscillators, or within filters.Values are normally in the range between a few
picofarads up to two or possibly three thousand picofarads.
Silver Mica Capacitor
For this type of capacitor the silver electrodes are plated directly on to the mica
dielectric. Again several layers are used to achieve the required capacitance. Wires
for the connections are added and then the whole assembly is encapsulated.
TANTALUM CAPACITOR
Ordinary aluminium electrolytic capacitors are rather large
for many uses. In applications where size is of importance tantalum capacitors may
be used. These are much smaller than the aluminium electrolytic capacitors and
instead of using a film of oxide on aluminium they us a film of oxide on tantalum.
Tantalum capacitors do not normally have high working voltages, 35V is normally
the maximum, and some even have values of only a volt or so.
Like electrolytic capacitors, tantalum capacitors are
also polarised and they are very intolerant of being reverse biased, often exploding
when placed under stress. However their small size makes them very attractive for
many applications. They are available in both leaded and surface mount formats.
2.12RESISTOR:
A resistor is a two-terminal electronic component designed to oppose an electric
current by producing a voltage drop between its terminals in proportion to the
current, that is, in accordance with Ohm's law: V = IR. The resistance R is equal to
the voltage drop V across the resistor divided by the current I through the resistor.
Symbol of Fixed Resistor Symbol of Variable Resistor
Resistors are characterized primarily by their resistance and the power they
can dissipate. Other characteristics include temperature coefficient, noise, and
inductance. Practical resistors can be made of resistive wire, and various
compounds and films, and they can be integrated into hybrid and printed circuits.
Size, and position of leads are relevant to equipment designers; resistors must be
physically large enough not to overheat when dissipating their power. Variable
resistors, adjustable by changing the position of a tapping on the resistive element,
and resistors with a movable tap ("potentiometers"), either adjustable by the user of
equipment or contained within, are also used.Resistors are used as part of electrical
networks and electronic circuits.
There are special types of resistor whose resistance varies with various
quantities, most of which have names, and articles, of their own: the resistance of
thermistors varies greatly with temperature, whether external or due to dissipation,
so they can be used for temperature or current sensing; metal oxide varistors drop
to a very low resistance when a high voltage is applied, making them suitable for
over-voltage protection; the resistance of a strain gauge varies with mechanical
load; the resistance of photoresistors varies with illumination; the resistance of a
Quantum Tunnelling Composite can vary by a factor of 1012 with mechanical
pressure applied; and so on.
V-I Characteristics
UNITS
The ohm (symbol: Ω) is the SI unit of electrical resistance, named after Georg
Ohm. The most commonly used multiples and submultiples in electrical and
electronic usage are the milliohm, ohm, kilohm, and megohm.
TYPES OF RESISTORS
Although resistors come in various forms we can divide them up into just two
basic types:-
1. Fixed resistors
2. Variable resistors (or ‘potentiometers’)
A fixed resistor is a component with two wires which obeys Ohm's Law — i.e. it's
a bit of material which behaves as we described in the last section. Electronic
engineers and manufacturers have adopted some standards for resistors. These are
intended to keep the cost down and make it easier for you to buy them from
whichever supplier you like without having to redesign the equipment you want to
put them in.
Fixed Resistors
In an electrical circuit, some objects may need a lesser amount of
current than the input value. In such cases, fixed resistors are used to reduce the
flow of current. They are placed in such a way that a higher voltage must first pass
through them before it flows further. The value of the resistance is fixed and does
not change with change in the applied voltage or current flowing through it. The
resistance value is measured in ohms and the value ranges from a few milliohms to
about a giga-ohm.
Variable resistors consist of a resistance track with connections at
both ends and a wiper which moves along the track as you turn the spindle. The
track may be made from carbon, cermet (ceramic and metal mixture) or a coil of
wire (for low resistances). The track is usually rotary but straight track versions,
usually called sliders, are also available. Variable resistors may be used as a
rheostat with two connections (the wiper and just one end of the track) or as a
potentiometer with all three connections in use. Miniature versions called presets
are made for setting up circuits which will not require further adjustment.
Variable Resistor
Variable resistors are often called potentiometers in books and catalogues. They
are specified by their maximum resistance, linear or logarithmic track, and their
physical size. The standard spindle diameter is 6mm.
RESISTOR COLOR CODE
4-Band Color Code of Resistor
CALCULATING RESISTOR VALUES
The "left-hand" or the most significant coloured band is the band which is nearest to a connecting lead with the colour coded bands being read from left-to-right as follows;
Digit, Digit, Multiplier = Colour, Colour x 10 colour in Ohm's (Ω's)
For example, a Resistor has the following coloured markings;
Yellow Violet Red = 4 7 2 = 4 7 x 10 2 = 4700Ω or 4k7.
The fourth band if used determines the percentage tolerance of the resistor and is given as;
Brown = 1%, Red = 2%, Gold = 5%, Silver = 10 %
If resistor has no fourth tolerance band then the default tolerance would be at 20%.
It is sometimes easier to remember the resistor colour codes by using mnemonics,
which is a saying that has a separate word to represent each of the Ten + Two
colours in the code. However, these sayings are often crude but never the less
effective and here are a few of the more "cleaner" versions:
Bad Booze Rots Our Young Guts But Vodka Goes Well
Bad Boys Ring Our Young Girls But Vicky Goes Without
Bad Boys Ring Our Young Girls But Vicky Gives Willingly -- Get Some Now
(This one is only slightly better because it includes the tolerance bands of Gold,
Silver, and None).
2.13 .7812,7805 IC REGULATORS:
They are commonly used in electronic circuits requiring a regulated
power supply due to their ease-of-use and low cost. They are positive voltage
regulators: they produce a voltage that is positive relative to a common ground.
These devices support an input voltage anywhere from a couple of volts over the
intended output voltage, up to a maximum of 35 or 40 volts, and typically provide
1 or 1.5 amperes of current (though smaller or larger packages may have a lower or
higher current rating).
ADVANTAGES:
ICs do not require additional components to provide a constant, regulated source of power, making them easy to use, as well as economical and efficient uses of space.
They are easy to use and handle
IC REGULATORS
2.14.TRANSFORMERS:
A transformer is a device that transfers electrical energy from one
circuit to another through inductively coupled conductors — the transformer's coils
or "windings". Except for air-core transformers, the conductors are commonly
wound around a single iron-rich core, or around separate but magnetically-coupled
cores. A varying current in the first or "primary" winding creates a varying
magnetic field in the core (or cores) of the transformer. This varying magnetic field
induces a varying electromotive force (EMF) or"voltage" in the "secondary"
winding. This effect is called mutual induction
If a load is connected to the secondary circuit, electric charge will flow in the
secondary winding of the transformer and transfer energy from the primary circuit
to the load connected in the secondary circuit. The secondary induced voltage VS,
of an ideal transformer, is scaled from the primary VP by a factor equal to the ratio
of the number of turns of wire in their respective windings:
By appropriate selection of the numbers of turns, a transformer thus
allows an alternatingvoltage to be stepped up — by making NS more than NP — or
stepped down, by making it
BASIC PARTS OF A TRANSFORMER:
In its most basic form a transformer consists of:
A primary coil or winding.
A secondary coil or winding.
A core that supports the coils or windings.
Refer to the transformer circuit in figure as you read the following explanation:
The primary winding is connected to a 60-hertz ac voltage source. The magnetic
field (flux) builds up (expands) and collapses (contracts) about the primary
winding. The expanding and contracting magnetic field around the primary
winding cuts the secondary winding and induces an alternating voltage into the
winding. This voltage causes alternating current to flow through the load. The
voltage may be stepped up or down depending on the design of the primary and
secondary windings.
THE COMPONENTS OF A TRANSFORMER:
Two coils of wire (called windings) are wound on some type of core material. In
some cases the coils of wire are wound on a cylindrical or rectangular cardboard
form. In effect, the core material is air and the transformer is called an AIR-CORE
TRANSFORMER. Transformers used at low frequencies, such as 60 hertz and 400
hertz, require a core of low-reluctance magnetic material, usually iron. This type of
transformer is called an IRON-CORE TRANSFORMER. Most power transformers
are of the ironcore type. The principle parts of a transformer and their functions
are:
The CORE, which provides a path for the magnetic lines of flux.
The PRIMARY WINDING, which receives energy from the ac source.
The SECONDARY WINDING, which receives energy from the primary windingand delivers it to the load.
2.16.Relay :
A relay is an electrically operated switch. Many relays use an electromagnet to
operate a switching mechanism, but other operating principles are also used.
Relays find applications where it is necessary to control a circuit by a low-power
signal, or where several circuits must be controlled by one
RELAY
The first relays were used in long distance telegraph circuits, repeating the signal
coming in from one circuit and re-transmitting it to another. Relays found
extensive use in telephone exchanges and early computers to perform logical
operations. A type of relay that can handle the high power required to directly
drive an electric motor is called a contactor. Solid-state relays control power
circuits with no moving parts, instead using a semiconductor device to perform
switching. Relays with calibrated operating characteristics and sometimes multiple
operating coils are used to protect electrical circuits from overload or faults; in
modern electric power systems these functions are performed by digital
instruments still called "protection relays".
2.17 OPTO COUPLER:
How They Are Used:Basically the simplest way to visualise an optocoupler is in terms of its two main components: the input LED and theoutput transistor or diac. As the two are electrically isolated, this gives a fair amount of flexibility when it comes to connecting them into circuit. All we really have to do is work out a convenient way of turning the input LED on and off, and using the resulting switching of the photo-transistor/diac to generate an output waveform or logic.
The optocoupler application or function in the circuit is to:
Monitor high voltage Output voltage sampling for regulation System control micro for power on/off Ground isolation
An optocoupler is a combination of a light source and a photosensitive detector. In the optocoupler, or photon coupled pair, the coupling is achieved by light being generated on one side of a transparent insulating gap and being detected on the other side of the gap without an electrical connection between the two sides(except for a minor amount of coupling capacitance).
CHAPTER-3
BLOCK DIAGRAM &CIRCUIT DIAGRAM
BLOCK DIAGRAM:
ENERGY METER
MICROCONTROLLER
DIGITAL DISPLAY
SMART CARD READ/WRITE
BUZZER
POWER SUPPLY
CIRCUIT DIAGRAM:
CHAPTER-4
BENEFITS OF PREPAID ENERGY METER
Benefits of Prepaid Energy Metering
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.
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.
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.
1.3.3 Market Restraints
Consumer behavior: Consumers have not had any major problems with the
existing post-paid system, and hence it is likely to be difficult to convince them to
change over to prepaid system. Consumers might not appreciate the concept of
"pay and use" as far as electricity is concerned because it might be perceived as an
instrument to control common man’s life style.
Initial investment: Utilities might be discouraged by the huge initial investment,
which includes the cost of instrument, marketing campaign, establishing
distribution channel, and other management costs.
Rapid technology changes: The rapid technology changes happening in the
metering market are expected to delay the decision to go for prepaid system.
Uncertainty over the success: Prepaid system is not as proven a concept in all the
markets as South Africa; hence there is bound to be uncertainty over its success, if
implemented. The success of the system depends on the commitment by utilities
and for this they need to get convinced on the real benefits of prepaid meters
1.3.4 Recent Initiatives The Sabah Electricity Sdn Bhd (SESB), Malaysia, has awarded a contract to
a local manufacturer to supply 1,080 prepaid meters
Countries such as Thailand, Bangladesh, Singapore, and Iran have been
showing increased interest in adopting prepaid system
In India, the State of West Bengal has decided to introduce the smart card
operated prepaid energy meters in remote islands of Sunderbans. In
Mumbai, pre-paid power isprovided by the Brihanmumbai Electricity
Supply and Transport (BEST)Undertaking.Tata Power plans to introduce
pre-paid electricity in Delhi. Tata Steel islikely to install prepaid electricity
meters at its employee township in Jamshedpur.
CHAPTER-5 ADVANTAGES OF PREPAID ENERGY METER
ADVANTAGES OF PREPAID ENERGY METER
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
CHAPTER-6 SOFTWARE DESCRIPTION & PROGRAM USED
Software Description A firmware developed in C language is programmed into the
microcontroller’s code memory area. The firmware control’s the working of the
entire hardware part. Usually the microcontrollers and the processors execute their
instructions which are in machine code. In early days the applications were written
in assembly language. The development of the huge application is very difficult by
using the normal assembly language, because of their less readability. Later for the
fast developments, the high level languages are introduced into the embedded
system. C language is one of the most commonly used in the embedded system
field. The ANSI C version is modified by adding specific hardware related
functionality and information. The modified C language is commonly termed as
Embedded C. The Keil Uvision 3 IDE is used for the development of the
embedded system application development.
Keil software:
Keil Software is used provide you with software development
tools for 8051 based microcontrollers. With the Keil tools, you can generate
embedded applications for virtually every 8051 derivative. The supported
microcontrollers are listed in the μ-vision.
Firmware code // main.c
#include"main.h" Unsigned int count; unsigned int databuf[4]; unsigned int pulseCount,unitConsume,balAmount,tariff,balUnit,totalConsume ; bit RelyOn = 0; bit alarm = 0 ;
// Interrupt function for the Pulse sensingvoid pulseISR() interrupt 0
//unsigned int i;EX0 = 0;if(RelyOn) // If rely is ON
if(balAmount >= tariff)pulseCount++; // Count LED Pulses
if(pulseCount >= ONE_UNIT) // Reaches One Unit Of Electricity
pulseCount = 0;unitConsume++; // count usage of each unitLEDRED = 0;delayMore(5);LEDRED = 1;//totalConsume++;if(balAmount >= tariff)
balAmount = balAmount - tariff;else
balAmount = 0;totalConsume = totalConsume + unitConsume;// Memorise the current Total Unit used
EX0 = 1;
void Timer0Int() interrupt 1 // Interrupt function for the timer 0
TF0 = 0;TR0 = 0;ET0 = 0;count--;TH0 = 0x4B; // value for 50msec delay
TL0 = 0xFC;ET0 = 1;if(count==0)
DisplayDateTime();count = 1200;
TR0 = 1;
void main() // main funtion unsigned char i;
BUZ = 0; LCD_init(); // Initialise LCD RTC_init(); LCD_command(0x01); LCD_BCKL = 0; LCD_command(0x80); LCD_sendString(" Prepaid Energy"); LCD_command(0xC0); LCD_sendString(" Metering"); delayMore(400); TimerInit(); IntInit(); //LCD_BCKL = 1; LCD_command(0x01); #define ONBOARD Device_init(databuf); // Read EEPROM and Store values into RAM #undef ONBOARD //pulseCount = databuf[0]; // pulse counted totalConsume = databuf[1]; // if(totalConsume >= 9999) totalConsume = 0; balAmount = databuf[2]; // balence amount if(balAmount >= 2000) balAmount = 0;
tariff = databuf[3]; if((tariff == 0)||(tariff==0xFF)) tariff = 1; balUnit = balAmount/tariff; //#undef ONBOARD DeviceSetting(); //UpdateUnit(); Validate_Recharge(); // Check for the starting condition Program_SmrtCard(); // Check smartcard programming before starting actual process
//while(Insert_SmrtCard()); DisplayDateTime(); LCD_command(0xC0); LCD_sendString("B:"); IntToString(balAmount); LCD_sendString(" KWH:"); IntToString(totalConsume); TR0 = 1; while(1) if(Insert_SmrtCard()) // If smart Card is Inserted
TR0 = 0;delayMore(500); // key bounce Delay#define SMARTCARDdelayMore(5);Read_Card(); // read SmartCardValidate Recharge(); // Update the new rechargeErase_Card();delayMore(50); // one time usage of one card LCD_command(0x80);LCD_sendString("Remove Smart Crd");
while(Insert_SmrtCard());LCD_command(0x01);DisplayDateTime();#undef SMARTCARDdelayMore(5);/*#define ONBOARD
Device_init(databuf); // Read EEPROM and Store values into RAM #undef ONBOARD
balAmount = databuf[2]; */balUnit = balAmount/tariff;UpdateUnit(); EX0 = 0;TR0 = 1;LCD_sendString(" ");LCD_command(0xC0);LCD_sendString("B:");
IntToString(balAmount); LCD_sendString(" KWH:"); IntToString(totalConsume);
if(RelyOn) // If rely is ON
if(EnergyPulse()) // If Pulse LED Blinks
//while(EnergyPulse());if(balAmount >= tariff)
pulseCount++; // Count LED Pulsesif(pulseCount >= ONE_UNIT) // Reaches One Unit Of Electricity
pulseCount = 0;unitConsume++; // count usage of each unit//totalConsume++;if(balAmount >= tariff)
balAmount = balAmount - tariff;else
balAmount = 0;for(i=0;i<20;i++)
BUZ = ~BUZ;delayMore(10);
BUZ = 0;
if(balAmount > 30)
GRNON();alarm = 0;
if((balAmount>=10)&&(balAmount<=30))
YELON();if(alarm==0)
BUZ = 1;for(i=0;i<6;i++)
BUZ = ~BUZ;delayMore(10);
alarm = 1;BUZ = 0;
if(balAmount<10)
REDON();if(alarm == 1)
BUZ = 1;for(i=0;i<6;i++)
BUZ = ~BUZ;delayMore(10);
alarm = 0;BUZ = 0;
LCD_command(0xC0);LCD_sendString("B:");
IntToString(balAmount);LCD_sendString(" KWH:");IntToString(totalConsume+unitConsume);//balUnit = balAmount/tariff;//if(unitConsume >= balUnit)if(balAmount < tariff)
for(i=0;i<20;i++)
BUZ = ~BUZ;delayMore(10);
BUZ = 0;totalConsume = totalConsume + unitConsume;UpdateUnit();unitConsume = 0; // Reached The Usage LimitbalUnit = 0;RLYOFF(); // Switch of the O/P of Prepaid enrgy RelyOn = 0;
// Memorise the current Total Unit used
if(balAmount<10)
REDON();
void delayMore(unsigned int d) // a delay function
unsigned int i,j;for(i=0;i<d;i++)
for(j=0;j<1000;j++); void TimerInit() // Initialization of the timer
count = 1200;
TMOD = ( TMOD&0xF0 )| 0x01; TH0 = 0x4B; // value for 50msec delayTL0 = 0xFC;
void IntInit() // Initailization of the interrupts
//EX0 = 1;ET0 = 1; // Timer 0 intEA = 1; // Global Int enable
// Process.c file/**************************************************************************** __0xx_________________0x02____________0x04_____________0x06_______* | |pulseCount(2B) | unitConsume(2B) | balAmount(2B) | tariff(2B) |*****************************************************************************/
#include<main.h>extern unsigned int volatile balAmount,unitConsume,tariff ;extern volatile unsigned int totalConsume; extern bit RelyOn;
void Delay(unsigned int count) // a small delay function
while(count--);
void Read_Card() // read the card data
unsigned int RechargeValue;#undef ONBOARD#define SMARTCARDI2CMEM_readData(0x0A,0x02,&RechargeValue); // read the reacharge value//RechargeValue = *read;switch(RechargeValue)
case 0:balAmount += 0; //Rs NilLCD_command(0x01);LCD_command(0x80);LCD_sendString("Insert Valid Card");
break;case 25:
balAmount += 25; //Rs 25/-LCD_command(0x01);LCD_command(0x80);LCD_sendString("Rs25 Recharged");break;
case 50:balAmount += 50; //Rs 50/-LCD_command(0x01);LCD_command(0x80);LCD_sendString("Rs50 Recharged");
break;case 75:
balAmount += 75; //Rs75/-LCD_command(0x01);LCD_command(0x80);LCD_sendString("Rs75 Recharged");
break;case 100:
balAmount += 100; //Rs 100/-LCD_command(0x01);LCD_command(0x80);LCD_sendString("Rs100 Recharged");
break;default:
balAmount += 0; //Rs NilLCD_command(0x01);LCD_command(0x80);LCD_sendString("Insert Valid Card");
break;
LCD_command(0xC0);LCD_sendString("Bal:");IntToString(balAmount);BUZ = 1;delayMore(10);BUZ = 0;EX0 = 1;delayMore(300);#undef SMARTCARD
void Validate_Recharge()
if(balAmount>0)
RelyOn = 1;RLYON();
void Erase_Card()
unsigned int Erase[1];#undef ONBOARD#define SMARTCARDErase[0] = 0x00;I2CMEM_writeData(0x0A,0x02,Erase); #undef SMARTCARD
void UpdateUnit()
unsigned int buff[3];#define ONBOARDdelayMore(10);//buff[0] = pulseCount;buff[0] = totalConsume;buff[1] = balAmount;buff[2] = tariff;
I2CMEM_writeData(0x02,0x06,buff);delayMore(10);#undef ONBOARD
void Device_init(unsigned int *buf)
I2CMEM_readData(0x00,0x08,buf);unsigned int pulseBalance(unsigned int tariffAmount, unsigned int balance)
return ((balance/tariffAmount)*ONE_UNIT);void Program_SmrtCard()
unsigned int New[1];if(KeyOneIsPressed())
if(!(Insert_SmrtCard()))
LCD_command(0x01);LCD_command(0x80);LCD_sendString("Insert Smart Card");delayMore(3000);return;
#undef ONBOARDdelayMore(10);#define SMARTCARDDelay(1000);LCD_command(0x01);LCD_command(0x80);LCD_sendString("Reprogram Card");LCD_command(0xC0);LCD_sendString("Press 4 3 2 1 ");while(KeyOneIsPressed());
while((!KeyOneIsPressed())&&(!KeyTwoIsPressed())&&(!KeyThreeIsPressed())&&(!KeyFourIsPressed()));
if(KeyOneIsPressed())
Delay(1000);New[0] = 25;I2CMEM_writeData(0x0A,0x02,New);LCD_command(0x01);LCD_command(0x80);LCD_sendString("Rs25 Recharge");LCD_command(0xC0);LCD_sendString("Successful !");
if(KeyTwoIsPressed())
Delay(1000);New[0] = 50;
I2CMEM_writeData(0x0A,0x02,New);LCD_command(0x01);LCD_command(0x80);LCD_sendString("Rs50 Recharge");LCD_command(0xC0);LCD_sendString("Successful !");
if(KeyThreeIsPressed())
Delay(1000);New[0] = 75;
I2CMEM_writeData(0x0A,0x02,New);LCD_command(0x01);LCD_command(0x80);LCD_sendString("Rs75 Recharge");LCD_command(0xC0);LCD_sendString("Successful !");
if(KeyFourIsPressed())
Delay(1000);New[0] = 100;
I2CMEM_writeData(0x0A,0x02,New);
LCD_command(0x01);LCD_command(0x80);LCD_sendString("Rs100 Recharge");LCD_command(0xC0);LCD_sendString("Successful !");
delayMore(200);BUZ = 1;delayMore(10);BUZ = 0;LCD_command(0x01);
LCD_command(0x80);LCD_sendString("Remove The Card");while((Insert_SmrtCard()));#undef SMARTCARD
void DeviceSetting() // function for updating the tariff if(KeyFourIsPressed())
LCD_command(0x01);LCD_command(0x80);LCD_sendString("Current Tariff:");LCD_command(0xC0);IntToString(tariff);while((KeyFourIsPressed()));while(!(KeyFourIsPressed()))
if(KeyTwoIsPressed())
tariff++;LCD_command(0xC0);IntToString(tariff);while(KeyTwoIsPressed());
if(KeyThreeIsPressed())
tariff--;LCD_command(0xC0);IntToString(tariff);while(KeyThreeIsPressed());
UpdateUnit();LCD_command(0x01);LCD_command(0x80);LCD_sendString("Tariff Updated");delayMore(100);
CHAPTER-7
FUTURE SCOPE&CONCLUSION
FUTURE SCOPE:
In the present time of 21st century we have no space for
errors or faults either in any technical system or in general applications.
Prepaid energy meter is an advantageous conc ept for the fu ture .
I t s fac i l i ta tes the exemption from electricity bills. Electricity coupons
will be available at nearby shops. The word prepaid means "pay
before use" one of the advantageous fea ture of th is concept.Prepaid
energy meter is used to prepaid the ongoing supply of electricity to homes, offices
etc
CONCLUSION:
The monopolistic power distribution market in Asia is gradually
transforming into a competitive marketplace. Differentiation in service is
going to be the key competitive factor to improve market share in the
deregulated power markets. Prepaid meters with their advantages over
conventional ones are likely to help power distributors to differentiate and
offer value-added services to consumers. Encourgaing consumers to opt for
prepaid meters on a voluntary basis and offering tariff or non-tariff
incentives to those consumers who prepay their power charges, would help
the utilities to implement this sytem.
REFERENCE:
WWW.SEMINARPROJECTS.COM
WWW.8051PROJECTS.COM
www.wikipedia.comwww.alldatasheet.comwww.8051.com