You are on page 1of 57


Every month we can see a person standing in front of our house from Electricity board or water Board whose duty is to read the energy meter/water meter and handover the bills (electric or water) to the owner of that house . This is nothing but meter reading. According to that reading we have to pay the bills. The main drawback of this system is that person has to go area by area and he has to read the meter of every house and handover the bills. The Electricity board and Water authority has to give privileges for these people to do their duty monthly. The thing is Government will not appoint any particular persons for this duty. The people working in these boards will go on a particular day and do their duty leaving all their pending works. Due to this, their work will be delayed and this is great loss for government. To overcome this drawback we have come up with an idea and thisidea will help the government and it will save the time of the employees working in these boards. The present system of energy billing is error prone and also time and labor consuming. Errors get introduced at every stage of energy billing like errors with electro-mechanical meters, human errors while noting down the meter reading, and errors while processing the paid bills and the due bills. There are many cases where the bill is paid and then is shownas a due amount in the next bill. There is no proper way to know the consumer‟s maximum demand, usage details, losses in the lines, and power theft. The major drawback of a post paid system is that there is no control of usage from the consumer‟s side. There is a lot of wastage of power due to the consumer‟s lack of planning of electrical consumption in an efficient way. Since the supply of power is limited, as a responsible citizen, there is a need to utilize electricity in a better and efficient way. The distribution company has to receive huge amounts in the form of pending bills, which results in substantial revenue losses and also hurdles to modernization because of lack of funds. There are many cases where the bill is paid and then is shownas a due amount in the next bill. There is no proper way to know the consumer‟s maximum demand, usage details, losses in the lines, and power theft. Since the supply of power is limited, as a responsible citizen, there is a need to utilize electricity in a better and efficient way.



The distribution company has to receive huge amounts in the form of pending bills, which results in substantial revenue losses and also hurdles to modernization because of lack of funds. Electricity board or water Board whose duty is to read the energy meter/water meter and handover the bills (electric or water) to the owner of that house.The Electricity board and Water authority has to give privileges for these people to do their duty monthly. 1.1What is meant by energy meter? An electricity meter or energy meter is a device that measures the amount of electric energy consumed by aresidence, business, or an electrically powered device.Electricity meters are typically calibrated in billing units, the most common one being the kilowatt hour [kWh]. Periodic readings of electric meters establish billing cycles and energy used during a cycle. 1.2 What is meant by prepaid energy meter? An electricity meter provides an interface between the utility and the customer. Successfully implemented, our product will benefit the end customer as well as the electric utility to the electricity board. It is compatibility with Measure electricity consumption accurately, Display real time account balance, Communicate with the utility of the customer and electricity board, Warn the user of low account balance by flashing an LED, Cut power off when there is zero credit on the account. Financial dealing through cash and cheques are now slowly paving way for transactions using smart cards and ATM (Automatic Teller Machine, also expanded as Any Time Money) machines. Smart card, of the size of a credit card, has a small micro-controller and memory; and it interacts with the smart card reader! ATM machine and acts as an electronic wallet. Smart card technology has the capability of ushering in a cashless society. From a technological point of view, the prepayment system consists of three welldifferentiated components. The first is a service meter installed at the unit where energywill be consumed, such as a household dwelling or a store. In general, these meters are of the “twogang” type, and consist of a user‟s interface unit and a current measuring set.The interface unit is a device installed inside the building, which allows the user to“interact” with the meter. This mechanism essentially requires the users to pay for the electricity before itsconsumption. In this way, consumers hold credit and then use the electricity until thecredit is exhausted.If the available credit is exhausted then the supply of electricity is cutoff by a relay.




2.1 Introduction to Embedded System: An embedded system can be defined as a computing device that does a specific focused job. Appliances such as the air-conditioner, VCD player, DVD player, printer, fax machine, mobile phone etc. are examples of embedded systems. Each of these appliances will have a processor and special hardware to meet the specific requirement of the application along with the embedded software that is executed by the processor for meeting that specific requirement.

2.2 Micro-Controller: A microcontroller (sometimes abbreviated µCor MCU) is a small computer on a single integrated circuit containing a processor core, memory, and programmable

input/outputperipherals. Program memory in the form of NOR flash or OTP ROM is also often included on chip, as well as a typically small amount of RAM. Microcontrollers are designed for embedded applications, in contrast to the microprocessors used in personal computers or other general purpose applications. Microcontrollers are used in automatically controlled products and devices, such as automobile engine control systems, implantable medical devices, remote controls, office machines, appliances, power tools, toys and other embedded systems. By reducing the size and cost compared to a design that uses a separate microprocessor, memory, and input/output devices, microcontrollers make it economical to digitally control even more devices and processes. Mixed signal microcontrollers are common, integrating analog components needed to control non-digital electronic systems. The AT89S52 is a low-power, high-performance CMOS 8-bit

microcontroller with 8K bytes of in-system programmable Flash memory. The device is manufactured using Atmel‟s high -density nonvolatile memory technology and is compatible with the industry- standard 8051 instruction set and pin out.



2.2.1Architecture of Micro Controller:

Fig2.1: Architecture of Microcontroller AT89S52 2.2.2Basic Registers: Accumulator: The Accumulator, as its name suggests, is used as a general register to accumulate the results of a large number of instructions. It can hold an 8-bit (1-byte) value and is the most versatile register the 89c51 has due to the sheer number of instructions that make use of the accumulator. More than half of the 89c51‟s 255 instructions manipulate or use the accumulator in some way.


4 "R" registers: The "R" registers are a set of eight registers that are named R0, R1, etc. up to and including R7.These registers are used as auxillary registers in many operations. To continue with the above example, perhaps you are adding 10 and 20. The original number 10 may be stored in the Accumulator whereas the value 20 may be stored in, say, register R4. To process the addition you would execute the command. The "B" Register: The "B" register is very similar to the Accumulator in the sense that it may hold an 8-bit (1-byte) value. The "B" register is only used by two 89c51 instructions: MUL AB and DIV AB. Thus, if you want to quickly and easily multiply or divide A by another number, you may store the other number in "B" and make use of these two instructions.Aside from the MUL and DIV instructions, the "B" register is often used as yet another temporary storage register much like a ninth "R" register. Special Function Registers: A map of the on-chip memory area called the Special Function Register (SFR) space. Note that not all of the addresses are occupied, and unoccupied addresses may not be implemented on the chip. Read accesses to these addresses will in general return random data, and write accesses will have an indeterminate effect. User software should not write 1s to these unlisted locations, since they may be used in future products to invoke new features. In that case, the reset or inactive values of the new bits will always be 0.

2.2.3 Structure of microcontroller: A microcontroller (sometimes abbreviated µC, or MCU) is a small computer on a single integrated circuit containing a processor core, memory, and programmable input/output peripherals. The microcontroller is consisting of four ports, timers, counters, interrupts, serial ports, RAM, EPROM(flash), processor and external input/output ports. And the enable, ALE, program status enable pins are also part of microcontroller.



Three timers are 16-bit wide.4.2.4 Timers: The 8052 has two timers: Timer 0. ENGINEERING COLLEGE 6 .R. The timers 1 and 2 functions are same as in 8051.Lower byte register of Timer 0 is TL0 and higher byte is TH0. Similarly lower byte register of Timer1 is TL1 and higher byte register is TH1. They can be used either as timers to generate a time delay or as counters to count events happening outside the microcontroller. Since the 8052 has an 8-bit architecture.2: Structure of Microcontroller AT89S52 2. Timer 1and Timer 2. the lower 2 bits are used to set the timer mode and the upper 2 bits to specify the operation.Fig 2.2. 2. JOGINPALLY B. each 16bit timer is accessed as two separate registers of low byte and high byte.TMOD is an 8-bit register in which the lower 4 bits are set aside for Timer 0 and the upper 4 bits for Timer 1. In each case.1 TMOD (timer mode) register: Both timers 0 and 1 use the same register TMOD to set the various operation modes.

8-bit timer/counter THx with TLx as 5-bit prescaler 0 1 1 16-bit timer mode.16-bit timer/counters THx and TLx are cascaded 1 0 2 8-bit auto reload timer/counter. Some timers do this by software.3: TMOD register Every timer has a means of starting and stopping. M1-Mode bit 1 M0-Mode bit 0 M1 M0 Mode Operating Mode 0 0 0 13-bit timer mode. ENGINEERING COLLEGE 7 .(MSB) GATE C/T M1 M0 GATE C/T M1 (LSB) M0 TIMER 1 GATE: TIMER 0 Table 2. Cleared for timer operation and set for counter operation. C/T: Timer or counter selected. THxholds a value that is to be reloaded into TLx each time it overflows 1 1 3 Split timer mode Table 2. The start and stop of the timer are controlled by the way of software by the TR (timer start) bits TR0 and TR1. some by hardware and some have both software and hardware controls. The hardware way of starting and stopping the timer by an external source is achieved by making GATE=1 in the TMOD register. The timers in the 8051 have both.R. These instructions start and stop the timers as long as GATE=0 in the TMOD register.4 : TMOD register mode JOGINPALLY B.

When it rolls over from FFH to 00H.2Timer 2: Timer 2 is a 16-bit Timer/Counter that can operate as either a timer or an event counter.This mode 2 is an 8-bit timer and therefore it allows only values of 00H to FFH to be loaded into the timer‟s register TH.The mode used here to generate a time delay is MODE 2. TH2 and TL2.2. The new count value appears in the register during S3P1 of the cycle following the one in which the transition was detected. After TH is loaded with the 8-bit value. Timer 2 consists of two 8-bit registers. the 8051 give a copy of it to TL. The type of operation is selected by bit C/T2 in the SFR T2CON (shown in Table 2. as shown in Table 2. it sets high the TF (timer flag). it starts to count up by incrementing the TL register.7). and baud rate generator. Table 2. Since a machine cycle consists of 12 oscillator periods. the level should be held for at least one full machine cycle. When the samples show a high in one cycle and a low in the next cycle. TF0 goes high and if Timer 1 is used. auto-reload (up or down counting).4. Since two machine cycles (24 oscillator periods) are required to recognize a 1-to-0 transition. TF1 goes high. Timer 2 has three operating modes: capture.The modes are selected by bits in T2CON. ENGINEERING COLLEGE 8 .5: Timer 2 mode operation In the Counter function. 2. the register is incremented in response to a 1-to-0 transition at its corresponding external input pin. the TL2 register is incremented every machine cycle. the maximum count rate is 1/24 of the oscillator frequency. the count is incremented. JOGINPALLY B. the count rate is 1/12 of the oscillator frequency. In the Timer function. When the timer starts. TL is reloaded automatically with the original value kept by the TH register. To ensure that a given level is sampled at least once before it changes. T2.8. When the TL register rolls from FFH to 0 and TF is set to 1. the external input is sampled during S5P2 of every machine cycle. In this function. It counts up until it reaches its limit of FFH. If Timer 0 is used.R.

7Timer 2 external enable: Timer 2 external enable when set. When set. ENGINEERING COLLEGE 9 . TCLK = 0 causes Timer 1 overflows to be used for the transmit clock. EXF2 does not cause an interrupt in up/down counter mode (DCEN = 1).2.2. When Timer 2 interrupt is enabled. 2.4. causes the serial port to use Timer 2 overflow pulses for its transmit clock in serial port Modes 1 and 3.2.4Timer 2 external flag: Timer 2 external flag set when either a capture or reload is caused by a negative transition on T2EX and EXEN2 = 1.R. 2. EXEN2 = 0 causes Timer 2 to ignore events at T2EX.4. RCAP2L) are the Capture/Reload registers for Timer 2 in 16-bit capture mode or 16-bit autoreload mode. 2. 2. TF2 will not be set when either RCLK = 1 or TCLK = 1.Timer 2 Registers Control and status bits are contained in registers T2CON (shown in Table 2. RCLK = 0 causes Timer 1 overflow to be used for the receive clock.5 Receive clock enable: Receive clock enable. causes the serial port to use Timer 2 overflow pulses for its receive clock in serial port Modes 1 and 3. for Timer 2.4.7) and T2MOD (shown in Table 2. The register pair (RCAP2H.2. JOGINPALLY B. allows a capture or reload to occur as a result of a negative transition on T2EX if Timer 2 is not being used to clock the serial port. EXF2 must be cleared by software.6Transmit clock enable: Transmit clock enablewhen set.4.3Timer 2 overflow flag: Timer 2 overflow flag set by a Timer 2 overflow and must be cleared by software. EXF2 = 1 will cause the CPU to vector to the Timer 2 interrupt routine.

2.2. The Data Pointer (DPTR): The Data Pointer (DPTR) is the 89C51‟s only user-accessable 16-bit (2-byte) register. is used to point to data.5 Interrupt Registers: The individual interrupt enable bits are in the IE register. as the name suggests. C/T2 = 1 for external event counter (falling edge triggered). 2. C/T2 = 0 for timer function.R.4. When either RCLK or TCLK = 1. When the 89c51 is initialized PC always starts at 0000h and is incremented each time an instruction is executed. this bit is ignored and the timer is forced to auto-reload on Timer 2 overflow. 2. It is often used to store 2-byte values which have nothing to do with memory locations.8 Start/Stop control: Start/Stop control for Timer 2. and "B" register are all 1-byte values.7The Program Counter (PC): The Program Counter (PC) is a 2-byte address which tells the 89c51 where the next instruction to execute is found in memory. ENGINEERING COLLEGE 10 . "R" registers. TR2 = 1 starts the timer.2. CP/RL2 = 1 causes captures to occur on negative transitions at T2EX if EXEN2 = 1. many programmers often take advantage of the fact that it‟s the only true 16-register available.4. It is used by a number of commands which allow the 89C51 to access external memory. CP/RL2= 0 causes automatic reloads to occur when Timer 2 overflows or negative transitions occur at T2EX when EXEN2= 1.9 Counter/Timer: Timer or counter select for Timer 2. The Accumulator. 2. It is important to note that PC JOGINPALLY B. Two priorities can be set for each of the six interrupt sources in the IP register.DPTR. 2.2.2.While DPTR is most often used to point to data in external memory.2.10 Capture/Reload: Capture/Reload select. When the 89c51 accesses external memory it will access external memory at the address indicated by DPTR.

isn‟t always incremented by one. like all registers except DPTR and PC.3 Pin Diagram of Microcontroller AT89S52: Fig 2. When you pop a value off the stack. 2.8 The Stack Pointer (SP): The Stack Pointer. In this way.2.2. and then decrements the value of SP. Since some instructions require 2 or 3 bytes the PC will be incremented by 2 or 3 in these cases. The Stack Pointer is used to indicate where the next value to be removed from the stack should be taken from.R.9 Input/output (I/O) port: All 8051 microcontrollers have 4 I/O ports.A logic state on a pin determines whether it is configured as input or output: 0=output. a voltage level on the appropriate pin will be 0.6: Pin Diagram of Microcontroller AT89S52 JOGINPALLY B. ENGINEERING COLLEGE 11 . 1=input. This means that the user has on disposal in total of 32 input/output lines connecting the microcontroller to peripheral devices. the 89c51 returns the value from the memory location indicated by SP. each consisting of 8 bits which can be configured as inputs or outputs. may hold an 8-bit (1-byte) value. the 89c51 first increments the value of SP and then stores the value at the resulting memory location. 2. then a logic zero (0) should be applied to the appropriate bit on I/O port. 2. When you push a value onto the stack. If a pin on the microcontroller needs to be configured as output.

Port 3 pins that are externally being pulled low will source current (IIL) because of the pull-ups. Port 1 also receives the low-order address bytes during Flash programming and verification. The Port 1 output buffers can sink/source four TTL inputs. this port is also similar to P0. a positive voltage pulse on this pin resets the microcontroller. By applying logical zero to this pin. Port 3 is an 8-bit bi-directional I/O port with internal pull-ups. When 1s are written to Port 1 pins they are pulled high by the internal pull-ups and can be used as inputs. These pins come under port 3. As inputs.2.4Pin description: Pins 1-8: Each of these pins can be configured as input or output. Port 3: Even though all pins on this port can be used as universal I/O port. the program starts execution from the beginning. When 1s are written to Port 3 pins they are pulled high by the internal pull-ups and can be used as inputs. In other words. Besides. The Port 3 output buffers can sink/source four TTL inputs. From hardware‟s perspective. JOGINPALLY B. ENGINEERING COLLEGE 12 . Port 1: Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. then the appropriate pins have to be configured like that. These pins are subset of Port1. Port 1 pins that are externally being pulled low will source current (IIL) because of the internal pull-ups. Pin 10: RXD Serial asynchronous communication input or Serial synchronous communication output. In other words. Since each of these functions use inputs. all of them have alternative functions. a logical one (1) must be written to the appropriate bit in the P3 register. with the difference that its outputs have a pull-up resistor embedded.R. Pin 9 – RST: Logical one on this pin stops microcontroller‟s operating and erases the contents of most registers. each of these pins can serve as universal input or output. Pins 10-17: Similar to port 1. As inputs.

Pin 14: T0 Counter 0 clock input. 19:X2. Pin 13: INT1 Interrupt 1 input. XTAL1: Input to the inverting oscillator amplifier and input to the internal clock operating circuit. the miniature ceramics resonators can be also used for frequency stabilization. Pin 18. Instead of quartz crystal. Pin 15: T1 Counter 1 clock input. A quartz crystal which determines operating frequency is usually connected to these pins.Pin 11: TXD Serial asynchronous communication output or Serial synchronous communication clock output. Later versions of the microcontrollers operate at a frequency of 0 Hz up to over 50 Hz. X1: Internal oscillator input and output. ENGINEERING COLLEGE 13 . JOGINPALLY B. Pin 16: WR Signal for writing to external (additional) RAM.R. Pin 17: RD Signal for reading from external RAM. Pin 12: INT0 Interrupt 0 inputs.

e. PSEN is activated twice each machine cycle. If external ROM is used for storing program then it has a logic-0 value every time the microcontroller reads a byte from memory. ENGINEERING COLLEGE 14 .These pins are Port 2. the microcontroller will set the lower address byte (A0-A7) on P0 and immediately after that activates the output ALE. Pin 30: ALE Prior to each reading from external memory. When the AT89C51 is executing code from external program memory. Pin 20: GND Signal Ground. It is important to know that even memory with capacity of 64Kb is not used ( i.XTAL2: Output from the inverting oscillator amplifier. Pins 21-28 port 2: If there is no intention to use external memory then these port pins are configured as universal inputs/outputs. In case external memory is used then the higher address byte.but minimum and maximum voltage high and low time specifications must be observed.R. of an inverting amplifier which can be configured for use as an on-chip oscillator. note all bits on port are used for memory addressing) the rest of bits are not available as inputs or outputs. Pin 29: PSEN Program Store Enable is the read strobe to external program memory. XTAL2 should be left unconnected while XTAL1 is driven as shown in Figure 2. Oscillator Characteristics: XTAL1 and XTAL2 are the input and output. There are no requirements on the duty cycle of the external clock signal. except that two PSEN activations are skipped during each access to external data memory. To drive the device from an external clock source. Either a quartz crystal or ceramic resonator may be used. Upon receiving JOGINPALLY B. i.e. addresses A8-A15 will appear on this port. respectively.

when logic zero (0) is applied to the ALE pin. if external memory is not used. This pin is also the program pulse input (PROG) during Flash programming. Otherwise.These pins are of Port 0 configuration. Setting the ALEdisable bit has no effect if the microcontroller is in external execution mode. Pins 32-39 PORT 0: Similar to port 2.signal from the ALE pin. up to end of address space. first internal and afterwards external (if it exists). and may be used for external timing or clocking purposes. these pins can be used as universal inputs or outputs. With the bit set. Otherwise. the pin is weakly pulled high. By applying logic zero to this pin. that one ALE pulse is skipped during each access to external Data Memory. ALE is active only during a MOVX or MOVC instruction. In normal operation ALE is emitted at a constant rate of 1/6 the oscillator frequency. a signal on this pin stops being emitted and P0 is used now for data transmission (Data Bus). ALE operation can be disabled by setting bit 0 of SFR location 8EH. however. That means that even there is a program written to the microcontroller. that if lock bit 1 is programmed. Pin 31: EA/VPP External Access Enable must be strapped to GND in order to enable the device to fetch code from external program memory locations starting at 0000H up to FFFFH. P0 is configured as address output (A0-A7) when the ALE pin is at high level (1) and as data output (Data Bus). ENGINEERING COLLEGE 15 . In the second part of the microcontroller‟s machine cycle. Address Latch Enable output pulse for latching the low byte of the address during accesses to external memory. JOGINPALLY B. the microcontroller will use both memories. however.R. Otherwise. Note. If desired. P2 and P3 are used for data and address transmission with no regard to whether there is internal memory or not. The program written to external ROM will be used instead. the external register (74HCT373 or 74HCT375 circuit is usually embedded) memorizes the state of P0 and uses it as an address for memory chip. EA should be strapped to VCC for internal program executions. by applying logic one to the EA pin. Note. EA will be internally latched on reset. it will not be executed.

8: Circuit diagram of power supply 2.C Output Step down transformer Bridge Rectifier Filter Regulator Fig 2.. ENGINEERING COLLEGE 16 .7: Power supply block diagram Fig 2.e. The adapter output voltage will be 12V DC none regulated. This JOGINPALLY B. the ac input available at the mains supply i.R.5Regulated Power supply: The microcontroller and other devices get power supply from AC to Dc adapter through voltage regulator. 9V or 12V.5. 2. 230V AC50Hz D. 230V is to be brought down to the required voltage level. Thus. DC voltages are required to operate various electronic equipment and these voltages are 5V.1 Transformer: Usually.Pin 40: VCC: Power supply of +5V(volts) is given to the circuit through this pin. The 7805 voltage regulators are used to convert 12 V to 5VDC. But these voltages cannot be obtained directly.

We use bridge rectifier to get high efficiency of nearly 80% to 85%. A voltage regulator is an electrical regulator designed to automatically maintain a constant voltage level. Therefore a regulator is applied at the output stage. The first number 78 represents positive supply and the numbers 05.C.5.5.1 Features: • Output Current up to 1A. Output received from this filter is constant until the mains voltage and load is maintained constant. In this project. voltage received at this point changes.4. ENGINEERING COLLEGE 17 . JOGINPALLY B. In order to obtain these voltage levels. In this project. However. a bridge rectifier is used because of its merits like good stability and full wave rectification. done by a transformer. 2. 12. into pulsating D. 2.C. 7805 and 7812 voltage regulators are to be used.5. 2. • Thermal Overload Protection. 8. It removes the ripples from the output of rectifier and smoothens the D. 12 represent the required output voltage levels.2 Rectifier: The output from the transformer is fed to the rectifier. • Short Circuit Protection. it regulates the input applied to it. It converts A. 10. Thus.C. 2. D.R. if either of the two is varied.3 Filter: Capacitive filter is used in this project. • Output Transistor Safe Operating Area Protection. 24V. 18. The rectifier may be a half wave or a full wave rectifier.4 Voltage regulator& its features: As the name itself implies. 9. 15. power supply of 5V and 12V are required.5. a step down transformer is employed to decrease the voltage to a required level. • Output Voltages of 5.C.

MicrocontrollerAT89S52. driver circuit and bulb.1:Block diagram of Energy embedded meter JOGINPALLY B.1 Block diagram of Energy embedded meter: ThisBlock diagram mainly Consistof Powersupply.The block diagram shown below POWER SUPPLY LCD IR TX A T 8 9 S 5 2 U L N INDICATOR LED IR RX RELAY Y BULB Fig 3.R. ENGINEERING COLLEGE 18 . Indicator LED(Light Emitting Diode).CHAPTER-3 HARDWARE DESCRIPTION 3. This gives the idea about the inter connection of the system. Relay.Liquid crystal display(LCD). IR Receiver.IR Transmitter.

Measure electricity consumption accurately. business ormachine. JOGINPALLY B.2 Overview of block diagram: We plan to make accurate power measurements. interface an LCD display as well as a keypad with the central microcontroller unit and implement a transceiver module in our system. Since electricity rates vary throughout the day. The display will also show the current electricity rate. Since the meter will send daily/hourly consumption data to the utility company. 2. When used in electricityretailing. And the bulb which is connected to the energy meter gets to knew that how much power is consumed in units through the they will no longer have to deal with late payments or non-paying customers. 4. An electricity meter provides an interface between the utility and the customer. The microcontroller which is used to operate over all the circuit gets to know that how much amount of power consumption is used. We would like our meter to be able to do the following things: 1.R. The device will show the remaining balance so that the user knows how much he has consumed and can plan ahead to not overuse the budget and know when he needs to refill the account. ENGINEERING COLLEGE 19 . The driver circuit acting as a relay acts as a switch between the power supply and the energy meter. Warn the user of low account balance by flashing an LED 5. the utilities record the values measured by these meters to generate a voice for the electricity.3. And the display shows that in how many units the power is used. Display real time account balance.The most common type is a kilowatt hour meter. An electric meter or Energy meter is a device that measures theamount of electrical energy supplied to or produced by a residence.Therefore. The utility companies will have a better idea of electricity demand. it will help reduce electricity theft. factories and homes etc. 3. the user can cut down on consumption when the rate is high. Communicate with the utility company. This can be used in the industries. And the Led indicator gives the warn that the power is used to be reducing and indicates that should be recharged.The utility companies would be able to collect the expenses from customers in advance.And the coin box is interfaced with the energy meter and the bulb. the whole project is designed on the PCB boards. Cut power off when there is zero credit on the account. This will help them to plan ahead.

the power will pass to the whole circuit. the epoxy package is designed as IR filter. In comparison with the standard GaAs on GaAs technology these emitters achieve more than 100 % radiant power improvement at a similar wavelength. 3. The transformer which is a part of power supply used to convert into 12V(volts) Direct current(DC). The forward voltages at low current and at high pulse current roughly correspond to the low values of the standard technology.4 IR Receiver (RX): The TSOP17. PIN diode and preamplifier are assembled on lead frame. high-performance CMOS 8-bit microcontroller with 8K bytes of in-system programmable Flash memory..3.3. Therefore these emitters are ideally suitable as high performance replacements of standard emitters.R.3. And the regulator will convert to 5V DC. molded in clear. ENGINEERING COLLEGE 20 .4: IR Transmitter TSAL6200 is a high efficiency infrared emitting diode in GaAlAs on GaAs technology.3. 3.2 Microcontroller AT89S52 The AT89S52 is a low-power. JOGINPALLY B.3 IR Transmitter (TX): Fig 3. – Series are miniaturized receivers for infrared remote control systems. bluegrey tinted plastic packages. 3.3.standard 80C51 instruction set and pin out. The device is manufactured using Atmel‟s high -density nonvolatile memory technology and is compatible with the industry.3 Block diagram Description: 3.1 Power supply: The overall power supply from the alternating current(AC) is of 230V(volts).

R. The first relays were used in long distance telegraph circuits. Many relays use anelectromagnet to operate a switching mechanism mechanically.The LCD along with the keypad will provide an interface between the meter and the user or in other words. Relays are used where it is necessary to control a circuit by a low-power signal (with complete electrical isolation between control and controlled circuits). with very high brightness.6 Indicator led: A light-emitting diode (LED) is a semiconductor light source. It will also be used for recharging the account. ENGINEERING COLLEGE 21 .Fig 3.5 Liquid Crystal Display (LCD): The primary function of the display will be to show the real time account balance along with the present rate of electricity. the utility and the user. ultraviolet. but modern versions are available across the visible.3.3. supporting all major transmission codes. 3. This effect is calledelectroluminescence and the color of the light. 3.LEDs emitted low-intensity red light.When a light-emitting diode is switched on. releasing energy in the form of photons. TSOP17XX is the standard IR remote control receiver series. and infrared wavelengths.5: IR Receiver The demodulated output signal can directly be decoded by a microprocessor. but other operating principles are also used. 3. repeating the signal coming JOGINPALLY B.7 Relay: A relay is an electrically operated switch.3. or where several circuits must be controlled by one signal.LEDs powerful enough for room lighting are relatively expensive and require more precise current and heat management than compact fluorescent lampsources of comparable output. electrons are able to recombine with holes within the device.LEDs are used as indicator lamps in many devices and are increasingly used for other lighting.

3. 3.When input terminal is high it offers low impedance path other wide it offers a high impedance. This ULN is used as from one circuit and re-transmitting it to another.8 ULN: Fig 3. The transceiver should be able to able to provide glitch-free communication. The LCD should have a lifetime of at least 10 years. ENGINEERING COLLEGE 22 . It acts as a current amplifier circuit used to run a high voltage/current peripheral circuits. This will help prevent any discrepancies in the event of a transaction.3.9 Bulb: A 0W (Watt) bulb is used for this system. The keypad should have a lifetime as long as the meter itself. Relays were used extensively in telephone exchanges and early computers to perform logical operations.6 ULN Pin overview diagram The ULN is a monolithic high voltage and high current darlington transistor arrays. 3. It consists of seven NPN Darlington pairs that feature high-voltage outputs with common-cathode clamp diode for switching inductive loads. Any two inputs and output are used for our purpose. It goes without saying that accurate power measurement is at the core of any electricity meter. The bulb glows through the energy meter when the coin is dropped in box to get the power.3.4 Requirements: The meter should be sturdy and resistant to normal wear and tear. Power measurements have to be accurate. JOGINPALLY B.The time lag between power measurement and display should be of the order of a few seconds.R.

e.ULN) will automatically shutdown the whole system. the relay (i. There shouldn‟t be a disruption in service during the process of recharging. Re 1. When the consumer insert a coin into the box which is connected in “prepaid energy meter with coin box”kit.Every consumer can have a coin box stored inside it using a MC program. Rs 5 etc…).Suppose if a consumer insert a coin of Re 1/. According to the power consumption the amount will be reduced.amount through the coin box so that prepaid energy meter kit will be activated.e. ENGINEERING COLLEGE 23 . When the amount is over.In our project we have given the name for coin box as prepaid card. JOGINPALLY B. Rs 2.R.7: Circuit diagram of energy embedded meter 3.5. The coin box is available at various ranges (i.The process of recharging one‟s account should be seamless.1 Circuit diagram explanation: A scheme of Electricity billing system called “prepaid energy meter with coin box” can facilitate in improved cash flow management in energy utilities and can reduces problem associated with billing consumer living in isolated area and reduces deployment of manpower for taking meter readings.5 Circuit diagram of energy embedded meter: Fig 3. 3.

The embedded C is an extension of the conventional C. ENGINEERING COLLEGE 24 .Embedded C is Controller or target specific.R.2Keil compiler setup: Procedure Steps: Step-1: Install Keil MicroVision-2 in your PC.1 Introduction to the embedded c: Embedded C for programming the application software to the microcontroller. 4. Embedded C allows direct communication with memory. JOGINPALLY B. Then after Click on that “Keil UVision-2” icon.CHAPTER-4 SOFTWARE DESCRIPTION 4. After opening the window go to toolbar and select Project Tab then close previous project.

Step-2: Next select New Project from Project Tab. JOGINPALLY B.R. ENGINEERING COLLEGE 25 .

Step-3: Then it will open “Create New Project” window. ENGINEERING COLLEGE 26 . Select the path where you want to save project and edit project name. JOGINPALLY B.R.

Step-4: Next it opens “Select Device for Target” window.R. JOGINPALLY B. It shows list of companies and here you can select the device manufacturer company. ENGINEERING COLLEGE 27 .

ENGINEERING COLLEGE 28 . “Project Window”.Step-5: For an example. JOGINPALLY B. it appears empty window here you can observe left side a small window i.e. Next Click OK Button. Next create a new file.R. for your project purpose you can select the chip as 89C51/52 from Atmel Group.

JOGINPALLY B.R.Step-6: From the Main tool bar Menu select “File” Tab and go to New. then it will open a window. ENGINEERING COLLEGE 29 . there you can edit the program.

JOGINPALLY B.Step-7: Here you can edit the program as which language will you prefer either Assembly or C.R. ENGINEERING COLLEGE 30 .

Step-8: After editing the program save the file with extension as “.R. JOGINPALLY B.asm”.c” or “.c” in the selected path.c”.asm” or if you write a pro gram in C Language save as “. Take an example and save the file as “test. if you write a program in Assembly Language save as “. ENGINEERING COLLEGE 31 .

Step-9: Then after saving the file. JOGINPALLY B. compile the program.R. For compilation go to project window select “source group” and right click on that and go to “Add files to Group”. ENGINEERING COLLEGE 32 .

c” as you saved before.R. JOGINPALLY B. ENGINEERING COLLEGE 33 . For an example here you can add “test.Step-9: Here it will ask which file has to add.

JOGINPALLY B. If there is any “Errors or Warnings” in your program you can check in “Output Window” that is shown bottom of the Keil window. again go to Project Window and right click on your “c file” then select “Build target” for compilation.Step-9: After adding the file.R. ENGINEERING COLLEGE 34 .

JOGINPALLY B. ENGINEERING COLLEGE 35 .R.Step-10: Here in this step you can observe the output window for “errors and warnings”.

Step-11: If you make any mistake in your program you can check in this slide for which error and where the error is by clicking on that error. ENGINEERING COLLEGE 36 . JOGINPALLY B.R.

ENGINEERING COLLEGE 37 . In Tool Bar menu go to “Debug” tab and select “Start/Stop Debug Session”.R.Step-12: After compilation then next go to Debug Session. JOGINPALLY B.

ENGINEERING COLLEGE 38 .R. LEDS are connected to PORT -1. You can observe the output in that port.Step-13: Here a simple program for “Leds Blinking”. JOGINPALLY B.

Step-14: To see the Ports and other Peripheral Features go to main toolbar menu and select peripherals. JOGINPALLY B.R. ENGINEERING COLLEGE 39 .

e.Step-15: In this slide see the selected port i. JOGINPALLY B. ENGINEERING COLLEGE 40 .R. PORT-1.

R. ENGINEERING COLLEGE 41 .Step-16: Start to trace the program in sequence manner i. JOGINPALLY B. step by step execution and observe the output in port window.e.

JOGINPALLY B. go to project window and right click on Target next select “Option for Target”.Step-17: After completion of Debug Session Create an Hex file for Burning the Processor.R. ENGINEERING COLLEGE 42 . Here to create a Hex file.

ENGINEERING COLLEGE 43 . JOGINPALLY B. here in “target tab” modify the crystal frequency as you connected to your microcontroller.R.Step-18: It appears one window.

In that Output tab click on “Create HEX File” and then click OK. JOGINPALLY B. ENGINEERING COLLEGE 44 .Step-19: Next go to “Output‟ tab.R.

ENGINEERING COLLEGE 45 .R.Step-20: Finally Once again compile your program. The Created Hex File will appear in your path folder. JOGINPALLY B.

"Pulses:").i. void main(void) { unsigned char c=0x00. voidwelcomemsg(void). command(0xc8). sbit en=P2^7. relay=0. sbit r=P1^1. command(0x01). p++. message(0xc0. //recharge key sbit pulses=P1^2. unsigned char a[100]. command(0xc8).4.//decrement pulses key //sbittr=P1^2.3Program: /********************************/ #include<reg52. JOGINPALLY B. message(0x80. welcomemsg(). conv1(c).unsigned char*). //new card issue key sbit relay=P2^0. while(1) { command(0x88). lcd_init().p=0x00. void delays(unsigned int). conv1(p)."Units:").R. voidlcd_init(void).msg_report=0. void message(unsigned char. void command(unsigned char). if(c>=1) { if(pulses==0) { while(pulses==0). voidlcddata(unsigned char).h> #include<intrins. voidstring_display(unsigned char*). ENGINEERING COLLEGE 46 .h> #include<string.h> #define ldata P0 sbitrs=P2^6. void conv1(unsigned char).

message(0x80."Units:"). command(0x01). message(0x80. c=c+0x03.x1++) { for(y1=0. command(0x01). command(0x01). ENGINEERING COLLEGE 47 . message(0x80. if(c==1) { message(0x80. command(0x01).x1<ms1. delays(10)."Recharge quickly"). delays(10). message(0xc0.R. command(0x88). message(0xc0. message(0xc0."Units:"). relay=1. } } void command(unsigned char value) JOGINPALLY B. conv1(c)."Units:").y1++). if(p==0x09) { p=0x00."Pulses:")."Pulses:").conv1(p). c--.L ON"). message(0x80. } else if(c==0) { relay=0.y1<1275. } } } } if(r==1) { while(r==1). message(0x80.y1."3U recharge."Pulses:"). for(x1=0. delays(10). } } } void delays(unsigned int ms1) { unsignedint x1." Load Off ").

} ////////////////////////////////////////////////////////////////////////// ////// voidlcddata(unsigned char value) { ldata = value. //rw = 0. rs = 1.i++) { lcddata(d[i]). delays(15).R.d[i]!='\0'. delays(1). en = 0. } void message(unsigned char value. command(0x80). for(i=0. } } JOGINPALLY B. rs = 0. delays(1). //rw = 0.{ ldata = value. command(0x0e). ENGINEERING COLLEGE 48 . command(0x01). } } voidstring_display(unsigned char *ptr2) { while(*ptr2) { lcddata(*ptr2). command(value). ptr2++. en = 1. en = 1. command(0x0c). command(0x06). en = 0.unsigned char *d) { unsigned char i. } voidlcd_init(void) { command(0x38).

R. d2=t%10. string_display(" MICRO WARE "). } ////////////////////////////////////////// JOGINPALLY B. string_display(" WELCOME TO ")./**************************************/ voidwelcomemsg(void) { command(0x80). string_display("Coin Box System ").t. command(0xc0). //delays(1). d1=d1+0x30. delays(10). } //////////////////////////////////////////// void conv1(unsigned char x) { unsigned char d1. lcddata(d1). command(0x80). delays(10).d2. t=x/10. d1=x%10. command(0xc0). string_display(" Prepaid "). d2=d2+0x30. lcddata(d2). ENGINEERING COLLEGE 49 .

052MHz AT89S52 1.2 Power supply off: This clip shows the entire circuit before switching on the power supply. ENGINEERING COLLEGE 50 . Bulb AC Wires A 0W(watt) bulb used to glow. 4 wires are needed. Power requirements: 3.CHAPTER-5 RESULT ANALYSIS 5. Dimensions: 1. IR transmitter and Receiver.27 x 0.1 Specifications 5.3 to 5V DC>3 mA(may vary). power supply.5. Oscillator frequency Microcontroller Used IR Sensors 11.R. LCD. energy meter.96 x1. Communication: Single bit high/low output.2 Power supply off The hardware kit is consisting of total components i. Microcontroller AT89S52. Convert 12V to 5V. Table 5. Fig. relay. JOGINPALLY B. 3.e.1 Specifications: Components Used Power supply Transformer Regulator Specifications 230V AC Step-down transformer converting 230V to 12V.0 in. 2.

5. Fig.R.4 Power Supply On: Clip showing power supply being circulated among all the parts of the kit. Fig. ENGINEERING COLLEGE 51 . 5.5.3 Power supply unit The power supply is passed through entire circuit. the bulb glows and on the LCD display shows the units how much power is consumed.4 Power supply on When the power supply is ON state.5. JOGINPALLY B.3 Power Supply Unit: The transformer takes 230V ac supply and steps down to the required voltage level which is rectified to dc using rectifier circuitry as shown.

5. then it displays to “recharge quickly”.1 LCD display at initial stage: Fig 5. JOGINPALLY B.5.then the number of units is incremented by 3 units.3 shows that to recharge his account quickly after expiration of his previous account.5 LCD display: 5.2 LCD display after recharge: Fig 5.3: LCD display for indication to recharge The fig 5.2: LCD display after recharge When consumer recharges his account with Re 1/.5. When there is only one unit left over. That is after 10thpulse the account will expire. The display shows units and pulses as „0‟ before recharge. ENGINEERING COLLEGE 52 . 5. LCD display at initial stage The consumer observes his power of consumption at the initial stage.R.5.5.3 LCD display for indication to recharge: Fig 5.5.

2. Since the meter will send daily/hourly consumption data to the utility company. The following features are: 1. Since electricity rates vary throughout the day. the user can cut down on consumption when the rate is high. Provision of a keypad to recharge the account from a different card every time. The display will also show the current electricity rate.The device will show the remaining balance so that the user knows how much he has consumed and can plan ahead to not overuse the budget and know when he needs to refill the account.R. JOGINPALLY B. it will help reduce electricity theft. Automatic shut-down feature once the account balance is zero.The customer can recharge his account wirelessly from his home. 3. LCD to display real time account balance and the current electricity rate. LED to warn the user of low account balance. 4. 5. Wireless capabilities to recharge the account from home. ENGINEERING COLLEGE 53 .

If you aren't able to buy a top-up in time. ENGINEERING COLLEGE 54 . Since the supply of power is limited. And there is a provision of a keypad to recharge the account from a different card every time. There is no need of any person going to each and every house to note the meterreading. JOGINPALLY B. as a responsible citizen. This means you could be left paying old rates and owing a lump sum or paying too much. which can take months.Thus in this way the electricity board can reduce their work.ADVANTAGES & DISADVANTAGES Advantages: 1. 4. 3. 4. Disadvantages: 1. The best energy deals on the market aren't available to prepayment meter customers. This involves the consumer continuously in managing their electricity usage and conserve energy. 5. Older meters need to have their prices updated manually after price rises or falls. you could find yourself with your supply switched off. They can be inconvenient because you have to go out to top up keys and smartcards. 2. 2. there is a need to utilize electricity in a better and efficient way. We can avoid errors that get introduced at every stage of energy billing like errors with electro-mechanical meters.R. 3. 5.

2. This is also applicable based on RFID technology. 3. 5.R. It is applicable for the GSM type system.APPLICATIONS 1. In the technology of smart card this is used. For the air-conditional system it is applicable. 4. JOGINPALLY B. It is mainly used for EB distribution system. 6. In LPG revolution path this can be used. ENGINEERING COLLEGE 55 .

Advanced electricity meters that generate consumption data enabling customers to see when they are using energy. offices etc. Future scope: The system can be made more user friendly by using smart card technology. to manage that use more efficiently. This project work has been taken up which serves the purposes of energy monitoring and controlling by implementing prepaid system. Prepaid energy meter is used to prepaid the ongoing power supply of electricity to homes.R. energy measurement and electric energy pilferage detection has become prime importance for the state electricity department. It is hoped that this work helps the electric engineers for better energy management and its utility in the distribution system for economic liability of the electric companies. Now a days. non payment of electricity bills etc. This system is of great advantage to the electricity department as this unit can be utilized effectively for preventing power theft. Prepaid energy meter is an advantageous concept for the future. The energy meter used in this produces pulses according to load and this can be converted as prepaid energy meter using smart card. which when interfaced with static electronic energy meter works as a online prepaid energy meter.CONCLUSIONS & FUTURE SCOPE Conclusions: An attempt can be made in this work to develop a system. To save money by adjusting energy use in response to price signals. By this the consumers and suppliers can be benefited by using this prepaid energy meter. JOGINPALLY B. It facilitates the exemption from electricity bills. Further work can be done in reading the consumed energy from energy meter wirelessly using Bluetooth technology. The whole process of billing can be centralized. ENGINEERING COLLEGE 56 . The scope of this project work is to introduce advanced technology in converting direct current (DC) voltage to alternating current (AC) voltage and introduction to prepaid energy metering concept.

info [6].8051projects. Rigel Press.alldatasheets. Datasheets of [8].8051projects.ULN2003 JOGINPALLY B.www.REFERENCES [1]. Second Edition by Mazidi. Sharma. S. AT24C02. Programming and Interfacing the8051 Microcontroller in C and Assembly Language. www. Design and implementation of wireless automatic meter reading system.TenthEditionby the Edison Electric Institute. MazidiandMcKinlay [3]. Handbook for Electricity [7]. [2].Shoeb.R.The 8051 Microcontroller and Embedded Systems Using Assembly and C.S and S. Emery. [5]. S and H. 2011. IJEST. ENGINEERING COLLEGE 57 . 2010. [4]. www.Yelaran.