Final Doc2

download Final Doc2

of 59

Transcript of Final Doc2

  • 8/2/2019 Final Doc2

    1/59

    Power management for shopping mall with visitors counting

    CHAPTER: 1

    INTRODUCTION1.1 MOTIVATION:

    In the present day life everything is going to be automated to reduce theinvolvement of human beings. Even though the system is automated we have to give

    the control signals to perform. In this passion its also necessary to reduce the power

    consumption for offices and the houses. Here for this concept we are designing a

    project based on the shopping malls to reduce the power usage according to the count

    of persons in the hall.

    1.2 OBJECTIVE OF THE PROJECT:

    The project provides a method for automatic control of devices (lights, fans,or AC s) throughout a shopping mall. A unique architecture of occupancy sensors

    includes entry/exit sensors for detecting movement through doorways. The

    bidirectional sensors are used to sense the entry and exit. This project is designed

    around a microcontroller which forms the control unit of the project.

    The central embedded controller controls the devices according to the no. of

    persons entered into the shopping mall in response to the entry/exit sensors. The

    present project provides a system for saving power of a shopping mall. The hall ofthe mall is provided with bidirectional entry and exit way sensors.

    All the input devices such as sensors and output devices such as LCD are

    interfaced to microcontroller. The microcontroller controls the devices according to

    the inputs from the IR sensors.

    1

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    2/59

    Power management for shopping mall with visitors counting

    CHAPTER: 2

    SURVEY OF LITRETURE

    2.1 INTRODUCTION:

    Main aim of our project is to save the power by controlling the devices status

    i.e., on or off depending upon number of visitors.

    We provide IR transmitter and the receivers to count the number of visitors, this

    transmitter and the receivers are places at both sides of the path, one transmitter,

    receiver at the entering path and other at the exiting path. When the visitor enters, IR

    transmitter signal to the receiver will be interrupted and the one count will be

    incremented. In the same way at the exiting path.

    Whenever logic low signal comes to microcontroller, it will increment count by one

    and depending upon the program, when the number of visitors increase, controller

    will automatically on the devices. And as the count get decremented at the exiting

    path, it automatically off the devices. Relays are used to perform on and off

    operations . This will save the power in shopping malls

    2.2 EXISTING SYSTEM:

    At present all electronic devices like fan ,ac ,light are controlled manually in

    shopping mall and there is no concept like management of power in shopping mall in

    any form .The only existing method of managing power in shopping mall is manually

    switching off electronic devices whenever customers are not present at particular

    section , but this type of method is not correct as it is impossible to switch on devices

    frequently without any involment of electronic system.

    2.3 DISADVANTAGES OF EXISTING SYSTEM:

    The existing system fails in terms of controlling electronic devices as per increase

    and decrease in count of visitors in shopping mall. This system also fails in terms of

    managing power in shopping mall indeed it would be better if we say it completely

    does not have any concept of power management.2

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    3/59

    Power management for shopping mall with visitors counting

    2.4 PROPOSED SYSTEM:

    The project provides a method for automatic control of devices (lights, fans,

    or AC s) throughout a shopping mall. A unique architecture of occupancy sensors

    includes entry/exit sensors for detecting movement through doorways. The

    bidirectional sensors are used to sense the entry and exit. This project is designed

    around a microcontroller which forms the control unit of the project. The central

    embedded controller controls the devices according to the no. of persons entered into

    the shopping mall in response to the entry/exit sensors. The present project provides

    a system for saving power of a shopping mall. The hall of the mall is provided with

    bidirectional entry and exit way sensors.

    All the input devices such as sensors and output devices such as LCD are

    interfaced to microcontroller. The microcontroller controls the devices according to

    the inputs from the IR sensors.

    3

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    4/59

    Power management for shopping mall with visitors counting

    CHAPTER: 3

    DESIGN METHODOLOGY

    3.1 BLOCK DIAGRAM:

    Fig 3.1 block diagram of power management for shopping malls

    3.2 BLOCK DIAGRAM EXPLANATION:

    3.2.1 POWER SUPPLY:

    In this system we are using 5V power supply for microcontroller of

    Transmitter section as well as receiver section. We use rectifiers for converting the

    A.C. into D.C and a step down transformer to step down the voltage. The full

    4

    Dept. of ECE,AITS,Hyd.

    Regulated

    power supply

    Hall with

    IR Sensors

    A

    T

    8

    9

    S

    5

    1

    LCD

    Devices

  • 8/2/2019 Final Doc2

    5/59

    Power management for shopping mall with visitors counting

    description of the Power supply section is given in this documentation in the

    following sections i.e. hardware components.

    3.2.2 MICROCONTROLLER (8051):

    In this project work the micro-controller is playing a major role. Micro-

    controllers were originally used as components in complicated process-control

    systems. However, because of their small size and low price, Micro-controllers are

    now also being used in regulators for individual control loops. In several areas

    Micro-controllers are now outperforming their analog counterparts and are cheaper as

    well.

    The purpose of this project work is to present control theory that is relevant

    to the analysis and design of Micro-controller system with an emphasis on basic

    concept and ideas. It is assumed that a Microcontroller with reasonable software is

    available for computations and simulations so that many tedious details can be left to

    the Microcontroller. The control system design is also carried out up to the stage of

    implementation in the form of controller programs in assembly language OR in C-

    Language.

    3.2.3 LCD DISPLAY SECTION:

    This section is basically meant to show up the status of the project. This

    project makes use of Liquid Crystal Display to display / prompt for necessary

    information.

    3.2.4 HALL WITH IR SENSORS: it indicates the group of sensors arranged in thearea like hall

    3.2.5 DEVICES:

    Devices indicate the different appliances used in the shop which are to be controlledlike lights, fans etc.

    3.3 SCHEMATIC DIAGRAM

    5

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    6/59

    Power management for shopping mall with visitors counting

    Fig 3.2 schematic block diagram

    3.3.1 MICROCONTROLLER:

    We use AT89C51 microcontroller. As port 0 doesnt have any resistance internally,

    to improve the driving capability of the port 0, we need to connect pull up resistors. .

    9th pin of the microcontroller is reset pin, when the reset pin is 1, microcontroller

    clears all registers and restarts the procedure ,18 and 19 pins of the microcontroller

    are XTAL 1,XTAL2 which are connected with the extenal crystal. Crystal is used to

    set the baud rate. Generally 11.059MHZ crystal is connected .gives 9600 baud rate.

    3.3.2 POWER SUPPLY:

    6

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    7/59

    Power management for shopping mall with visitors counting

    The main aim of this power supply is to convert the 230V AC into 5V DC in

    order to give supply for the TTL or CMOS devices. In this process we are using a

    step down transformer, a bridge rectifier, a smoothing circuit and the RPS.

    At the primary of the transformer we are giving the 230V AC supply. Thesecondary is connected to the opposite terminals of the Bridge rectifier as the input.

    From other set of opposite terminals we are taking the output to the rectifier.

    The bridge rectifier converts the AC coming from the secondary of the transformer

    into pulsating DC. The output of this rectifier is further given to the smoother circuit

    which is capacitor in our project. The smoothing circuit eliminates the ripples from

    the pulsating DC and gives the pure DC to the RPS to get a constant output DC

    voltage. The RPS regulates the voltage as per our requirement

    3.3.3 RELAY:

    Relay is a device which acts like a switch to on and off the devices, it is connected to

    P2.4 pin through an amplifier, device is connected to relay at normal and neutral pin,

    as it is an electromechanical relay, when it is given 1 by program it turns from no

    connection to normal pin and makes device on, i.e., operated by programming

    3.3.4 LCD MODULE:

    This module is used to display the status of the devices. This module consists

    of 8 data lines D0 D7, which are connected to the 8 pins of port0 (P0). Additionally

    this module is having 3 control lines namely RS, RW and EN, which are connected

    to the port2 higher pins P2.5, P2.6 and P2.7 respectively. And the supply connections

    are given from the Power supply output 7805 to the VCC and VSS pins of the LCD.

    3.3.5 IR TRANSMITTER AND RECEIVER:

    IR sensors are input devices, IR sensors consist of both transmitter and receiver, andboth are connected on two sides of path. Two receivers are connected tomicrocontrollers port3.4 and P3.5 pins. These are used to detect the user enteringand exit.

    7

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    8/59

    Power management for shopping mall with visitors counting

    CHAPTER: 4

    EXPERIMENTAL INVESTIGATION

    This section introduces you with the commonly used electronic components that we

    usually use in our daily life but with difference for its use in current application.

    8

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    9/59

    Power management for shopping mall with visitors counting

    . 4.1 DESCRIPTION OF HARDWARE COMPONENTS

    In this chapter we are going to cover all parts of power management for

    shopping malls with bidirectional visitors counting in detailed manner and their

    functions in brief. Here we are more interested about the Microcontroller since it isthe heart of the project. So the complete architecture is explained and also

    significance of the Microcontroller

    HARDWARE COMPONENTS:

    1. Micro controller

    2. power supply

    3. LCD

    4. relays

    5. devices

    4.1.1 MICRO CONTROLLER (AT89S51)

    4.1.1.1 INTRODUCTION

    A Micro controller consists of a powerful CPU tightly coupled with memory,

    various I/O interfaces such as serial port, parallel port timer or counter, interrupt

    controller, data acquisition interfaces-Analog to Digital converter, Digital to Analog

    converter, integrated on to a single silicon chip.

    If a system is developed with a microprocessor, the designer has to go for external

    memory such as RAM, ROM, EPROM and peripherals. But controller is provided all

    these facilities on a single chip. Development of a Micro controller reduces PCB size

    and cost of design.One of the major differences between a Microprocessor and a

    Microcontroller is that a controller often deals with bits not bytes as in the real world

    application.

    Intel has introduced a family of Micro controllers called the MCS-51.

    9

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    10/59

    Power management for shopping mall with visitors counting

    Fig 4.1 micro controller

    4.1.1.2 FEATURES:

    Compatible with MCS-51 Products

    4K Bytes of In-System Programmable (ISP) Flash Memory Endurance: 1000Write/Erase Cycles

    4.0V to 5.5V Operating Range

    Fully Static Operation: 0 Hz to 33 MHz

    Three-level Program Memory Lock

    128 x 8-bit Internal RAM

    32 Programmable I/O Lines

    Two 16-bit Timer/Counters

    Six Interrupt Sources

    Full Duplex UART Serial Channel

    Low-power Idle and Power-down Modes

    4.1.1.3 DESCRIPTION

    The AT89S51 is a low-power, high-performance CMOS 8-bit microcontroller with 4K

    bytes of in-system programmable Flash memory. The device is manufactured using

    10

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    11/59

    Power management for shopping mall with visitors counting

    Atmels high-density nonvolatile memory technology and is compatible with the industry-

    standard 80C51 instruction set and pinout. The on-chip Flash allows the program memory

    to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By

    combining a versatile 8-bit CPU with in-system programmable Flash on a monolithic chip,

    the Atmel AT89S51 is a powerful microcontroller which provides a highly-flexible and

    cost-effective solution to many embedded control applications.

    4.1.1.4 BLOCK DIAGRAM:

    Fig 4.2 Block diagram

    4.1.1.5 PIN DIAGRAM:

    11

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    12/59

    Power management for shopping mall with visitors counting

    Fig 4.3 pin diagram of micro controller

    4.1.1.6 PIN DESCRIPTION

    VCC - Supply voltage.

    GND - Ground.

    PORT 0:

    Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each pin can

    sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high-

    impedance inputs. Port 0 can also be configured to be the multiplexed low-order

    address/data bus during accesses to external program and data memory. In this mode, P0

    has internal pull-ups. Port 0 also receives the code bytes during Flash programming andoutputs the code bytes during program verification. External pull-ups are required

    during program verification.

    PORT 1:

    12

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    13/59

    Power management for shopping mall with visitors counting

    Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 1 output

    buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins, they are pulled

    high by the internal pull-ups and can be used as inputs. As inputs, Port 1 pins that are

    externally being pulled low will source current (IIL) because of the internal pull-ups. Port

    1 also receives the low-order address bytes during Flash programming and verification.

    Table 4.1 Heigher Bits of Port1

    PORT 2:

    Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 2 output

    buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled

    high by the internal pull-ups and can be used as inputs. As inputs, Port 2 pins that are

    externally being pulled low will source current (IIL) because of the internal pull-ups. Port

    2 also receives the high-order address bits and some control signals during Flash

    programming and verification.

    PORT 3:

    Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 3 output

    buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins, they are pulled

    high by the internal pull-ups and can be used as inputs. As inputs, Port 3 pins that are

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

    receives some control signals for Flash programming and verification. Port 3 also serves

    the functions of various special features of the AT89S51, as shown in the following table.

    13

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    14/59

    Power management for shopping mall with visitors counting

    Table 4.2 Special Function Register

    RST:

    Reset input. A high on this pin for two machine cycles while the oscillator is

    running resets the device. This pin drives High for 98 oscillator periods after the Watchdog

    times out. The DISRTO bit in SFR AUXR (address 8EH) can be used to disable this

    feature. In the default state of bit DISRTO, the RESET HIGH out feature is enabled.

    ALE/PROG:

    Address Latch Enable (ALE) is an output pulse for latching the low byte of the

    address during accesses to external memory. This pin is also the program pulse input

    (PROG) during Flash programming. In normal operation, ALE is emitted at a constant rate

    of 1/6 the oscillator frequency and may be used for external timing or clocking purposes.

    Note, however, that one ALE pulse is skipped during each access to external data memory.

    If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the

    bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is

    weakly pulled high. Setting the ALE-disable bit has no effect if the microcontroller is in

    external execution mode.

    PSEN:14

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    15/59

    Power management for shopping mall with visitors counting

    Program Store Enable (PSEN) is the read strobe to external program memory.

    When the AT89S51 is executing code from external program memory, PSEN is activated

    twice each machine cycle, except that two PSEN activations are skipped during each

    access to external data memory.

    EA/VPP:

    External Access Enable. EA must be strapped to GND in order to enable the device

    to fetch code from external program memory locations starting at 0000H up to FFFFH.

    Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset. EA

    should be strapped to VCC for internal program executions. This pin also receives the 12-

    volt programming enable voltage (VPP) during Flash programming.

    XTAL1:

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

    circuit.

    XTAL2:

    Output from the inverting oscillator amplifier.

    4.1.1.7 OSCILLATOR CHARACTERISTICS:

    XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier

    which can be configured for use as an on-chip oscillator, as shown in Figs 6.2.3.

    Either a quartz crystal or ceramic resonator may be used. To drive the device from an

    external clock source, XTAL2 should be left unconnected while XTAL1 is driven as

    shown in Figure 6.2.4.There are no requirements on the duty cycle of the external

    clock signal, since the input to the internal clocking circuitry is through a divide-by-

    two flip-flop, but minimum and maximum voltage high and low time specifications

    must be observed.

    15

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    16/59

    Power management for shopping mall with visitors counting

    Fig 4.4 Oscillator Connections Fig 4.5 External Clock Drive Configuration

    4.1.2 REGULATED POWER SUPPLY

    The power supplies are designed to convert high voltage AC mainselectricity to a suitable low voltage supply for electronics circuits and

    other devices. A RPS (Regulated Power Supply) is the Power Supply

    with Rectification, Filtering and Regulation being done on the AC mains to

    get a Regulated power supply for Microcontroller and for the other

    devices being interfaced to it.

    A power supply can by broken down into a series of blocks, each of which

    performs a particular function. A d.c power supply which maintains the output

    voltage constant irrespective of a.c mains fluctuations or load variations is known as

    Regulated D.C Power Supply

    For example a 5V regulated power supply system as shown below:

    16

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    17/59

    Power management for shopping mall with visitors counting

    Fig 4.6 components of a typical linear power supply

    4.1.2.1 TRANSFORMER:

    A transformer is an electrical device which is used to convert electrical power

    from one Electrical circuit to another without change in frequency.

    Transformers convert AC electricity from one voltage to another with little loss

    of power. Transformers work only with AC and this is one of the reasons why mains

    electricity is AC. Step-up transformers increase in output voltage, step-down

    transformers decrease in output voltage. Most power supplies use a step-down

    transformer to reduce the dangerously high mains voltage to a safer low voltage.

    The input coil is called the primary and the output coil is called the secondary. There

    is no electrical connection between the two coils; instead they are linked by an

    alternating magnetic field created in the soft-iron core of the transformer. The two

    17

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    18/59

    Power management for shopping mall with visitors counting

    lines in the middle of the circuit symbol represent the core. Transformers waste very

    little power so the power out is (almost) equal to the power in. Note that as voltage is

    stepped down current is stepped up. The ratio of the number of turns on each coil,

    called the turns ratio, determines the ratio of the voltages. A step-down transformer

    has a large number of turns on its primary (input) coil which is connected to the high

    voltage mains supply, and a small number of turns on its secondary (output) coil to

    give a low output voltage.

    Fig 4.7 An Electrical Transformer

    Turns ratio = Vp/ VS = Np/NS

    Power Out= Power In

    VS X IS=VP X IP

    Vp=primary (input) voltage

    Np=number of turns on primary coil

    Ip = primary (input) current

    4.1.2.2 RECTIFIER:

    A circuit which is used to convert a.c to dc is known as RECTIFIER. The process

    of conversion a.c to d.c is called rectification

    4.1.2.2.1 TYPES OF RECTIFIERS:

    18

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    19/59

  • 8/2/2019 Final Doc2

    20/59

    Power management for shopping mall with visitors counting

    0.287 0.693 0.812

    RMS voltage Vrms Vm/2 Vm/2 Vm/2

    Table 4.3 Comparision of Different Rectifiers

    FULL-WAVE RECTIFIER:

    From the above comparison we came to know that full wave bridge rectifier as

    more advantages than the other two rectifiers. So, in our project we are using full

    wave bridge rectifier circuit.

    BRIDGE RECTIFIER:

    A bridge rectifier makes use of four diodes in a bridge arrangement to achieve

    full-wave rectification. This is a widely used configuration, both with individual

    diodes wired as shown and with single component bridges where the diode bridge is

    wired internally.

    A bridge rectifier makes use of four diodes in a bridge arrangement as shown

    in fig (a) to achieve full-wave rectification. This is a widely used configuration, both

    with individual diodes wired as shown and with single component bridges where the

    diode bridge is wired internally.

    20

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    21/59

    Power management for shopping mall with visitors counting

    Fig 4.8 Bridge Rectifier

    OPERATION:

    During positive half cycle of secondary, the diodes D2 and D3 are in forward biased

    while D1 and D4 are in reverse biased as shown in the fig4.8. The current flow

    direction is shown in the fig 4.9 with dotted arrows.

    Fig 4.9 D2 and D3 Output

    During negative half cycle of secondary voltage, the diodes D1 and D4 are in

    forward biased while D2 and D3 are in reverse biased as shown in the fig4.9. The

    current flow direction is shown in the fig 4.10 with dotted arrows.

    21

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    22/59

    Power management for shopping mall with visitors counting

    Fig 4.10 D1 and D4 Output

    4.1.2.3 FILTER:

    A Filter is a device which removes the a.c component of rectifier output but

    allows the d.c component to reach the load.

    4.1.2.3.1 CAPACITOR FILTER:

    We have seen that the ripple content in the rectified output of half wave rectifier

    is 121% or that of full-wave or bridge rectifier or bridge rectifier is 48% such highpercentages of ripples is not acceptable for most of the applications. Ripples can be

    removed by one of the following methods of filtering.

    (a) A capacitor, in parallel to the load, provides an easier by pass for the ripples

    voltage though it due to low impedance. At ripple frequency and leave the D.C. to

    appear at the load.

    (b) An inductor, in series with the load, prevents the passage of the ripple current

    (due to high impedance at ripple frequency) while allowing the d.c (due to low

    resistance to d.c).

    (c) Various combinations of capacitor and inductor, such as L-section filter

    section filter, multiple section filter etc. which make use of both the properties22

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    23/59

    Power management for shopping mall with visitors counting

    mentioned in (a) and (b) above. Two cases of capacitor filter, one applied on half

    wave rectifier and another with full wave rectifier. Filtering is performed by a large

    value electrolytic capacitor connected across the DC supply to act as a reservoir,

    supplying current to the output when the varying DC voltage from the rectifier is

    falling. The capacitor charges quickly near the peak of the varying DC, and then

    discharges as it supplies current to the output. Filtering significantly increases the

    average DC voltage to almost the peak value (1.4 RMS value).

    To calculate the value of capacitor(C),

    C = *3*f*r*Rl

    Where,f = supply frequency,

    r = ripple factor,

    Rl = load resistance

    Note: In our circuit we are using 1000F hence large value of capacitor isplaced to reduce ripples and to improve the DC component.

    4.1.2.4 REGULATOR:

    Voltage regulator ICs is available with fixed (typically 5, 12 and 15V) or variable

    output voltages. The maximum current they can pass also rates them. Negative

    voltage regulators are available, mainly for use in dual supplies. Most regulators

    include some automatic protection from excessive current ('overload protection') and

    overheating ('thermal protection'). Many of the fixed voltage regulators ICs have 3

    leads and look like power transistors, such as the 7805 +5V 1A regulator shown on

    the right. The LM7805 is simple to use. You simply connect the positive lead of your

    unregulated DC power supply (anything from 9VDC to 24VDC) to the Input pin,

    connect the negative lead to the Common pin and then when you turn on the power,

    you get a 5 volt supply from the output pin.

    23

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    24/59

    Power management for shopping mall with visitors counting

    Fig 4.11 A Three Terminal Voltage Regulator

    4.1.2.4.1 78XX:

    The Bay Linear LM78XX is integrated linear positive regulator with three

    terminals. The LM78XX offer several fixed output voltages making them useful in

    wide range of applications. When used as a zener diode/resistor combination

    replacement, the LM78XX usually results in an effective output impedance

    improvement of two orders of magnitude, lower quiescent current. The LM78XX is

    available in the TO-252, TO-220 & TO-263packages,

    4.1.2.4.2 FEATURES:

    Output Current of 1.5A

    Output Voltage Tolerance of 5%

    Internal thermal overload protection

    Internal Short-Circuit Limited

    Output Voltage 5.0V, 6V, 8V, 9V, 10V, 12V, 15V, 18V, 24V.

    4.1.3 LIQUID CRYSTAL DISPLAY

    24

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    25/59

    Power management for shopping mall with visitors counting

    4.1.3.1 INTRODUCTION TO LCD:

    In recent years the LCD is finding widespread use replacing LED s (seven-segment

    LED or other multi segment LED s). This is due to the following reasons:

    1. The declining prices of LCD s.

    2. The ability to display numbers, characters and graphics. This is in

    contract to LED s, which are limited to numbers and a few characters.

    3. Incorporation of a refreshing controller into the LCD, there by relieving the

    CPU of the task of refreshing the LCD. In the contrast, the LED must be refreshed

    by the CPU to keep displaying the data.

    4. Ease of programming for characters and graphics.

    Fig 4.12 LCD Display

    4.1.3.2 USES:

    The LCD s used exclusively in watches, calculators and measuring instruments is

    the simple seven-segment displays, having a limited amount of numeric data. The

    recent advances in technology have resulted in better legibility, more information

    displaying capability and a wider temperature range. These have resulted in the LCD

    s being extensively used in telecommunications and entertainment electronics. The

    LCD s has even started replacing the cathode ray tubes (CRTs) used for the displayof text and graphics, and also in small TV applications.

    25

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    26/59

    Power management for shopping mall with visitors counting

    F i g 4 . 1 3 L C D B a c k V i e w

    F i g 4 . 1 4 L C D S i d e V i e w

    4 . 1 . 3 . 3 S P E C I F I C AT I O N S

    Number of Characters: 16 characters x 2 Lines

    Character Table: English-European (RS in Datasheet)

    Module dimension: 80.0mm x 36.0mm x 13.2mm(MAX)

    View area: 66.0 x 16.0 mm

    Active area: 56.2 x 11.5 mm

    Dot size: 0.56 x 0.66 mm

    Dot pitch: 0.60 x 0.70 mm

    Character size: 2.96 x 5.46 mm

    Character pitch: 3.55 x 5.94 mm

    LCD type: STN, Positive, Transflective, Yellow/Green

    Duty: 1/16

    View direction: Wide viewing angle Backlight Type: yellow/green LED

    RoHS Compliant: lead free

    Operating Temperature: -20C to + 70C

    26

    Dept. of ECE,AITS,Hyd.

    http://popupwindowxy%28%27products/lcd/lcd162b_back_side.jpg',%20640,%20480)
  • 8/2/2019 Final Doc2

    27/59

    Power management for shopping mall with visitors counting

    4.1.3.4 LCD PIN DIAGRAM:

    F i g 4 . 1 5 L C D P i n D i a g r a m

    Each and every pin of LCD is described neatly in following table

    Code

    (hex)

    Command to LCD Instruction

    Register

    1 Clear display screen

    2 Return home

    4 Decrement cursor

    6 Increment cursor

    5 Shift display right

    7 Shift display left

    8 Display off, cursor off A Display off, cursor on

    C Display on, cursor off

    E Display on, cursor on

    27

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    28/59

    Power management for shopping mall with visitors counting

    F Display on, cursor blinking

    10 Shift cursor position to left

    14 Shift cursor position to right

    18 Shift the entire display to the left

    1C Shift the entire display to the right

    80 Force cursor to beginning of 1st line

    C0 Force cursor to beginning of 2nd line

    38 2 lines and 5x7 matrix

    Table 4.4 LCD Command Operation4.1.3.5 LCD INTERFACING

    SENDING COMMANDS AND DATA TO LCD

    28

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    29/59

    Power management for shopping mall with visitors counting

    F i g 4 . 1 6 L C D I n t e r f a c i n g

    4.1.3.6DS WITH A TIME DELAY:

    To send any command from table 2 to the LCD, make pin RS=0. For data, make

    RS=1.Then place a high to low pulse on the E pin to enable the internal latch of the

    LCD.

    4.1.4 RELAYS:

    Relay is an electrically operated switch. Current flowing through the coil of the

    relay creates a magnetic field which attracts a lever and changes the switch contacts.

    29

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    30/59

    Power management for shopping mall with visitors counting

    The coil current can be on or off so relays have two switch positions and they are

    double throw (changeover) switches.

    F i g 4 . 1 7 P i n s o f R e l a y

    Relays allow one circuit to switch a second circuit which can be completely

    separate from the first. For example a low voltage battery circuit can use a relay to

    switch a 230V AC mains circuit. There is no electrical connection inside the relay

    between the two circuits; the link is magnetic and mechanical.

    F i g 4 . 1 8 P i c s o f R e l a y

    The coil of a relay passes a relatively large current, typically 30mA for a 12V

    relay, but it can be as much as 100mA for relays designed to operate from lower

    voltages. Most ICs (chips) cannot provide this current and a transistor is usually used

    to amplify the small IC current to the larger value required for the relay coil. The

    maximum output current for the popular 555 timer IC is 200mA so these devices can

    supply relay coils directly without amplification.

    Relays are usually SPDT or DPDT but they can have many more sets of

    switch contacts, for example relays with 4 sets of changeover contacts are readily

    available. Most relays are designed for PCB mounting but you can solder wires30

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    31/59

    Power management for shopping mall with visitors counting

    directly to the pins providing you take care to avoid melting the plastic case of the

    relay. The supplier's catalogue should show you the relay's connections. The coil will

    be obvious and it may be connected either way round. Relay coils produce brief high

    voltage 'spikes' when they are switched off and this can destroy transistors and ICs in

    the circuit. To prevent damage you must connect a protection diode across the relay

    coil. The animated picture shows a working relay with its coil and switch contacts.

    You can see a lever on the left being attracted by magnetism when the coil is

    switched on. This lever moves the switch contacts.

    Fig 4.19Operation of Relay

    The coil of a relay passes a relatively large current, typically 30mA for a 12V relay.

    The relay's switch connections are usually labeled as COM, NC and NO:

    COM = Common, always connect to this, it is the moving part of the switch.

    NC = Normally Closed, COM is connected to this when the relay coil is off.

    NO = Normally Open, COM is connected to this when the relay coil is on.

    Connect to COM and NO if you want the switched circuit to be on when the relay

    coil is on.

    Connect to COM and NC if you want the switched circuit to be on when the relay

    coil is off.

    31

    Dept. of ECE,AITS,Hyd.

    http://www.kpsec.freeuk.com/components/relay.htm#protecthttp://www.kpsec.freeuk.com/components/relay.htm#protect
  • 8/2/2019 Final Doc2

    32/59

    Power management for shopping mall with visitors counting

    4.1.4.1 CHOOSING A RELAY

    You need to consider several features when choosing a relay:

    1 .Physical size and pin arrangement If you are choosing a relay for an existing PCByou will need to ensure that its dimensions and pin arrangement are suitable. You

    should find this information in the supplier's catalogue. Coil voltage the relay's coil

    voltage rating and resistance must suit the circuit powering the relay coil. Many relays

    have a coil rated for a 12V supply but 5V and 24V relays are also readily available.

    Some relays operate perfectly well with a supply voltage which is a little lower than

    their rated value.

    2. Coil resistance the circuit must be able to supply the current required by the relay

    coil. You can use Ohm's law to calculate the current:

    3. For example: A 12V supply relay with a coil resistance of 400 passes a current

    of 30mA. This is OK for a 555 timer IC (maximum output current 200mA), but it is

    too much for most ICs and they will require a transistorto amplify the current.

    4. Switch ratings (voltage and current) the relay's switch contacts must be suitable for

    the circuit they are to control. You will need to check the voltage and current ratings.

    Note that the voltage rating is usually higher for AC, for example: "5A at 24V DC or

    125V AC".

    4.1.4.2 PROTECTION DIODES FOR RELAYS:

    Transistors and ICs (chips) must be protected from the brief high voltage 'spike'

    produced when the relay coil is switched off. The diagram shows how a signal diode

    (eg 1N4148) is connected across the relay coil to provide this protection. Note that

    32

    Dept. of ECE,AITS,Hyd.

    http://www.kpsec.freeuk.com/ohmslaw.htmhttp://www.kpsec.freeuk.com/trancirc.htm#chiphttp://www.kpsec.freeuk.com/ohmslaw.htmhttp://www.kpsec.freeuk.com/trancirc.htm#chip
  • 8/2/2019 Final Doc2

    33/59

    Power management for shopping mall with visitors counting

    the diode is connected 'backwards' so that it will normally not conduct. Conduction

    only occurs when the relay coil is switched off, at this moment current tries to

    continue flowing through the coil and it is harmlessly diverted through the diode.

    Without the diode no current could flow and the coil would produce a damaging high

    voltage 'spike' in its attempt to keep the current flowing.

    Relays and transistors compared

    Like relays, transistors can be used as an electrically operated switch. For

    switching small DC currents (< 1A) at low voltage they are usually a better choice

    than a relay. However transistors cannot switch AC or high voltages (such as mains

    electricity) and they are not usually a good choice for switching large currents

    (> 5A). In these cases a relay will be needed, but note that a low power transistor

    may still be needed to switch the current for the relay's coil! The main advantages

    and disadvantages of relays are listed below:

    4.1.4.3 ADVANTAGES OF RELAYS:

    Relays can switch AC and DC, transistors can only switch DC.

    Relays can switch high voltages, transistors cannot.

    Relays are a better choice for switching large currents (> 5A).

    Relays can switch many contacts at once.

    4.1.4.4 DISADVANTAGES OF RELAYS:

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

    times per second.

    Relays use more power due to the current flowing through their coil.

    33

    Dept. of ECE,AITS,Hyd.

    http://www.kpsec.freeuk.com/components/tran.htmhttp://www.kpsec.freeuk.com/components/tran.htm
  • 8/2/2019 Final Doc2

    34/59

    Power management for shopping mall with visitors counting

    Relays require more current than many chips can provide, so a low power

    transistor may be needed to switch the current for the relay's coil.

    4.1.4.5 DETAILS:

    These SPDT relays covers switching capacity of 10A in spite of miniature size for

    PCB Mount.

    4.1.4.6 CONTACT RATING:

    12A at 120VAC

    10A at 120VAC

    10A at 24VDC

    4.1.4.7 COIL RESISTANCE:400ohm 12VDC

    4.1.4.8 LIFE EXPECTANCY:Mechanical 10,000,000 operations at no load

    Electrical 100,000 at rated resistive load

    4.1.4.9 APPLICATIONS:

    Domestic Appliances

    Office Machines

    Audio Equipment

    Coffee-Pots

    Control units

    4.1.5 DIVICES:

    IR TRANSMITTER:

    4.1.5.1 IR LED:

    34

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    35/59

    Power management for shopping mall with visitors counting

    Here the IR transmitter is nothing but the IR LED. It just looks like a normal LED

    but transmits the IR signals. Since the IR rays are out of the visible range we cannot

    observe the rays from the transmitter.

    These are infrared LEDs; the light output is not visible by our eyes. They can be usedas replacement LEDs for remote controls, night vision for camcorders, invisible

    beam sensors, etc.

    Fig 4.20 IR LED

    4.1.5.2 ADVANTAGES:

    Infrared LEDs are ideal light sources for use with night vision goggles,

    surveillance cameras, medical imaging, recognition and calibration systems.

    Due to their resistance to ambient-light impediments and electromagnetic

    interference (EMI), Infrared LEDs enhance the performance of wireless computer-to-

    PDA links, collision avoidance systems, automation equipment, biomedical

    instrumentation, and telecommunications equipment.

    Solid-state design renders Infrared LEDs impervious to electrical andmechanical shock, vibration, frequent switching and environmental extremes. With

    an average life span of 100,000-plus hours (11 years), Infrared LEDs operate reliably

    year-after-year.

    PHOTO DIODE:

    35

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    36/59

    Power management for shopping mall with visitors counting

    A photodiode is a type of photodetector capable of converting light into

    either current or voltage, depending upon the mode of operation.

    Photodiodes are similar to regular semiconductor diodes except that they may

    be either exposed (to detect vacuum UV or X-rays) or packaged with a window or

    optical fibre connection to allow light to reach the sensitive part of the device. Many

    diodes designed for use specifically as a photodiode will also use a PIN junction

    rather than the typical PN junction.

    4.1.5.3 PRINCIPLE OF OPERATION:

    A photodiode is a PN junction or PIN structure. When a photon of sufficient

    energy strikes the diode, it excites an electron thereby creating a mobile electron anda positively charged electron hole. If the absorption occurs in the junction's depletion

    region, or one diffusion length away from it, these carriers are swept from the

    junction by the built-in field of the depletion region. Thus holes move toward the

    anode, and electrons toward the cathode, and a photocurrent is produced.

    PHOTOVOLTAIC MODE:

    When used in zero bias or photovoltaic mode, the flow of photocurrent out ofthe device is restricted and a voltage builds up. The diode becomes forward biased

    and "dark current" begins to flow across the junction in the direction opposite to the

    photocurrent. This mode is responsible for the photovoltaic effect, which is the basis

    for solar cellsin fact, a solar cell is just an array of large photodiodes.

    PHOTOCONDUCTIVE MODE:

    In this mode the diode is often (but not always) reverse biased. This increasesthe width of the depletion layer, which decreases the junction's capacitance resulting

    in faster response times. The reverse bias induces only a small amount of current

    (known as saturation or back current) along its direction while the photocurrent

    remains virtually the same.36

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    37/59

    Power management for shopping mall with visitors counting

    Although this mode is faster, the photovoltaic mode tends to exhibit less

    electronic noise. (The leakage current of a good PIN diode is so low < 1nA that

    the JohnsonNyquist noise of the load resistance in a typical circuit often dominates.)

    OTHER MODES OF OPERATION:

    Avalanche photodiodes have a similar structure to regular photodiodes, but they are

    operated with much higher reverse bias. This allows each photo-generated carrier to

    be multiplied by avalanche breakdown, resulting in internal gain within the

    photodiode, which increases the effective responsivity of the device.

    Phototransistors also consist of a photodiode with internal gain. A phototransistor is

    in essence nothing more than a bipolar transistor that is encased in a transparent case

    so that light can reach the base-collector junction. The electrons that are generated by

    photons in the base-collector junction are injected into the base, and this current is

    amplified by the transistor operation. Note that although phototransistors have a

    higher responsivity for light they are unable to detect low levels of light any better

    than photodiodes. Phototransistors also have slower response times.

    4.1.5.4 MATERIALS

    The material used to make a photodiode is critical to defining its properties, because

    only photons with sufficient energy to excite electrons across the material's bandgap

    will produce significant photocurrents.

    Materials commonly used to produce photodiodes include:

    Material Wavelength range(nm)

    Silicon 1901100

    37

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    38/59

    Power management for shopping mall with visitors counting

    Germanium 4001700

    Indium gallium

    arsenide8002600

    Lead sulfide

  • 8/2/2019 Final Doc2

    39/59

    Power management for shopping mall with visitors counting

    DARK CURRENT:

    The current through the photodiode in the absence of light, when it is operated in

    photoconductive mode. The dark current includes photocurrent generated by

    background radiation and the saturation current of the semiconductor junction. Darkcurrent must be accounted for by calibration if a photodiode is used to make an

    accurate optical power measurement, and it is also a source of noise when a

    photodiode is used in an optical communication system.

    NOISE-EQUIVALENT POWER:

    (NEP) The minimum input optical power to generate photocurrent, equal to the rmsnoise current in a 1 hertz bandwidth. The related characteristic detectivity (D) is the

    inverse of NEP, 1/NEP; and the specific detectivity () is the detectivity normalized to

    the area (A) of the photodetector,. The NEP is roughly the minimum detectable input

    power of a photodiode.

    When a photodiode is used in an optical communication system, these parameters

    contribute to the sensitivity of the optical receiver, which is the minimum input

    power required for the receiver to achieve a specified bit error ratio.

    4.1.5.6 APPLICATIONS:

    Photodiode schematic symbol. P-N photodiodes are used in similar

    applications to other photodetectors, such as photoconductors, charge-coupled

    devices, and photomultiplier tubes.

    Fig 4.21 Photo Diode

    39

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    40/59

    Power management for shopping mall with visitors counting

    Photodiodes are used in consumer electronics devices such as compact disc players,

    smoke detectors, and the receivers for remote controls in VCRs and televisions. In

    other consumer items such as camera light meters, clock radios (the ones that dim the

    display when it's dark) and street lights, photoconductors are often used rather than

    photodiodes, although in principle either could be used.

    Photodiodes are often used for accurate measurement of light intensity in science and

    industry. They generally have a better, more linear response than

    photoconductors.They are also widely used in various medical applications, such as

    detectors for computed tomography (coupled with scintillators) or instruments to

    analyze samples (immunoassay). They are also used in blood gas monitors.

    PIN diodes are much faster and more sensitive than ordinary p-n junction diodes, and

    hence are often used for optical communications and in lighting regulation.P-N

    photodiodes are not used to measure extremely low light intensities. Instead, if high

    sensitivity is needed, avalanche photodiodes, intensified charge-coupled devices or

    photomultiplier tubes are used for applications such as astronomy , spectroscopy,

    night vision equipment and laser range finding.

    4.1.5.7 IR LED DESCRIPTION:

    The QED233 / QED234 is a 940 nm GaAs/AlGaAs LED encapsulated in a clear

    untinted, plastic T-1 3/4 package.

    40

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    41/59

    Power management for shopping mall with visitors counting

    Fig 4.22 LEDS

    4.1.5.8 FEATURES:

    Lambda= 940 nm

    Chip material =GaAs with AlGaAs window

    Package type: T-1 3/4 (5mm lens diameter)

    Matched Photo sensor: QSD122/123/124

    Medium Emission Angle, 40

    High Output Power

    Package material and color: Clear, untinted, plastic

    Ideal for remote control applications

    LIGHT EMITING DIODES

    It is a semiconductor diode having radioactive recombination. It requires a

    definite amount of energy to generate an electron-hole pair.

    41

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    42/59

    Power management for shopping mall with visitors counting

    The same energy is released when an electron recombines with a hole. This

    released energy may result in the emission of photon and such a recombination. Hear

    the amount of energy released when the electro reverts from the conduction band to

    the valence band appears in the form of radiation. Alternatively the released energy

    may result in a series of phonons causing lattice vibration. Finally the released energy

    may be transferred to another electron. The recombination radiation may be lie in the

    infra-red and visible light spectrum. In forward is peaked around the band gap

    energy and the phenomenon is called injection luminescence. I n a junction biased in

    the avalanche break down region , there results a spectrum of photons carrying much

    higher energies . Almost White light then gets emitted from micro-plasma breakdown

    region in silicon junction. Diodes having radioactive recombination are termed as

    Light Emitting Diode, abbreviated as LEDs

    In gallium arsenide diode, recombination is predominantly a radiation

    recombination and the probability of this radio active recombination far exceeds that

    in either germanium or silicon . Hence Ga As LED has much higher efficiency in

    terms of

    Photons emitted per carrier. The internal efficiency of Ga As LED may be very close

    to 100% but because of high index of refraction, only a small fraction of the internalradiation can usually come out of the device surface. In spite of this low efficiency

    of actually radiated light , these LEDs are efficiency used as light emitters in visual

    display units and in optically coupled circuits, The efficiency of light generation

    increases with the increase of injected current and with decreases in temperature.

    The light so generated is concentrated near the junction since most of the charge

    carriers are obtained within one diffusion length of the diode junction

    The following are the merits of LEDs over conventional incandescent and other typesof lamps

    1. Less power consumption

    2. Very fast action

    42

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    43/59

    Power management for shopping mall with visitors counting

    3. Emission of monochromatic light

    4. small size and weight

    5. No effect of mechanical vibrations

    6. Extremely long life

    CHAPTER: 5

    RESULTSThe operation of our industry oriented mini project titled Power management for

    shopping mall with visitors counting is as follows:-

    The entrance and exit view of our project

    43

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    44/59

    Power management for shopping mall with visitors counting

    Fig 5.1 Entrance and Exit Section

    The transmitting and receiving view of our project

    Fig 5.2 Transmitting and Receiving Section

    The microcontroller along with power supply and display section of our project

    44

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    45/59

    Power management for shopping mall with visitors counting

    Fig 5.3 Micro Controller And Display Section

    Power supply is going to provide necessary supply required for our project. Themicrocontroller will perform all controlling action of our entire project and willguide all electronic devices to switch ON and switch OFF depending upon itsfunctionality. The entire operation is going to be displayed using LCD.

    The complete overview of our project

    45

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    46/59

    Power management for shopping mall with visitors counting

    Fig 5.4 Complete overview of our Project

    Whenever a visitor enters from the entrance section the microcontroller will

    recognize and a count will be incremented which will be displayed by LCD.

    Whenever a visitor from the exit section the microcontroller will recognize and a

    count will be decremented which will be displayed by LCD. The devices like fan,

    lights are turned ON or OFF depending upon count displayed by LCD

    46

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    47/59

    Power management for shopping mall with visitors counting

    CHAPTER: 6

    CONCLUSION

    The project work Power management for shopping mall with visitorscounting is designed in such a way which makes of the software and hardware

    resources successfully. The hardware components are integrated which are

    software controlled.The software in this case is nothing but a pre-defined set of

    code which is written or burned into a Microcontroller on which all the

    operations of the connected hardware components depend.

    Main aim of our project is to save the power by controlling the devices status

    i.e., on or off depending upon number of visitors.

    We provide IR transmitter and the receivers to count the number of visitors, this

    transmitter and the receivers are places at both sides of the path, one transmitter,

    receiver at the entering path and other at the exiting path. When the visitor

    enters, IR transmitter signal to the receiver will be interrupted and the one count

    will be incremented. In the same way at the exiting path.

    Whenever logic low signal comes to microcontroller, it will increment count by

    one and depending upon the program, when the number of visitors increase,

    controller will automatically on the devices. And as the count get decremented

    at the exiting path, it automatically off the devices. Relays are used to perform

    on and off operations . This will save the power in shopping malls

    The project POWER MANAGEMENT FOR SHOPPING MALLS WITH

    VISITORS COUNTING has been successfully designed and tested. Integrating

    features of all the hardware components used have developed it. Presence of every

    module has been reasoned out and placed carefully thus contributing to the best

    working of the unit.

    47

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    48/59

    Power management for shopping mall with visitors counting

    Secondly, using highly advanced ICs and with the help of growing

    technology the project has been successfully implemented.

    CHAPTER: 7

    FUTURE SCOPE

    The project can be further extended by making use of other electronic devices

    like room temperature detector . By using this electronic device we can predict room

    temperature of shopping mall and adjust program coding in such a way as to control

    switching on and off of electronic devices like Fans, AC , Lights etc depending upon

    varying temperature . Hence by doing so we can save further power when ever sun is

    brighter i.e. when room temperature is high and provide sufficient brightnesswhenever darkness prevails around by switching on more number of devices.

    48

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    49/59

    Power management for shopping mall with visitors counting

    CHAPTER: 8

    BIBILIOGRAPHY

    NAME OF THE SITES

    1. WWW.MITEL.DATABOOK.COM

    2. WWW.ATMEL.DATABOOK.COM

    3. WWW.FRANKLIN.COM

    4. WWW.KEIL.COM

    REFERENCES

    (1) 8051-MICROCONTROLLER AND EMBEDDED SYSTEM.

    Mohd. Mazidi.

    (2) The 8051 Micro-controller Architecture, programming & Applications

    By: Kenneth J. Ayala

    49

    Dept. of ECE,AITS,Hyd.

    http://www.mitel.databook.com/http://www.atmel.databook.com/http://www.franklin.com/http://www.keil.com/http://www.mitel.databook.com/http://www.atmel.databook.com/http://www.franklin.com/http://www.keil.com/
  • 8/2/2019 Final Doc2

    50/59

    Power management for shopping mall with visitors counting

    APPENDIX

    A. PROGRAM CODE:

    #include

    #include

    sbit s1_entry = P3^4;

    sbit s1_exit = P3^5;

    sbit led1 = P2^0;

    sbit led2 = P2^1;

    sbit led3 = P2^2;

    sbit led4 = P2^3;sbit led5 = P2^4;

    unsigned int count;

    void delay1(unsigned int);

    void int_init();

    void main()

    {unsigned char first;

    char x,d1,d2,d3;

    int count1;

    LCD_Init();

    led1=1;led2=1;led3=1;led4=1;led5=1;

    Disp_Str("POWER SAVING FOR");

    LCD_Cmd(0xc0);

    Disp_Str(" SHOPPING MALLS ");

    delay1(100);

    50

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    51/59

    Power management for shopping mall with visitors counting

    LCD_Cmd(0x80);

    Disp_Str(" INITIALY LIGHT ");

    LCD_Cmd(0xc0);

    Disp_Str(" ON ");

    led1=0;

    delay1(100);

    LCD_Cmd(0x01);

    delay1(10);

    count = 0;

    while(1)

    {

    x = count/10; d1 = count%10; d2 = x % 10; d3 = x / 10;

    LCD_Cmd(0x80); Disp_Str("CNT IN HALL =");

    LCD_Data(d3+0x30); LCD_Data(d2+0x30); LCD_Data(d1+0x30);

    while(1)

    {

    if(s1_entry==0) {first = 1;break;}

    if(s1_exit==0) {first = 2;break;}

    }

    if(first==1)

    {

    while(!s1_entry); while(!s1_exit);

    count++; }

    if(first==2)

    51

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    52/59

    Power management for shopping mall with visitors counting

    {

    while(!s1_exit); while(!s1_entry);

    if(count>0) count--;

    }

    count1 = 100*d3+10*d2+d1;

    if (count1=5 && count1=15 && count1=25 && count1=35)

    { led1=0;led2=0;led3=0;led4=0;led5=0; }

    delay1(50); }

    }

    void int_init()

    {

    IE = 0x85; }

    void delay1(unsigned int dtime)

    {

    unsigned int i,j;

    for (i=0; i

  • 8/2/2019 Final Doc2

    53/59

    Power management for shopping mall with visitors counting

    for (j=0; j

  • 8/2/2019 Final Doc2

    54/59

    Power management for shopping mall with visitors counting

    VISION3:

    Vision3 is an IDE (Integrated Development Environment) that helps you write,

    compile, and debug embedded programs. It encapsulates the following components:

    A project manager.

    A make facility.

    Tool configuration.

    Editor.

    A powerful debugger.

    To help you get started, several example programs (located in the \C51\Examples,

    \C251\Examples, \C166\Examples, and \ARM\...\Examples) are provided.

    HELLO is a simple program that prints the string "Hello World" using the

    Serial Interface.

    BUILDING AN APPLICATION IN VISION2

    To build (compile, assemble, and link) an application in Vision2, you must:

    1. Select Project - (for example, 166\EXAMPLES\HELLO\HELLO.UV2).

    2. Select Project - Rebuild all target files or Build target.

    Vision2 compiles, assembles, and links the files in your project.

    CREATING YOUR OWN APPLICATION IN VISION2

    To create a new project in Vision2, you must:

    1. Select Project - New Project.

    2. Select a directory and enter the name of the project file.

    3. Select Project - Select Device and select an 8051, 251, or C16x/ST10 device

    from the Device Database.

    4. Create source files to add to the project.

    5. Select Project - Targets, Groups, Files, Add/Files, select Source Group1,

    and add the source files to the project.

    54

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    55/59

    Power management for shopping mall with visitors counting

    6. Select Project - Options and set the tool options. Note when you select the

    target device from the Device Database all special options are set automatically.

    You typically only need to configure the memory map of your target hardware.

    Default memory model settings are optimal for most applications.

    7. Select Project - Rebuild all target files or Build target.

    DEBUGGING AN APPLICATION IN VISION2

    To debug an application created using Vision2, you must:

    1. Select Debug - Start/Stop Debug Session.

    2. Use the Step toolbar buttons to single-step through your program. You may

    enterG, main in the Output Window to execute to the main C function.

    3. Open the Serial Window using the Serial #1 button on the toolbar.

    Debug your program using standard options like Step, Go, Break, and so on.

    STARTING VISION2 AND CREATING A PROJECT

    Vision2 is a standard Windows application and started by clicking on the

    program icon. To create a new project file select from the Vision2 menu

    Project New Project. This opens a standard Windows dialog that asks you for

    the new project file name.

    We suggest that you use a separate folder for each project. You can simply

    use the icon Create New Folder in this dialog to get a new empty folder. Then select

    this folder and enter the file name for the new project, i.e. Project1.

    Vision2 creates a new project file with the name PROJECT1.UV2 which

    contains a default target and file group name. You can see these names in the Project

    WINDOW FILES.

    55

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    56/59

    Power management for shopping mall with visitors counting

    Now use from the menu Project Select Device for Target and select a CPU

    for your project. The Select Device dialog box shows the Vision2 device database.

    Just select the microcontroller you use. We are using for our examples the Philips

    80C51RD+ CPU. This selection sets necessary tool options for the 80C51RD+

    device and simplifies in this way the tool Configuration

    BUILDING PROJECTS AND CREATING A HEX FILES

    Typical, the tool settings under Options Target are all you need to start a

    new application. You may translate all source files and line the application with a

    click on the Build Target toolbar icon. When you build an application with syntax

    errors, Vision2 will display errors and warning messages in the Output

    Window Build page. A double click on a message line opens the source file on the

    correct location in a Vision2 editor window.

    Once you have successfully generated your application you can start debugging.

    After you have tested your application, it is required to create an Intel HEX

    file to download the software into an EPROM programmer or simulator. Vision2

    creates HEX files with each build process when Create HEX files under Options for

    Target Output is enabled. You may start your PROM programming utility after the

    make process when you specify the program under the option Run User Program #1.

    CPU SIMULATION

    Vision2 simulates up to 16 Mbytes of memory from which areas can be

    mapped for read, write, or code execution access. The Vision2 simulator traps and

    reports illegal memory accesses being done.

    In addition to memory mapping, the simulator also provides support for the

    integrated peripherals of the various 8051 derivatives. The on-chip peripherals of the

    CPU you have selected are configured from the Device

    DATABASE SELECTION

    56

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    57/59

    Power management for shopping mall with visitors counting

    You have made when you create your project target. Refer to page 58 for

    more Information about selecting a device. You may select and display the on-chip

    peripheral components using the Debug menu. You can also change the aspects of

    each peripheral using the controls in the dialog boxes.

    START DEBUGGING

    You start the debug mode of Vision2 with the Debug Start/Stop Debug

    Session command. Depending on the Options for Target Debug Configuration,

    Vision2 will load the application program and run the startup code Vision2 saves

    the editor screen layout and restores the screen layout of the last debug session. If the

    program execution stops, Vision2 opens an editor window with the source text or

    shows CPU instructions in the disassembly window. The next executable statement is

    marked with a yellow arrow. During debugging, most editor features are still

    available. For example, you can use the find command or correct program errors.

    Program source text of your application is shown in the same windows. The

    Vision2 debug mode differs from the edit mode in the following aspects:

    The Debug Menu and Debug Commands described on page 28 are

    Available. The additional debug windows are discussed in the following. The project

    structure or tool parameters cannot be modified. All build Commands are disabled.

    DISASSEMBLY WINDOW

    The Disassembly window shows your target program as mixed source and

    assembly program or just assembly code. A trace history of previously executed

    instructions may be displayed with Debug View Trace Records. To enable the trace

    history, set Debug Enable/Disable Trace Recording. If you select the Disassembly

    Window as the active window all program step commands work on CPU instructionlevel rather than program source lines. You can select a text line and set or modify

    code breakpoints using toolbar buttons or the context menu commands.

    C. EMBEDDED SYSTEM:

    57

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    58/59

    Power management for shopping mall with visitors counting

    An embedded system is a special-purpose system in which the computer is

    completely encapsulated by or dedicated to the device or system it controls. Unlike a

    general-purpose computer, such as a personal computer, an embedded system

    performs one or a few predefined tasks, usually with very specific requirements.

    Since the system is dedicated to specific tasks, design engineers can optimize it,

    reducing the size and cost of the product. Embedded systems are often mass-

    produced, benefiting from economies of scale.

    Personal digital assistants (PDAs) or handheld computers are generally considered

    embedded devices because of the nature of their hardware design, even though they

    are more expandable in software terms. This line of definition continues to blur as

    devices expand. With the introduction of the OQO Model 2 with the Windows XP

    operating system and ports such as a USB port both features usually belong to

    "general purpose computers", the line of nomenclature blurs even more.

    Physically, embedded systems ranges from portable devices such as digital watches

    and MP3 players, to large stationary installations like traffic lights, factory

    controllers, or the systems controlling nuclear power plants.

    In terms of complexity embedded systems can range from very simple with a single

    microcontroller chip, to very complex with multiple units, peripherals and networksmounted inside a large chassis or enclosure.

    Fig 9.2 Embedded System

    EXAMPLES OF EMBEDDED SYSTEMS:

    58

    Dept. of ECE,AITS,Hyd.

  • 8/2/2019 Final Doc2

    59/59

    Power management for shopping mall with visitors counting

    Avionics, such as inertial guidance systems, flight control hardware/software and

    other integrated systems in aircraft and missiles

    Cellular telephones and telephone switches

    Engine controllers and antilock brake controllers for automobilesHome automation products, such as thermostats, air conditioners, sprinklers, and

    security monitoring systems

    Handheld calculators

    Handheld computers

    Household appliances, including microwave ovens, washing machines, television

    sets, DVD players and recorders

    Medical equipmentPersonal digital assistant

    Videogame consoles

    Computer peripherals such as routers and printers.

    Industrial controllers for remote machine operation.