You are on page 1of 59

1

INTRODUCTION

1.1 OBJECTIVE

1.2 SCOPE OF THE PROJECT 1.3 BLOCK DIAGRAM

1.1

OBJECTIVE

Embedded systems have already improved our lives in numerous ways. A good example is an automatic washing machine or a microwave oven .Embedded system does not require a complete operating system, which may make the system bulky, but only the basic functionalities of an operating system, is needed. All embedded systems not have the same software and hardware, which is why these systems perform, varied task. All embedded systems need microprocessor and the kind of microprocessors in them are quite varied. This project is to design and develop an energy meter that measures the amount of electrical energies supplied to or produced by residence, business or machine. Our project differs from an ordinary energy meter, it includes some additional facilities Prepaid billing facility Automatic shock prevention circuit Wireless transmission The project is done using Microchips microcontroller PIC 16F877 .This has very much influence in our current and future life. If the system is working in prepaid mode bill amount which is remitted can enter through the key board in the client side. If the clients consumption exceeds the paid bill amount the system will automatically disconnect the connection .Shock prevention circuit helps from any electrical accidents. That is, when any kind of shock is present, the system will automatically disconnect the connection. The wireless transmission allows the transfer of data including meter readings, any complaints which can be send directly to the electricity board.

1.2

SCOPE OF THE PROJECT

The project ENERGY METER WITH SHOCK PREVENTION CIRCUIT has a great role in reducing the wastage of electricity in future. As the charges are prepaid, the consumer had a limit to use up to their balance. Here the paid bill amount which is remitted can enter through keyboard in the clients side. If the clients consumption exceeds the paid bill amount, the system will automatically disconnect the connection. We can see the unit of consumption, amount status etc on the LCD module. It also helps from any electrical accidents through the shock prevention circuit. That is, when any kind of shock is presents, the system will automatically disconnect the connection. Energy meters, the only direct revenue interface between utilities and consumers, have gone several advancements in the last decade. The conventional electro-mechanical meters are being replaced with electronic meters to improve accuracy in meter reading. The wireless transmission allows the transfer of data including meter readings, any complaints which can be send directly to the electricity board. This reduces the man power.

This is an efficient and economic meter .This presents accurate reading. Conventional energy meters used are erratic and some of them are not working properly. Because they are made by electro mechanical counters that will count by revolutions of a disk. According to difference in temperature the rotations of the disk may change, so the reading will change.

1.3. BLOCK DIAGRAM

Fig 1.3.1: Block diagram of transmitter

Fig 1.3.2: Block diagram of receiver Energy meter is a device that measures the amount of electrical energy supplied to or produced by a residence, business or machine. Here, ENERGY METER WITH SHOCK PREVENTION consists of a transmitter and a receiver section. The transmitter section consist of voltage sensing module, current sensing module, shock detection module, power supply, key board, display, control circuit and a transmitter. In this voltage sensing module sense the ac voltage, then stepped down it first and then rectified. Then the rectified output can be directly given to the microcontroller. The current sensing module used to measure ac current. It is measured by using a current transformer. The shock detection module prevents from any electrical accidents. Power supply is used to give sufficient power to the microcontroller. Keyboard is the predominant interface between humans and computers. Using this keyboard we can enter the prepaid value to the microcontroller. There is also a display unit for displaying the value which we enter as prepaid value and other details. Control circuit is used to control supply line in the desired

manner. Transmitter module is used for transmitting the prepaid value as well as any complaints to the receiving section (i.e. electricity office). In this the receiving section consists of a receiving antenna, power supply and display unit .Here we use the microcontroller 16C73. It is an eight bit microcontroller. The receiving antenna receives the transmitted value and displays the content through the LCD.The PIC 16C73 is an one time programmer.

THORETICAL EXPOSITION

2.1. MATERIALIZATION OF BLOCK DIAGRAM

2.1.1 AC Voltage Sensing Module It is used to measure AC voltages from phase and neutral in the line. AC voltage to be measured is stepped down first and then rectified to get the D.C. output. Because only the D.C. can be converted into digital form. The rectified digital signal can fed directly to the microcontroller through its port.

Fig 2.1.1.1: AC Voltage sensing module 2.1.2.AC Current Sensing Module

It is used to measure AC current. AC current is measured by using a current transformer.

Fig 2.1.2.1: AC Current sensing module Here primary of a current transformer is connected in series with the load. As the current flows through the primary of C.T, an e.m.f will induced in the secondary winding .i.e. we will get some voltage at the o/p of the transformer with respect to the current flowing through primary. As larger the amount of current drawn, by the load, the amount of voltage at the output will be greater. Thus we can convert current in to voltage and this voltage is fed to the controller. 2.1.3. Shock Detection Module

Fig 2.1.3.1: shock detection module In normal case, the current flowing through the windings are equal and opposite in direction. So the toroid is in balance condition, there is no emf produced. In case, any disturbance

occur the toroid unbalanced and then produced an emf across AB. Then the produced emf will be amplified. This amplification can be done by using instrumentation amplifier .An instrumentation system is used to measure the output signal produced by a transducer and often to control the physical signal producing it. The instrumentation amplifier is intended for precise, low level signal amplification where low noise, low thermal and time drifts, high input resistance and accurate close loop gain are required .Examples of instrumentation amplifier ICL7605 and LH0036 .

2.1.4. Power Supply Power supply is used to give sufficient power to the microcontroller. A step down transformer and a bridge rectifier is used here to convert AC to DC. A regulator IC is also used here to give constant supply.7805 IC is used for power supply and it is connected to the bridge rectifier.
. A C . 1 I / P 4 8 5 R E C T I F I E R R E G U L A T O R I C . O / P .

Fig 2.1.4.1: power supply This circuit can give +5V output at about 150 mA current, but it can be increased to 1 A when good cooling is added to 7805 regulator chip. The circuit has over overload and terminal protection. Circuit diagram of the power supply.

Fig 2.1.4.2: circuit diagram The capacitors must have enough high voltage rating to safely handle the input voltage feed to circuit. The circuit is very easy to build for example into a piece of Vero board. Pin out of the 7805 regulator IC. 1. Unregulated voltage in 2. Regulated voltage out 3. Ground 2.1.5. MICROCONTROLLER PIC micro controllers are low-cost computers-in-a-chip; they allow electronics designers and hobbyists add intelligence and functions that mimic big computers for almost any electronic product or project. The programming of the system is done using a PIC micro controller 16F877. This powerful (200 nanosecond instruction execution) yet easy-to-program (only 35 single word instructions) CMOS FLASH-based 8-bit micro controller packs Microchip's powerful PIC architecture into a 40-pin package and is upwards compatible with the PIC16C5X, PIC12CXXX and PIC16C7X devices. It is has five ports. I.e. port A, port B, port C, port D, port E. The PIC 16F877 has flash memory of 8K and Data memory of 368 bytes Data EEPROM of 256 bytes. 2.1.5.1. WHY PIC IS USED? Speed High Performance RISC CPU

Instruction Set Simplicity Integration Of Operation Features Programmable Timer Options Interrupt Control EPROM/OTP/ROM Options Inbuilt Modules Low Power Consumption Wide Operation Voltage Range :2.5to 6.0 Volt Programmable Code Protection Mode Power Saving Sleep Mode

2.1.5.2. PIC 16F877A- FEATURES High performance CPU Only 35 instructions All single cycle instruction except for program branches. Operating speed DC20MHz,clock i/p DC-200ns instruction cycles Up to 8Kx14 word of flash memory Up to 368x8 bytes of data memory Up to 256x8 bytes of EEPROM data memory Interrupt compatibility Power on reset Power up timer and oscillator start up timer Watch dog timer with its own chip RC oscillator for reliable operation Programmable code protection power saving SLEEP mode Low power, high speed CMOS FLASH/EEPROM technology

In circuit serial programming capability via two pins Processor read write access to program memory Single 5v in circuit serial programming capability In circuit debugging via two pins Wide operating voltage range High sink or source current Low power consumption

2.1.5.3. PINOUT DIAGRAM OF PIC 16F877

Fig 2.1.5.3: pinout diagram

2.1.5.4. PIC 16F877 PINOUT DESCRIPTION Pin name Osc/clkin Dip pin # 13 Plccpin # 14 I/O/O type 1 Buffer type St/cmos description Osc.crystal qfp 30

Osc/clkout

14

15

i/p. osc.crystal

31

MCLR/Vpp

i/p

st

o/p Master clear 18 i/p or pgm o/p. Port A is bi 19 directional i/p 20 . 21 22 23 24 Port B is a bi 8 directional i/o 9 port. Port b 10 can be s/w 11 pgmed pull up on for 14 15 16 17

RA0/AN0 RA1/AN1 RA2/AN2/VREFRA3/AN3/VREF+ RA4/TOCK1 RA5/SS/AN4 RB0/INT RB1 RB2 RB3/PGM RB4 RB5 RB6/PGC RB7/PGD

2 3 4 5 6 7 33 34 35 36 37 38 39 40

3 4 5 6 7 8 36 37 38 39 41 42 43 44

I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O

TTL TTL TTL TTL SL TTL TTL/ST1 TTL TTL TTL TTL TTL TTL/ST2 TTL/ST2

2.1.5.5. PROGRAM MEMORY The PIC 16F87x devices have a 13-bit program counter, Capable of addressing an 8K x 14 program memory space. The PIC 16F877 has 8Kx 14 words of FLASH program memory. The RESET Vector is at 0000h and the interrupt vector is at 0004h.

2.1.5.6. DATA MEMORY Data memory is partition in to multiple banks which contain the general purpose registers and special function registers. Bits RP1(status <6>) and RP0(status<5>) are the banks bits. RP1:RP0 00 01 10 11 BANK 0 1 2 3

Each bank extends up to 7Fh (128bits). The lower location of each banks are Reserved for the special function registers. About the special function registers are general purpose registers, implemented as the static RAM. All implemented banks contain special function registers .Some frequently used special function register from 1 bank may be mirrored in another bank for code reduction and quicker access. 2.1.5.7.General Purpose Register The register file can be accessed either directly, or indirectly through the file select register (FSR)

2.1.5.8. SPECIAL PURPOSE REGISTER The Special purpose registers are registers used by the CPU and peripheral modules for controlling the desired operation of the devices. These devices are implemented as static RAM. Some examples of the SFRs are INDF, OPTION_REG, FSR, PCLATH e.t.c. 2.1.5.9. STATUS REGISTER

The Status register contains the arithmetic status of the ALU, the RESET status and the bank select bits for data memory. The STATUS register can be the destination for any instruction, as with any other register. R/W-0 IRP Bit 7 R/W-0 RP1 R/W-0 RP0 R-1 R-1 R/W-x R/W-x Z R/W-x DC bit 0 C

TO

PD

BIT 7

IRP: Register Bank select bit 1=Bank 2, 3(100h-1FFh) 0=Bank 0, 1(00h-FFh)

Bit 6-5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0

RP1:RP0: Register bank selects bits TO: time out bit PD: power down bit Z: Zero bit DC: Digit carry C: Carry

2.1.5.10 I/O PORTS ASSOCIATED WITH PIC 16F877 Some pins for these I/O ports are multiplexed with an alternate function for the peripheral features on the device. PIC16F877 have FIVE ports (Port A, B,C, D, E). PORT A & TRIS A Registers

Port A is a 6-bit wide, bit wide, bi-directional port. The corresponding data direction register is TRISA. Setting a TRISA bit will make the corresponding Port A pin as input. Clearing a TRISA bit will make the corresponding Port A pin as output. Pin RA4 is multiplexed with the Timer 0 module clock input to become the RA4/T0CK1 pin. The RA4/T0CK1 pin is a Schmitt Trigger input and an open drain output. All other Port A pins have TTL input levels and full CMOS output drivers. Other Port A pins are multiplexed with analog input and analog Vref input. The operation of each pin is selected by cleaning/setting the control bits in the ADCON1 register. TRISA register controls the direction of the RA pins, even when they are used as analog inputs. The user must ensure the bits in the TRISA register are maintained set when using them as analog inputs. PORT B AND THE TRISB Register PORTB is an 8-bit wide, bi-directional port. The corresponding data direction register is TRISB. Setting a TRISB bit will make the corresponding PORTB pin an input. Clearing a TRISB bit make the corresponding PORTB pin an output. Three pins of PORTB are multiplexed with the Low Voltage Programming function: RB3/PGN, RB6/PGC and RB7/PGD. The alternate functions of these pins are described in the Special Features Section. Each of the PORTB pins has a weak internal pull-up. A single control bit can turn on all the pull-ups. This is performed by cleaning bit RBPU (OPTION_REG<7>). The weak pull-up is automatically turned off when the port pin is configured as an output. The pulls are disabled on a Power-on Reset.

Four of the PORTB pins, RB7:RB4 have interrupt on change feature. Only pins configured as inputs can cause this interrupt to occur. The input pin (RB7:RB4) are compared with the old value latched on the last read of PORTB. The Mismatch output of RB7:RB4 are ORed together to generate the RBPORT change interrupt with flag bit RBIF (INTCON<0>). This interrupt can wake the device from SLEEP. A mismatch condition will continue to set flag bit RBIF. Reading PORTB will end the mismatch condition and allow flag bit RBIF to be cleared PORTC AND THE TRISTC Register

PORTC is an 8 bit wide, bi-directional port. The corresponding data direction register is TRISC. Setting TRISC bit (=1) will make the corresponding PORTC pin an input. Clearing TRISC bit (=0) will make the corresponding PORTC pin an output. PORTC is multiplexed with several peripheral functions. PORTC pin have SCHMITT Trigger input buffers. When the I2C module is enabled the PORTC<4:3> pin can be configure with normal I2C levels. PORT D AND THE TRIS D REGISTER PORT D is an 8-bit port with Schmitt trigger input buffers. Each pin is individually configurable as an input or output. .PORT E AND THE TRIS E REGISTER

PORT E has three pins which are individually configurable as input or output .The PORT E pins becomes I/O control inputs for the microprocessor port when bit PSPMODE(TRIS<4>) is set .PORT E pins are multiplexed with analog input . TRISE controls the direction of the RE pins. 2.1.5.11. TIMER MODULE

TIMER0 MODULE

The TIMER0 module timer /counter have the following features: 8-bit timer/counter Readable and writable 8-bit software programmable pre scalar Internal or external clock select Interrupt on overflow from FFh to 00h Edge select for external clock Timer mode is selected by clearing bit TOCS (OPTION_REG<5>). In timer mode, the timer 0 module will increment every instruction cycle. Counter mode is selected by setting bit TOCS (OPTION-REG<5>). In counter mode, TIMER0 will increment either on every rising or falling edge of pin RA4/TOCK1. The pre scalar is mutually exclusively shared between the timer0 module and the watch dog timer. TIMERO INTERRUPT The TMR0 interrupt is generated when the TMR0 register overflows from FFh to 00h . This overflow sets bit TOIF (INTCON<2>).

USING TIMER0 WITH AN EXTERNAL CLOCK When no pre scalar is used the external clock is the same as the pre scalar output. PRE SCALAR There is only one pre scalar available, which is mutually exclusively shared between the TMR0 module and the watch dog timer. A pre scalar assignment for the TMR0 module means that there is no pre scalar for the watch dog timer, and vice versa. This pre scalar is

not readable or writable.The PSA and PS2:PS0 bits (OPTION_REG<3:0>) determine the pre scalar assignment and pre scalar ratio. R/W-1 R/W-1 R/W-1 R/W-1 R/W-1 TOSE R/W-1 R/W-1 PS2 R/W1 PS1 PS0

R INTEDG TOCS BPU Bit7 Bit 7 Bit 6 Bit 5 RBPU INTEDG

PSA

Bit0

T0CS: TMR0 clock source select bit 1=transition on TOCK1 pin 0= internal instruction cycle clock (CLKOUT)

Bit 4

T0SE: TMRsource edge select bit 1=increment on high-to-low transition on T0CK1 pin 0=increment on low-to-high transition on T0CK1 pin

Bit 3

PSA: pre scalar assignment bit 1= pre scalar is assigned to the watch dog timer 0=pre scalar is assigned to the timer 0 module

Bit 2-0

PS2:PS0: pre scalar rate select bits

Bit value 000 001 010 011 100 101 110 111

TMR0 RATE 1:2 1:4 1:8 1:16 1:32 1:64 1:128 1:256

WDT RATE 1:1 1:2 1:4 1:8 1:16 1:32 1:64 1:128

REGISTERS ASSOCIATED WITH TMR0 The registers associated with TMR0 are TMR0, INTCON, and OPTION_REG. TIMER 1 MODULE The timer 1 module is a 16 bit timer/counter consisting of two 8-bit registers (TMR1H and TMR1L), which are readable and writable. The TMR1 register pair (TMR1H:TMR1L) increment from 0000h to FFFFh and rolls over to 0000h .The TMR1 interrupt, if enabled, is generated on over flow, which is latched in interrupt flag bit TMR1IF( PIR1<0>).This interrupt can be enabled /disabled by setting /clearing TMR1 interrupt bitTMR1IE(PIE1<0>). TIMER 1 can operate in one of two modes: As a timer As a counter The operating mode is determined by the clock select bit, TMR1CS (T1CON<1>). U-0 u-0 R/W-0 Bit 7 Bit 7-6 Bit5-4 Bit 3 R/W-0 R/W-0 R/W-0 R/W-0 R/W-0 TMR1CS TMR1ON bit 0 T1CKPS1 T1CKPS0 TIOSCEN T1SYNC unimplemented TICKPS1:T1CKPS0: TIMER 1 input clock pre scale select bits T1OSCEN:Timer1 oscillator enable control bit 1= oscillator is enabled 0= oscillator is shut-off Bit 2 Bit 1 Bit 0 T1SYNC:TMR1 external clock input synchronization control TMR1CS:TMR1 clock source select bit TMR1ON: TMR1 on bit bit enable

TIMER1 OPERATION IN TIMER MODE TIMER mode is selected by clearing the TMR1CS (T1CON<1>) Bit. In this mode the input clock to the timer isFosc/4.The synchronize control bit T1SYNC effect, since the internal clock is always in sync. (T1CON<2>) has no

RESETTING OF TIMER1 REGISTER PAIR(TMR1H,TMR1L) TMR1H and TMR1L registers are not reset to 00h on a PORT, or any other RESET, except by the CCP1 and CCP2 special event triggers. T1CON registers is reset to 00h on a power on Reset, or a Brown-out RESET ,which shuts off the timer and leaves a 1:1 pre scale . TIMER2 MODULE

TIMER2 is an 8-bit timer with a pre scalar and a post scalar. It can be used as the PWM time base for the PWM mode of the CCP modules .The TMR2 registers is readable and writable, and is cleared on any device RESET. The input clock has a pre scale option of 1:1,1:4,1:16,selected by control bits T2CKPS1:T2CKPS0(T2CON<1:0) It has an 8 bit period register, PR2.TMR2 increments from 00h until it matches PR2and then reset to 00h on the next increment cycle.PR2 is a readable and writable register.PR2 register is initialized to FFh up R/W-0on RESET.

U-0 R/W-0

R/W-0

R/W-0

R/W-0

R/W-0

R/W-0

- TOUTPS3 TOUTPS2 TOUTPS1 TOUTPS0 TMR2ON T2CKPS1 T2CKP Bit7 Bit 7 Bit 6-3 Bits 2 unimplemented TOUTPS3: TOUTPSO: Timer2 Output Post scale selected bits TMR2ON: Timer 2 on bit bit0

Bit 1-0 T2CKPS1:T2CKPS0: Timer 2 Clock Presale Select bits Timer 2 prescaler and Postscaler

The prescale and postscaler counters are cleared when any of the following occurs: A write to the TMR2 register A write to the T2CON register Any device reset TMR2is not cleared when T2CON is written.

2.1.5.12. ANALOG TO DIGITAL CONVERTER MODULE The analog to digital converter module has 8 inputs for the 40 pin PIC .The A/D module has 4 register. A/D results high register. A/D results low register A/D control register 0. A/D control register 1.

The A/D conversion of the analog input signals in a corresponding 10-bit digital number.

R/W-0 ADCS1

ADCON0 REGISTER. R/W-0 ADCS0 R/W-0 CHS2 R/W-0 CHS1 R/W-0 CHS0 R/W-0 GO/DONE U-0 -----R/W-0 ADCON

U-0 ADFM

ADCON1 REGISTER U-0 R/W-0 U-0 R/W-0 PCFG3 R/W-0 PCFG2 R/W-0 PCFG1 R/W-0 PCFG0

2.1.5.13. USART This mode is usually used to communicate in 8-bit ASCII code. It has two pins for transmittion and reception.Transmittion begins whenever data is written to SBUF .USART is an acronym for universal synchronous asynchronous receiver and transmitter. Control Register Of Transmittion. (Txsta) CSRC TX 9 TxEN SYNC BRGH TRMT Tx9D

Control Register Of Reception (Rxsta) SPEN Rx9 SREN CREN ADDEN FERR OERR Rx9D

2.1.6. Keyboard The predominant interface between humans and computers is the keyboard. The one constant in all keyboard applications is the need to accommodate the human user. The hardware designer has to select keys that will survive in the intended environment. The programmer must write code that will anticipate and defeat inadvertent and also deliberate attempts by the human to confuse the program. The universal key characteristic Is the ability to bounce: The contacts vibrate open and closed for a number of milliseconds when the key is hit and often when it is released. Keyboards are commercially produced in one of the three general hypothetical wiring configurations are, The lead-per-key Configuration

X-Y Matrix Keyboard Coded Keyboard

Generally, we using lead-per-key configuration, when there are very few keys to be sensed. Since each key could tie up a port pin, it is suggested that the number be kept to 16 or fewer for this keyboard type. This configuration is the most cost- effective for a small number of keys. 2.1.7. Display We use LCD displays.

LCD INTERFACE - Liquid crystal displays are generally more flexible than LED displays because they allow for a variety of text and/or graphics. LCDs require less power LEDs making them suitable for lose power requirements.) LCDs are more readable in sunlight and an use backlights for night viewing. However, LCDs are more expensive than LED displays. LCDs come in a variety of sizes. Text displays are specified by their character size, the number of lines, and the number of characters per line. 2.1.7.1. LCD MODULE The LCD module, made by Crystallonics, is 16x2 line interactive displays. It needs a power supply of +5v. The module has inbuilt controller chip, such as an HD44780, which acts as an interface between CPU and the row and column drivers. The controller takes care of generating characters, refreshing the display, and so on. The module has a back light driven by a pair of pads separate from the interface pads .The LCD module works in two modes for communicating with the micro controller - 8 bit (byte) mode & 4 bit (nibble) mode. In the later case only the higher nibble i.e. pins DB4-DB7 is used for communication. For controlling the LCD module we have used only the port D.

Fig 2.1.7.1.LCD module 2.1.7.2. PINOUT DESCRIPTION

PIN NO. 1 2 3 4 Vss Vdd Vo RS(H/L)

SYMBOL Ground +5v

FUNCTION

Contrast Adjust Register Select H=Data/L=Instruction

R/W (H/L)

Read/Write H=Rread/L=Write

6 7 8 9 10 11 12 13 14 15 16

E DB0 DB1 DB2 DB3 DB4 DB5 DB6 DB7 BLBL+

Enable Data Pin 1 Data Pin 2 Data Pin 3 Data Pin4 Data Pin 5 Data Pin 6 Data Pin 7 Data Pin8 Back Light Back Light

Fig 2.1.7.2.pinout description

Contrast: A variable voltage applied to this pin controls the contrast. Use a and adjust until you see the background.

potentiometer

Register Select: This pin selects whether you are sending the module a command or data. Read/Write: This pin allows for bi-directional communications. For the discussions here, uni-directional communications will be used. Ground this pin.

Enable: This is the latch pin. A high-to-low transition causes the value on the data lines to be latched by the module. DB0-DB7: Apply the data or commands to these pins. The SPI module and a 74595 can be used to make a serial interface. The same latch pin can be used for both because the '595 latches on LH while the LCD latches on HL. Transmit the value via SPI the set the latch then clear it. 2.1.7.2. PRINTING CHARACTERS To print a character to set the RS high, place the ASCII value on the data pins, and the latch the data. The character will appear on the screen at the current cursor location. A 60s delay must occur between characters.

2.1.8.1. Output Control Unit

Fig 2.1.8.1.output control unit Output control unit is used to control supply line in the desired manner. In prepaid facility the usage over the credit limit will result, the relay will be cut-off and then the supply off. Similarly, any disturbances or shock occur, the relay will be cut-off and then supply will turn off. The voltage and current specification of this relay is 12V and 10A. 2.1.9. TRANSMITTER Transmitter transmits the data to the receiver side. Here the transmitter module model is FS 1000A. LOS range, open ground is 80 m. It require working voltage of 3-12V. Dimension of this module is 22mm x 23mm. It needed working current of 10-15 mA. Its working mode is amplitude modulation (AM). Its transport speed is 4KB/s. Its frequency of transmition is 315/433MHZ. Its transmit power is 10mW. It requires an external antenna and its range 315MHZ. It uses 25cm normal cores or single cores wire. It has four pins .i.e. data, Vdd,Vss and antenna.

Fig 2.1.9.1.Transmitter module 2.1.10. RECIEVER Receiver receives the transmitted data and displays the content through the LCD. In the receiver section, the PIC 16C73 is used. It is one time programming IC. The figure below shown is the typical receiver module. In this only three pin is available.i.e. Vdd, Vss, Data out

Fig 2.1.10.1 receiver module Receiver module model is PCR2A.The receiving sensitivity of the module is -95dbm.It need 5V for proper working. Its dimension is 37mm x16mm. The receiving frequency is 315/433 MHZ. The external antenna has length of 18-25 cm.The transport speed is 4KB/sec.The working temperature is -10 to +70 degree Celsius. The current needed for it is equivalent to 0.5 to 0.8 mA.The other model is PCR2 and it doesnt need any external antenna.

3
DESIGN
3.1 HARDWARE DESIGN
3.1.1. VOLTAGE SENSOR 3.1.2. CURRENT SENSOR 3.1.3. SHOCK DETECTION MODULE 3.1.4. POWER SUPPLY 3.1.5. RELAY 3.1.6. TRANSMITTING MODULE 3.1.7. KEYBOARD 3.1.8. RECEIVING MODULE

3.2. SOFTWARE DESIGN


3.2.1. INITIALIZATION OF LCD 3.2.2. INITIALIZATION OF REGISTERS 3.2.3. ADC INITIALIZATION

3.1 HARDWARE DESIGN

3.1.1. VOLTAGE SENSOR For measuring the line voltage we use a step down transformer. Here the input range is 230V and this voltage is rectified, filtered, and calibrated to 0-5V, then given to the input port of the microcontroller. 3.1.2. CURRENT SENSOR For measuring the line current, current transformer. If we give 100W as load we will get 0.83V as output. Here the transformer consists of primary windings of 3 and secondary winding of 2500. 3.1.3..SHOCK DETECTION The current flowing through the windings are equal and opposite in direction. So the toroid is in balance condition, there is no emf produced. In case, any disturbance occur the toroid unbalanced and then produced an emf. Then the produced emf will be amplified. This amplification can be done by using instrumentation amplifier .An instrumentation system is used to measure the output signal produced by a transducer and often to control the physical signal producing it. The instrumentation amplifier is intended for precise, low level signal amplification where low noise, low thermal and time drifts, high input resistance and accurate close loop gain are required .Examples of instrumentation amplifier ICL7605 and LH0036 . Op-amp used is LM324. R1=1.5+1=2.5K R2=470K AF=-RF/R1=470/2.5=188K SO GAIN OF THE AMPLIFIER IS 188. 3.1.4. Power supply

The system requires a regulated +5v supply for the semiconductors and a +12V unregulated supply for the relay. These can be delivered from the 230V domestic supply. Before applying this to the system we must step down this high voltage to an appropriate value. After that it should be rectified. To achieve +5 V DC we should regulate this.All this are run in the power supply circuitry. 3.1.5. RELAY Out put control unit is used to control supply line in the desired manner. In prepaid facility the usage, over the credit limit will results the relay will be cut-off and then the supply off. Similarly, any disturbances or shock occur, the relay will be cut-off and then supply will turn off. Here the specification of this module is 12V and 10 A. We use a BC 543transistor for operating the relay. One kilo ohms resistor is used for reducing the base current.

3.1.6. TRANSMITTING MODULE Transmitter transmits the data to the receiver side. Here the transmitter module model is FS 1000A. LOS range, open ground is 80 m. It require working voltage of 3-12V. Dimension of this module is 22mm x 23mm.It needed working current of 10-15 mA. Its working mode is amplitude modulation (AM). Its transport speed is 4KB/s. Its frequency of transmition is 315/433MHZ. Its transmit power is 10mW. It requires an external antenna and its range 315MHZ. It uses 25cm normal cores or single cores wire. It has four pins .i.e. data, Vdd, Vss and antenna.

3.1.7. KEY BOARD

Keyboards are commercially produced in one of the three general hypothetical wiring configurations are, The lead-per-key Configuration X-Y Matrix Keyboard Coded Keyboard

The predominant interface between humans and computers is the keyboard. The one constant in all keyboard applications is the need to accommodate the human user. The hardware designer has to select keys that will survive in the intended environment. The programmer must write code that will anticipate and defeat inadvertent and also deliberate attempts by the human to confuse the program. Microchip switch are used as the key.

3.1.8. RECEIVING MODULE Receiver receives the transmitted data and displays the content through the LCD. In the receiver section, the PIC 16C73 is used. It is one time programming IC. The figure below shown is the typical receiver module. In this only three pin is available.i.e. Vdd, Vss, Data out Receiver module model is PCR2A.The receiving sensitivity of the module is -95dbm.It need 5V for proper working. Its dimension is 37mm x16mm. The receiving frequency is 315/433 MHZ. The external antenna has length of 18-25 cm.The transport speed is 4KB/sec.The working temperature is -10 to +70 degree Celsius. The current needed for it is equivalent to 0.5 to 0.8 mA.The other model is PCR2 and it doesnt need any external antenna.

3.2. SOFTWARE DESIGN


3.2.1 INITIALIZATION OF LCD

The LCD must be initialized before it can be used. Be sure to initialize the SPI before sending commands to the LCD Initialization: Wait 300ms for startup delay Set Display Mode (see below) Turn display on(see Display/Cursor On/Off command) Set entry mode (see Entry Mode command) Clear display (see Clear Display command) Display Mode: Sets the display mode. Usually done only during initialization. RS = 0, Data = B'001dnfxx', t = 60s d: 1 = 8 bit data, 0 = 4 bit data n: 1 = 4 rows on , 0 = 2 rows on (2 rows or 1 row on if a two line display) f: 1 = 5 10 dots, 0 = 5 7 dots Usually you will want 8 bit data, 4 rows on, and

3.2.2. INITIALIZATION OF REGISTERS The registers are initialized for the storage and the retrieval of the data or the bits given to the hardware devices of the system. 3.2.3. ADC INITIALIZATION The ADC is available in 8-bit or 10 bit, which is in built in the PIC IC. By initializing the ADC we must provide sufficient delays.

STEPS FOR ADC INITIALIZATION Configure ADCON0&ADCON1 as required.

20micro second delay for charging the capacitor. Set go bit. Check for done Move the result from result register to a register.

FLOWCHART

4
SYSTEM EVALUATION

4.1. TEST EACH INDIVIDUAL BLOCK 4.2. SYSTEM INTEGRATION 4.3. PCB LAYOUT

4.1. TEST INDIVIDUAL BLOCK

4.1.1. VOLTAGE SENSING MODULE Voltage sensing module is used for measuring AC voltage in the line. Here the range of input voltage is 230V and take the corresponding output voltage.i.e.

AC VOLTAGE

DC VOLTAGE

6v

12.38v

35v

12.43

80v

12.49v

109v

12.43v

224v

12.84v Fig 4.1.1 Table for voltage sensing module

The above table is shown that the readings of bridge rectifier. This output DC voltage is calibrated to 0-5v and given to the microcontroller.

4.1.2. CURRENT SENSING MODULE

This module is used for measuring the current .For this we use a current transformer. It has primary winding of 3 and secondary windings of 2500 .The output of the current transformer are given below: If we use a 100w load then we will get the output voltage as 0.83v.

Load to be used 2w 4w 6w 8w 9w 0.0166v 0.0332v 0.0498v 0.0664v 0.0747v

Output voltage

Fig 4.1.2. Table for current sensing module 4.1.3. SHOCK DETECTION MODULE Shock detection module is preventing from any electrical accidents. For this we use a toroid. In normal case, the current flowing through the windings are equal and opposite in direction so the toroid is in balance condition, there is no emf produced. In case, any disturbance occur the toroid unbalanced and then produced an emf across the secondary side. Then the produced emf will be amplified. This amplification can be done by using instrumentation amplifier. This value is greater than 100mv, it is assumed to be shock.

4.1.4. POWER SUPPLY The system requires a regulated +5v supply for the semiconductors and a +12V unregulated supply for the relay.These can be delivered from the 230V domestic supply. Before applying this to the system we must step down this high voltage to an appropriate

value. After that it should be rectified. To achieve +5 V DC we should regulate this. All this is run in the power supply circuitry. A 12-0-12V step down transformer is connected to provide the necessary low voltage. The transformer also works as an Isolator between the hot and cold end. The hot end refers to the 230v supply, which is hazardous one, and the cold one refers to the low ,safe voltage .Now the hot portion appears only at the primary of the transformer. The secondary of the transformer deliver 12v ac pulses along with a ground. This ac supply goes to a center tap rectifier, which converts the ac into a unidirectional voltage. The ripples in the resulting supply is filtered and smoothed by a 2200micro FD/25V capacitor. The 0.1 microfarad capacitor bypasses any high frequency noises. The resulting supply has magnitude above 17V. This voltage is given to the regulated IC 7805.This IC provides a regulated 5V positive supply at its 3rd pin. This required input for this is more than 7.5V.

Fig 4.1.4.1.power supply 4.1.5. DISPLAY LCD COMMANDS There are several different commands that can be sent to the LCD to control its operation. To send a command clear the RS, place the command on the data lines, and latch the data. Depending on the command a delay of 60s or 2ms is required before any thing else can be sent to the module. Clear Display:- Clears display and returns cursor to home position. RS = 0, Data = B'00000001', t = 2ms

Cursor at Home:- Returns cursor to home position and returns shifted screen to original position but does not clear the screen. RS = 0, Data = B'0000001x', t = 2ms

Display/Cursor On/Off - Turns display on and off. Turns cursor on and off. RS = 0, Data = B'00001dcb', t = 60s d: 1 = display on, 0 = display off c: 1 = cursor on, 0 = cursor off b: 1 = cursor blink, 0 = cursor solid

Cursor/Display Shift-: Move the cursor or shift the display one position. RS = 0, Data = B'0001sdxx', t = 60s s: 1 = shift display, 0 = move cursor d: 1 = right, 0 = left

Position Cursor:- Move the cursor to the indicated position. RS = 0, Data = B'1aaaaaaa', t = 60s

a: Address of new cursor position as given in the following table. Row 1: 0 2 18 Row 2: 64 66 82 Row 3: 20 22 38 Row 4: 84 86 85 21 39 (H'14' - H'27') 65 83 (H'40' - H'53') 1 19 (H'00' - H'13')

102

103

(H'54' - H'67') RS = 0, Data =

Entry Mode: When a character is printed the cursor will automatically move or the display will shift. This command sets the desired mode. B'000001ds', t = 60s d: 1 = increment, 0 = decrement s: 1 = display shift, 0 = cursor move 4.1.6. RELAY Relays specification is 10A and 25mV.When any shock i.e. voltage more than 100mv is find in the circuit, it automatically disconnect the connection. 4.1.7. TRANSMITTER The details of this module are given below: MODEL RANGE LOS, OPEN GROUND WORKING VOLTAGE DIMENSION WORKING CURRENT WORKING MODE TRANSPORT SPEED TRANSMIT FREQUENCY TRANSMIT POWER EXTERNAL ANTENNA single core wire. : FS 1000A : 80m : 3-12V : 22mm x 23mm : 10-15mA : Amplitude modulation : 4KB/SEC : 315/433MHz : 10 m W : 315 MHz /use 25 cm and normal core or

4.1.8. RECEIVER The details of receiver module are given below: MODEL : PCR2A

RECEIVE SENSITIVITY WORKING VOLTAGE DIMENSION WORKING CURRENT EXTERNAL ANTENNA TRANSPORT SPEED RECEIVING FREQUENCY WORKING TEMPERATURE

: -95d B : 5V : 37mm x 16mm : 0.5-0.8mA : 18-25cm : 4KB/S : 315/433MHz : -10 - +70 degree

4.2. SYSTEM INTEGRATION

4.2.1. TRANSMITTER

Fig 4.2.1.circuit diagram for transmitter

4.2.2. RECEIVER

Fig 4.2.2.circuit diagram of receiver

4.3. PCB LAYOUT

Fig 4.3.1.PCB LAYOUT CIRCUIT DESCRIPTION

The above figure shows the circuit of ENERGY METER WITH SHOCK PREVENTION .The basic element used is PIC16F877,which is used for embedded system. The voltage sensing module sense the voltage in the line and rectified output can given to the controller through input port. The PIC can take input as only less than or equal to 5V. The current sensing module is used to measure AC current. AC current is measured by using a current transformer. Here primary of a current transformer is connected in series with the load. As the current flows through the primary of C.T, an e.m.f will induced in the secondary winding .i.e. we will get some voltage at the o/p of the transformer with respect to the current flowing through primary. As larger the amount of current drawn, by the load, the amount of voltage at the output will be greater. Thus we can convert current in to voltage and this voltage is fed to the microcontroller. The shock detection circuits in normal case, the current flowing through the windings are equal and opposite in direction. So the toroid is in balance condition, there is no emf produced. In case, any disturbance occur the toroid get unbalanced and then produced an emf across AB. Then the produced emf will be amplified. This amplification can be done by using instrumentation amplifier .An instrumentation system is used to measure the output signal produced by a transducer and often to control the physical signal producing it. The instrumentation amplifier is intended for precise, low level signal amplification where low noise, low thermal and time drifts, high input resistance and accurate close loop gain are required. Power supply is used to give sufficient power to the microcontroller. A step down transformer and a bridge rectifier is used here to convert AC to DC. A regulator IC is also used here to give constant supply.7805 IC is used for power supply and it is connected to the bridge rectifier.

The system is having display unit, which is LCD.It is connected to the port B pin of PIC. RB1 to RB7 pins are used for connecting it. The result from ADRESH is converted to ASCII code, which is given to the LCD through PORT B directly. In prepaid facility the usage, over the credit limit will results the relay will be cut-off and then the supply off. Similarly, any disturbances or shock occur, the relay will be cut-off and then supply will turn off. There is a transmitting antenna for transmition. The receiving section, we use the PIC 16C73. The receiving antenna receives the transmitted value and displays the content through LCD .The PIC 16C73 is a one time programmer.

5
CONCLUSION

5.1. RESULT 5.2. FUTURE EXPOSITION

5.1.

RESULT

An ENERGY METER WITH SHOCK PREVENTION CIRCUIT is developed and it reduces the electric charge by using prepaid facility, and it also helps from the electrical accidents. It also uses wireless transmission. Enter the value=100 Rs/The pre paid amount validity is over and the relay is automatically disconnected. If the voltage is above 100 mV then it is detected as shock.

5.2.

FUTURE EXPOSITION

An energy meter is a device that measures the electrical energy supplied to or produced by a residence or an industry. In this energy meter prepaid billing facility, shock prevention circuit and wireless transmittion are added. By using existing system, the wastage of electricity is increased. But energy meter with shock prevention circuit reduce the wastage of electricity. We can add many more facility into this. That is, we can add short circuit detection module into this. That detects any fire in the circuit, it will automatically disconnect the connection. Another expansion we can do to this system is the security facility. That means a password is set and unauthorized people cannot access this meter. Another facility is that both the consumers and electricity officers can send their information together. That is, we can implement full duplex or half duplex mode communication.

BIBILIOGRAPHY

THE 8051 MICROCONTROLLOR ELECTRICAL TECNOLOGY -B.L .Theraja & A.K. Thereja -Kenneth J .Ayala

OP-AMPS AND LINEAR INTEGRATED CIRCUIT -Ramakant .A.Gayakwad http://books.google.com/books?id=OkL1Smk4uiAC&dq. p.841 http://books.google.com/books?id=Atw4AAAAMAAJ&pg=PA335. , p.335/ http://www.microchip.com/ http://www.electronicsforyou.com/ http://www.datasheetcatalog.com / http://www.analog.com/

APPENDIX

TEST DATA TABLE Voltage sensing module Input voltage 6v 35v 80v 109v 190v 224v Output dc 12.38v 12.43v 12.49v 12.62v 12.74v 12.84v voltage current sensing module Load to be used 2w 3w 4w 5w 6w 8w Output voltage 0.0166v 0.0249v 0.0332v 0.0415v 0.0498v 0.0664v

LIST OF MAJOR COMPONENTS PIC 16C73, 16F877, LCD, KEY, RF module, current transformer, voltage measurement, power supply, relay, extra components, PCB.

COST ESTIMATE

PIC 16C73 PIC16F877 LCD KEY RF module Voltage Transformer Power supply Relay Extra components PCB Assembly charge

:-100 :-180 :-200x2 :-100 :-350

Current transformer :-100 :-200 :-250 :-75 :-400 :-300x2 :-200

DATA SHEET

You might also like