Sie sind auf Seite 1von 60

PREPAID ELECTRICITY BILLING USING ARDUINO AND ZIGBEE

B Tech. Project Report.

Ch. Avinash A . Narasimha Rao B . Venkat Santhosh K . Bharath Kumar Raju

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING GOKARAJU RANGARAJU INSTITUTE OF ENGINEERING AND TECHNOLOGY
(Affiliated to Jawaharlal Nehru Technological University)

HYDERABAD 500 090 2013


Page I

PREPAID ELECTRICITY BILLING USING ARDUINO AND ZIGBEE


Project Report Submitted in Partial Fulfillment of the Requirements for the Degree of

Bachelor of Technology in Electronics and Communication Engineering by Ch. Avinash (09241A0402) A . Narasimha Rao (09241A0420) B . Venkat Santhosh (09241A0445) K . Bharath Kumar Raju (09D71A0433)

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING GOKARAJU RANGARAJU INSTITUTE OF ENGINEERING AND TECHNOLOGY
(Affiliated to Jawaharlal Nehru Technological University)

HYDERABAD 500 090 2013

Page II

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING GOKARAJU RANGARAJU INSTITUTE OF ENGINEERING AND TECHNOLOGY (Affiliated to Jawaharlal Nehru Technological University) HYDERABAD 500 090 2013

Certificate
This is to certify that this project report entitled PREPAID ELECTRICITY BILLING USING ARDUINO AND ZIGBEE by Ch . Avinash (Roll No. 09241A0402), A . Narasimha Rao (Roll No. 09241A0420) ,B . Venkat Santhosh (Roll No. 09241A0445) and K . Bharath Kumar Raju(Roll No.09D71A0433)submitted in partial fulfillment of the requirements for the degree of Bachelor of Technology in Electronics and Communication Engineering of the Jawaharlal Nehru Technological University, Hyderabad, during the academic year 2012-13, is a bonafide record of work carried out under our guidance and supervision. The results embodied in this report have not been submitted to any other University or Institution for the award of any degree or diploma.

(Guide) Prof. R. Naga Pavani

(External examiner)

(Head of the department) Dr. Ravi Billa

Page III

ACKNOWLEDGMENT

[To Project Guides(s)] It is a pleasure to express thanks to Prof. R . Naga Pavani for the encouragement and guidance throughout the course of this project.

[To all others (if any), such as individuals and organizations who were instrumental in the completion of your project] Ch. Avinash _________________________________

A. Narasimha Rao ______________________________ B. Venakat Santhosh ___________________________ K . Bharath Kumar Raju ___________________________

Page IV

ABSTRACT
The billing process of electricity consumption which we are using at present is very long process and requires lot of man power. The energy billing in India is error prone and also time and labor consuming. Errors get introduced at every stage of energy billing like errors with electromechanical meters, human errors while noting down the meter reading and error while processing the paid bills and the due bills. There are many cases where the bill is paid and then is shown as 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.

For overcoming all the difficulties present in the system we are introducing fully automated billing process. In the proposed system front end is user friendly and can be operated easily by having minimum computer knowledge. The billing process is prepaid energy billing, which could be titled. Pay first and then use it. There are clear results from many countries, where prepaid system has reduced the wastage by a large amount. Another advantage of the prepaid system is that the human errors made reading meters and processing bills can be reduced to a large extent. Keywords: ZIGBEE, Microcontroller, LCD display, Energy meter,LDR.

Page V

CONTENTS
Abstract List of figures
Fig 2.1.................................................................................................................... Fig 3.1.................................................................................................................... Fig 3.2.................................................................................................................... Fig 4.1.................................................................................................................... Fig 4.2.................................................................................................................... Fig 4.3.................................................................................................................... Fig 4.4................................................................................................................... Fig 4.5.................................................................................................................... Fig 4.6.................................................................................................................... Fig 4.7.................................................................................................................... Fig 4.8.................................................................................................................... Fig 4.9................................................................................................................... Fig 4.10................................................................................................................. Fig 4.11.................................................................................................................. Fig 4.12.................................................................................................................. Fig 4.13................................................................................................................. Fig 4.14................................................................................................................. Fig 5.1................................................................................................................... Fig 6.1............................................................................. 02 08 11 14 17 21 22 25 28 30 34 36 37 37 38 39 40 41 43

Page VI

List of tables
Table 3.1............................................................................................................... Table 4.1............................................................................................................... Table 4.2............................................................................................................... Table 4.3............................................................................................................... Table 4.4............................................................................................................... Table 4.5............................................................................................................... 12 16 23 31 31 32

Chapter 1:Introduction
1.1 Background.......................................... 1.2Aim of this Project................................ 1.3 Methodology.. 1.4 Significance.......................................... 01 01 01 01

Chapter 2 : Arduino
2.1 UNO Board........ 2.2 Summary................... 2.3 Power.................... 2.4 Memory .......... 2.5 Input and output 02 03 03 04 04

Chapter 3 : Atmega 328


3.1 Features................... 3.2 Pin configurations.................... 3.3 Pin descriptions................... 06 08 08

Page VII

3.4 Overview....................... 3.5 Characteristics ...........

09 11

Chapter 4 : Hardware Equipment


4.1 Energy Meter.. 4.2 LDR 13 21

4.3 Relay ............. 24 4.4 LCD....... 4.5 Zigbee.................... 29 33

Chapter 5 : Block Diagram And Working........ Chapter 6 : Flow Chart.. Chapter 7 : Program Code......... Chapter 8 : Future scope and conclusion.................

41 43 45 50

Page VIII

Chapter 1 INTRODUCTION
1.1 Background :
We see for every month , a man comes to our house providing electricity bill for the month we have used. That is we pay the bill for the electricity we have consumed. Payment after the usage is known as postpaid billing.

1.2 Aim of this Project:


The aim of our project is to pay the bill and then use the electricity. Payment done before the usage is known as prepaid. Hence our project prepaid electricity billing.

1.2 Methodology :
We do our project on ARDUINO board and transmit the messages to PC by using Zigbee technology. Simultaneously the messages get displayed on LCD.

1.3 Significance of this Work :


By this project, we know the current usage and we use the electricity in a conscious way. We can manage the usage when the income is tight. False billings can be avoided.

Page 1

Chapter 2 ARDUINO

Fig 2.1

Page 2

2.1Summary:
Microcontroller Operating Voltage ATmega328 5V

Input Voltage (recommended) 7-12V Input Voltage (limits) Digital I/O Pins Analog Input Pins DC Current per I/O Pin DC Current for 3.3V Pin Flash Memory SRAM EEPROM Clock Speed 6-20V 14 (of which 6 provide PWM output) 6 40 mA 50 mA 32 KB (ATmega328) of which 0.5 KB used by bootloader 2 KB (ATmega328) 1 KB (ATmega328) 16 MHz

2.2Power:
The Arduino Uno can be powered via the USB connection or with an external power supply. The power source is selected automatically. The board can operate on an external supply of 6 to 20 volts. If supplied with less than 7V, however, the 5V pin may supply less than five volts and the board may be unstable. If using more than 12V, the voltage regulator may overheat and damage the board. The recommended range is 7 to 12 volts. The power pins are as follows:

VIN. The input voltage to the Arduino board when it's using an external power source (as opposed to 5 volts from the USB connection or other regulated power source). You can supply voltage through this pin, or, if supplying voltage via the power jack, access it through this pin.

5V.This pin outputs a regulated 5V from the regulator on the board. The board can be supplied with power either from the DC power jack (7 - 12V), the USB connector (5V), or the VIN pin of the board (7-12V). Supplying voltage via the 5V or 3.3V pins bypasses the regulator, and can damage your board. We don't advise it.

Page 3

3V3. A 3.3 volt supply generated by the on-board regulator. Maximum current draw is 50 mA. GND. Ground pins. IOREF. This pin on the Arduino board provides the voltage reference with which the microcontroller operates. A properly configured shield can read the IOREF pin voltage and select the appropriate power source or enable voltage translators on the outputs for working with the 5V or 3.3V.

2.3Memory:
The ATmega328 has 32 KB (with 0.5 KB used for the bootloader). It also has 2 KB of SRAM and 1 KB of EEPROM (which can be read and written with the EEPROM library).

2.4 Input and Output :


Each of the 14 digital pins on the Uno can be used as an input or output, using pinMode(), digitalWrite(), and digitalRead()functions. They operate at 5 volts. Each pin can provide or receive a maximum of 40 mA and has an internal pull-up resistor (disconnected by default) of 20-50 kOhms. In addition, some pins have specialized functions:

Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data. These pins are connected to the corresponding pins of the ATmega8U2 USB-to-TTL Serial chip.

External Interrupts: 2 and 3. These pins can be configured to trigger an interrupt on a low value, a rising or falling edge, or a change in value.

PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite() function. SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication using the SPI library.

LED: 13. There is a built-in LED connected to digital pin 13. When the pin is HIGH value, the LED is on, when the pin is LOW, it's off. The Uno has 6 analog inputs, labeled A0 through A5, each of which provide 10 bits of resolution (i.e. 1024 different values). By default they measure from ground to 5 volts, though is it possible

Page 4

to change the upper end of their range using the AREF pin and the analogReference() function. Additionally, some pins have specialized functionality:

TWI: A4 or SDA pin and A5 or SCL pin. Support TWI communication using the Wire library. There are a couple of other pins on the board:

AREF. Reference voltage for the analog inputs. Used with analogReference(). RESET. Bring this line LOW to reset the microcontroller. Typically used to add a reset button to shields which block the one on the board.

Page 5

Chapter 3 Atmega 328


3.1 Features:
High Performance, Low Power AVR 8-Bit Microcontroller Advanced RISC Architecture 131 Powerful Instructions Most Single Clock Cycle Execution 32 x 8 General Purpose Working Registers Fully Static Operation Up to 20 MIPS Throughput at 20 MHz On-chip 2-cycle Multiplier High Endurance Non-volatile Memory Segments 32K Bytes of In-System Self-Programmable Flash progam memory 1K Bytes EEPROM 2K Bytes Internal SRAM Write/Erase Cycles: 10,000 Flash/100,000 EEPROM Data retention: 20 years at 85C/100 years at 25C(1) Optional Boot Code Section with Independent Lock Bits In-System Programming by On-chip Boot Program True Read-While-Write Operation Programming Lock for Software Security Peripheral Features Two 8-bit Timer/Counters with Separate Prescaler and Compare Mode One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and Capture Mode Real Time Counter with Separate Oscillator Six PWM Channels 8-channel 10-bit ADC in TQFP and QFN/MLF package Temperature Measurement 6-channel 10-bit ADC in PDIP Package

Page 6

Temperature Measurement Programmable Serial USART Master/Slave SPI Serial Interface Byte-oriented 2-wire Serial Interface (Philips I2C compatible) Programmable Watchdog Timer with Separate On-chip Oscillator On-chip Analog Comparator Interrupt and Wake-up on Pin Change Special Microcontroller Features Power-on Reset and Programmable Brown-out Detection Internal Calibrated Oscillator External and Internal Interrupt Sources Six Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down, Standby, and Extended Standby I/O and Packages 23 Programmable I/O Lines 28-pin PDIP, 32-lead TQFP, 28-pad QFN/MLF and 32-pad QFN/MLF Operating Voltage: 1.8 - 5.5V Temperature Range: -40C to 85C Speed Grade: 0 - 20 MHz @ 1.8 - 5.5V Low Power Consumption at 1 MHz, 1.8V, 25C: Active Mode: 0.2 mA Power-down Mode: 0.1 A Power-save Mode: 0.75 A (Including 32 kHz RTC)

Page 7

3.2 Pin Configurations:

Fig 3.1

3.3 Pin Descriptions:


VCC: Digital supply voltage. GND : Ground. Port B (PB7:0) XTAL1/XTAL2/TOSC1/TOSC2: Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port B output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port B pins that are externally pulled low will source current if the pull-up resistors are activated. The Port B pins are tri-stated when a reset condition becomes active, even if the clock is not running. Depending on the clock selection fuse settings, PB6 can be used as input to the inverting Oscillator amplifier and input to the internal clock operating circuit. Depending on the clock selection fuse settings, PB7 can be used as output from the inverting Oscillator amplifier. If the Internal Calibrated RC

Page 8

Oscillator is used as chip clock source, PB7..6 is used as TOSC2..1 input for the Asynchronous Timer/Counter2 if the AS2 bit in ASSR is set. Port C (PC5:0) : Port C is a 7-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The PC5..0 output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port C pins that are externally pulled low will source current if the pull-up resistors are activated. The Port C pins are tri-stated when a reset condition becomes active, even if the clock is not running. PC6/RESET : If the RSTDISBL Fuse is programmed, PC6 is used as an I/O pin. Note that the electrical characteristics of PC6 differ from those of the other pins of Port C. If the RSTDISBL Fuse is unprogrammed, PC6 is used as a Reset input. A low level on this pin for longer than the minimum pulse length will generate a Reset, even if the clock is not running. Port D (PD7:0) : Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port D output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port D pins that are externally pulled low will source current if the pull-up resistors are activated. The Port D pins are tri-stated when a reset condition becomes active, even if the clock is not running. AVCC : AVCC is the supply voltage pin for the A/D Converter, PC3:0, and ADC7:6. It should be externally connected to VCC, even if the ADC is not used. If the ADC is used, it should be connected to VCC through a low-pass filter. Note that PC6..4 use digital supply voltage, VCC. AREF : AREF is the analog reference pin for the A/D Converter. ADC7:6 (TQFP and QFN/MLF Package Only) : In the TQFP and QFN/MLF package, ADC7:6 serve as analog inputs to the A/D converter. These pins are powered from the analog supply and serve as 10-bit ADC channels.

3.4 Overview:
The ATmega328P is a low-power CMOS 8-bit microcontroller based on the AVR enhanced RISC architecture. By executing powerful instructions in a single clock cycle, the ATmega328P achieves throughputs approaching 1 MIPS per MHz allowing the system designer to optimize power consumption versus processing speed. The device is manufactured using Atmels high density non-volatile memory technology. The On-chip ISP Flash allows the program memory to be reprogrammed In-System through an SPI

Page 9

serial interface, by a conventional non-volatile memory programmer, or by an On-chip Boot program running on the AVR core. The Boot program can use any interface to download the application program in the Application Flash memory. Software in the Boot Flash section will continue to run while the Application Flash section is updated, providing true Read-While-Write operation. By combining an 8-bit RISC CPU with In-System Self-Programmable Flash on a monolithic chip, the Atmel ATmega48PA/88PA/168PA/328P is a powerful microcontroller that provides a highly flexible and cost effective solution to many embedded control applications. The ATmega328P AVR is supported with a full suite of program and system development tools including: C Compilers, Macro Assemblers, Program Debugger/Simulators,In-Circuit Emulators, and Evaluation kits.

Page 10

Fig 3.2

3.5 Electrical Characteristics:


Absolute Maximum Ratings Operating Temperature.................................. -55C to +125C Storage Temperature ..................................... -65C to +150C Voltage on any Pin except RESET with respect to Ground ................................-0.5V to VCC+0.5V Voltage on RESET with respect to Ground......-0.5V to +13.0V Maximum Operating Voltage ............................................ 6.0V DC Current per I/O Pin ............................................... 40.0 mA
Page 11

DC Current VCC and GND Pins................................ 200.0 mA DC Characteristics Parameter Power Current(1) Condition Supply Active 1
Typ. Max. Units

MHz, 0.3

0.5

mA

VCC = 2V Active 4 MHz, 1.7 2.5 mA

VCC = 3V Active 8 MHz, 5.2 9 mA

VCC = 5V Idle 1 MHz, VCC 0.04 = 2V 0.3 0.15 0.7 2.7 mA mA mA

Idle 4 MHz, VCC 1.2 = 3V Idle 8 MHz, VCC = 5V Power-save mode(3)(4) 32 kHz TOSC 0.8 enabled, VCC = 1.8V 0.9 32 kHz TOSC enabled, VCC = 3V WDT enabled, 4.2

1.6

A A

2.6

Power-down mode(3)

A A

VCC = 3V WDT disabled, 0.1 2

VCC = 3V

Table 3.1

Page 12

Chapter 4 HARDWARE EQUIPMENT

4.1 Energy meter:


Definition:-Energy meter is an instrument which measures electrical energy. It is also known as watt-hour (Wh) meter. It is an integrating device. There are several types of energy meters single phase induction type energy meter are very commonly used to measure electrical energy consumed in domestic and commercial installation. Electrical energy is measured in kilo watthours (kWh) by this energy meter. Modern electricity meters operate by continuously measuring the instantaneous voltage (volts) and current (amperes) and finding the product of these to give instantaneous electrical power (watts) which is then integrated against time to give energy used (joules, kilowatt-hours).

Page 13

Fig 4.1

S.No Parameter 1 Applicable Standard

Specification IS: 13779-1999

2 3

Class of Accuracy Ratings

Class 1.0 For Direct Connection:

Page 14

Basic Current: 2.5A to 10A Maximum Current- 10A to 60A For CT Operated: -/1A, -/5A 4 5 6 7 8 9 Operating Voltage Operating Frequency Starting Current Protection Class Temperature Range Power Consumption 240V (Range: 40% to +20%) 50 Hz 5% 0.4% of the rated current IP-51 -10C to +65C Voltage Circuit: <1W & 8VA Current Circuit: <4VA 10 Tamper Proof Features

i)Mechanical methods:
a) Specially designed tamper proof meter housing. b) The meter cover has two sealing screws, for sealing of meter & one additional sealing screw for sealing of hinge type terminal cover. c) Sealing by using high tensile steel wire with plastic/ poly-carbonate seals. d) Uni-directional screws for sealing of meters e) Ultrasonic welding

ii) Electrical Methods:

Page 15

For Single Phase Meters: a) Current reversal / phase neutral interchange. b) Earth loading fully / partially. c) Immune to Magnetic Tamper as per CBIP/BIS. d) Immune to high voltage /high frequency (35KV)Tamper. e) Can withstand 440V at input between phase &Neutral for 30 minutes f) Neutral missing from both supply /load side.

Table 4.1

Working:
The conventional mechanical energy meter is based on the phenomenon of Magnetic Induction. It has a rotating aluminium Wheel called Ferriwheel and many toothed wheels. Based on the flow of current, the Ferriwheel rotates which makes rotation of other wheels. This will be converted into corresponding measurements in the display section. Since many mechanical parts are involved, mechanical defects and breakdown are common. More over chances of manipulation and current theft will be higher. The power line currents and voltages are sensed by using specialized sensors. By using the I.C. data from the sensors are processed. The IC used in the circuit is a Digital Signal Processing IC with inbuilt analog to digital converters. The IC is capable of sampling the each voltage and current input.

Page 16

Fig 4.2 Electronic Energy Meter is based on Digital Micro Technology (DMT) and uses no moving parts. So the EEM is known as Static Energy Meter In EEM the accurate functioning is controlled by a specially designed IC called ASIC (Application Specified Integrated Circuit). ASIC is constructed only for specific applications using Embedded System Technology. Similar ASIC are now used in Washing Machines, Air Conditioners, Automobiles, Digital Camera etc.

In addition to ASIC, analogue circuits, Voltage transformer, Current transformer etc are also present in EEM to Sample current and voltage. The Input Data (Voltage) is compared with a programmed Reference Data (Voltage) and finally a Voltage Rate will be given to the output. This output is then converted into Digital Data by the AD Converters (Analogue- Digital converter) present in the ASIC.

The Digital Data is then converted into an Average Value. Average Value / Mean Value is the measuring unit of power. The output of ASIC is available as Pulses indicated by the LED (Light Emitting Diode) placed on the front panel of EEM. These pulses are equal to Average Kilo Watt Hour (kWh / unit). Different ASIC with various kWh are used in different makes of

Page 17

EEMs. But usually 800 to 3600 pulses / kWh generating ASIC s are used in EEMs.The output of ASIC is sufficient to drive a Stepper Motor to give display through the rotation of digits embossed wheels. The output pulses are indicated through LED. The ASIC are manufactured by Analogue Device Company. ADE 7757 IC is generally used in many countries to make EEMs. ADE 7555 / 7755 ASIC maintains the international standard CLASS I IEC 687/ 1036.

Concept:
The AEW static poly or single phase watt-hour meter having integral register that collects, processes and store energy. Main aspect of its design is to meet the quality, performance and functional requirements of the final consumer and very important economy aspects of the utility business environment. As an operational point of view static watt-hour meter is an intelligent metering instrument designed for household, commercial and industrial metering depending upon the requirement of the final consumer. Selection of the single or three-phase meter depends upon the load requirement

General Features: Display of Measured values or Energy Register:


The meter has a unidirectional stepper motor type register consisting of 5+1 digits (last digit in red colour for decimal display). The register marking is indelible and easily readable and the size of numeral is 5.5 X 2 mm in white on black background. The register has transparent encapsulation and is completely sealed unit, so that digits are not changeable through a mechanical approach. The meter is able to register energy within the prescribed accuracy level given by the BIS even in the presence of harmonics. The ratio gear wheel is made of synthetic material to reduce friction, wear & tear and it is resistant to magnetic field and tampering.

Terminal Block, Cover and Terminals:


The material of terminal block is flame retardant engineering plastic/bakelite having sufficient thickness, insulating properties and mechanical strength with nickel plated brass inserts for connecting terminals. The terminal block ensure reasonable safety against the spread of fire and
Page 18

not ignite by the thermal overload of live parts in contact with them. All the clearance and creepage distances are as per relevant ISS. The terminal cover is transparent of poly carbonate material with thickness of 2 mm and the terminal cover is an extended type completely covering the terminal block and fixing holes with the provision of conductor entry at the bottom for incoming and outgoing leads. The terminal cover is provided that it remains permanently connected with meter base. The terminals and the screws are of suitable rating to carry 150% of Imax and electroplated or tinned brass and of replaceable type.

Indicators:
a) Pulse output: LED indicator is glowing in proportion to KWH registered for on spot calibration or test purpose. b) Power on: LED indicator for potential missing is provided normally in ON position for each phase. c) Earth Load: A separate LED indicator marked Earth is provided which glow in case of earth

d) Reverse: A separate LED indicator marked REV is provided which glow in case of load reverse tamper conditions.

Installation:
The AEW meters are ready to install as they are calibrated and tested at the factory. Proper method of installation should be applied for personal safety and for protection of the meter from any damages. During the installation of the meter make sure that installed mater matches the required ratings. Installing a mismatched meter can damage the equipment.

Connections:
Connecting the Static Watt Hour Meter is very simple. Remove the terminal covers and get easy access to terminals wires are inserted from the bottom of terminal block. Now ensure that the wires are firmly connected to terminals.

Page 19

Safety Precautions:
Safety procedure must be followed during the installation & operation of this product. Connection should be made by the trained personnel with a great care. Meter connection should be made when there is no load. All major safety precautions are to be taken by the personnel involved in the installation of the meter.

Calibration Of Meter:
Calibration of meters is done at factory with the help of various sophisticated instruments as specified by the Bureau of Indian Standards. The standard and equipment used by Allied Engineering Works are all certified by the Indian standards. The certified accuracy of our meters dispatched from factory is sustained without any drift from the accuracy class over a long period and do not require rectification.

Page 20

4.2 Light Dependant Resistor (LDR):


A photoresistor or light dependent resistor (LDR) is a resistor whose resistance decreases with increasing incident light intensity; in other words, it exhibits photoconductivity. The general purpose photoconductive cell is also known as LDR light dependent resistor. It is a type of semiconductor and its conductivity changes with proportional change in the intensity of light. The symbol for photoresistor is

Fig 4.3

A photoresistor is made of a high resistance semiconductor. If light falling on the device is of high enough frequency, photons absorbed by the semiconductor give bound electrons enough energy to jump into the conduction band. The resulting free electron (and its hole partner) conduct electricity, thereby lowering resistance. Thus the LDR or photo-conductive transducer has the resistance which is the inverse function of radiation intensity.

Where, 0 = threshold wavelength, in meters e = charge on one electron, in Coulombs

Page 21

Ew = work function of the metal used, in eV Here we must note that any radiation with wavelength greater than the value obtained in above equation cannot produce any change in the resistance of this device. Construction of a Light Dependent Resistor: there two common types of materials used to manufacture the photoconductive cells. They are Cadmium Sulphide (CdS) and

Cadmium Selenide (CdSe). The band gap energy of Cadmium Sulphide is 2.42eV and for Cadmium Selenide it is1.74eV. Due to such large energy gaps, both the materials have extremely high resistivity at room temperature. Hence, these materials are widely used in LDR for practical purpose. A long, thin and narrow strip of CdS is fixed on the surface of ceramic substrate in the form of zigzag wire as shown in following figure. This construction gives minimum area and maximum length. Then the structure is enclosed in round metallic or plastic case and two terminals (made up of either tin or indium) are taken out for external connections. The structure is covered with glass sheet to protect it from moisture and dust and allows only light to fall on it.

Fig 4.4

Page 22

Characteristics of photoconductive cells:


Photoconductor Cadmium Sulphide CdS Cadmium Selenide CdSe Lead Sulphide PbS Lead Selenide PbSe Time Constant 100 milli sec 10 milli sec 410 micro sec 10.2 micro sec Table 4.2 Now when the device is dark, its resistance is called as dark resistance. This resistance is typically of the order of 1013 ohms. When light falls on it, its resistance decreases up to several kilo ohms or even hundreds of ohms, depending on the intensity of light, falling on it. The spectral response characteristics of two commercial cells were compared in our laboratory. And we found that there is almost no response to the radiation of a wavelength which was shorter than 300nm. It was very interesting to note that the Cadmium Sulphide cell has a peak response nearer or within the green color of the spectrum within a range of 520nm. Thus it can be used nearer to the infra-red region up to 750nm. It was found that the maximum response of Cadmium Sulphoselenide is in the yellow-orange range at 615nm and also it can be used in the infra-red region up to about 970nm. Spectral Band 0.47 to 0.72 um 0.6 to 0.77 um 1 to 3.2 um 1.52 to 4.2 um

Page 23

4.3 Relay:
A relay is an electrically operated switch. Many relays use an electromagnet to operate a switching mechanism mechanically, but other operating principles are also used. 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), or where several circuits must be controlled by one signal. The first relays were used in long distance telegraph circuits, repeating the signal coming in from one circuit and re-transmitting it to another. Relays were used extensively in telephone exchanges and early computers to perform logical operations. A type of relay that can handle the high power required to directly control an electric motor or other loads is called a contactor. Solid-state relays control power circuits with no moving parts, instead using a semiconductor device to perform switching. Relays with calibrated operating characteristics and sometimes multiple operating coils are used to protect electrical circuits from overload or faults; in modern electric power systems these functions are performed by digital instruments still called "protective relays".

Page 24

Fig 4.5 A simple electromagnetic relay consists of a coil of wire wrapped around a soft iron core, an iron yoke which provides a low reluctance path for magnetic flux, a movable iron armature, and one or more sets of contacts (there are two in the relay pictured). The armature is hinged to the yoke and mechanically linked to one or more sets of moving contacts. It is held in place by a spring so that when the relay is de-energized there is an air gap in the magnetic circuit. In this condition, one of the two sets of contacts in the relay pictured is closed, and the other set is open. Other relays may have more or fewer sets of contacts depending on their function. The relay in the picture also has a wire connecting the armature to the yoke. This ensures continuity of the circuit between the moving contacts on the armature, and the circuit track on the printed circuit board (PCB) via the yoke, which is soldered to the PCB.
Page 25

When an electric current is passed through the coil it generates a magnetic field that activates the armature, and the consequent movement of the movable contact(s) either makes or breaks (depending upon construction) a connection with a fixed contact. If the set of contacts was closed when the relay was de-energized, then the movement opens the contacts and breaks the connection, and vice versa if the contacts were open. When the current to the coil is switched off, the armature is returned by a force, approximately half as strong as the magnetic force, to its relaxed position. Usually this force is provided by a spring, but gravity is also used commonly in industrial motor starters. Most relays are manufactured to operate quickly. In a low-voltage application this reduces noise; in a high voltage or current application it reduces arcing. When the coil is energized with direct current, a diode is often placed across the coil to dissipate the energy from the collapsing magnetic field at deactivation, which would otherwise generate a voltage spike dangerous to semiconductor circuit components. Some automotive relays include a diode inside the relay case. Alternatively, a contact protection network consisting of a capacitor and resistor in series (snubber circuit) may absorb the surge. If the coil is designed to be energized with alternating current (AC), a small copper "shading ring" can be crimped to the end of the solenoid, creating a small out-of-phase current which increases the minimum pull on the armature during the AC cycle.[1] A solid-state relay uses a thyristor or other solid-state switching device, activated by the control signal, to switch the controlled load, instead of a solenoid.

Pole and throw:


Since relays are switches, the terminology applied to switches is also applied to relays; a relay switches one or more poles, each of whose contacts can be thrown by energizing the coil in one of three ways:

Normally-open (NO) contacts connect the circuit when the relay is activated; the circuit is disconnected when the relay is inactive. It is also called a Form A contact or "make" contact. NO contacts may also be distinguished as "early-make" or NOEM, which means that the contacts close before the button or switch is fully engaged.

Normally-closed (NC) contacts disconnect the circuit when the relay is activated; the circuit is connected when the relay is inactive. It is also called a Form B contact or "break"

Page 26

contact. NC contacts may also be distinguished as "late-break" or NCLB, which means that the contacts stay closed until the button or switch is fully disengaged.

Change-over (CO), or double-throw (DT), contacts control two circuits: one normally-open contact and one normally-closed contact with a common terminal. It is also called a Form C contact or "transfer" contact ("break before make"). If this type of contact utilizes a "make before break" functionality, then it is called a Form D contact.

The following designations are commonly encountered:

SPST Single Pole Single Throw. These have two terminals which can be connected or disconnected. Including two for the coil, such a relay has four terminals in total. It is ambiguous whether the pole is normally open or normally closed. The terminology "SPNO" and "SPNC" is sometimes used to resolve the ambiguity.

SPDT Single Pole Double Throw. A common terminal connects to either of two others. Including two for the coil, such a relay has five terminals in total. DPST Double Pole Single Throw. These have two pairs of terminals. Equivalent to two SPST switches or relays actuated by a single coil. Including two for the coil, such a relay has six terminals in total. The poles may be Form A or Form B (or one of each). DPDT Double Pole Double Throw. These have two rows of change-over terminals. Equivalent to two SPDT switches or relays actuated by a single coil. Such a relay has eight terminals, including the coil.

Page 27

Fig 4.6

Page 28

4.4 LCD:
LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and is very commonly used in various devices and circuits. These modules are preferred over and other multi segment LEDs. The reasons being: LCDs are economical; easily programmable; have no limitation of displaying special & even custom characters (unlike in seven segments), animations and so on. A 16x2 LCD means it can display 16 characters per line and there are 2 such lines. In this LCD each character is displayed in 5x7 pixel matrix. This LCD has two registers, namely, Command and Data. The command register stores the command instructions given to the LCD. A command is an instruction given to LCD to do a predefined task like initializing it, clearing its screen, setting the cursor position, controlling display etc. The data register stores the data to be displayed on the LCD. The data is the ASCII value of the character to be displayed on the LCD.

FEATURES:
Type: Character Display format: 16 x 2 characters Built-in controller: ST 7066 (or equivalent) Duty cycle: 1/16 5 x 8 dots includes cursor + 5 V power supply LED can be driven by pin 1, pin 2, or A and K N.V. optional for + 3 V power supply Optional: Smaller character size (2.95 mm x 4.35 mm)

Page 29

Pin Diagram:

Fig 4.7 Pin No 1 2 3 4 5 6 7 Function Ground (0V) Supply voltage; 5V (4.7V 5.3V) Contrast adjustment; through a variable resistor Selects command register when low; and data register when high Low to write to the register; High to read from the register Sends data to data pins when a high to low pulse is given 8-bit data pins
Page 30

Name Ground Vcc VEE Register Select Read/write Enable DB0

8 9 10 11 12 13 14 15 16

Backlight VCC (5V) Backlight Ground (0V) Table 4.3

DB1 DB2 DB3 DB4 DB5 DB6 DB7 Led+ Led-

Ratings Of LCD:
ABSOLUTE MAXIMUM RATINGS ITEM Power Supply Input Voltage SYMBOL STANDARD VALUE MIN. TYP. MAX. VDDto VSS VI - 0.3 - 0.3 7.0 VDD UNIT V V

Table 4.4

Electrical Characteristics:

ELECTRICAL CHARACTERISTICS: SYMBO CONDITI ITEM L ON


Input Voltage Supply Current VDD IDD VDD=+5V VDD=+5V

STANDARD VALUE
MIN. 4.7 TYP. 5.0 1.2 MAX 5.3 1.6

UNIT
V mA

Recommended LC Driving Voltage for Normal Temperature Version Module

VDD to VD

- 20 C 0 25 C 50 C 70 C
Page 31

3.5 3.2

3.8 -

5.2 4.2 -

LED Forward Voltage LED Forward Current - Array LED Forward Current - Edge EL Power Supply Current

VF IF IF IEL

25 C 25 C 25 C VEL= 110 VAC, 400 Hz

4.2 100 20 -

4.6 40 5.0

V mA mA mA

Table 4.5

Page 32

4.5 Xbee:
XBee is a brand of radio that supports a variety of communication protocols, including Zig-Bee, 802.15.4, and Wi-Fi, among others. The Zigbee protocol that is used by Xbee is a standard the same way that Bluetooth is a standard. Any manufacturers device that fully supports the ZigBee standard can communicate with any other companys ZigBee device. Most modern network protocols employ a concept of layers to separate different components and functions into independent modules that can be assembled in different ways. The network layer below ZigBee that supports its advanced features is known as IEEE 802.15.4. This is a set of standards that define power management, addressing, error correction, message formats, and other point-to-point specifics necessary for proper communication to take place from one radio to another.

As each Zigbee communicates with very other Zigbee, the ZigBee network will also have at least one other player, either a router device or an end device. Many networks will have both, and most will be much larger than just two or three radios:

Coordinator

ZigBee networks always have a single coordinator device. This radio is responsible for forming the network, handing out addresses, and managing the other functions that define the network, secure it, and keep it healthy. Remember that each network must be formed by a coordinator and that youll never have more than one coordinator in your network.

Router

A router is a full-featured ZigBee node. It can join existing networks, send information, receive information, and route information. Routing means acting as a messenger for communications between other devices that are too far apart to convey information on their own. Routers are typically plugged into an electrical outlet because they must be turned on all the time. A network may have multiple router radios.

Page 33

End device There are many situations where the hardware and full-time power of a router are excessive for what a particular radio node needs to do. End devices are essentially stripped-down versions of a router. They can join networks and send and receive information, but thats about it. They dont act as messengers between any other devices, so they can use less expensive hardware and can power themselves down intermittently, saving energy by going temporarily into a nonresponsive sleep mode. End devices always need a router or the coordinator to be their parent device. The parent helps end devices join the network, and stores messages for them when they are asleep. ZigBee networks may have any number of end devices. In fact, a network can be composed of one coordinator, multiple end devices, and no routers at all.

Features of the Xbee module:


Supply Voltage Operating Current (Transmit) Operating Current (Receive) Indoor/Urban Range Outdoor RF line-of-sight Range 2.8V 3.4V 40mA 40mA up to 133 ft. (40 m) up to 400 ft. (120 m)

Fig 4.8

Page 34

Pin Configuration:

Pin # 1 2 3 4 5 6

Name VCC DOUT DIN / CONFIG DIO8 RESET PWM0 / RSSI / DIO10

Direction Output Input Either Input Output

Description Power supply UART UART Data In Digital I/O 8 Module Reset PWM Output 0 / RX Signal Strength Indicator / Digital IO

7 8 9

PWM / DIO11 [reserved] DTR / SLEEP_RQ/ DI8

Either Input

Digital I/O 11 Do not connect Pin Sleep Control Line or Digital Input 8

10 11 12

GND DIO4 CTS / DIO7

Either Either

Ground Digital I/O 4 Clear-to-Send Flow Control or Digital I/O 7

13

ON / SLEEP

Output

Module Status Indicator

14 15

[reserved] Associate / DIO5

Either

Do not connect Associated Indicator, Digital I/O 5

16

RTS / DIO6

Either

Request-to-Send Flow Control, Digital I/O 6

Page 35

17

AD3 / DIO3

Either

Analog Input 3 or Digital I/O 3

18

AD2 / DIO2

Either

Analog Input 2 or Digital I/O 2

19

AD1 / DIO1

Either

Analog Input 1 or Digital I/O 1

20

AD0 / DIO0

Either

Analog Input 0 or Digital I/O 0

Fig 4.9

Mounting Considerations :
The XBee Series 2 RF Module was designed to mount into a receptacle (socket) and therefore does not require any soldering when mounting it to a board. The receptacle is the Arduino Xbee Shield. This Shield is mounted on the Arduino Uno. By doing so, the power and communication lines of the Arduino Uno board are connected to the Xbee.

Page 36

Fig 4.10

Interfacing Xbee and Arduino Uno:

Fig 4.11

Xbee programming:
Each XBee radio has a tiny computer on board. This internal microcontroller runs a program, also known as firmware, that performs all its addressing, communication, security, and utility functions. This firmware can be configured with different settings that define things like its local address, which type of security is enforced, who it should send messages to, and how it should read sensors connected to its local input pins. The firmware on the Xbee module can be upgraded or changed using the X-CTU program. The working of the X-CTU program is as shown below. To use X-CTU, the XBee radio is plugged into a USB adapter, the adapter is then

Page 37

plugged into one of the computers USB ports. The X-CTU software is then launched. Xbees USB connection will be listed under the Select Com Port. Click the appropriate port to select it.

Fig 4.12 The above example, X-CTU dialogue box is the first that appears. The Baud rate is set to 9600, Data bits as 8, Parity to None and Stop Bits to 1. The Test/Query is then clicked to obtain the existing firmware in the Xbee.

Page 38

Fig 4.13

Modem Configuration :
In order to configure the modem, click on the modem configuration tab on the main window of X-CTU. The following dialogue box appears.

Page 39

Fig 4.14 To have a look at the existing firmware the Xbee is configured with, click on the Read option on the dialogue box. The class of radio modem is shown under Modem: XBEE. Under the function set a set of different firmware that can be updated onto the Xbee radio can be seen. Depending on the operation the Xbee needs to be given, the function set is set to either the ZIGBEE CORDINATOR AT or the ZIGBEE ROUTER AT or THE ZIGBEE ENDDEVICE AT. The Write button writes the selected firmware onto the Xbee module.

Page 40

Chapter 5 BLOCK DIAGRAM AND WORKING

Power supply

Energy meter

LDR

Relay

Load

LCD Atmega 328

Xbee Tx

Xbee Rx

PC

Switch
Fig 5.1

First , the supply is given to the energy meter. Here , we connect two 100W bulbs as load. There is an LED named cal on the energy meter. The blinking rate of this LED depends upon the load connected to it. We use Light Dependant Resistor (LDR) , to read this pulses. The LDR shows a different output voltage when the light is incident on it and when the light is not incident on it. This difference in the output levels of the LDR will be taken as our input source.

Page 41

So when the cal LED glows , the output voltage of LDR will be low. So , we use this situation as interrupt and run an Interrupt Service Routine (ISR). In Arduino , for the purpose of interrupts there are dedicated pins(digital pin 2 and 3). Hence we connect LDR to either 2nd or 3rd pins. When the interrupt occurs , we increment the number of pulses. In our project , we decrement the amount and units for every three pulses occurring. For every three pulses, - amount will be deducted by three rupees, - one unit will be deducted. These messages will get displayed both on LCD and HyperTerminal on the PC. The messages get transmitted to the PC by means of Zigbee technology. Finally when the amount reaches to zero , a warning message Recharge immediately, load OFF will be displayed. Then the load connected will be OFF by means of a relay connected to a pin of microcontroller. The role of the switch here is a recharge switch. By pressing the switch - Rs.9/- will be credited, - 3 units will get credited and - relay will be in ON state making the load ON when it is OFF state. These recharge amount and units will be stored in EEPROM and get updated for every three pulses and by the switch press.

Page 42

Chapter-6 FLOW CHART


START

iiIJJS and Initialise amounts units

ON RELAY

Write values to EEPROM

If LED glows 3 times ? ? ?

Yes Decrease amount by 3 and units by 1

Message

No

If amount =0 ? Yes

Page 43

Warning Message

Relay OFF

No

If Switch pressed ?

Yes Message

Display the Amount Credited

STOP

Fig .6.1

Page 44

Chapter 7 PROGRAM CODE


#include <EEPROM.h> #include<LiquidCrystal.h> LiquidCrystal lcd(8,9,10,11,12,13); byte amt,units; int byte_addr,byte_addr1,num_pulses; int relay=4,sw = 7,temp = 0; void recharge(); void setup() { lcd.begin(16,2); pinMode(2,INPUT); pinMode(4,OUTPUT); pinMode(sw,INPUT); digitalWrite(sw,HIGH); Serial.begin(9600); amt = 9; units = 3; byte_addr = 0; byte_addr1 = 1;

Page 45

EEPROM.write(byte_addr, amt); EEPROM.write(byte_addr1, units); }

void loop() { if(amt != 0) { digitalWrite(4,HIGH); attachInterrupt(0,pulse,FALLING); if(num_pulses == 3) { units = EEPROM.read(byte_addr1); units--; EEPROM.write(byte_addr1, units); amt = EEPROM.read(byte_addr); amt = amt-3; EEPROM.write(byte_addr, amt); Serial.print("Balance amount:"); Serial.print(amt,DEC); lcd.print("Balance amount:");

Page 46

lcd.print(amt,DEC); Serial.print("Units remaining:"); Serial.print(units,DEC); lcd.print("Units remaining"); lcd.print(units,dec); num_pulses = 0; } if (amt == 0) { if(temp == 0) { Serial.print("Recharge immediately,load OFF"); lcd.print("Recharge immediately,load OFF"); digitalWrite(4,LOW); digitalWrite(13,HIGH); delay(500); digitalWrite(13,LOW); delay(500); temp = 1; } }

Page 47

} recharge(); } void pulse() { num_pulses++; }

void recharge() { if(digitalRead(sw) == 0) { while(digitalRead(sw) == 0); units = EEPROM.read(byte_addr1); units = units + 3; EEPROM.write(byte_addr1, units); amt = EEPROM.read(byte_addr); amt = amt + 9; EEPROM.write(byte_addr, amt); digitalWrite(4,HIGH); Serial.print("Recharge successful");

Page 48

lcd.print("Recharge successful"); Serial.print("Balance amount:"); Serial.print(amt,DEC); lcd.print("Balance amount:"); lcd.print(amt,DEC); Serial.print("Units remaining:"); Serial.print(units,DEC); lcd.print("Units remaining:"); lcd.print(units,DEC); temp = 0; } }

Page 49

Chapter 8 FUTURE SCOPE AND CONCLUSION

Result:
The project has been successfully completed and is in proper working condition. Prepaid energy meter is used to prepaid the ongoing supply of electricity to homes, offices etc. We will get rid of the monthly electricity bills as recharge coupons will be available at nearby shops. It is an advantageous concept for the future.

Future Scope:Prepaid energy meter is an advantageous concept for the future. Its facilitates the exemption from electricity bills. Electricity coupons will be available at nearby shops. The word prepaid means "pay before use" one of the advantageous feature of this concept. Prepaid energy meter is used to prepaid the ongoing supply of electricity to homes, offices etc.

Applications:
1) In Homes. 2) In Festivals where electricity is required just for a few days. 3) Rental accommodation. 4) Industries and Factories. 5) In Malls

Conclusions:
Prepayment systems have been proposed as an innovative solution to the problem of affordability in utilities services. In spite of being a popular system in European and African countries, the use of such mechanisms remains controversial. Among the main arguments in favour of its dissemination are the advantages concerning lower costs of arrears, running costs and finance charges for the service provider and the better allocation of resources it implies for
Page 50

users. The arguments against prepaid meters are based on the higher cost of the technology and the possibility of self-disconnection of low-income users. 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. Encouraging consumers to opt for prepaid meters on a voluntary basis and offering tariff or non-tariff incentives to those consumers who prepay their power charges, would help the utilities to implement this system

Advantages of Prepaid Energy Meters:


1. Lower Overheads. 2. No bill production. 3. No bill distribution. 4. Pay before use. 5. Recover money owed (debt). 6. No need to chase payments. 7. No further actions such as disconnection.

Disadvantages:
1.) The main disadvantage of the system is, because of huge electronic hardware involved in the system, the overall system consumes more electric energy. Remedy: When the system is converted into engineering module, the bulky hardware can be converted into a small-integrated chip. When the hardware is minimized naturally the system consumes less power. 2.) Since it is a prototype module, because of huge hardware the system occupies more space. 3.) The consumer or the electrical department has to spend more amounts for installing this kind of smart energy meters. Economically it is not advised.

Page 51

CHRONOLOGICAL BIBLIOGRAPHY

[ 1 ] Loss.P.A.V, Lamego.M.M and Vieira.J.L.F,A single phase microcontroller based energy meter, IEEE Instrumentation and Measurements Technology conference St. Paul, Minessota, USA, May 18-21,1998 [ 2 ] Kwan, B.H., Moghavvemi, M., PIC Based Smart Card Prepayment System, Student Development, pp. 440- 443, 2002. [ 3 ] Martin U. Reissland, the book on Electrical measurements, New Age international publishers, 2008 edition. [ 4 ] Arduino, http://www.arduino.cc/ , March 2011 [ 5 ] Digi, "XBee ZNet 2.5/XBee PRO Znet 2.5 OEM Product Manual", 2010. [ 6 ] Joanie Wexler (March 16, 05) Bluetooth and ZigBee: compare and contrast. Available:http://www.techworld.com/mobility/features/index.cfm?featureid=1261

Page 52

Das könnte Ihnen auch gefallen