Professional Documents
Culture Documents
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
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:-
a single bus system (device addressing is discussed in detail underthe Device Addressing section).
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 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.
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
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.
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.
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.
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.
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.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.
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.
Increasing non-technical losses: Metering errors, tampering with meters leading to low registration and calibration related frauds are some of the key components of non-technical losses. India reports greater than 10 percent of non-technical losses. It has been reported that prepaid meters control non-technical losses better than conventional ones. Opportunities in the emerging electrifying markets: Most of the Asian countries do not have 100 percent electrification; hence new markets are being created by the increasing generating capacity. Prepaid systems can be more easily introduced in such new markets rather than the existing ones.
The 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.
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.
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
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.
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.
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.
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).
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.
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.
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.
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.
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.
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.
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.
Features: 500mA rated collector current (Single output) High-voltage outputs: 50V Inputs compatible with various types of logic. Relay driver application
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
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; }
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:");
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; }
// 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
#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.