Anda di halaman 1dari 82

PES INSTITUTE OF TECHNOLOGY, BANGALORE

(An Autonomous Institute Under VTU, Belgaum)


100 Feet Ring Road, Banashankari 3rd stage, Bangalore-560085

PROJECT REPORT On AN AUTOMATIC ENERGY METER READING SYSTEM WITH ADVANCED BILLING TECHNOLOGY
Submitted in the partial fulfillment of the requirementfor the award of the degree of

BACHELOR OF ENGINEERING IN ELECTRICAL AND ELECTRONICS


(Academic Session: JANUARY -JUNE 2014) Submitted By N .J.Sanath Pronit Das SiddharthChavali Under the guidance of: 1PI10EE058 1PI09EE067 1PI10EE097

Mrs. Nandita Roy.


Professor DEPARTMENT OF ELECTRICAL&ELECTRONICS ENGINEERING, PESIT, BANGALORE

Department of Electrical and Electronics Engineering

Page 1

PES INSTITUTE OF TECHNOLOGY, BANGALORE


(An Autonomous Institute Under VTU, Belgaum)
100 Feet Ring Road, Banashankari 3rd stage, Bangalore-560085 DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING

Certificate
Certified that the project work entitled Automatic An Automatic Energy meter Reading System With Advanced Billing Technology is a bonafide work carried out by the team of students N.J. Sanath, Pronit Das and Siddharth Chavali in partial fulfillment for the award of degree of Bachelor of Engineering in Electrical and Electronicsof P.E.S Institute of Technology, Bangalore, Autonomous Institute under Visvesvaraya Technological University, Belgaum during the academic year 2013-2014. It is certified that all corrections/suggestions indicated for internal assessment have been incorporated in the report submitted in the department library. The project report has been approved as it satisfies the academic requirements with respect to 8th semester Project Work prescribed for the Bachelor of Engineering degree.

(SIGNATURE OF THE GUIDE)

(SIGNATURE OF THE HOD)

(SIGNATURE OF THE PRINCIPAL)

Mrs. Nandita Roy

Dr. Keshavan B K

Dr.K.N.B.Murthy

Name of the student: 1. N.J. Sanath 2. Pronit Das 3. Siddhath chavali External Viva Name of the Examiners 1._____________________ 2._____________________

University Seat number: 1PI10EE058 1PI09EE067 1PI10EE097

Signature with Date _____________________ _____________________ Page 2

Department of Electrical and Electronics Engineering

ACKNOWLEDGEMENTS

On the successful completion of our project, we are grateful to our institution PES Institute of technology for having provided us with the facilities which has made this project a success. We would like to express our gratitude to Dr. K. N.Balasubramanya Murthy, Principal, PESIT, Bangalore and our esteemed Director Prof. D.Jawahar, PESIT, Bangalore for providing a congenial working environment. We are thankful to Dr. B. K.Keshavan, HOD of EEE department, PESIT for his continued support, encouragement and guidance. We sincerely thank our guide Mrs.NanditaRoy, Assistant Professor, department of EEE, for her constant support and guidance throughout the project work. Lastly we would like to thank all the professors, lecturers, staff members of the EEE department, our parents and friends for providing the much needed encouragement and support.

Department of Electrical and Electronics Engineering

Page 3

SYNOPSIS:
''An Automatic Energy Meter Reading System With Advanced Billing Technology" is a project which has many advantages like coast effective, time consume, more or less human error and many more. The main issue in thisis time consume ,nobody likes to share their personal or family time for a unknown person who comes to our house for take the electric meter readings which sometime feel a consumer an unnecessary trouble .so we decided to make this system fully automatic ,where a single click makes everything possible within a second and gives every possible data in your door step. This project is fully automatic as we said before like consumer's electric meter automatically take the meter readings by own and store in its data server which can show in a LCD screen ,so the consumer satisfaction is completely 100% as long as the meter readings automatically go to electric board office where its shown them the complete data along with meter readings and how much energy consumed so no need to send anybody to send from the electricity board office to consumer house overall we can see it save the money, time ,human effort and more or les human error alsoand full satisfaction for a consumer and for the company also. we are going to use Zigbee technology and GSM technology in this project which are once at a time very much coast effective as long as completely automatic system where minimum 2km to maximum 50 km, it can operate any consumer house through out an electricity board.

Department of Electrical and Electronics Engineering

Page 4

TABLE OF CONTENTS

Department of Electrical and Electronics Engineering

Page 5

Department of Electrical and Electronics Engineering

Page 6

1. INTRODUCTION

Every human being requires a home to live and his life is made comfortable by using many electrical gadgets . These gadgets are typically to used to regulate temperature , reduce effort , getting things done faster in their daily life . The important thing to note all these gadgets are powered by Electricity , This electricity is supplied by Electricity Boards or Private suppliers through the meters installed at every home. The electricity supplier necessarily ensures that units consumed by the homes are recorded accurately and charges are computed correctly . In our daily life ,the electricity billing needs one electricity board person to visit each and every home to check how much unit they have consumed and take the meter readings in every month and then they will provide electricity bill to consumer. If any consumer did not pay the bill at the right time ,then again one electricity board person has to visit that home to cut the electric supply , and to do the connection when he pays the bill. But , in modern days ,we don't have that to so much time to do all these complexity ,so we decide that by , using this project there is no necessity to visit each and every home and collect the meter readings ,sending the bill and receiving the payment manually. Instead , an Electricity board authorized person can received the meter reading of each and every home by using ZIGBEE technology and as well as can send electricity bill automatically via message to every consumer by using GSM technology to their cell phones. As long as an authorized cut off/on the supply for every home by using this technology .And all these things can be achieved by sitting at one place. So overall in this project by using the modern technology ,we reduce the human effort and as long as reduce the unnecessary power wastage.

Department of Electrical and Electronics Engineering

Page 7

There are situations like, we are going outside and power is not there. So we will forget to switch off all fans and lights. If the power comes, before we come back to our home leads to power wastage. By using our project we can reduce power wastage, by the same time homeowner can send the appropriate message to trip off those power, we can switch off all equipments and thereby reduce the power consumption, Using this project farmer can trip OFF & trip ON his pump set and also known current information about the remote place, by doing little modifications, it can be used as home appliances controller.

Department of Electrical and Electronics Engineering

Page 8

System B
Electric Meter

BLOCKDIAGRAM
Electricity Board

Microcontroller

Zigbee
System A
Electric Meter Microcontroller

Microcontroller

GSM

Consumer

Zigbee

SERVER
Electricity Board Main System

System C
Electric Meter Microcontroller

Zigbee

Zigbee

Show Application
A B C

Software
Click

fig.1.1 block diagram

Department of Electrical and Electronics Engineering

Page 9

2. HARDWARE DESRIPTION
2.1ARM7LPC2148

fig 2.1

2.1.1 Features
16-bit/32-bit ARM7TDMI-S microcontroller in a tiny LQFP64 package.

8 kB to 40 kB of on-chip static RAM and 32 kB to 512 kB of on-chip flash

memory. 128-bit wide interface/accelerator enables high-speed 60 MHz operation.

In-System Programming/In-Application Programming (ISP/IAP) via on-chip boot

loader software. Single flash sector or full chip erase in 400 ms and programming of 256 bytes in 1 ms.

Department of Electrical and Electronics Engineering

Page 10

Embedded ICE RT and Embedded Trace interfaces offer real-time debugging with the on-chip Real Monitor software and high-speed tracing of instruction execution.

USB 2.0 Full-speed compliant device controller with 2 kB of endpoint RAM. In addition, the LPC2146/48 provides 8 kB of on-chip RAM accessible to USB by DMA.

One or two (LPC2141/42 vs. LPC2144/46/48) 10-bit ADCs provide a total of

6/14 analog inputs, with conversion times as low as 2.44 s per channel.

Single 10-bit DAC provides variable analog output (LPC2142/44/46/48 only).

Two 32-bit timers/external event counters (with four capture and four compare

channels each), PWM unit (six outputs) and watchdog.

Low power Real-Time Clock (RTC) with independent power and 32 kHz clock input.

Multiple serial interfaces including two UARTs (16C550), two Fast I2C-bus (400 kbit/s), SPI and SSP with buffering and variable data length capabilities.

Vectored Interrupt Controller (VIC) with configurable priorities and vector addresses.

Department of Electrical and Electronics Engineering

Page 11

Up to 45 of 5 V tolerant fast general purpose I/O pins in a tiny LQFP64 package,.

Up to 21 external interrupt pins available.

60 MHz maximum CPU clock available from programmable on-chip PLL with Settling time of 100 s.

On-chip integrated oscillator operates with an external crystal from 1 MHz to 25 MHz.

Power saving modes include Idle and Power-down.

Individual enable/disable of peripheral functions as well as peripheral clock scaling for additional power optimization.Processor wake-up from Power-down mode via external interrupt or BOD.

2.1.2 I2C - Bus


The LPC2141/42/44/46/48 each contain two I2C-bus controllers. The I2C-bus is bidirectional, for inter-IC control using only two wires: a serial clock line (SCL), and a serial data line (SDA). Each device is recognized by a unique address and can operate as either a receiver-only device (e.g., an LCD driver or a transmitter with the capability to both receive and send information (such as memory)). Transmitters and/or receivers can operate in either master or slave mode, depending on whether the chip has to initiate a data transfer or is only addressed. The I2C-bus is a multi-master bus, it can be controlled by more than one bus master connected to it.The I2C-bus implemented in LPC2141/42/44/46/48 supports bit rates up to 400 kbit/s (Fast I2C-bus).
Department of Electrical and Electronics Engineering Page 12

Compliant with standard I2C-bus interface. Easy to configure as master, slave, or master/slave. Programmable clocks allow versatile rate control. Bidirectional data transfer between masters and slaves. Multi-master bus (no central master). Arbitration between simultaneously transmitting masters without corruption of serial data on the bus. Serial clock synchronization allows devices with different bit rates to communicate via one serial bus. Serial clock synchronization can be used as a handshake mechanism to suspend and resume serial transfer. The I2C-bus c ostic purposes The LPC2141/42/44/46/48 each contain one SPI controller. The SPI is a full duplex Serial interface, designed to handle multiple masters and slaves connected to a given bus. Only a single master and a single slave can communicate on the interface during a given. Data transfer. During a data transfer the master always sends a byte of data to the slave, And the slave always sends a byte of data to the master. Compatible with Motorolas SPI, TIs 4-wire SSI and National Semiconductors Micro wire buses. Synchronous serial communication. Master or slave operation. 8-frame FIFOs for both transmit and receive. Four bits to 16 bits per frame.

Department of Electrical and Electronics Engineering

Page 13

2.1.3 Pin Diagram

Department of Electrical and Electronics Engineering

Page 14

2.2 GSM (GLOBAL SYSTEM FOR MOBILE COMMUNICATION)

fig 2.2
Global System for Mobile (GSM) is a second generation cellular standard developed to cater voice services and data delivery using digital modulation. Global System for Mobile communications is the most popular standard for mobile phones in the world. Its promoter, the GSM Association, estimate that 82% of the global mobile market uses the standard. GSM is used by over 2 billion people across more than 212 countries and territories. Its ubiquity makes international roaming very common between mobile phone operators, enabling subscribers to use their phones in many parts of the world. GSM has used a variety of voice codecs to squeeze 3.1 kHz audio into between 5.6 and 13 kbit/s. Originally, two codecs, named after the types of data channel they were allocated, were used, called Half Rate (5.6 kbit/s) and Full Rate (13 kbit/s). These used a system based upon linear predictive coding (LPC). In addition to being efficient with bit rates, these codecs also made it easier to identify more important parts of the audio, allowing the air interface layer to prioritize and better protect these parts of the signal.
Department of Electrical and Electronics Engineering Page 15

There five different cell sizes in a GSM network-macro, micro, Pico, femto and umbrella cells. The coverage area of each cell varies according to the implementation environment. Macro cells can be regarded as cells where the base station antenna is installed on a mast or a building above average roof top level. Micro cells are cells whose antenna height is under average roof top level; they are typically used in urban areas. Picocells are small cells whose coverage diameter is a few dozen meters; they are mainly used indoors. Femtocells are cells designed for use in residential or small business environments and connect to the service providers network via a broadband internet connection. Umbrella cells are used to cover shadowed regions of smaller cells and fill in gaps in coverage between those cells. Cell horizontal radius varies depending on antenna height, antenna gain and propagation conditions from a couple of hundred meters to several tens of kilometers. The longest distance the GSM specification supports in practical use is 35 kilometers (22 mi). Indoor coverage is also supported by GSM and may be achieved by using an indoor picocell base station, or an indoor repeater with distributed indoor antennas fed through power splitters, to deliver the radio signals from an antenna outdoors to the separate indoor distributed antenna system. These are typically deployed when a lot of call capacity is needed indoors, for example in shopping centres or airports. However, this is not a prerequisite, since indoor coverage is also provided by in-building penetration of the radio signals from nearby cells. The modulation used in GSM is Gaussian minimum-shift keying (GMSK), a kind of continuous-phase frequency shift keying. In GMSK, the signal to be modulated onto the carrier is first smoothed with a Gaussian low-pass filter prior to being fed to a frequency modulator, which greatly reduces the interference to neighboring channels (adjacent channel interference). One of the key features of GSM is the Subscriber Identity Module (SIM), commonly known as a SIM card. The SIM is a detachable smart card containing the users subscription information and phonebook. This allows the user to retain his or her information after switching handsets. Alternatively, the user can also change operators
Department of Electrical and Electronics Engineering Page 16

while retaining the handset simply by changing the SIM. Some operators will block this by allowing the phone to use only a single SIM, or only a SIM issued by them; this practice is known as SIM locking, and is illegal in some countries. A subscriber can usually contact the provider to remove the lock for a fee, utilize private services to remove the lock, or make use of ample software and websites available on the Internet to unlock the handset themselves. While most web sites offer the unlocking for a fee, some do it for free. The locking applies to the handset, identified by its International Mobile Equipment Identity (IMEI) number, not o the account (which is identified by the SIM card). It is always possible to switch to another (non-locked) handset if such a handset is available. A modem is a communication device that converts binary into analog acoustic signals for transmission over telephone lines and converts these acoustics signals back into binary form at the receiving end. Conversion to analog signal is known as modulation; conversion back to binary signal is known as demodulation. In the terminology used in the RS-232C communication standard, modems are DCEs, which mean the connected at one end to a DTE (e.g. computer) device. Low-speed modems are designed to operate asynchronously. Each data frame conforms an asynchronous transmission mechanism. High-speed modems as well as leased-lines modems use synchronous transmission. The two modems use a common time base and operate continuously at substantially the same frequency and the phase relationship by circuit that monitors the connection. A half-duplex modem must alternately send and received signals. Half-duplex allows more of the channel bandwidth to be put to use but slows data communications. A full-duplex modem can simultaneously handle two signals using two carriers to transmit and receive data. Each carrier uses a half of the bandwidth available to it and its modulation.

Department of Electrical and Electronics Engineering

Page 17

ASK is not used For data communications because it is very susceptible to electrical noise interference. Low-speed modems use FSK, higher speed modems use PSK, and the very high speed modems use a conjunction of ASK and PSK. The SMS/MMS Gateway requires a connection to an SMSC (Short Messaging Service Centre) to interface with SMS and MMS networks. An SMSC connection can consist of one or more of the following: GSM Modem A GSM modem or phone connected to a PC serial port (or to a USB port with an appropriate modem driver). SMPP (Short Message Peer to Peer Protocol) A TCP/IP connection over the internet or a private network to a service that supports v3.3 or v3.4 of the SMPP protocol. UCP/EMI (Universal Computer Protocol/ External Machine Interface) A TCP/IP connection over the internet or a private network to a service that supports v3.5 or v4.0 of the UCP/EMI protocol. HTTP (Hyper Text Transfer Protocol, e.g., the standard protocol for the web) A TCP/IP connection over the internet or private network to a service that accepts SMS messages via an HTTP GET based protocol allows you to chain multiple Now SMS/MMS Gateways together.) M-Bus is a one pin bi-directional bus for both transmitting and receiving data from the phone. It is slow (9600bps) and only half-duplex. Only two pins on the phone are used. One ground and one data. M-Bus runs at 9600bps, 8 data bits, odd parity, one stop bit. The data terminal ready (DTR) pin must be cleared with the request to send (RTS). This powers the electronics in the cable and I think it sets it for M-Bus operation. F-Bus is the later high-speed full-duplex bus. It uses one pin for transmitting data and one pin for receiving data plus the ground pin. Very much like a standard serial port. It is fast 115,200bps, 8 data bits, no parity, one stop bit. For F-Bus the data terminal ready (DTR) pin must be set and the request to send (RTS) pin cleared.

Department of Electrical and Electronics Engineering

Page 18

2.2.1 Sending SMS Messages from a microcontroller using a GSM Modem:


A GSM modem is a wireless modem that works with GSM wireless networks. A wireless modem is similar to a dial-up modem. The main difference is that a wireless modem transmits data through a wireless network whereas a dial-up modem transmits data through a copper telephone line. Most mobile phones can be used as a wireless modem. To send SMS messages, first place a valid SIM card into a GSM modem, which is then connected to microcontroller by RS232 cable. After connecting a GSM modem to a microcontroller, you can control the GSM modem by sending instructions to it. The instructions used for controlling the GSM modem are called AT commands. GSM modems support a common set of standard AT commands. In addition to this common set of standard AT commands, GSM modems support an extended set of AT commands. One use of the extended AT commands is to control the sending and receiving of SMS messages.

2.2.2 The following table lists the AT commands that are related to the writing and sending of SMS messages:

AT command +CMGS +CMSS

Meaning Send message Send message from storage

+CMGW

Write message to memory

Department of Electrical and Electronics Engineering

Page 19

AT command +CMGD +CMGC +CMMS

Meaning Delete message Send command More messages to send

2.2.3 Characteristics of GSM Standard:


Fully digital system using 900,1800 MHz frequency band. TDMA over radio carriers(200 KHz carrier spacing. 8 full rate or 16 half rate TDMA channels per carrier. User/terminal authentication for fraud control. Encryption of speech and data transmission over the radio path. Full international roaming capability. Low speed data services (upto 9.6 Kb/s). Compatibility with ISDN. Support of Short Message Service (SMS).

2.2.4 Advantages of GSM over Analog system:


Capacity increases. Reduced RF transmission power and longer battery life. International roaming capability. Better security against fraud (through terminal validation and user authentication). Encryption capability for information security and privacy. Compatibility with ISDN, leading to wider range of service.

Department of Electrical and Electronics Engineering

Page 20

2.2.5 GSM Applications:


Mobile telephony. GSM-R. Value Added Services. Telemetry System

Fleet management. Automatic meter reading. Toll Collection. Remote control and fault reporting of DG sets.

2.2.6 GSM Module


The GSM Modem comes with a serial interface through which the modem can be controlled using AT command interface. An antenna and a power adapter are provided. The basic segregation of working of the modem is as under: Voice calls SMS GSM Data calls GPRS

Voice calls: Voice calls are not an application area to be targeted. In future if interfaces like a microphone and speaker are provided for some applications then this can be considered.

SMS: SMS is an area where the modem can be used to provide features like: Pre-stored SMS transmission These SMS can be transmitted on certain trigger events in an automation system SMS can also be used in areas where small text information has to be sent. The transmitter can be an automation system or machines like vending machines, collection machines or applications like positioning systems where the navigator keeps on sending
Department of Electrical and Electronics Engineering Page 21

SMS at particular time intervals SMS can be a solution where GSM data call or GPRS services are not available GSM Data Calls: Data calls can be made using this modem. Data calls can be made to a normal PSTN modem/phone line also (even received). Data calls are basically made to send/receive data streams between two units either PCs or embedded devices. The advantage of Data calls over SMS is that both parties are capable of sending/receiving data through their terminals.

2.2.7Applications and Facts about GSM Data Calls


Devices that have communication on serial port either on PC or in the embedded environment Devices that want to communicate with a remote server for data transfer This capability of data transfer can help in reducing processing requirements of the device The basic aim is to provide a wireless solution keeping the existing firmware intact The clients firmware continues to work without any modifications (no changes in the existing software required) GSM data calls can be a good solution where data has to be transmitted from a hand-held device to a central server The interface on two sides can be between PCs as well as embedded devices Calls can be established by the terminals at either side to start data calls The Modem remains transparent during data transfer after the call is established. Call establishment utility to be provided in case PC terminals Call establishment to be automated in case of embedded terminals. GSM converter can be an option where intelligence of establishing calls has to be put in case ofembedded devices. Concept of GSM converter is discussed later.

Department of Electrical and Electronics Engineering

Page 22

2.2.8 Dial-Up Networks Using GSM Data Calls: Dial up networking is a utility
available with Windows through a person can dial the Data call number of this modem from any PC and share the file system on either PCs. This can be a good utility where both terminals are PC based. Sharing the file system remotely enables monitoring of devices remotely. Thus the modem can act as a piece of device which acts as a spy in the system. Can be a good debugging utility wherein a person can configure/monitor a remote PC based system and even rectify it. Some companies do sell their products with a GSM modem inside it just for this handy feature which allows them to configure the machines sitting anywhere in the world. Since the connection can have upper layer protocols like TCP/IP in this connection becomes more reliable and useful.

2.2.9 GSM Converter: GSM converter will be an add-on device to be attached


between a terminal which wants data transfer and the GSM modem. This GSM converter will take care of call establishment where the embedded device cannot make a call. The converter will remain transparent through-out the call once call is established. The GSM converter will be a very small piece of hardware possibly embedded inside the cable itself.

fig 2.3 : Basic Architecture of GSM Module

Department of Electrical and Electronics Engineering

Page 23

2.3LCD (LIQUID CRYSTAL DISPLAY)


2.3.1 Introduction:
Liquid crystal display is very important device in embedded system. It offers high flexibility to user as he can display the required data on it. But due to lack of proper approach to LCD interfacing many of them fail. Many people consider LCD interfacing a complex job but according to me LCD interfacing is very easy task, you just need to have a logical approach. This page is to help the enthusiast who wants to interface LCD with through understanding. Copy and Paste technique may not work when an embedded system engineer wants to apply LCD interfacing in real world projects. You will be knowing about the booster rockets on space shuttle. Without these booster rockets the space shuttle would not launch in geosynchronous orbit. Similarly to understand LCD interfacing you need to have booster rockets attached! To get it done right you must have general idea how to approach any given LCD.This page will help you develop logical approach towards LCD interfacing. First thing to begin with is to know what LCD driver/controller is used in LCD.Yes, your LCD is dumb it does not know to talk with your microcontroller. LCD driver is a link between the microcontroller and LCD. You can refer the datasheet of LCD to know the LCD driver for e.g. JHD 162A is name of LCD having driver HD44780U.You have to interface the LCD according to the driver specification. To understand the algorithm of LCD interfacing user must have datasheet of both LCD and LCD driver. Many people ignore the datasheets and end up in troubles. If you want to interface LCD successfully you must have datasheets.Why people ignore datasheets? Most of us do not like to read 100 pages of datasheet. But for a accurate technical specification datasheets are must. I will show you a technique to manipulate a datasheet within minutes.First thing to find out in datasheet is the features viz. operating voltage, type of interface, maximum speed for interface in MHz, size of display data RAM, number of pixels, bits per pixel, number of row and columns. You must have the pin diagram of LCD.Pin diagram of LCD driver can be omitted.Study the type of communication protocol whether it is parallel or serial interface. Check how LCD
Department of Electrical and Electronics Engineering Page 24

discriminates data bytes and command bytes, which pins on LCD are used for communication. Study Interface timing diagram given in the datasheet.From datasheet of LCD driver find out whether hardware reset is required at startup, what is the time of reset pulse, is it active low and which pins of LCD are to be toggled.Major task in LCD interfacing is the initialization sequence. In LCD initialization you have to send command bytes to LCD. Here you set the interface mode, display mode, address counter increment direction, set contrast of LCD, horizontal or vertical addressing mode, color format. This sequence is given in respective LCD driver datasheet. Studying the function set of LCD lets you know the definition of command bytes. It varies from one LCD to another. If you are able to initialize the LCD properly 90% of your job is done.Next step after initialization is to send data bytes to required display data RAM memory location. Firstly set the address location using address set command byte and than send data bytes using the DDRAM write command. To address specific location in display data RAM one must have the knowledge of how the address counter is incremented. In recent years the LCD is finding widespread use replacing LEDs This is due to following reasons I. II. The declining prices of LCDs The ability to display numbers, characters and graphics. This is in contrast to LEDs, which are limited to numbers and few characters. III. Incorporation of a refreshing controller in to LCD, there by relieving the CPU of the task of refreshing the LCD. In contrast LCD must be refreshed by CPU to keep displaying the data.

fig.2.4.LCD display

Department of Electrical and Electronics Engineering

Page 25

2.3.2 Basic reading


This section deals with the character based LCD module which use Hitachi HD44780 controller chip. These modules are not quite as advanced as the latest generation, full size, full color, back lit types used in todays laptop computers, but far from being phased out, Character based LCDs, are still used extensively in commercial and industrial equipment ,particularly where display requirements are reasonably simple.

2.3.3 Shapes and sizes


Even limited to character based modules, there is still a wide variety of shapes and Sizes available. Line lengths 8, 16,2,024,32 and 40 character are all standard, in one, two and 4 lines versions. Several different liquid crystal technologies based exist. Supertwist types, for Example, offer improved contrast and viewing angle over the older twisted nematic types. Some modules are available with backlighting, so that they can viewed in dimly lit conditions.

2.3.4 Connections
A 14 pin access is provided having 8 data lines,3 control lines and 3 power lines. The connections are laid out in one of two common configurations, either two row of seven pins, or a single row of 14 pins. The two layout alternatives are displayed in fig 2.5

Department of Electrical and Electronics Engineering

Page 26

fig2.5: Pin out of the 2 basic LCD formats. On most displays, the pins are numbered on the LCDs PCB, but if not, it is quite easy to locate pin1.Since this pin is connected to ground, it often has a thicker PCB track connected to it and it is generally connected to the metal work at some point. The block diagram of an LCD module with all the pin details is shown in figure 2.7 The function of each of the connections is shown in table 1.Pin 1 and 2 are the power supply lines, Vss and Vdd. The Vdd pin should be connected to positive supply and Vss to 0V supply or ground. Although the LCD module data sheets specify a 5VDC supply, Supplies of 6V and 4-5V both work well, and even 3V is sufficient for some modules Pin 3 is a control pin ,Vee , which is used to alter the contrast of the display. Ideally, this pin should be connected to a variable voltage supply.Pin 4 is the (RS)register select line. When this line is low, data bytes transferred to the display are treated as commands and data bytes read from the display indicate its status.By setting the RS line
Department of Electrical and Electronics Engineering Page 27

high, character data can be transferred to and from the module. Pin 5 is read/write line. this line is pulled low in order to write commands or character data to the module, or pulled high to read character data or status information from its registers.

fig 2.6:Pin out functions for all the LCD type

Department of Electrical and Electronics Engineering

Page 28

fig2.7: pin details on an LCD module Pin 6 is the enable line. this input is used to initiate the actual transfer of commands or character data between the module and the data lines. When writing to the display, data is transferred only on high to low transition of this signal. Pin 7 to 14 are data bus lines (D0 to D7).data can be transferred to and from the display either as a single 8 bit byte or two 4 bit nibbles. The other two pins LED+ and LED- is used for back light of the LCD. Now let us try to display a single character on LCD. When powered up ,the display should show a series of dark squares, possibly on a part of the display. These character cells are actually in their off state, so the contrast control should be adjusted anti clock wise until the squares are only just visible. The display module resets itself to an initial state when power is applied, which
Department of Electrical and Electronics Engineering Page 29

curiously has the display blanked off, so that even if the characters are entered, they cannot be seen. it is therefore necessary to issue a command at this point, to switch the display on. The display on/off and cursor command turns on the display, but also determines the cursor style at the same time. Initially it is better to select a blinking cursor with under line, so that its position can be clearly seen. ie code 00001111(0F).set the data switches (s1 to s8)to 00001111(0F) and ensure that RS switch (S10)is down(logic 0).so that the device is in command mode Now press E switch (S9) momentarily, which enables the chip to accept the data. Now set RS switch to up position (logic 1), switching the chip from command mode to character mode and enter the binary value 01000001(41)on data switches. This is ASCII code for a capital A. Press the switch and marvel as the display fills up with capital As .Clearly,something is not right.

2.3.5 The internal structure of LCD module.


LCD is connected to the microcontroller through the controller interface. LCD has an internal memory which stores the lookup table for all the characters. Any ASCII value of a character that is passed to the LCD module is compared with the lookup table in the memory and that value is displayed

Department of Electrical and Electronics Engineering

Page 30

fig 2.8 : Internal structure of LCD module.

2.3.6 Liquid crystal


Liquid crystals are substances that exhibit a phase of matter that has properties Between those of a conventional liquid, and those of a solid crystal. For instance, a liquid Crystal (LC) may flow like a liquid, but have the molecules in the liquid arranged and/or Oriented in a crystal-like way.

Each pixel of an LCD typically consists of a layer of molecules aligned between two transparent electrodes, and two polarizing filters, the axes of transmission of which are (most of the cases) perpendicular to each other. The surfaces of the electrodes, that are in contact with the liquid crystal material, are treated so as to align the liquid crystal molecules in a particular direction. This treatment typically consists of a thin polymer layer that is unidirectional rubbed using, for example, a cloth. The direction of the liquid
Department of Electrical and Electronics Engineering Page 31

crystal alignment is then defined by the direction of rubbing. Electrodes are made of a transparent conductor called Indium Tin Oxide (ITO).

Fig 2.9 liquid crystal molecule alignment

2.3.7 Definitions
i. ii. Resolution: The horizontal and vertical size expressed in pixels (e.g., 1024x768). Dot pitch: The distance between the centers of two adjacent pixels. The smaller the dot pitch size, the less granularity is present, resulting in a sharper image. Dot pitch may be the same both vertically and horizontally, or different (less common). iii. Viewable size: The size of an LCD panel measured on the diagonal (more specifically known as active display area). iv. Response time: The minimum time necessary to change a pixel's color or brightness.

2.3.8Interfacing LCD with microcontroller


Interfacing LCD with microcontroller is very easy task. You just have to know the proper LCD programming algorithm. LCD used here has HD44780u dot matrix LCD controller. LCD module has 8-bit data interface and control pins. One can send data as 8bit or in pair of two 4-bit nibbles.
Department of Electrical and Electronics Engineering Page 32

To display any character on LCD micro controller has to send its ASCII value to the data bus of LCD. For e.g. to display 'AB' microcontroller has to send two hex bytes 41h and 42h respectively. LCD display used here is having 16x2 size. It means 2 lines each with 16 characters.

fig 3.0 Interfacing LCD with microcontroller

Department of Electrical and Electronics Engineering

Page 33

2.3.9LCD Initialization
This is the pit fall for beginners. Proper working of LCD depend on the how the LCD is initialized. We have to send few command bytes to initialize the lcd. Simple steps to initialize the LCD 1. Specify function set: Send 38H for 8-bit, double line and 5x7 dot character format. 2. Display On-Off control: Send 0FH for display and blink cursor on. 3. Entry mode set: Send 06H for cursor in increment position and shift is invisible. 4. Clear display: Send 01H to clear display and return cursor to home position

2.3.10 Role of LCD


The LCD module is used in the vehicle anti-collision system to display the range information which is calculated by LV Max Sonar-EZ1 and also to display one of the three zones in which the vehicle is present. If the distance displayed is above 20 inches it displays safe zone.If the distance is between 15 and 19 inches , then it displays alert zone. If the distance is below 15 inches , the LCD will display stop zone.

2.3.1116X2 LCD

This LCD can be used to display 16 characters in 2 rows. It has the ability to display numbers, characters and graphics. It has an inbuilt refreshing circuit, thereby relieving the CPU from the task of refreshing. LCD discussed has total of 14 pins.

Department of Electrical and Electronics Engineering

Page 34

2.3.12Pin out of a generic 16x 2 LCD

DO D1 D2 D3 D4 D5 D6 D7 VSS

fig 3.1 LCD pin Description


VCCVEE RS R/W EN

Pin 1 2 3 4 5 6

Symbol Vss Vcc Vee RS R/W EN

I/O Description I I I/O Ground +5V Power Supply Power Supply to contrast RS = 0 to select command register RS = 1 to select data register Enable 8 bit data bus

7 to 14 D0 to D8 I/O

Table 1.1

Department of Electrical and Electronics Engineering

Page 35

2.3.13 LCD Command Codes


Code(HEX) Command to LCD Instruction Register 1 2 4 6 80 C0 38 Clear display screen Return home Decrement cursor (shift cursor to left) Increment cursor (shift cursor to right) Force cursor to the beginning of first line Force cursor to the beginning of second line 2 lines and 5x7 matrix

Table 1.2

2.3.14 Liquid Crystal Display


In recent years the LCD is finding widespread use replacing LEDs This is due to following reasons a) The declining prices of LCDs b) The ability to display numbers, characters and graphics. This is in contrast to LEDs, which are limited to numbers and few characters. c) Incorporation of a refreshing controller in to LCD, there by relieving the CPU of the task of refreshing the LCD. In contrast LCD must be refreshed by CPU to keep displaying the data. .

Department of Electrical and Electronics Engineering

Page 36

2.3.15 Bounce
The problem here is contact bounce. Practically every time the E switch is closed, its contact will bounce that although, occasionally only one character appears, most attempts will result in 10 or 20 characters coming up on the display. what is needed is a de-bounce circuit. But what about the commands entered earlier, why didnt contact bounce interfere? In fact it did, but it doesnt matter whether a command is entered just once or several times, It gets executed any way. A solution to the bounce problem is in fig 3.2 Here a couple of NAND gates are cross coupled to form a set reset latch(or flip flop)which flips over and latches. So that the contact bounce is eliminated. Either a TTL 74LS00 or CMOS &74HC00can be used in this circuit. The switch must be an S.P.D.T (single pole double throw) type, a micro switch is ideal.

Fig 3.2 : de-bounce circuit

Department of Electrical and Electronics Engineering

Page 37

After modifying the circuit, the screen full of As can be cleared using the Clear display command. Put binary value 00000001 ($01) on the data switches, set the RS switch to the down position and press the new modified E switch. The display is cleared. Note that the output of the de-bounce circuit is high when the switch is pressed and low when the switch is released. Since it is the high to low transition that actually be observed that characters appear on the display, not when the button is pressed, but when it is released.

Department of Electrical and Electronics Engineering

Page 38

\2.3.15 Flow chart for LCD


Start

Connect RS to EN to P1.1

Make lower 4 bits by multiplying by FOH Shift right by 2 positions

Send it to P1

EN = 1,Give some delay EN = 0

Reset P1

Make upper 4 bits by multiplying by FOH Shift right by 2 positions Send it to P1

EN = 1,Give some delay EN = 0

Reset P1

RS = 1

If given byte is to be printed

RS = 0

Stop

Department of Electrical and Electronics Engineering

Page 39

2.4 RELAYS
2.4.1 INTRODUCTION
A relay is an electrically operated switch. Current flowing through the coil of the relay creates a magnetic field which attracts a lever and changes the switch contacts. The coil current can be on or off, so relays have two switch positions and they are double throw (changeover) switches. Relays allow one circuit to switch a second circuit which can be completely separate from the first. For example a low voltage battery circuit can use a relay to switch a 230V AC mains circuit. There is no electrical connection inside the relay between the two circuits, the link is magnetic and mechanical. The coil of a relay passes a relatively large current, typically 30mA for a 12V relay, but it can be as much as 100mA for relays designed to operate from lower voltages. Most ICs (chips) cannot provide this current and atransistor is usually used to amplify the small IC current to the larger value required for the relay coil. The maximum output current for the popular 555 timer IC is 200mA so these devices can supply relay coils directly without amplification.

Figure 3.4 Picture of relays

Department of Electrical and Electronics Engineering

Page 40

Relays are usually SPDT or DPDT but they can have many more sets of switch contacts, for example relays with 4 sets of changeover contacts are readily available. Most relays are designed for PCB mounting but you can solder wires directly to the pins providing you take care to avoid melting the plastic case of the relay. The coil will be obvious and it may be connected either way round. Relay coils produce brief high voltage 'spikes' when they are switched off and this can destroy transistors and ICs in the circuit. To prevent damage you must connect a protection diode across the relay coil. The animated picture shows a working relay with its coil and switch contacts. You can see a lever on the left being attracted by magnetism when the coil is switched on. This lever moves the switch contacts. There is one set of contacts (SPDT) in the foreground and another behind them, making the relay DPDT.

Figure 3.5 Relay showing coil and switches

The relay's switch connections are usually labeled COM, NC and NO: COM = Common, always connect to this, it is the moving part of the switch. NC = Normally Closed, COM is connected to this when the relay coil is off. NO = Normally Open, COM is connected to this when the relay coil is on.

Department of Electrical and Electronics Engineering

Page 41

Connect to COM and NO if you want the switched circuit to be on when therelay coil is on. Connect to COM and NC if you want the switched circuit to be on when the relaycoil is off.

2.4.2 CHOOSING A RELAY


Physical size and pin arrangement : If you are choosing a relay for an existing PCB you will need to ensure that its dimensions and pin arrangement are suitable. Coil voltage : The relay's coil voltage rating and resistance must suit the circuit powering the relay coil. Many relays have a coil rated for a 12V supply but 5V and24V relays are also readily available. Some relays operate perfectly well with a supply voltage which is a little lower than their rated value. Coil resistance: The circuit must be able to supply the current required by the relay coil. You can use Ohm's law to calculate the current: Relay coil current = supply voltage / coil resistance The supplier's catalogue should show us the relay's connections. The coil will be obvious and it may be connected either way round. Relay coils produce brief high voltage 'spikes' when they are switched off and this can destroy transistors and ICs in the circuit. To prevent damage we must connect a protection diode across the relay coil.

The Figure 3.6 shows a working relay with its coil and switch contacts. We can see a lever on the left being attracted by magnetism when the coil is switched on. This lever moves the switch contacts. There is one set of contacts (SPDT) in the foreground and another behind them, making the relay DPDT.

Department of Electrical and Electronics Engineering

Page 42

Figure 3.6: Circuit Symbol of Relay We need to consider several features when choosing a relay Switch ratings (voltage and current)The relay's switch contacts must be suitable for

the circuit they are to control. You will need to check the voltage and current ratings. Note that the voltage rating is usually higher for AC, for example: "5A at 24V DC or 125V AC". Switch contact arrangement (SPDT, DPDT etc)Most relays are SPDT or DPDT which are often described as "single pole changeover" (SPCO) or "double pole changeover" (DPCO)

2.4.3 Relays and transistors compared


Like relays, transistors can be used as an electrically operated switch. For switching small DC currents (< 1A) at low voltage they are usually a better choice than a relay. However transistors cannot switch AC or high voltages (such as mains electricity) and they are not usually a good choice for switching large currents (> 5A). In these cases a relay will be needed, but note that a low power transistor may still be needed to switch the current for the relay's coil. The main advantages and disadvantages of relays are listed below:

Department of Electrical and Electronics Engineering

Page 43

2.4.4 Advantages of relays:

Relays can switch AC and DC, transistors can only switch DC. Relays can switch high voltages, transistors cannot. Relays are a better choice for switching large currents (> 5A). Relays can switch many contacts at once.

2.4.5 Disadvantages of relays:

Relays are bulkier than transistors for switching small currents. Relays
cannot switch rapidly (except reed relays), transistors can switch many times per second.

Relays use more power due to the current flowing through their coil. Relays require more current than many ICs can provide, so a low power transistor
may be needed to switch the current for the relay's coil.

The coils, which provide the necessary magnetic flux to operate a relay, are available for operation on a variety of voltages between 5V and 115V DC. and 12V to 250V AC. at currents of between 5 mA and 400 mA.

Department of Electrical and Electronics Engineering

Page 44

2.5ZIGBEE
2.5.1 Introduction
In 21st century, wireless sensor networks are becoming necessary and seen as indispensible in various medical and telecommunication equipments, smart energy resources, home automation products etc., which require monitoring and control. Zigbee is a wireless technology, which communicates on the principle of IEEE 802.15.4 standard. IEEE 802.15.4 is a standard that states the details for the lower layers of the communication. This standard focuses on the low-cost and low power communication. Because of Zigbees low cost, low power consumption and ability to connect in a mesh network, it is becoming more optimum solution for monitoring and control applications. Ability to connect in mesh network allows Zigbee to provide more range compared to other wireless technologies such as INFRARED, BLUETOOTH etc. In addition, it also provides high reliability of the data reproduced at receiver. It also consumes less power in communicating data between its transmitter and receiver, which means longer life with smaller batteries. The primary reason for low power consumption in Zigbee devices is that they work on very small duty cycle that helps them to have a longer life span. Variation in duty cycle depends upon the application usage, for example, some applications need data more frequently like in health centers compared to others such as home automation systems.

2.5.2Types of Zigbee Devices


2.5.2.1Zigbee Coordinator This acts as the building block of the Zigbee communication. Zigbee coordinator forms the root of the various topologies like mesh, star, tree topology network etc. and communicates from one device to other. There is only one Zigbee coordinator in the whole Zigbeeenvironment.
Zigbee Devices Zigbee Coordinator

Figure 3.7: Zigbee coordinator

Department of Electrical and Electronics Engineering

Page 45

2.5.2.2Full Function Device Full function devices support all IEEE 802.15.4 functions and features that are defined by the standard. They can also function as a Zigbee coordinator. More memory and computing power availability helps them to work as router also, which helps in transmitting data to longer distances through different networks .

Full Function Devices

Figure 3.8: Full function device

2.5.2.3

Reduced Function Device Reduced function devices just talk to the Zigbee coordinators or Full function devices. They cannot

perform the functions of a router or coordinator .

Reduced Function Devices

Figure 3.9: Reduced function device

Department of Electrical and Electronics Engineering

Page 46

2.5.3Zigbee Network
The Zigbee coordinator does Zigbee network initialization. As soon as the network is powered up, the coordinator starts the network initialization sequence. After that, the coordinator starts a search for the full function devices and reduced function devices to establish a network. Joining Network as a New Device Whenever a new device either Full Function Device (FFD) or Reduced Function Device (RFD) wants to join a network, it sends a request to all other parent capability devices such as FFDs that it wants to join the network. Then all the parent devices send a packet, which gives the information about their address and number of devices already connected to it. The child device that can be either FFD or RFD collects all the data and then selects one of the devices as a parent device, which is best suited for it. Then that parent device is responsible to provide the child device a unique ID .

Joining Previous Network Zigbee devices save the information in a table whenever they are connected to a network. This table

stores the information, which helps the device to reconnect to the same network again. So next time whenever they are switched on, they first look into that table about the previous information and try to connect to the old network. If the table is blank then they try to connect into a network as a new device.

2.5.4Mechanism for Data Transfer


Whenever a device wants to send a data packet, it has to check for channel. If the channel is idle, device can send a packet else it has to wait. If the receiver is FFD then transmitters can send the packet any time because its transceiver always remains ON. However if the receiver is RFD then there are chances that its transceiver is OFF to save power. So to avoid data loss all RFDs send a packet to their corresponding parent device as soon as there transceiver comes to ON position to get the data packet which was send to them when they were in sleeping mode .

2.5.5Zigbee Network Topology


Zigbee network topology can be divided into three types : Star Topology Star topology consists of one Zigbee coordinator and one or more RFDs or FFDs. All end point devices directly communicate to coordinator. If the end point devices want to talk to each other they have to send the information to coordinator first and then coordinator sends that information to appropriate receiver.
Department of Electrical and Electronics Engineering Page 47

Zigbee Coordinator

Full Function Device

Function Device FigureReduced 4.0: Star topology

Mesh Topology Mesh topology also consists of one Zigbee coordinator and one or more RFDs or FFDs, but in this topology, FFDs can directly contact other FFDs to communicate the data acket.

Zigbee Coordinator

Full Function Device

Figure 4.1: Mesh topology


Reduced Function Device

Cluster Tree Topology This type of topology is used when range from transmitter to receiver is large and Zigbee coordinator has to join two or more networks.
Zigbee Coordinator

Full Function Device

Reduced Function Device

Figure 4.2: Cluster tree topology

Department of Electrical and Electronics Engineering

Page 48

2.5.6 Zigbee Device Communication Flow Chart

Initialize the Device

Setup a New Network

Waiting for the RFD/FFD to join

RFD/FFD Join?

NO
YES

Receive the RFD/FFD Data

Figure 4.3: Flow Chart showing working of Zigbee coordinator

Department of Electrical and Electronics Engineering

Page 49

Initialize the Device

Send Signal to join network

Join Network

NO

YES Waiting for the data from/to sensor/device

Send/Receive data to/from Coordinator

YES Successfully Transferred

NO

Figure 4.4 Flow Chart showing working of Zigbee device

Department of Electrical and Electronics Engineering

Page 50

2.6POWER SUPPLY
The input to the circuit is applied from the regulated power supply. The a.c. input i.e.,230V from the mains supply is step down by the transformer to 12V and is fed to arectifier. The output obtained from the rectifier is a pulsating d.c voltage. So in order to get a pure d.c voltage, the output voltage from the rectifier is fed to a filter to remove anya.c components present even after rectification. Now, this voltage is given to a voltageregulator to obtain a pure constant dc voltage.

Block Diagram:

fig 4.5

2.6.1 Transformer:
Usually, DC voltages are required to operate various electronic equipment and these voltages are 5V, 9V or 12V. But these voltages cannot be obtained directly. Thus the a.cinput available at the mains supply i.e., 230V is to be brought down to the required voltage level. This is done by a transformer. Thus, a step down transformer is employed to decrease the voltage to a required level.

Department of Electrical and Electronics Engineering

Page 51

2.6.2 Rectifier:
The output from the transformer is fed to the rectifier. It converts A.C. into pulsating. D.C. The rectifier may be a half wave or a full wave rectifier. In this project, a bridge rectifier is used because of its merits like good stability and full wave rectification.

2.6.3 Filter:
Capacitive filter is used in this project. It removes the ripples from the output ofrectifier and smoothens the D.C. Output received from this filter is constant until the mains voltage and load is maintained constant.

However, if either of the two is varied, D.C. voltage received at this point changes. Therefore a regulator is applied at the output stage.

2.6.4 Voltage Regulator:


As the name itself implies, it regulates the input applied to it. A voltage regulator is anelectrical regulator designed to automatically maintain a constant voltage level. In thisproject, power supply of 5V and 12V are required. In order to obtain these voltage levels,7805 and 7812 voltage regulators are to be used. The first number 78 represents positivesupply and the numbers 05, 12 represent the required output voltage levels.Avariableregulated power supply, also called a variable bench power supply, is one where you cancontinuously adjust the output voltage to your requirements. Varying the output of thepowersupply is the recommended way to test a project after having double checked parts placement against circuit drawings and the parts placement guide. This type of regulation is ideal for having a simple variable bench power supply.Actually this is quite important because one of the first projects a hobbyist should undertake is the construction of a variable regulated power supply. While a dedicated supply is quite handy e.g. 5V or 12V, it's much handier to have a variable supply onhand, especially for testing. Most digital logic circuits and processors need a 5-volt power supply. To use these parts we need to build a regulated 5-volt source. Usually you start with an unregulated power supply ranging from 9 volts to 24 volts DC (A 12 volt power supply is included with the Beginner Kit and the Microcontroller Beginner Kit.).
Department of Electrical and Electronics Engineering Page 52

To make a 5 volt power supply, we use a LM7805 voltage regulator IC (Integrated Circuit). The IC is shown below.

fig 4.6

The LM7805 is simple to use. You simply connect the positive lead of your unregulated. DC power supply (anything from 9VDC to 24VDC) to the Input pin, connect the negative lead to the Common pin and then when you turn on the power, you get a 5 volt supply from the Output pin.

2.6.4.1 Circuit Features:

Brief description of operation: Gives out well regulated +5V output, output current capability of 100 mA Circuit protection: Built-in overheating protection shuts down output when regulator IC gets too hot Circuit complexity: Very simple and easy to build Circuit performance: Very stable +5V output voltage, reliable operation
Department of Electrical and Electronics Engineering Page 53

Availability of components: Easy to get, uses only very common basic components Design testing: Based on datasheet example circuit, I have used this circuit successfully as part of many electronics projects

Applications: Part of electronics devices, small laboratory power supply Power supply voltage: Unregulated DC 8-18V power supply Power supply current: Needed output current + 5 mA Component costs: Few dollars for the electronics components + the input transformer

2.8 CIRCUIT DIAGRAM:

Fig4.7 : Power Supply Circuit Diagram

This 5V dc acts as Vcc to the microcontroller. The excess voltage is dissipated as heat via an Aluminum heat sink attached to the voltage regulator.

Department of Electrical and Electronics Engineering

Page 54

2.9Bridge Rectifier:
A diode bridge is an arrangement of four diodes connected in a bridge circuit as shown below, that provides the same polarity of output voltage for any polarity of the input voltage. When used in its most common application, for conversion of alternating current (AC) input into direct current (DC) output, it is known as a bridge rectifier. The diagram describes a diode-bridge design known as a full-wave rectifier. This design can be used to rectify single phase AC when no transformer center tap is available. A bridge rectifier makes use of four diodes in a bridge arrangement to achieve full-wave rectification. This is a widely used configuration, both with individual diodes wired as shown and with single component bridges where the diode bridge is wired internally.

fig 4.8

Department of Electrical and Electronics Engineering

Page 55

2.9.1 Typical Bridge Rectifier

For both positive and negative swings of the transformer, there is a Forward path through the diode bridge. Both conduction paths cause Current to flow in the same direction through the load resistor, accomplishing full-wave rectification. While one set of diodes is forward biased, the other set is reverse biased and effectively eliminated from the circuit.

2.9.2 Current Flow in the Bridge Rectifier

Current in Bridge Rectifier for +ve half cycle

fig 4.9 Current in Bridge Rectifier for -ve half cycle

Department of Electrical and Electronics Engineering

Page 56

FLOW CHART` SYSTEM C


START

SYSTEM B
START

SYSTEM C
START

Read meter (sensor)

Read meter (sensor)

Read meter (sensor)

Process Loading

Process Loading

Process Loading

Send data

Send data

Send data

STOP

ZIGBEE

STOP

ZIGBEE

STOP

ZIGBEE

START Read data from ZIGBEE

Read data and covert to ASCII NO

if data is received

YES

Send data to PC/Receive data

Send SMS to customer

STOP

Department of Electrical and Electronics Engineering

Page 57

3.SOFTWARE DESCRIPTION
3.1 Introduction to keilVision3
The Vision3 IDE is a Windows-based software development platform that combines a robust editor, project manager, and make facility. Vision3 integrates all tools including the C compiler, macro assembler, linker/locator, and HEX file generator. The Vision3 IDE offers numerous features and advantages that help you quickly and successfully develop embedded applications. They are easy to use and are guaranteed to help you achieve your design goals.

3.2 Features
1) The Vision3 Simulator is the only debugger that completely simulates all onchip peripherals. 2) Simulation capabilities may be expanded using the Advanced Simulation Interface (AGSI). 3) Vision3 incorporates project manager, editor, and debugger in a single environment. 4) The Vision3 Device Database automatically configures the development tools for the target microcontroller. 5) The Vision3 IDE integrates additional third-party tools like VCS, CASE, and FLASH/Device Programming. 6) The ULINK USB-JTAG Adapter supports both Debugging and Flash programming with configurable algorithm files. 7) Identical Target Debugger and Simulator User Interface. 8) The Code Coverage feature of the Vision3 Simulator provides statistical analysis of your program's execution.

Department of Electrical and Electronics Engineering

Page 58

3.3 Benefits
1) Write and test application code before production hardware is available. Investigate different hardware configurations to optimize the hardware design. 2) Sophisticated systems can be accurately simulated by adding your own peripheral drivers. 3) Safety-critical systems can be thoroughly tested and validated. Execution analysis reports can be viewed and printed for certification requirements. 4) Accelerates application development. While editing, you may configure debugger features. While debugging, you may make source code modifications. 5) Quickly access development tools and third-party tools. All configuration details are saved in the Vision3 project.

6) The same tool can be used for debugging and programming. No extra configuration time required. 7) Shortens your learning curve. 8) Mistakes in tool settings are practically eliminated and tool configuration time is minimized.

The Vision3 screen provides you with a menu bar for command entry, a tool bar where you can rapidly select command buttons, and windows for source files, dialog boxes, and information displays. Vision3 lets you simultaneously open and view multiple source files. Vision3 has two operating modes: 1) Build Mode: Allows you to translate all the application files and to generate executable programs. The features of the Build Mode are described under Creating Applications. 2) Debug Mode: Provides you with a powerful debugger for testing your application. The Debug Mode is described in Testing Programs.

Department of Electrical and Electronics Engineering

Page 59

In both operating modes you may use the source editor of Vision3 to modify your source code. The Debug mode adds additional windows and stores an own screen layout. The following picture shows a typical configuration of Vision3 in the Debug Mode.

Fig 5.0Keil The tabs of the Project Workspace give you access to: 1) Files and Groups of the project. 2) CPU Registers during debugging. 3) Tool and project specific on-line Books. 4) Text Templates for often used text blocks. 5) Function in the project for quick editor navigation. 6) The tabs of the Output Window provides: Build messages and fast error access; Debug Command input/output console; Find in Files results with quick file access. 7) The Memory Window gives access to the memory areas in display various formats. 8) The Watch & Call Stack Window allows you to review and modify program variables and displays the current function call tree.

Department of Electrical and Electronics Engineering

Page 60

9) The Workspace is used for the file editing, disassembly output, and other debug information. 10) The Peripheral Dialogs help you to review the status of the on-chip peripherals in the microcontroller.

3.4 Software Development Cycle


When you use the Keil Vision3, the project development cycle is roughly the same as it is for any other software development project. Create a project, select the target chip from the device database, and configure the tool settings. Create source files in C or assembly. Build your application with the project manager. Correct errors in source files. Test the linked application.

The following block diagram illustrates the complete Vision3 software development cycle. Each component isdescribed below.

Department of Electrical and Electronics Engineering

Page 61

Figure 5.1 Software Development Cycle using Keil Vision3

3.2C Compiler & Macro Assembler


Source files are created by the Vision3 IDE and are passed to the C or EC++ Compileror Macro Assembler. The compiler and assembler process source files and create reloadable object files. 3.2.1 Library Manager The library manager allows you to create object library from the object files created by the compiler and assembler. Libraries are specially formatted, ordered program collections of object modules that may be used by the linker at a later time. When the linker processes a library, only those object modules in the library that are necessary to create the program are used.

Department of Electrical and Electronics Engineering

Page 62

3.2.2 Linker/Locator The Linker/Locator creates an executable program file using the object

modules extracted from libraries and those created by the compiler and assembler. An executable program file (also called absolute object module) contains no relocatable code or data. All code and data reside at fixed memory locations. This executable program file may be used:

To program an Flash ROM or other memory devices, With the Vision3 Debugger for simulation and target debugging, With an in-circuit emulator for the program testing. 3.2.3 Vision3 Debugger The Vision3 symbolic, source-level debugger is ideally suited for fast,

reliable program debugging. The debugger includes a high-speed simulator that let you simulate an microcontroller system including on-chip peripherals and external hardware. The attributes of the chip you use are automatically configured when you select the device from the Device Database.

3.3 Proload v5.4


Proload is a user friendly software interface for programmer boards from Sunrom Technologies. Proload gets its name from "Program Loader" term. It takes in compiled HEX file and loads it to the hardware. Any compiler can be used. The source code can be in Assembly or C, as all of them generate compiled HEX files.

3.4 Embedded C:
When designing software for a smaller embedded system with the 8051, it is very common place to develop the entire product using assembly code. With many projects, this is a feasible approach since the amount of code that must be generated is typically
Department of Electrical and Electronics Engineering Page 63

less than 8 kilobytes and is relatively simple in nature. If a hardware engineer is tasked with designing both the hardware and the software, he or she will frequently be tempted to write the software in assembly language. The trouble with projects done with assembly code can is that they can be difficult to read and maintain, especially if they are not well commented. Additionally, the amount of code reusable from a typical assembly language project is usually very low. Use of a higher-level language like C can directly address these issues. A program written in C is easier to read than an assembly program. Since a C program possesses greater structure, it is easier to understand and maintain. Because of its modularity, a C program can better lend itself to reuse of code from project to project. The division of code into functions will force better structure of the software and lead to functions that can be taken from one project and used in another, thus reducing overall development time. A high order language such as C allows a developer to write code, which resembles a humans thought process more closely than does the equivalent assembly code. The developer can focus more time on designing the algorithms of the system rather than having to concentrate on their individual implementation. This will greatly reduce development time and lower debugging time since the code is more understandable. By using a language like C, the programmer does not have to be intimately familiar with the architecture of the processor. This means that someone new to a given processor can get a project up and running quicker, since the internals and organization of the target processor do not have to be learned. Additionally, code developed in C will be more portable to other systems than code developed in assembly. Many target processors have C compilers available, which support ANSI C. All of this is not to say that assembly language does not have its place. In fact, many embedded systems (particularly real time systems) have a combination of C and assembly code. For time critical operations, assembly code is frequently the only way to go. One of the great things about the C language is that it allows you to perform low-level manipulations of the hardware if need be, yet provides you the functionality and abstraction of a higher order language.
Department of Electrical and Electronics Engineering Page 64

3.5 Flash Magic:


Flash Magic is an application developed by Embedded Systems Academy to allow you to easily access the features of a microcontroller device. With this program you can erase individual blocks or the entire Flash memory of the microcontroller. This application is very useful for those who work in the electronics field. The main window of the program is composed of five sections where you can find the most common functions in order to program a microcontroller device. Using the Communications section you will be able to choose the way a specific device connects to your computer. Select the COM port to be used and the baud rate. It is recommended that you choose a low baud rate first and increase it afterwards. This way you will determine the highest speed with which your system works. In order to select which parts of the memory to erase, choose from the items in the Erase section. The third section is optional. It offers you the possibility to program a HEX file. In the next section you will be able to find different programming options, such as verify after programming, gen block checksums, execute and others. When youre done, click the Start button that can be found in the Start section. The program will start the device, and you will able to see the progress of the operations at the bottom of the main window.

Using Flash Magic, you are able to perform different operations to a microcontroller device, operations like erasing, programming and reading the flash memory, modifying the Boot Vector, performing a blank check on a section of the Flash memory and many others. This is an application for programming NXP microcontrollers. The program will automatically verify the chip after the Hex file is loaded to it. The unused space is filled to improve the security. Checksum calculation routine and security bytes programming are also possible. It allows In system programming for a bundle of microcontrollers. The below screen shot depict he main screen of the same software. For successful execution of ISP below mentioned steps should be followed.

Department of Electrical and Electronics Engineering

Page 65

Step 1 Step 2 .Step 3 Step 4 Step 5 Switch on the supply to programmer board and hit "Start". Reset the device when asked to do so.
Page 66

Select proper device. Select proper port of communication. Select proper baud rate. Make sure baud rate matches with device baud rate.

Select- Erase FLASH option.

Select proper HEX file to be burnt in the controller IC.

Check Verify after programming checkbox.

Department of Electrical and Electronics Engineering

4. Functional Description
4.1.Pin Diagram``

Department of Electrical and Electronics Engineering

Page 67

4.2 Working Principle


In this project, there are two main stakeholders/parties - the Electricity Board and the Consumers. An official present in the Electricity Board office wants to procure the number of units consumed by the respective consumer and update the database .Using the Zigbee technology ,which is installed at every house in the society and a software known as Hypeterminal , the official from the controller room sends an alert message to the consumer through his corresponding unique consumer ID via GSM(Global System for Mobile communications).Irrespective of the presence of the consumer in his house , the consumer is alerted and responds mentioning usage of the number of units. The Electricity Board retrieves this information and feeds it to the database .The database processes this information ,calculates the bill with deadline and other necessary details and finally generates it. Depending on the payment of the bill by the consumer, the Electricity Board official can easily verify. If the consumer fails to pay the bill within the deadline , the Electricity Board official can cutoff the supply connection to the house and the consumer is forced to pay the bill with penalty. According that main concept, there are 2 phases one is phase 1 and another is phase 2. In phase 1, a newer version of an electric meter is introduced where a consumer is able to read the exact number of rotations with the number of units in the meter reading system. In phase 1 ,the components used are a basic analog meter , LCD, microcontroller and a zigbee with load. The working principle with construction is explained in below. In the basic analog meter , a small hole is drilled in it's disc for the purpose of sensing the meter readings by an Infrared Interrupter sensor which is placed at the corner of the meter. While the disc rotates , the moment the hole passes through the IR sensor it takes a count of one otherwise zero . This IR sensors operate at a voltage of 5V,using a 330 ohms resistor to maintain a direct voltage to a nominal voltage saving the sensor.

Department of Electrical and Electronics Engineering

Page 68

Now , the microcontroller ARM7LPC2148 operating at 12V is used. The IR sensor consists of 3 main lines - green , black and red. The black line is connected to the ground terminal of microcontroller, the Red line is connected to 5V and the green line is connected to the output terminal of the microcontroller (which is port 1 (1.25)).When the hole passes through this sensor , the green line operates the sensing part from the microcontroller. In microcontroller, there are 2 ports - port 0 and port 1.There is also an LCD which operates at 5V. In the microcontroller , pin numbers 15,16 and 17 of port 0 are connected to LCD terminals RS, RW and En and pin numbers 18,19,20 and 21 are connected to LCD terminals D4,D5,D6 and D7.The 5V of LCD is connected to the 5V of the microcontroller and the ground terminal of the LCD as a black line is connected to the ground terminal of microcontroller . In Zigbee , the Zigbee usually operates between 9 - 12V , but here it operates at 5V through microcontroller .There are 2 pins - RX and TX which stand for receiver and transmitter respectively. In the Zigbee RX pin directly goes to the TX pin of the microcontroller and TX pin directly goes to the RX pin of the microcontroller . As a result when the load is inserted and switched ON , the disc rotates and by the time the hole in the disc passes through the IR sensor and the LCD screen displays 1 rotation, like this 5 rotations makes an unit. This microcontroller stores all the data and send via Zigbee. Here we finish our Phase 1 which belongs to a consumer part. In phase 2 ,we are introducing the electricity board office .Here we are using a software flashmagic , a zigbee, a GSM module and a microcontroller. The data obtained from the customer end is stored in the microcontroller. Whenever we need to procure the data from the customer end, we use the software and zigbee to see the data in our system. Using a software named Flashmagic , we develop a new software such that whenever needed , we are able to see the data by immediately pressing Shift + R . The electricity board office sends a command to the consumer through zigbee which is installed in both the places. In response to that command the consumer sends his data to the electricity board and that data is seen in our system. Also, that data is immediately stored in the microcontroller .The TX pin of the microcontroller is connected to the RX pin of the GSM module. As a result at that time through the message received in the consumer's mobile , each and every detail
Department of Electrical and Electronics Engineering Page 69

is sent .Conventionally, every unit costs Rs 10/-.Till this date , we have completed 99% successful of our project. Every detail mentioned in the above description has been incorporated in the hardware prototype.

5. Results
5.1 Snapshots of the Hardware

Department of Electrical and Electronics Engineering

Page 70

Department of Electrical and Electronics Engineering

Page 71

Department of Electrical and Electronics Engineering

Page 72

Department of Electrical and Electronics Engineering

Page 73

Department of Electrical and Electronics Engineering

Page 74

Department of Electrical and Electronics Engineering

Page 75

Department of Electrical and Electronics Engineering

Page 76

5.2 Software snapshots

Department of Electrical and Electronics Engineering

Page 77

6. Conclusion
6.1 Advantages
The over all project brings in Automation in billing . It optimizes the usage of man power. It achieves saving of time by reducing the travel time . It facilitates automatic upgrading of user details in the database. It keeps the system clean between the Electricity Board officers and the respective consumer by clearly displaying the number of units with very high accuracy in the bill to the consumer.

It eliminates the discrepancy in billing . Accurate meter reading, no more estimates Improved billing and new model of billing can be introduced Accurate profile classes and measurement classes, true costs applied Energy management through profile data graphs Improved procurement power though more accurate data - de-risking price

6.2 Disadvantages
It needs constant, uninterrupted power supply . It needs annual inspection It works only the presence of a network through a service provider as GSM is a vital component in it.

Department of Electrical and Electronics Engineering

Page 78

7.Future Scope of the Project


This project can be further improved by integrating customer account with Electricity Board so that automatic bill amount can be deducted from customer account . This project can also be further improved in controlling of power distribution among different consumers . Power Theft can be implemented with this project in turn improving overall functioning of monitoring unit. This project can be controlled the power wastage management by the smart grid system. Increase the zigbee co-ordination length and reach can every possible corner of any consumer. Use GPRS system which can help throughly zigbee as a slave server and store the readings and via GPRS it can send the data to anywhere in the world. In Future we can use the solar power to save the electricity power which can save the enviorment also.

Department of Electrical and Electronics Engineering

Page 79

8. REFERRENCES
8.1 Zigbee Technology
Hands-On ZigBee: Implementing 802.15.4 with Microcontrollers (Embedded Technology). IEEE 802.15.4 and ZigBee as Enabling Technologies for Low-Power Wireless Systems with Quality-of-Service Constraints Zigbee Wireless Mesh Network for Building Automation and Control: Monitoring and control the real time temperature,power,intruder security using zigbee technology ZigBee wireless network technology and the actual entry

8.2 ARM7LPC2148
ARM System Developer's Guide by Andrew. N.Slausse,DomnicSymes

8.3 GSM Module


The GSM System for Mobile Communications by

MichelMouly

8.4 LCD Screens


Advanced Microcontroller Trainer Using 8051,AVR and PIC: Interfacing of GSM, Touch Screen LCD , Stepper Motor and Keypad NomanMuneer , RameezAkhtar , ZainulAbdeen

Department of Electrical and Electronics Engineering

Page 80

Department of Electrical and Electronics Engineering

Page 81

Department of Electrical and Electronics Engineering

Page 82

Anda mungkin juga menyukai