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
Page 1
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.
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._____________________
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.
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.
Page 4
TABLE OF CONTENTS
Page 5
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.
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.
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
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.
loader software. Single flash sector or full chip erase in 400 ms and programming of 256 bytes in 1 ms.
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.
6/14 analog inputs, with conversion times as low as 2.44 s per channel.
Two 32-bit timers/external event counters (with four capture and four compare
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.
Page 11
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.
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.
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.
Page 13
Page 14
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.
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.
Page 18
2.2.2 The following table lists the AT commands that are related to the writing and sending of SMS messages:
+CMGW
Page 19
Page 20
Fleet management. Automatic meter reading. Toll Collection. Remote control and fault reporting of DG sets.
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.
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.
Page 23
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
Page 25
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
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.
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.
Page 30
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).
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.
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.
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.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.
Page 34
DO D1 D2 D3 D4 D5 D6 D7 VSS
Pin 1 2 3 4 5 6
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
Page 35
Table 1.2
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.
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.
Page 38
Connect RS to EN to P1.1
Send it to P1
Reset P1
Reset P1
RS = 1
RS = 0
Stop
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.
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.
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.
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.
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.
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)
Page 43
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.
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.
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.
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 .
2.5.2.3
Reduced Function Device Reduced function devices just talk to the Zigbee coordinators or Full function devices. They cannot
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.
Zigbee Coordinator
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
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
Page 48
RFD/FFD Join?
NO
YES
Page 49
Join Network
NO
NO
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.
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.
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.
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
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.
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
Page 55
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.
Page 56
SYSTEM B
START
SYSTEM C
START
Process Loading
Process Loading
Process Loading
Send data
Send data
Send data
STOP
ZIGBEE
STOP
ZIGBEE
STOP
ZIGBEE
if data is received
YES
STOP
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.
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.
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.
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.
The following block diagram illustrates the complete Vision3 software development cycle. Each component isdescribed below.
Page 61
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.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
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.
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.
4. Functional Description
4.1.Pin Diagram``
Page 67
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
Page 70
Page 71
Page 72
Page 73
Page 74
Page 75
Page 76
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.
Page 78
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
MichelMouly
Page 80
Page 81
Page 82