Escolar Documentos
Profissional Documentos
Cultura Documentos
DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING GOKARAJU RANGARAJU INSTITUTE OF ENGINEERING AND TECHNOLOGY
(Affiliated to Jawaharlal Nehru Technological University)
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)
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.
(External examiner)
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
Page VII
09 11
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 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.
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).
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
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
Fig 3.1
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
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
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
Table 3.1
Page 12
Page 13
Fig 4.1
2 3
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
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
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
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.
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
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.
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.
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
8 9 10 11 12 13 14 15 16
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:
STANDARD VALUE
MIN. 4.7 TYP. 5.0 1.2 MAX 5.3 1.6
UNIT
V mA
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
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.
Fig 4.8
Page 34
Pin Configuration:
Pin # 1 2 3 4 5 6
Name VCC DOUT DIN / CONFIG DIO8 RESET PWM0 / RSSI / DIO10
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
Either Input
Digital I/O 11 Do not connect Pin Sleep Control Line or Digital Input 8
10 11 12
Either Either
13
ON / SLEEP
Output
14 15
Either
16
RTS / DIO6
Either
Page 35
17
AD3 / DIO3
Either
18
AD2 / DIO2
Either
19
AD1 / DIO1
Either
20
AD0 / DIO0
Either
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
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
Power supply
Energy meter
LDR
Relay
Load
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
ON RELAY
Message
No
If amount =0 ? Yes
Page 43
Warning Message
Relay OFF
No
If Switch pressed ?
Yes Message
STOP
Fig .6.1
Page 44
Page 45
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
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
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
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