Energy Metering Circuit Using GSM-Semi Report

download Energy Metering Circuit Using GSM-Semi Report

of 54

Transcript of Energy Metering Circuit Using GSM-Semi Report

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    1/54

    Microcontroller

    Selection Criteria

    1. The first and the foremost criterion for selecting a microcontroller is that it must meetthe task at hand efficiently and cost effectively. In analyzing the need of a

    microcontroller based project we must see whether an 8 bit, 16 bit, 32 bit

    microcontroller can best handle the computing need of the task most efficiently.

    Among other consideration in this category are speed, power consumption, amount of

    on chip RAM and ROM, the number of sufficient I/O ports and cost per unit.

    2. Second how easy is it to develop product around it. Key considerations are the

    availability of an assembler, debugger, emulator and technical support.

    3. Its ready availability in needed quantity, both now and in future.

    Taking all these considerations we have chosen ATMEL 89C51 microcontroller.

    2.3.1.2 Brief History of 8051

    In 1981, Intel Corporation introduced an 8 bit microcontroller called 8051, thishad 128 bytes of RAM, 4 bytes of on chip ROM, two timers, one serial port, and 4

    ports each 8 bits wide all on a single chip. At this time it was referred to as system on

    chip. The 8051 is an 8 bit processor meaning that the CPU can work only on 8 bit at a

    time. Data larger than 8 bit has to be broken up into 8 bit pieces to be processed by the

    CPU.

    The 8051 became widely popular after Intel allowed other manufacturers to make

    and market any flavor of 8051 with the condition that they remain code compatible

    with 8051. This has lead to many versions of 8051 with a different speed and amount of

    on chip ROM marketed by different companies.

    Software

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    2/54

    As our project required involved the application of software, on consulting with our

    project guide we came to the conclusion that we shall use Embedded C for

    programming utilizing the Keil software

    Use of embedded processors cars, mobile phones, medical equipment, aerospace

    systems etc is widespread. The applications of embedded C are exploited through the

    Keil software. Keil was founded in 1986 to market add on products for development

    tools provided by many of the silicon vendors. It soon became evident that there was a

    void in the market placethat must be filled with quality software development tools. It

    was then that Keil introduced the first C compiler designed from the ground-up

    specifically for 8051 microcontroller.

    The literature about Keil was collected from the net as well as some e-books via

    the internet.http://www.keil.com/company is the link of the site from which the basics

    of the software was taken.

    Chapter 3. ADOPTED METHODOLOGY

    Planning in phases:

    Before commencement of the project it was decided to plan the project in phases so the

    following are the phases in which the project will be done:

    The very first phase was planning the project and getting the concepts right about the

    project.

    This involved lot of reading and understanding about the core concepts and the

    applications of our project.

    Getting to know about the features of various components present in the circuitry.

    http://www.keil.com/companyhttp://www.keil.com/companyhttp://www.keil.com/companyhttp://www.keil.com/company
  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    3/54

    Learning about various softwares like keil , Eagle 4.11 etc that will be used in our

    project.

    Procuring the various components required for the project.

    Creating the PCB (printed circuit board) for our project.

    Interfacing the monitoring system with GSM module.

    Implementing the entire project.

    Testing the working of the final monitoring system.

    3.3TUTORIAL ON MICROCONTROLLERThe 89C51 microcontroller is from the 8051 family of microcontrollers. The basis

    features of all the controllers in this family are the same, except for a few differences

    from device to device. The features of the Atmel IC 89C51 is discussed in detail below.

    below.

    3.3.1 Memory OrganizationThe basic block diagram of the family of the 80x51 is as shown below in the

    figure.

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    4/54

    Fig. 3.8

    All 80x51 devices have separate address spaces for program and data memory.

    The logical separation of program and data memory allows the data memory to be

    accessed by 8-bit addresses, which can be quickly stored and manipulated by an 8-bit

    CPU. Program memory (ROM, EPROM) can only be read, not written to. There can

    be up to 64k bytes of program memory. In the 89C51,there is 4K Bytes of

    Reprogrammable Flash Memory(Program Memory) and 128 x 8-bit Internal RAM

    (Data Memory).

    3.3.2 Special Function Registers3.6.2.1 Description

    Special Function Registers (SFRs) ate area of memory that control

    functionality of the processor. SFRs are accessed as if they were normal Internal

    RAM. The only difference is that Internal RAM is from address 00h through 7Fh

    whereas SFR registers exist in the address range of 80h through FFh. Each SFR has

    an address (80h through FFh) and a name. The following chart provides a graphical

    presentation of the 80C51's SFRs, their names, and their address.

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    5/54

    Fig. 3.9

    As you can see, although the address range of 80h through FFh offer 128 possible

    addresses, there are only 19 SFRs in a standard 80C51. All other addresses in the SFR

    range (80h through FFh) are considered invalid. Writing to or reading from these

    registers may produce undefined values or behavior. There are 3 categories of SFRs

    namely I/O, control and other.

    Whether a given I/O line is high or low and the value read from the line are

    controlled by the I/O SFRs. The control SFRs in some way control the operation or

    the configuration of some aspect of the 80x51. For example, TCON controls the

    timers, SCON controls the serial port.The remaining SFRs, are "other SFRs." These

    SFRs can be thought of as auxillary SFRs in the sense that they don't directly

    configure the 80x51 but obviously the 80x51 cannot operate without them. For

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    6/54

    example, once the serial port has been configured using SCON, the program may read

    or write to the serial port using the SBUF register.

    3.6.2.2 Overview of all SFRs

    This section will endeavor to quickly overview each of the standard SFRs

    found in the above SFR chart map. This section is to just give you a general idea of

    what each SFR does.

    SP (Stack Pointer, Address 81h): This is the stack pointer of the

    microcontroller. This SFR indicates where the next value to be taken from the stack

    will be read from in Internal RAM. If you push a value onto the stack, the value will

    be written to the address of SP + 1. That is to say, if SP holds the value 07h, a PUSH

    instruction will push the value onto the stack at address 08h. This SFR is modified by

    all instructions which modify the stack, such as PUSH, POP, LCALL, RET, RETI,

    and whenever interrupts are provoked by the microcontroller.

    DPL/DPH (Data Pointer Low/High, Addresses 82h/83h): The SFRs DPL and

    DPH work together to represent a 16-bit value called the Data Pointer. The data

    pointer is used in operations regarding external RAM and some instructions involving

    code memory. Since it is an unsigned two-byte integer value, it can represent values

    from 0000h to FFFFh (0 through 65,535 decimal).

    PCON (Power Control, Addresses 87h): The Power Control SFR is used to

    control the power control modes. Certain operation modes allow the to go into a type

    of "sleep" mode which requires much less power. These modes of operation are

    controlled through PCON. Additionally, one of the bits in PCON is used to double the

    effective baud rate of the serial port.

    TCON (Timer Control, Addresses 88h, Bit-Addressable): The Timer Control

    SFR is used to configure and modify the way in which the two timers operate. This

    SFR controls whether each of the two timers is running or stopped and contains a flag

    to indicate that each timer has overflowed. Additionally, some non-timer related bits

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    7/54

    are located in the TCON SFR. These bits are used to configure the way in which the

    external interrupts are activated and also contain the external interrupt flags which are

    set when an external interrupt has occured.

    TMOD (Timer Mode, Addresses 89h): The Timer Mode SFR is used to

    configure the mode of operation of each of the two timers. Using this SFR your

    program may configure each timer to be a 16-bit timer, an 8-bit autoreload timer, a

    13-bit timer, or two separate timers. Additionally, you may configure the timers to

    only count when an external pin is activated or to count "events" that are indicated on

    an external pin.

    TL0/TH0 (Timer 0 Low/High, Addresses 8Ah/8Ch): These two SFRs, taken

    together, represent timer 0. Their exact behavior depends on how the timer is

    configured in the TMOD SFR; however, these timers always count up. What is

    configurable is how and when they increment in value.

    TL1/TH1 (Timer 1 Low/High, Addresses 8Bh/8Dh): These two SFRs, taken

    together, represent timer 1. Their exact behavior depends on how the timer is

    configured in the TMOD SFR; however, these timers always count up. What is

    configurable is how and when they increment in value.

    P1 (Port 1, Address 90h, Bit-Addressable): This is input/output port 1. Each bit

    of this SFR corresponds to one of the pins on the microcontroller. For example, bit 0

    of port 1 is pin P1.0, bit 7 is pin P1.7. Writing a value of 1 to a bit of this SFR will

    send a high level on the corresponding I/O pin whereas a value of 0 will bring it to a

    low level.

    SCON (Serial Control, Addresses 98h, Bit-Addressable): The Serial Control

    SFR is used to configure the behavior of the on-board serial port. This SFR controls

    the baud rate of the serial port, whether the serial port is activated to receive data, and

    also contains flags that are set when a byte is successfully sent or received.

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    8/54

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    9/54

    bank select flags which are used to select which of the "R" register banks are

    currently selected.

    ACC (Accumulator, Addresses E0h, Bit-Addressable): The Accumulator is

    one of the most-used SFRs, since it is involved in so many instructions. The

    Accumulator resides as an SFR at E0h, which means the instruction MOV A,#20h is

    really the same as MOV E0h,#20h. However, it is a good idea to use the first method

    since it only requires two bytes whereas the second option requires three bytes.

    B (B Register, Addresses F0h, Bit-Addressable): The "B" register is used in

    two instructions: the multiply and divide operations. The B register is also commonly

    used by programmers as an auxiliary register to temporarily store values.

    3.6.3 Timers/Counters

    3.6.3.1 General Description

    The MCS-51 has two 16 bit Timer/ Counter register Timer 0 and Timer 1. Both

    can be configured to operate either as timers or event counter. Microcontroller can be

    used as timer or counter as you need. Microcontroller will act as timer when switch

    position on upper and microcontroller will act as counter when switch position on

    lower by controlling C/T bit on TMOD register. The diagram below shows the logic

    of the timer/counter circuit.

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    10/54

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    11/54

    TFx: Timer overflow flag. Set by hardware on Timer/Counter overflow. Cleared

    by hardware when processor vector to interrupt routine, or clearing the bit in

    software.

    TRx: Timer Run control bit . Set/ cleared by software to turn Timer/ Counter

    on/off

    IEx: Interrupt Edge flag. Set by hardware when external interrupt edge detected.

    Cleared when interrupt processed.

    ITx: Interrupt type control bit. Set/ cleared by software to specefy falling edge/

    low level trigerred external interrupts

    3.6.3.2 Modes of the timer

    M1 M0 Operating

    0 0 13 bit Timer, TLx serves as 5 bit prescaler

    0 116 bit Timer/Counter THx and TLx are cascaded, there is no

    prescaler

    1 0 8 bit auto reaload Timer/ Counter THx holds a value which is

    tobe reloaded into TLx each time it overflows

    1 1

    (Timer 0) TL0 is an 8 bit Timer/ Counter controlled by the

    standard timer 0 control bits

    (Timer 1) Timer/ Counter 1 stopped

    Mode 0 (13-bit Timer mode) :

    Figure shows the Mode 0 operation as it applies to Timer 1. In this mode,

    the Timer register is configured as a 13-bit register. As the count rolls over from all

    1s to all 0s, it sets the Timer interrupt flag TF1. The counted input is enabled to the

    Timer when TR1 = 1 and either GATE = 0 or INT1 = 1. (Setting GATE = 1 allows

    the Timer to be controlled by external input INT1, to facilitate pulse width

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    12/54

    measurements). The 13-bit register consists of all 8 bits of TH1 and the lower 5 bits

    of TL1. The upper 3 bits of TL1 are indeterminate and should be ignored. Setting the

    run flag (TR1) does not clear the registers. Mode 0 operation is the same for the

    Timer 0 as for Timer 1.

    Fig. 3.11

    Mode 1 (16-bit Timer mode) :

    Mode 1 is the same as Mode 0, except that the Timer register is being run

    with all 16 bits.

    Fig. 3.12

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    13/54

    Mode 2 (8-bit Auto Reload):

    Mode 2 configures the Timer register as an 8-bit Counter (TL1) with

    automatic reload, as shown in Figure. Overflow from TL1 not only sets TF1, but also

    reloads TL1 with the contents of TH1, which is preset by software. The reload leaves

    TH1 unchanged.

    Fig. 3.13

    Mode 3 (2 8-bit Counter/Timer):

    Timer 1 in Mode 3 simply holds its count. The effect is the same as settingTR1=0. Timer 0 in Mode 3 establishes TL0 and TH0 as two separate counters. The

    logic for Mode 3 on Timer 0 is shown in Figure. TL0 uses the Timer 0 control bits:

    C/T, GATE, TR0, INT0, and TF0. TH0 is locked into a timer function (counting

    machine cycles) and takes over the use of TR1 and TF1 from Timer 1. Thus, TH0

    now controls the Timer 1 interrupt. Mode 3 is provided for applications requiring

    an extra 8-bit timer on the counter. With Timer 0 in Mode 3, an 80C51 can look like

    it has three Timer/Counters. When Timer 0 is in Mode 3, Timer 1 can be turned on

    and off by switching it out of and into its own Mode 3, or can still be used by the

    serial port as a baud rate generator, or in fact, in any application not requiring an

    interrupt.

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    14/54

    Fig 3.14

    3.7 SERIAL COMMUNICATION :

    3.7.1 Serial Port in 89C51

    The serial port is full duplex, meaning it can transmit and receive

    simultaneously. It is also receive-buffered, meaning it can commence reception of a

    second byte before a previously received byte has been read from the register.

    The serial port receive and transmit registers are both accessed at Special Function

    Register SBUF. Writing to SBUF loads the transmit register, and reading SBUF

    accesses a physically separate receive register.

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    15/54

    Fig. 3.15

    The serial port can operate in 4 modes:

    Mode 0:

    Serial data enters and exits through RxD. TxD outputs the shift clock. 8

    bits are transmitted/received (LSB first). The baud rate is fixed at 1/12 the oscillator

    frequency.

    Mode 1:

    10 bits are transmitted (through TxD) or received (through RxD): a start

    bit (0), 8 data bits (LSB first), and a stop bit (1). On receive, the stop bit goes into

    RB8 in Special Function Register SCON. The baud rate is variable.

    Mode 2:

    11 bits are transmitted (through TxD) or received (through RxD): start bit

    (0), 8 data bits (LSB first), a programmable 9th data bit, and a stop bit (1). On

    Transmit, the 9th data bit (TB8 in SCON) can be assigned the value of 0 or 1. On

    receive, the 9th data bit goes into RB8 in Special Function Register SCON, while the

    stop bit is ignored. The baud rate is programmable to either 1/32 or 1/64 the oscillator

    frequency.

    Mode 3:

    11 bits are transmitted (through TxD) or received (through RxD): a start

    bit (0), 8 data bits (LSB first), a programmable 9th data bit, and a stop bit (1). In fact,

    Mode 3 is the same as Mode 2 in all respects except baud rate. The baud rate in Mode

    3 is variable.

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    16/54

    In all four modes, transmission is initiated by any instruction that uses SBUF as a

    destination register. Reception is initiated in Mode 0 by the condition RI = 0 and

    REN = 1. Reception is initiated in the other modes by the incoming start bit if REN =

    1.

    3.7.2 RS232 Standards :

    In telecommunications, RS-232 (Recommended Standard 232) is a

    standard for serial binary data signals connecting between a DTE (Data terminal

    equipment) and a DCE (Data Circuit-terminating Equipment). It is commonly used in

    computer serial ports. The RS-232 standard defines the voltage levels that correspond

    to logical one and logical zero levels. The standard has been renamed several times

    during its history as the sponsoring organization changed its name, and has been

    variously known as EIA RS 232, EIA 232, and most recently as TIA 232. Valid

    signals are plus or minus 3 to 15 volts. The range near zero volts is not a valid RS-

    232 level; logic one is defined as a negative voltage, the signal condition is called

    marking, and has the functional significance of OFF. Logic zero is positive, the signal

    condition is spacing, and has the function ON. The standard specifies a maximum

    open-circuit voltage of 25 volts. The region -3 to +3 is called as a dead band, since

    the voltages are undefined in this region. For this reason to use RS232 to any

    microcontroller we must first use voltage converters like MAX232 to convert TTL

    logic to RS232 logic and vice versa. Such chips are commonly known as line drivers.

    3.7.3 MAX232

    A standard serial interfacing for PC, RS232C, requires negative logic, i.e.,

    logic '1' is -3V to -12V and logic '0' is +3V to +12V. To convert a TTL logic, say,

    TxD and RxD pins of the uC chips, thus need a converter chip. A MAX232 chip has

    long been using in many uC boards. It provides 2-channel RS232C port and requires

    external 10uF capacitors. This I.C. also includes two receivers and two transmitters in

    the same package. This is useful in many cases when you only want to use the

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    17/54

    Transmit and Receive data Lines. You don't need to use two chips, one for the receive

    line and one for the transmission.

    Fig. 3.16

    Chapter 4. ANALYSIS EXPERIMENTATION AND

    RESULTS

    4.1 IC DESCRIPTION

    4.1.1 MICROCONTROLLER ATMEL AT89C51

    4.1.1.1 Features

    Compatible with MCS51 Products

    4K Bytes of Reprogrammable Flash Memory

    2.7V to 6V Operating Range

    Fully Static Operation: 0 Hz to 24 MHz

    Two-level Program Memory Lock

    128 x 8-bit Internal RAM 15 Programmable I/O Lines

    Two 16-bit Timer/Counters

    Six Interrupt Sources

    Programmable Serial UART Channel

    Direct LED Drive Outputs

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    18/54

    On-chip Analog Comparator

    Low-power Idle and Power-down Modes

    Brown-out Detection Power-On Reset (POR)

    Green (Pb/Halide-free/RoHS Compliant) Packaging Endurance: 1,000

    Write/Erase Cycles

    4.1.1.2.Description

    The AT89C51 is a low-voltage, high-performance CMOS 8-bit

    microcontroller with 4K bytes of Flash programmable and erasable read-only

    memory. The device is manufactured using Atmels high-density nonvolatile

    memory technology and is compatible with the industry-standard MCS-51

    instruction set. By combining a versatile 8-bit CPU with Flash on a monolithic

    chip, the Atmel AT89C51 is a powerful microcontroller which provides a highly-

    flexible and cost-effective solution to many embedded control applications.

    The AT89C51 provides the following standard features: 4K bytes of

    Flash, 128 bytes of RAM, 15 I/O lines, two 16-bit timer/counters, a five-vector,

    two-level interrupt architecture, a full duplex serial port, a precision analog

    comparator, on-chip oscillator and clock circuitry. In addition, the AT89C51 is

    designed with static logic for operation down to zero frequency and supports two

    software-selectable power saving modes. The Idle Mode stops the CPU while

    allowing the RAM, timer/counters, serial port and interrupt system to continue

    functioning. The power-down mode saves the RAM contents but freezes the

    oscillator disabling all other chip functions until the next hardware reset.

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    19/54

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    20/54

    4.1.1.4. Internal Block Diagram

    Fig. 4.2

    4.1.1.5. Pin Description

    VCC

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    21/54

    Supply voltage.

    GND

    Ground.

    Port 1

    Port 1 is an 8-bit bi-directional I/O port. Port pins P1.2 to P1.7 provide internal

    pullups. P1.0 and P1.1 require external pullups. P1.0 and P1.1 also serve as the

    positive input (AIN0) and the negative input (AIN1), respectively, of the on-chip

    precision analog comparator. The Port 1 output buffers can sink 20 mA and can

    drive LED displays directly. When 1s are written to Port 1 pins, they can be used

    as inputs. When pins P1.2 to P1.7 are used as inputs and are externally pulled low,

    they will source current (IIL) because of the internal pullups. Port 1 also receives

    code data during Flash programming and verification.

    Port 3

    Port 3 pins P3.0 to P3.5, P3.7 are seven bi-directional I/O pins with internal

    pullups. P3.6 is hard-wired as an input to the output of the on-chip comparator

    and is not accessible as a general- purpose I/O pin. The Port 3 output buffers can

    sink 20 mA. When 1s are written to Port 3 pins they are pulled high by the

    internal pullups and can be used as inputs. As inputs, Port 3 pins that are

    externally being pulled low will source current (IIL) because of the pullups. Port 3

    also serves the functions of various special features of the AT89C51 as listed

    below: Port 3 also receives some control signals for Flash programming and

    verification.

    Port Pin Alternate Functions

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    22/54

    P3.0 RXD (serial input port)

    P3.1 TXD (serial output port)

    P3.2 INT0 (external interrupt 0)

    P3.3 INT1 (external interrupt 1)

    P3.4 T0 (timer 0 external input)

    P3.5 T1 (timer 1 external input)

    RST

    Reset input. All I/O pins are reset to 1s as soon as RST goes high. Holding the

    RST pin high for two machine cycles while the oscillator is running resets the

    device. Each machine cycle takes 12 oscillator or clock cycles.

    XTAL1

    Input to the inverting oscillator amplifier and input to the internal clock operating

    circuit.

    XTAL2Output from the inverting oscillator amplifier.

    4.1.2 MAX232

    4.1.2.1 Features

    Meets or Exceeds TIA/EIA-232-F and ITU Recommendation V.28

    Operates From a Single 5-V Power Supply With 1.0-uF Charge-Pump

    Capacitors

    Operates Up To 120 kbit/s

    Two Drivers and Two Receivers

    30-V Input Levels

    Low Supply Current . . . 8 mA Typical

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    23/54

    ESD Protection Exceeds JESD 22-2000-V Human-Body Model (A114-A)

    Upgrade With Improved ESD (15-kV HBM)and 0.1-_F Charge-Pump

    Capacitors is available With the MAX202

    Applications :TIA/EIA-232-F, Battery-Powered Systems, Terminals,

    Modems, and Computers

    4.1.2.2 Description

    The MAX232 is a dual driver/receiver that includes a capacitive

    voltage generator to supply TIA/EIA-232-F voltage levels from a single 5-V

    supply. Each receiver converts TIA/EIA-232-F inputs to 5-V TTL/CMOS levels.

    These receivers have a typical threshold of 1.3 V, a typical hysteresis of 0.5 V,

    and can accept 30-V inputs. Each driver converts TTL/CMOS input levels into

    TIA/EIA-232-F levels. The driver, receiver, and voltage-generator functions are

    available as cells in the Texas Instruments LinASIC library.

    4.1.2.3Pin Diagram

    Fig. 4.3

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    24/54

    4.1.2.4Interfacing DiagramThe diagram below shows the interfacing pin configuration of the IC

    MAX232 with the DB9 (Female) serial port connector and the Microcontroller.

    16X2 LCD DISPLAY

    4.1.5.1 Features

    Maximum input voltage: 5.3VDC

    Operating input voltage: 5VDC

    8-bit interface data bus

    Controller: HD47780 equivalent

    Character font size: 0.125"W x 0.200"H

    16 pin/terminals

    Display size: 2.5"L x 0.7"W

    Module size: 3.4"L x 1.2"W x 0.5"T

    4.1.5.2 Description

    This is a 16 character by 2 line display, with the standard HD44780

    chipset. It works great with any microcontroller and it is very easy to interface. This LCD

    has 8-bit parallel interface. It is possible to use all 8 bits plus 3 control signals or 4 bits

    plus the control signals.

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    25/54

    4.1.5.3 Pin Diagram

    Fig. 4.6

    Fig. 4.7

    4.1.5.4 LCD Interfacing diagram

    The diagram below gives the interfacing configuration of the LCD with

    the microcontroller.

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    26/54

    Energy Metering Circuit:

    This enrgy meter is manly built around the IC 7751, an ANALOG DEVICEELECTRONIC ENERGY METERING IC, which converts the analog input energy

    reading into output as pulse for displaying the count value which is equivalent to the

    energy consumption. In addition to monitoring the energy consumption and data

    transmission & reception, the meter also provides protection against high voltage, over

    current and theft by immediately disconnecting metering circuit from the supply and

    altering the consumer by giving an audible alarm, so that the consumer or maintenance

    personal to take corrective action.

    This circuit takes two current samples in terms of voltage form then takes one voltage

    sample, and then generates a series of pulses depending upon the load connected.

    It contains analog to digital converter section internal to it, and it also ahs its own

    reference, it work s on the fixed frequency source generated by the crystal connected to it

    externally.

    There is also fault detection facility provided in the metering IC, So whenever the two

    currents i.e. Phase and neutral, differs by the value more than 12% fault indication is

    provided.

    2.1 ENERGY MEASUREMENT BLOCK:

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    27/54

    This block takes the proportional voltage, proportional current in a fixed duration

    so that the energy consumed V*I*t. To obtained the voltage supply 230V is potentially

    dived with the help of respective network and thus part of AC voltage under

    measurement is obtained. Similarly, to obtain the current measurement differential input

    signals are taken using current transformers.

    These two signals (V & I) are fed to AD 7751. This IC internally multiply current

    and voltage signal and generate instantaneous power signal. This signal is low pass

    filtered and converted to frequency F1 and F2 using digital to frequency converter, these

    signals are taken across pin no 23 and 24. Thus the o/p is a frequency signal proportional

    to the consumed energy.

    The internal block diagram schematic of the 7751 is shown below,

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    28/54

    Opto Coupler Ic :

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    29/54

    Is is a 4 termianl device,it provides isolation between two different circuits, it enables in

    sending the information through optical medium,

    What it does is it provides isolation from the electrical circuit which is having the AC gnd

    and the micro controller circuit which is having DC gnd.

    If isolation was not there then because of presence of neutral as AC Gnd, which would

    have been get combined with the DC gnd, then it would have created the short circuit the

    complete damaging of the digital circuitry.

    That is why there exits a opto coupler.

    Two numbers of opto couplers are used in cascade manner that is in series so that both

    the get the same pulse at the same time.

    One opto coupler sends pulses to the stationary counting micro controller circuit and

    other sends signal to remote station.

    Micro controller block:

    This block contains the main circuitry which measures the enrgy in terms of the

    pulses,here micro controller AVR is configured as counting the in put pulses as well as

    diplaying the reading on the back light LCD.

    Mocro contreoller is to be configured as a counter by putting the appropriate vlue in its

    TMOD register,sele cting the preticular timer as a counter and selecrting the particular

    poin as input pin for receiving the pulses.then also configure the modes aof the operation

    of the counting, mode 0 is selcted inthis application,as it has 8 bit wide register it counts

    upto 255 and with 5 bit prescaler so combining both we get the last counting value upto

    1fffh.it counts in mod32 manner.So if 1kwhr=3200 pulses then 100 count of the 32 is to

    be displayed o the LCD display.

    Display:-

    Display section include 16*1 back light LCD interfaced with the microcontroller. It has

    own processor to control the display information. So the interfacing of the LCD is done

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    30/54

    same as peripherals. It has own commands, addresses for the different locations on

    different lines. Here 16 character one line LCD with 5 * 7 dot matrix pattern LCD is used

    it require 5v supply for operation & same 5v for back light LED. The back light is having

    greenish yellow shade of light. It has 8 data lines for sending the data over it & 3 control

    lines to communicate with the LCD. Before reading & writing to LCD its busy status

    need to be checked.

    LCD gives more advantages & as compaired to the LED 7 segment displays. They are as

    follows

    1) The decline in price of LCD

    2) The ability to display number, character & graphics. This is in contrast to LED which

    are limited to numbers & few character.

    3)In corporation of refreshing controller into the LCD, thereby relieving the CPU of the

    task of refreshing the LDC. In contrast, the LED must be refreshed by the CPU (or in

    some other way) to keep displaying the data.

    4)Ease of programming for characters & graphics.

    LCD:

    It is a back light LCD, It has its own processor so it can be called as intelligent LCD. It is

    treated as other peripheral device. So it needs to be interfaced like any other device.

    It has 8 data lines and 3 control lines,

    Using these 3 control lines one can read and write into the LCD, it also has internal

    RAM.

    IT also has address location specifying the particular location on particular lines. For 1

    line the address starts from 80H through 8F so one can specify the location of the

    character or number be displayed.

    These 3 control lines are R/S: register select

    R/W: read Write

    E: Enable

    Transmitter:-

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    31/54

    It contains the GSM module for transmission of the data in the form of SMS.SMS is send

    to the user informing him about the update.GSM module SIM 300 is used in this

    project.It is interfaced with the microcontroller using serial communication i.e. RS232

    protocol.

    Receiver Block:

    The transmitted data is received by the mobile phone of the user whose number is fed

    into the data base. So that information in the form of SMS is send.

    Power Supply:-

    For our all IC we require 5V D.C. supply which can be generated by step

    down transformer, full wave bridge rectifier, filter condenser & voltage

    regulator IC7805.

    12V supply for relay is generated separately using the same procedure as

    above.

    Chapter 4 : Design Details

    5.1 Power supply design

    Power supply is the first and the most important part of our project. For our

    project we require +5V regulated power supply with maximum current rating

    500mA Following basic building blocks are required to generate regulated power supply.

    Step-down

    transformerRectifier

    Filter

    Ckt.Three

    Terminal

    Voltage reg.

    Regulated O/P

    VoltageMains 230 V

    A.C.

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    32/54

    Step Down Transformer :-

    Step down transformer is the first part of regulated power supply. To

    step down the mains 230V A.C. we require step down transformer.

    Following are the main characteristic of electronic transformer.

    1) Power transformers are usually designed to operate from source of low

    impedance at a single freq.

    2) It is required to construct with sufficient insulation of necessary

    dielectric strength.

    3) Transformer ratings are expressed in voltamp. The volt-amp of each

    secondary winding or windings are added for the total secondary VA. To

    this are added the load losses.

    4) Temperature rise of a transformer is decided on two well-known factors

    i.e. losses on transformer and heat dissipating or cooling facility provided

    unit.

    Rectifier Unit :-

    Rectifier unit is a ckt. which converts A.C. into pulsating D.C.

    Generally semi-conducting diode is used as rectifying element due to its

    property of conducting current in one direction only. Generally there are two

    types of rectifier.

    1) Half wave rectifier

    2) Full wave rectifier

    In half wave rectifier only half cycle of mains A.C. is rectified so its

    efficiency is very poor. So we use full wave bridge type rectifier, in which

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    33/54

    four diodes are used. In each half cycle, two diodes conduct at a time and we

    get maximum efficiency at o/p.

    Following are the main advantages and disadvantages of a full-wave

    bridge type rectifier ckt.

    Advantages:-

    1) The need of center tapped transformer is eliminated.

    2) The o/p is twice that of center tap circuit for the same secondary voltage.

    3)The PIV rating of diode is half of the center tap circuit.

    Disadvantages:-

    1) It requires four diodes.

    2) As during each half cycle of A.C. input, two diodes are conducting

    therefore voltage drop in internal resistance of rectifying unit will be

    twice as compared to center tap circuit.

    Filter Circuit :-

    Generally a rectifier is required to produce pure D.C. supply for using

    at various places in the electronic circuit. However, the o/p of rectifier has

    pulsating character i.e. if such a D.C. is applied to electronic circuit it will

    produce a hum i.e. it will contain A.C. and D.C. components. The A.C.

    components are undesirable and must be kept away from the load. To do so

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    34/54

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    35/54

    2) Operating Voltage.

    3) Frequency Range.

    4) Efficiency and Regulation.

    Size of core

    Size of core is one of the first considerations in regard of weight and volume of

    transformer. This depends on type of core and winding configuration used. Generally

    following formula is used to find area or size of core.

    P1

    Ai = -----------

    0.87

    Ai = Area of cross - section in Sq. cm. and

    P1 = Primary voltage.

    In transformer P1 = P2

    For our project we required +5V regulated output. So transformer secondary

    rating is 12V, 4A

    So secondary power wattage is,

    P2 = 12 x 4 w.

    = 48w

    48

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    36/54

    So Ai = 0.87

    = 7.427

    Generally 10% of area should be added to core to accommodate all turns for

    low Iron losses and compact size.

    So Ai = 8.1697

    Turns per volt

    Turns per volt of transformer are given by relation

    10,000

    Turns / Volt = -----------------------

    4.44 f Bm Ai

    Here,

    f is the frequency in Hz

    Bm is flux density in Wb/m2

    Ai is net area of cross section.

    Following table gives the value of turns per volt for 50 Hz frequency.

    Flux density

    Wb/m2

    1.14 1.01 0.91 0.83 0.76

    Turns per volt 40/Ai 45/Ai 50/Ai 55/Ai 60/Ai

    Generally lower the flux density better be quality of transformer.

    For project for 50 Hz the turns per Volt for 0.91 Wb/m2 from above table.

    Turns per Volt = 50 / Ai

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    37/54

    50

    = 8.1697

    6.13

    Thus for Primary winding = 220 x 6.13 = 1346.43.

    & for Secondary winding = 12 x 6.13 = 74

    Wire size

    As stated above size depends upon the current to be carried out by the

    winding, which depends upon current density of 3.1 A/mm2. For less copper

    losses 1.6 A/mm2

    or 2.4 A/mm2

    may be used. Generally even size guage of

    wire are used.

    Rectifier Design

    R.M.S. Secondary voltage at secondary of transformer is 12V.

    So maximum voltage Vm across Secondary is

    = Rms. Voltage x 2

    = 12 x 2

    = 16.97

    D.C. O/p Voltage at rectifier O/p is

    2 Vm

    Vdc = ----------

    2 x 16.97

    = -----------------------

    = 10.80 V

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    38/54

    PIV rating of each diode is

    PIV = 2 Vm.

    = 2 x 16.97

    = 34 V

    & maximum forward current which flow from each diode is 500mA.

    So from above parameter we select diode IN 4007 from diode selection

    manual.

    Design of Filter Capacitor

    Formula for calculating filter capacitor is,

    1

    C = ----------------------

    43 r f RL.r = ripple present at o/p of rectifier.

    (Which is maximum 0.1 for full wave rectifier.)

    F = frequency of mains A.C.

    RL = I/p impedance of voltage regulator IC.

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    39/54

    1

    C = ------------------------------

    43 x 0.1 x 50 x 28= 1030 f 1000 f.

    And voltage rating of filter capacitor is double of Vdc i.e. rectifier o/p which

    is 20V. So we choose 1000 f / 25V filter capacitor. [Ref : 6]

    IC 7812 (Voltage Regulator IC.)

    Specifications :

    Available o/p D.C. Voltage = +12V.

    Line Regulation = 0.03

    Load Regulation = 0.5

    Vin maximum = 35 V

    Ripple Rejection = 66-80 (db)

    IC 7805 (Voltage Regulator IC.)

    Specifications :

    Available o/p D.C. Voltage = + 5V.

    1 2 3

    1 2 3

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    40/54

    Line Regulation = 0.03

    Load Regulation = 0.5

    Vin maximum = 35 V

    Ripple Rejection = 66-80 (db)

    Chapter 2 : Technical Details

    IC 78XX (Voltage Regulator IC )

    OUTPUT CURRENT UP TO 1.5 A

    OUTPUT VOLTAGESOF 5; 5.2; 6; 8; 8.5; 9;

    12; 15; 18; 24V

    THEOVERLOADPROTECTION

    SHORT CIRCUIT PROTECTION

    OUTPUT TRANSITION SOA PROTECTION

    DESCRIPTION

    The L7800 series of three-terminal positive regulators is available in TO-220

    TO-220FP TO-3 and D2PAK packages and several fixed output voltages,

    making it useful in a wide range of applications. These regulators can

    provide local on-card regulation, eliminating the distribution problems

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    41/54

    associated with single point regulation. Each type employs internal current

    limiting, thermal shut-down and safe area protection, making it essentially

    indestructible. If adequate heat sinking is provided, they can deliver over 1A

    output current. Although designed primarily as

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    42/54

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    43/54

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    44/54

    Electrical Characteristic :

    PCB DESIGNING AND FABRICATION

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    45/54

    Introduction to printed circuit boards:

    It is called PCB in short; printed circuit pattern applied to one or both sides

    of an insulating base, depending upon that, and it is called single sided PCB

    or double-sided PCB.

    Conductor materials available are silver, brass, aluminum and copper;

    copper is most widely used which is used here as well. The thickness of

    conducting material depends on the current carrying capacity of the circuit.

    The printed circuit board usually serves three functions:

    1. It provides mechanical support to the components mounted on it.

    2. It provides necessary electrical interconnection.

    3. It acts as heat sink, i.e., it provides a conduction path leading to

    removal of most of the heat generated in the circuit.

    Cu clad

    The base of laminate is either paper of glass fiber cloth. Cu foil, which is

    produced by the method of electroplating, is placed on laminate and both are

    kept under hydraulic pressure for proper adhesive pressure for proper

    adhesive. These Cu clad are easily available in the market.

    Types of Laminates

    National Electrical Manufactures Association (NEMA) has various grades of

    laminates that are obtained by different resins and filters.

    1. Phenol

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    46/54

    Phenol and Formaldehyde produce phenolic paper base laminate it has

    phenolic resins with proper filter. This is Brown in color and opaque.

    Disadvantage is poor moisture resistance.

    2. Epoxy LaminatesEpoxy paper that is also paper based but impregnated with epoxy resin,

    yellowish white and translucent.

    Epoxy Glass; This base material has high mechanical strength and good

    electrical properties usually green in color and semitransparent.

    There are a variety of laminates available. We have selected Fiber Glass

    epoxy laminate.

    PCB fabrication includes following steps:

    1) Layout of the circuit

    2) Artwork designing

    3) Printing

    4) Etching

    5) Drilling

    6) Mounting of components and soldering

    7) Finishing

    1. LayoutThe layout of a PCB has to incorporate all the board before one can

    go onto the all work preparation. Detailed circuit diagram, the design

    concept and the philosophy behind the equipment are very important for the

    layout.

    Layout Scale

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    47/54

    Depending on the accuracy required artwork should be produced at a 1:1 or

    2:1 or even 4:1 scale. The layout is best prepared on the same scale as the

    artwork to prevent the entire problem, which might be caused by redrawing

    of the layout to the artwork scale. The layout/ artwork scale commonly

    applied is 2:1 with a 1:1 scale, no demanding single sided boards can be

    designed but sufficient care should be taken, particularly during the artwork

    preparation.

    Procedure

    The first rule is to replace each and every PCB layout as viewed from

    the component side. This rule must be strictly followed to avoid confusion,

    which would otherwise be caused.

    Another important rule is not to start the designing of a layout unless an

    absolutely clear circuit diagram is available.

    Among the components, the larger ones are placed first and the space in

    between is filled with smaller ones. Components requiring input/output

    connecting come near the connector. All components are placed in such a

    manner that de-soldering of other components is not necessary if they have

    to be replaced.

    Layout sketch

    The end product of the layout designing is the pencil sketched

    component and conductor drawing which is caller layout sketched. It

    contains all the information for the preparation of the network.

    Component holes

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    48/54

    In a given, PCB most all the holes required are one particular

    diameter. Holes of a different are shown with a code in the actual layout

    sketch.

    Conductor Holes

    A code can be used for the conductor with a special width. Minimum

    spacing should also be provided.

    A) Holes B) Conductor Widths

    Standard holes Standard width, 0.5 mm

    1.1 mm 1 mm

    1.5 mm 2 mm

    3.2 mm 4 mm

    2) Artwork

    The generation of PCB artwork should be considered as the first step of the

    PCB manufacturing process. The importance of a prefect artwork should not

    be under estimated. Problems like inaccurate registered, broken annular

    rings or too critical spacing are often due to bad artwork. And even with the

    most sophisticated PCB production facilities, PCB can be made better than

    the quality of the artwork used.

    Basic Approaches

    For ink drawing on white cardboard paper, good quality Indian ink and

    ink-pen set are minimum requirements.

    Drawing practice ---drawing procedure is very at-least by 0.10.2, and

    solder pad locations.

    And conductors can be easily displaced by 0.30.5 mm

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    49/54

    3) Screen Printing

    The process of screeningprinting is well known to the printing

    industry because of its inherent capabilities of printing a wide range of inks

    on almost any kind of surface including glass, metal, plastic fabrics etc.

    Found their way into an extremely broad field of applications.

    Screen-printing offers the advantage of wide control on the ink deposition,

    thickness though the selection of suitable mass density and composition. In

    the production of PCBs, it is successfully employed in printing of

    Etch resists Plate resists

    Solder stop lacquers

    Notation printing

    In its basic form, the screen-printing process is very simple. A screen fabric

    with uniform meshes and opening is stretched and fixed on a solid frame of

    metal or wood. The circuit pattern area open, while the meshes in the rest of

    the area is closed.

    In the actual printing step, ink is forced by the moving squeeze thorough the

    open meshes onto the surface of the material to be printed.

    The ink deposition, in a magnified cross section, shows the shape of a

    trapezoid.

    Pattern transfer onto the Screen

    There are two different methods in use, and each method has its own

    advantages and disadvantages.

    With the direct method, the screen is prepared by coating a photographic

    emulsion directly onto the screen fabric and exposing it in the pattern area.

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    50/54

    The indirect method makes use of a separate screen process film, supported

    on a backing sheet. The film on its backing sheet that is there after pressed

    onto the screen fabric and sticks there. Finally, the backing sheet is peeled

    off, opening all those screen meshes, which are not covered by the film

    pattern.

    The direct method provides very durable screen stencils with a higher

    dimensional accuracy but the finest details are not reproduced. The indirect

    method is more suitable for smaller series and where the finest details to be

    reproduced. The indirect method is faster but dimensionally less accurate

    and the screen stencils are less durable, more sensitive to mechanical

    damages and interruption in printing.

    4) Etching

    In all subtractive PCB process, etching is one of the most important steps.

    The final copper pattern is formed by selective removal of all the unwanted

    copper, which is not protected by an etching unit.

    Solutions, which are used in etching process, are known as enchants.

    I) Ferric Chloride

    II) Cupric Chloride

    III) Chromic Acid

    IV) Alkaline Ammonia.

    Of these Ferric Chloride is widely used because it has short etching time and

    it can be stored for a long time. Etching of PCBs as required in modern

    electronic equipment production, is usually done in spray type etching

    machines.

    Tank or bubble etching, in which the boards kept in tank, were lowered and

    fully immersed into the agitated, has almost disappeared.

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    51/54

    5) Component Mounting

    Careful mounting of components on PCB increases the reliability of

    assembly.

    1) The leads must be cleaned before they are inserted in PCB holes.

    Asymmetric lead bending must be avoided; the ENT leads must fit into

    holes properly so that they can be soldered.

    2) When space is to be saved then vertical mounting is to be preferred.

    The vertical leads must have an insulating sleeve.

    3) Where jumper wire crosses over conductors, they must be insulated.

    4) For mounting of PCBs, TO5, DIP packages special jigs must be used

    of easy insertion.

    5) While mounting transistors, each lead must insulating sleeve. All the

    flat radial components such as resistors, diodes and inductors are mounted

    and soldered. Then IC bases are soldered. The vertical components such as

    transistors, gang condenser and FET are mounted & soldered.

    6) Soldering

    The next process after the component mounting is soldering; solder pint is

    achieved by heating the solder and base metal about the melting point of the

    solders used.

    The necessary heat depends upon:

    1) The nature and type of joints

    2) Melting temperature of solder

    3) Flux

    Soldering techniques are of so many types but we are using iron soldering.

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    52/54

    Iron soldering

    Soldering iron consists of an insulating handle connected through a metal

    shaft, of a bit accurately makes contact with the component parts of the joint

    and solder and heats them up. The electrical heating element is located in the

    hollow shank or handle to heat the bit.

    Functions of the Bit

    It stored heat and convey it from the heat source to the work. It may be

    required to store surplus solder from the joint. It may be required to store

    molten solder and flux to the work.

    The surface must be lined and wetted; this encourages flow of solder into the

    joint. When the surface of the work becomes tested by the solder, a

    continuous flow of liquid metal between the bit and the work provides a path

    of high thermal conductivity through which heat can flow into the work

    piece.

    Solder bit are made up of copper; this metal has good wetting property, heat

    capability and thermal conductivity. Tin-lead solder affects copper during

    soldering operation. Production of copper bit can be made with thick iron

    coating followed by Ni/Tin plating. The life of the bit is increased by a

    factor of 10 to 15. Solder irons are specified in terms of wattage. Depending

    on heat input intended for working and types of work ( continuous or

    individual) the choice of the solder iron can be made.

    Procedure of Soldering

    The points to be joined must be cleaned first and fluxed. The hard solder

    iron and solder wire is applied to the work. The melted solder becomes

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    53/54

    bright and fluid. The iron must be removed after sufficient time and joint is

    allowed to coal.

    At the end, finishing is done.

    PCB, Designing using computer aided designing (CAD):

    CAD has many advantages over manual designing, important among then is:

    1) Changes can be easily made because we dont have to erase our pencil

    work on paper repeatedly.

    2) Time is saved.

    3) Before taking printout we can have preview of the design etc.

    The software which we have used is Quick-route.

    Circuit diagram

    Layout

  • 8/2/2019 Energy Metering Circuit Using GSM-Semi Report

    54/54