You are on page 1of 63

ACKNOWLEDGMENT

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.

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, inaccurate costly, 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 by smart card based technology 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.

INTRODUCTION
The scope of the project work is to introduce advanced technology in converting dc voltage in to ac voltage and introducing prepaid energy metering concept. The energy meter used in this project work produces pulses according to the load and this meter is converted as prepaid energy meter using smart card, hence this meter can be called smart energy meter.

This kind of smart energy meters also can be installed at each and every house, where the state electricity department going to supply the conventional energy. Now a days energy Measurement and electric energy pilferage detection has become prime importance for the state electricity department.With the help of this project work lot of Manpower can be reduced and power pilferage can be controlled.

The overall system can be called as AMR (Automatic Meter reading) system, the main advantage of AMR system is that the consumed energy price can be calculated and at the same time price (amount in rupees) can be displayed automatically.

Finally the simplest form of smart metering is a display meter, which allows consumers to monitor consumption in money terms rather than kWh.

BLOCK DIAGRAM:-

SMART CARD

SMART CARD READER

MICROCONTROLLER DIGITAL DISPLAY

230V AC MAINS

AUTO SWITCH

OUTPUT

COMPONENTS USED:-

EPROM(24C04) MICROCONTROLLER(AT89S52) REAL TIME CLOCK(DS1307) LCD-2X16(DSL0001) 12MHZ CRYSTAL(CRY003) SINGLE PHASE ISI MARKED ENERGY METER(2.5A-10A) RESISTORS(10K,56K) CAPACITOR(33PF,1UF) BUZZER TRANSFORMER(12V/30A) CARD READER INTEGRATED CIRCUIT(ULN2003)

DESCRIPTION OF COMPONENTS:EEPROM(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 through serial 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 DIAGRAM:-

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 ST24C02AS 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 8

bits 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 opendrain 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-tolow 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 LSB 1 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, there is no STOP condition sent. The EEPROM will send an ACK if the internal programming cycle is completed. The MAX7651 can also be programmed to wait 10ms 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.

MICROCONTROLLER(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 Atmels high-density nonvolatile memory technology and is compatible with the indus-try-standard 80C51 instruction set and pinout. The onchip 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 contents but freezes the oscillator, disabling all other chip functions until the next interrupt or hardware reset. PIN DIAGRAM:-

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

BLOCK DIAGARAM:

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.

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 2wire 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.

3.2.4 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

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

3.2.6 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

REAL 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 IC, 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 IC 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: -40C to +85C Available in 8-Pin Plastic DIP or SO

DIAGRAM:

ENERGY METER:
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 improvements 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.

1.1 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 reading system is intended to remotely collect the meter readings of a locality using a communication system, without persons physically going and reading the meters visually.

1.2 Details About Electronic Energy Meter


The following are the advantages of electronic energy meter: 1.2.1 Accuracy While electromechanical meters are normally available with Class 2 accuracy, electronic meters of Class 1 accuracy are very common. 1.2.2 Low Current Performance Most of the electromechanical meters tend to run slow after a few years and stop recording 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.

1.2.3 Low Voltage Performance Most of the mechanical meters become inaccurate at voltages below 75% of rated voltage whereas electronic meters record accurately even at 50% of rated voltage. This is a major advantage where low voltage problem is very common. 1.2.4 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 to their mounting position. 1.2.5 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. 1.2.6 New Features Electronic meters provide many new features like prepaid metering and remote metering that can improve the efficiency of the utility. 1.2.6.1 Remote Metering of Energy Meters The introduction of electronic energy meters for electrical energy metering has resulted 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 the electric pole out of reach of the consumers thereby eliminating chances of tamper of the meter. Frequencies in the range of 400 MHz to 900 MHz are 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. 1.2.6.2 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 to the intelligence built in into the electronic meters, introduction of prepaid metering becomes much easier than in the case of electromechanical meters.

1.3 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 electromechanical 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 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.

1.3.1 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 Africas 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.

1.3.2 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 postpaid 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 mans 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 is provided by the Brihanmumbai Electricity Supply and Transport (BEST) Undertaking.Tata Power plans to introduce pre-paid electricity in Delhi. Tata Steel is likely to install prepaid electricity meters at its employee township in Jamshedpur. 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 microcontrollers 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 microcontrollers 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 and interface with microcontroller is describes in this section.

Fig. 2.35 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 LCDs 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 "

Buzzer Driver:

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.

Power 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. DIODE:
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.

Fig 2.5 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.

Currentvoltage characteristic
A semiconductor diode's currentvoltage characteristic, or IV 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 diodes IV 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.41.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 diodes 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 diodesThese 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.

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

Fig. 2.10 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 voltage High current capability Low leakage current High surge capability Low cost
MECHANICAL DATA

Case:Molded plastic use UL 94V-0 recognized Flame retardant epoxy Terminals:Axial leads, solderable per MIL-STD-202, method 208 Polarity:Color band denotes cathode Mounting Position:Any

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

Fig.2.14 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.

Fig.2.15 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.

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

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

Fig. 2.16 Symbol of Fixed Resistor

Fig. 2.17 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.

Fig. 2.19 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.

Fig2.20 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.

2.5.2 RESISTOR COLOR CODE

Fig. 2.21 4-Band Color Code of Resistor

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

Software Description
A firmware developed in C language is programmed into the microcontrollers code memory area. The firmware controls 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.

Relay 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 commoncathode 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 Relays

ULN 2003 Seven Darlington Array:


(HIGH VOLTAGE AND HIGH CURRENTDARLINGTON TRANSISTOR 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 pairs may 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:

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

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 sensing void 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 unit LEDRED = 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 { TF0 = 0; TR0 = 0; ET0 = 0;

// Interrupt function for the timer 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 SMARTCARD delayMore(5); Read_Card(); // read SmartCard Validate_Recharge(); // Update the new recharge Erase_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 SMARTCARD delayMore(5); /*#define ONBOARD Device_init(databuf); #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:");

// Read EEPROM and Store values into RAM

IntToString(totalConsume); } if(RelyOn) // If rely is ON { if(EnergyPulse()) // If Pulse LED Blinks { //while(EnergyPulse()); if(balAmount >= tariff) pulseCount++; // Count LED Pulses if(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 Limit balUnit = 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 delay TL0 = 0xFC; } void IntInit() { //EX0 = 1; ET0 = 1; EA = 1; }

// Initailization of the interrupts

// Timer 0 int // 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) { while(count--); } void Read_Card() { unsigned int RechargeValue; #undef ONBOARD // a small delay function

// read the card data

#define SMARTCARD I2CMEM_readData(0x0A,0x02,&RechargeValue); // read the reacharge value //RechargeValue = *read; switch(RechargeValue) { case 0: balAmount += 0; //Rs Nil LCD_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 Nil LCD_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 SMARTCARD Erase[0] = 0x00; I2CMEM_writeData(0x0A,0x02,Erase); #undef SMARTCARD } void UpdateUnit() { unsigned int buff[3]; #define ONBOARD delayMore(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 ONBOARD delayMore(10); #define SMARTCARD Delay(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); } }

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 nontariff incentives to those consumers who prepay their power charges, would help the utilities to implement this sytem.

You might also like