Smoke Detector Using Zigbee

Embed Size (px)

Citation preview

  • 7/28/2019 Smoke Detector Using Zigbee

    1/82

    1

    ORGANIZATIONAL PROFILE

    The National Small Industries Corporation Limited (NSIC) was established in

    1955 by the Government of India with a view to promote, aid and foster the growth of Small

    Industries in the country. NSIC continues to remain at the forefront, with it's various programs

    and projects, to assist the small-scale sector in the country.

    Over a period of four decades of this rescission, growth and development of

    small-scale sector, it has proved its strength within the country and abroad dynamically, showing

    its progressive attitude towards modernization, up gradation of technology, quality

    consciousness, strengthening linkages with large and medium scale enterprises and boosting

    exports of products from Small Enterprises. The small-scale sector continues to remain an

    important instrument for enterprise-building, dispersal of industries for even regional economic

    development and employment generation. NSIC has been successfully able to plan its assigned

    role in this endeavor.

    Due to changed industrial scenario and gradual globalization of the economy, small-scale

    sector has to face stiff competition as the insulated and protected market conditions are no more

    going to be available to it. To enable the small-scale industry to meet this challenge, NSIC has

    already initiated various steps so that SSI's can play their due role, even during polarization of

    various economic forces.

    A SPECTRUM OF ACTIVITIES

    NSIC provides diversified support through its wide spectrum of programs to TSC to cater

    to their different needs related to multi-products and multi-locations markets. It has adopted a

    multi-pronged approach to effectively serve the various needs of TSC. Assistance by NISC to

    Small Scale Units to sell their goods and services to government departments and agencies,

    through 'Single Point Registration Scheme', provides a vast marketing opportunity.

    The corporation also arranges indigenous as well as imported raw materials and parts

    to ensure that the production cycle of SSI's continues without break and they are able to produce

    high quality products. But that's not all. There is a lot more to NSIC. The organization operates

  • 7/28/2019 Smoke Detector Using Zigbee

    2/82

    2

    Hire purchase and Equipment Leasing Schemes for providing machinery and equipment at

    doorsteps of the entrepreneurs. These schemes not only have been able to generate a class of

    First Generation Entrepreneurs to set up enterprises with minimum investment, the schemes have

    also acted as stimulants to the existing entrepreneur for expansion, diversification, modernization

    and technology up gradation.

    Though a chain of five NSIC Technical Service Centers are located at different parts of

    the country, NSIC offers workshops, testing laboratories and common facilities to the

    entrepreneurs and their workmen are provided with avenues for skill up gradation through

    training in various technical trades. To encourage exports, NSIC has set up Software Technology

    Parks providing complete infrastructure to enable small entrepreneurs to undertake Software

    exports.

    ACTIVITIES

    Common facilities

    Prototype development

    Technology Transfer

    Human Resource DevelopmentPlacements

    Seminars and Workshops

    ASSISSTING COUNTRIES WORLDWIDE

    NSIC is committed to accelerate the growth of the small-scale sector not only in

    India but also in similar countries worldwide NSICs efforts in assisting other countries with

    infrastructure facilities and support service has been worthy.

  • 7/28/2019 Smoke Detector Using Zigbee

    3/82

    3

    .

    CHAPTER-1

    GENERAL OVERVIEW

  • 7/28/2019 Smoke Detector Using Zigbee

    4/82

    4

    GENERAL OVERVIEW

    1.1 INTRODUCTION:

    Technology is the word coined for the practical application of scientific knowledge in the industry.

    The advancement in technology cannot be justified unless it is used for leveraging the users

    purpose. Technology, is today, imbibed for accomplishment of several tasks of varied complexity,

    in almost all walks of life.

    The society as a whole is exquisitely dependent on science and technology.

    Technology has played a very significant role in improving the quality of life. One way through

    which this is done is by automating several tasks using complex logic to simplify the work.

    1.2 AIM:

    Vehicle access control system is an important sub-system of the intelligentized residence

    section. Today, in a growing emphasis on personal and property safety, the control of vehicles'

    access authorization and the management of the vehicles' access authority, access time and

    access method via computer, is safe and convenient. This paper describes a set of vehicle access

    control system based on ZigBee wireless technology. In this system, ZigBee coordinator and its

    terminal nodes installed respectively in the entrance of the district and the vehicles, together

    form a ZigBee wireless sensor network. This paper mainly introduces the overall structure,

    hardware platform and software design of this system. The implementation and performance

    tests of this system are fairly good.

  • 7/28/2019 Smoke Detector Using Zigbee

    5/82

    5

    1.3 METHODOLOGY:

    The above figure gives the pictorial representation of the procedure followed in the project

    development.

    In the specifications stage, the requirements of the model were identified. In order to

    identify the requirements, literature survey was carried out.

    The identified requirements and the specifications of the model were then analyzed to

    identify whether or not they were viable. If any of the specifications seemed impracticable, the

    specifications were reviewed.

    Once the viable specifications were identified, the design of the product was developed.

    A set of all possible test cases was also prepared simultaneously.

    Specifications Analysis ProductDesign

    TestCases

    High-level

    Desi n

    Low-level

    Desi n

    Coding &Unit

    Testing

    IntegrationSystem

    TestDocumentation

    TestDesign

    Successful

    Failure

  • 7/28/2019 Smoke Detector Using Zigbee

    6/82

    6

    The high level design document gives an overview of the design details.

    The low level design document contains the intricate details of the product design.

    The project was then divided into separate modules and each module was individually

    soldered, coded and tested.

    All the tested modules were then integrated. The integrated module was then tested for

    the set of all possible test cases. In case the integrated module didnt work fora certain test case, the

    specifications were reviewed accordingly.

    In general, after every stage in project development, the specifications were reviewed.

    After the integrated module satisfied all the test cases, different stages of the project were

    documented.

    1.4 SIGNIFICANCE OF PROJECT WORK:

    During the course of our project we developed a multi system controller that is capable of

    controlling devices that work on sensor supplies satisfactorily. We have developed a model that

    gives a demo of industrial automation.

  • 7/28/2019 Smoke Detector Using Zigbee

    7/82

    7

    CHAPTER-2

    INTRODUCTION

  • 7/28/2019 Smoke Detector Using Zigbee

    8/82

    8

    INTRODUCTION

    2.1 INTRODUCTION TO EMBEDDED SYSTEMS:

    2.1.1 EMBEDDED SYSTEMS:An embedded system is a specialized computer system that is housed in a large system in order to

    carry out certain specific applications. Some embedded systems include operating systems and most

    are so specialized such that the entire logic can be implemented as a single program.

    2.1.2 APPLICATIONS OF EMBEDDED SYSTEMS:

    Industrial machines Automobiles

    Medical equipment

    Cameras

    Household appliances

    Airplanes

    Vending machines

    Toys etc

    2.2INTRODUCTION TO ZIGBEE

    ZigBee coordinator(ZC): The most capable device, the coordinator forms the root of the

    network tree and might bridge to other networks. There is exactly one ZigBee coordinator in

    each network since it is the device that started the network originally. It is able to store

    information about the network, including acting as the Trust Centre & repository for security

    keys.

    ZigBee Router (ZR): As well as running an application function a router can act as an

    intermediate router, passing data from other devices.

    ZigBee End Device (ZED): Contains just enough functionality to talk to the parent node (either

    the coordinator or a router); it cannot relay data from other devices. This relationship allows the

    node to be asleep a significant amount of the time thereby giving long battery life. A ZED

  • 7/28/2019 Smoke Detector Using Zigbee

    9/82

    9

    requires the least amount of memory, and therefore can be less expensive to manufacture than a

    ZR or ZC.

    Protocols

    The protocols build on recent algorithmic research (Ad-hoc On-demand Distance Vector,

    neuRFon) to automatically construct a low-speed ad-hoc network of nodes. In most large

    network instances, the network will be a cluster of clusters. It can also form a mesh or a single

    cluster. The current profiles derived from the ZigBee protocols support beacon and non-beacon

    enabled networks.

    In non-beacon-enabled networks (those whose beacon order is 15), an unslotted CSMA/CA

    channel access mechanism is used. In this type of network, ZigBee Routers typically have their

    receivers continuously active, requiring a more robust power supply. However, this allows for

    heterogeneous networks in which some devices receive continuously, while others only transmit

    when an external stimulus is detected. The typical example of a heterogeneous network is a

    wireless light switch: the ZigBee node at the lamp may receive constantly, since it is connected

    to the mains supply, while a battery-powered light switch would remain asleep until the switch is

    thrown. The switch then wakes up, sends a command to the lamp, receives an acknowledgment,

    and returns to sleep. In such a network the lamp node will be at least a ZigBee Router, if not the

    ZigBee Coordinator; the switch node is typically a ZigBee End Device.

    In beacon-enabled networks, the special network nodes called ZigBee Routers transmit periodic

    beacons to confirm their presence to other network nodes. Nodes may sleep between beacons,

    thus lowering theirduty cycle and extending their battery life. Beacon intervals may range from

    15.36 milliseconds to 15.36 ms * 214 = 251.65824 seconds at 250 kbit/s, from 24 milliseconds to

    24 ms * 214 = 393.216 seconds at 40 kbit/s and from 48 milliseconds to 48 ms * 214 = 786.432

    seconds at 20 kbit/s. However, low duty cycle operation with long beacon intervals requires

    precise timing, which can conflict with the need for low product cost.

    http://en.wikipedia.org/wiki/AODVhttp://en.wikipedia.org/wiki/NeuRFonhttp://en.wikipedia.org/wiki/CSMA/CAhttp://en.wikipedia.org/wiki/Wireless_light_switchhttp://en.wikipedia.org/wiki/Duty_cyclehttp://en.wikipedia.org/wiki/Kbit/shttp://en.wikipedia.org/wiki/Kbit/shttp://en.wikipedia.org/wiki/Duty_cyclehttp://en.wikipedia.org/wiki/Wireless_light_switchhttp://en.wikipedia.org/wiki/CSMA/CAhttp://en.wikipedia.org/wiki/NeuRFonhttp://en.wikipedia.org/wiki/AODV
  • 7/28/2019 Smoke Detector Using Zigbee

    10/82

    10

    In general, the ZigBee protocols minimize the time the radio is on so as to reduce power use. In

    beaconing networks, nodes only need to be active while a beacon is being transmitted. In non-

    beacon-enabled networks, power consumption is decidedly asymmetrical: some devices are

    always active, while others spend most of their time sleeping.

    ZigBee devices are required to conform to the IEEE 802.15.4-2003 Low-Rate Wireless Personal

    Area Network (WPAN) standard. The standard specifies the lowerprotocol layersthe physical

    layer(PHY), and the medium access control (MAC) portion of the data link layer(DLL). This

    standard specifies operation in the unlicensed 2.4 GHz, 915 MHz and 868 MHz ISM bands. In

    the 2.4 GHz band there are 16 ZigBee channels, with each channel requiring 5 MHz of

    bandwidth. The center frequency for each channel can be calculated as, FC = (2405 + 5 * (ch -

    11)) MHz, where ch = 11, 12, ..., 26.

    The radios use direct-sequence spread spectrum coding, which is managed by the digital stream

    into the modulator. BPSK is used in the 868 and 915 MHz bands, and orthogonal QPSK that

    transmits two bits per symbol is used in the 2.4 GHz band. The raw, over-the-air data rate is 250

    kbit/sperchannel in the 2.4 GHz band, 40 kbit/s per channel in the 915 MHz band, and 20 kbit/s

    in the 868 MHz band. Transmission range is between 10 and 75(up to 1500meteres for zigbee

    pro.)meters (33 and 246 feet), although it is heavily dependent on the particular environment.

    The maximum output power of the radios is generally 0 dBm (1 mW).

    The basic channel access mode is "carrier sense, multiple access/collision avoidance"

    (CSMA/CA). That is, the nodes talk in the same way that people converse; they briefly check to

    see that no one is talking before they start. There are three notable exceptions to the use of

    CSMA. Beacons are sent on a fixed timing schedule, and do not use CSMA. Message

    acknowledgments also do not use CSMA. Finally, devices in Beacon Oriented networks that

    have low latency real-time requirements may also use Guaranteed Time Slots (GTS), which by

    definition do not use CSMA.

    http://en.wikipedia.org/wiki/Protocol_(computing)http://en.wikipedia.org/wiki/Layerhttp://en.wikipedia.org/wiki/Physical_layerhttp://en.wikipedia.org/wiki/Media_Access_Controlhttp://en.wikipedia.org/wiki/Data_link_layerhttp://en.wikipedia.org/wiki/Hertzhttp://en.wikipedia.org/wiki/Megahertzhttp://en.wikipedia.org/wiki/ISM_bandhttp://en.wikipedia.org/wiki/Hertzhttp://en.wikipedia.org/wiki/Megahertzhttp://en.wikipedia.org/wiki/Megahertzhttp://en.wikipedia.org/wiki/Direct-sequence_spread_spectrumhttp://en.wikipedia.org/wiki/BPSKhttp://en.wikipedia.org/wiki/QPSKhttp://en.wikipedia.org/wiki/Kilobithttp://en.wikipedia.org/wiki/Secondhttp://en.wikipedia.org/wiki/Channel_(communications)http://en.wikipedia.org/wiki/Meterhttp://en.wikipedia.org/wiki/Foot_(length)http://en.wikipedia.org/wiki/DBmhttp://en.wikipedia.org/wiki/Carrier_Sense_Multiple_Accesshttp://en.wikipedia.org/wiki/Carrier_Sense_Multiple_Accesshttp://en.wikipedia.org/wiki/DBmhttp://en.wikipedia.org/wiki/Foot_(length)http://en.wikipedia.org/wiki/Meterhttp://en.wikipedia.org/wiki/Channel_(communications)http://en.wikipedia.org/wiki/Secondhttp://en.wikipedia.org/wiki/Kilobithttp://en.wikipedia.org/wiki/QPSKhttp://en.wikipedia.org/wiki/BPSKhttp://en.wikipedia.org/wiki/Direct-sequence_spread_spectrumhttp://en.wikipedia.org/wiki/Megahertzhttp://en.wikipedia.org/wiki/Megahertzhttp://en.wikipedia.org/wiki/Hertzhttp://en.wikipedia.org/wiki/ISM_bandhttp://en.wikipedia.org/wiki/Megahertzhttp://en.wikipedia.org/wiki/Hertzhttp://en.wikipedia.org/wiki/Data_link_layerhttp://en.wikipedia.org/wiki/Media_Access_Controlhttp://en.wikipedia.org/wiki/Physical_layerhttp://en.wikipedia.org/wiki/Layerhttp://en.wikipedia.org/wiki/Protocol_(computing)
  • 7/28/2019 Smoke Detector Using Zigbee

    11/82

    11

    Software and Hardware

    The software is designed to be easy to develop on small, inexpensive microprocessors. The radio

    design used by ZigBee has been carefully optimized for low cost in large scale production. It has

    few analog stages and uses digital circuits wherever possible.

    Even though the radios themselves are inexpensive, the ZigBee Qualification Process involves a

    full validation of the requirements of the physical layer. This amount of concern about the

    Physical Layer has multiple benefits, since all radios derived from that semiconductor mask set

    would enjoy the same RF characteristics. On the other hand, an uncertified physical layer that

    malfunctions could cripple the battery lifespan of other devices on a ZigBee network. Where

    other protocols can mask poor sensitivity or other esoteric problems in a fade compensation

    response, ZigBee radios have very tight engineering constraints: they are both power and

    bandwidth constrained. Thus, radios are tested to the ISO 17025 standard with guidance given by

    Clause 6 of the 802.15.4-2006 Standard. Most vendors plan to integrate the radio and

    microcontroller onto a single chip.

    Controversy

    An academic research group has examined the Zigbee address formation algorithm in the 2006

    specification, and argues[6] that the network will isolate many units that could be connected. The

    group proposed an alternative algorithm with similar complexity in time and space.

    A white paperpublished by a European manufacturing group (associated with the development

    of a competing standard, Z-Wave) claims that wireless technologies such as ZigBee, which

    operate in the 2.4 GHz RF band, are subject to significant interference - enough to make them

    unusable.[7] It claims that this is due to the presence of other wireless technologies like Wireless

    LAN in the same RF band. The ZigBee Alliance released a white paper refuting these claims.[8]

    After a technical analysis, this paper concludes that ZigBee devices continue to communicate

    effectively and robustly even in the presence of large amounts of interference.

    http://en.wikipedia.org/wiki/Analog_circuithttp://en.wikipedia.org/wiki/Digital_circuithttp://en.wikipedia.org/wiki/ISO_17025http://en.wikipedia.org/wiki/ZigBee#cite_note-5#cite_note-5http://en.wikipedia.org/wiki/White_paperhttp://en.wikipedia.org/wiki/Z-Wavehttp://en.wikipedia.org/wiki/ZigBee#cite_note-Zig_WLAN_Interference-6#cite_note-Zig_WLAN_Interference-6http://en.wikipedia.org/wiki/Wireless_LANhttp://en.wikipedia.org/wiki/Wireless_LANhttp://en.wikipedia.org/wiki/ZigBee#cite_note-Zig_WLAN_Interference_Refute-7#cite_note-Zig_WLAN_Interference_Refute-7http://en.wikipedia.org/wiki/ZigBee#cite_note-Zig_WLAN_Interference_Refute-7#cite_note-Zig_WLAN_Interference_Refute-7http://en.wikipedia.org/wiki/Wireless_LANhttp://en.wikipedia.org/wiki/Wireless_LANhttp://en.wikipedia.org/wiki/ZigBee#cite_note-Zig_WLAN_Interference-6#cite_note-Zig_WLAN_Interference-6http://en.wikipedia.org/wiki/Z-Wavehttp://en.wikipedia.org/wiki/White_paperhttp://en.wikipedia.org/wiki/ZigBee#cite_note-5#cite_note-5http://en.wikipedia.org/wiki/ISO_17025http://en.wikipedia.org/wiki/Digital_circuithttp://en.wikipedia.org/wiki/Analog_circuit
  • 7/28/2019 Smoke Detector Using Zigbee

    12/82

    12

    .Advantages:

    low cost allows the technology to be widely deployed in wireless control and monitoring

    applications.

    low power-usage allows longer life with smaller batteries,.

    mesh networking provides high reliability and larger range.

    Applications:

    Home Automation

    ZigBee Smart Energy

    Telecommunication Applications

    Personal Home

    Hospital Care

  • 7/28/2019 Smoke Detector Using Zigbee

    13/82

    13

    CHAPTER-3

    MICROCONTROLLER

  • 7/28/2019 Smoke Detector Using Zigbee

    14/82

    14

    MICROCONTROLLER

    3.1 INTRODUCTION:

    A microcontroller is a computer on a chip. It is an integrated chip that is usually a part of an

    embedded system. It is a microprocessor that is meant to be more self contained, independent andyet function as a tiny, dedicated computer. It lays emphasis on high integration, low power

    consumption, self sufficiency and cost effectiveness.

    It is typically designed using the CMOS (complementary metal oxide semiconductor) technology

    and has the following features:

    a central processing unit

    discrete input and output pins

    serial input/output ports(UARTs)

    peripherals such as timers, counters

    RAM,ROM,EPROM,Flash Memory(EEPROM)

    Clock generator

    May include analog to digital converters

    In-circuit programming and debugging support

    Micro controller

    Memory

    (RAM/ROM)

    I/O ports

    Peripherals

  • 7/28/2019 Smoke Detector Using Zigbee

    15/82

    15

    3.2 ADVANTAGES:

    Design with microcontrollers has the following advantages:

    It has low overall system cost as all the peripherals are integrated onto a single chip.

    The product size is small, therefore the product is handy.

    System design and troubleshooting is simple.

    Since the peripherals are integrated on the same chip, the system is reliable.

    Additional RAM and ROM can be easily interfaced as and when required.

    Microcontrollers with on-chip ROM provides a software security feature.

    3.3 ATMEL 89S52:

    ATMEL 89C51 is a low power, high performance CMOS 8 bit microcomputer with 4K bytes of

    flash programmable and erasable read only memory (PEROM).The device is manufactured using

    Atmels high density, non volatile memory technology and is compatible with industry standard

    MCS-51 instruction set. It provides highly flexible and cost effective solution to many embedded

    control applications.

    3.4 FEATURES OF ATMEL 89S52:

    It has 4K bytes of in-system reprogrammable flash memory (1000 write/erase cycles).

    Fully static operation: 0-24 MHz

    Three level program memory lock

    128 bytes internal RAM

    32 programmable I/O lines(4 ports)

    Two 16 bit timers/counters

    Six interrupt sources

    Programmable serial channel

    Low power idle and Power down modes

    8 bit CPU optimized for controlled applications

    64 K of external program memory

    Full duplex UART

  • 7/28/2019 Smoke Detector Using Zigbee

    16/82

    16

    3.5 BLOCK DIAGRAM OF THE MICROCONTROLLER:

    Fig 3.5 Block Diagram of the Microcontroller

  • 7/28/2019 Smoke Detector Using Zigbee

    17/82

    17

    3.6 DESCRIPTION OF BLOCK DIAGRAM:

    3.6.1 CENTRAL PROCESSING UNIT (CPU):The microcontroller consists of 8 bit ALU with associated registers like register A,

    register B,Program status word(PSW),Stack pointer(SP) ,a 16 bit program counter(PC) and a 16 bit

    data pointer register(DTPR).

    3.6.2ARITHMETIC LOGIC UNIT(ALU):

    The ALU performs arithmetic and logic functions on 8 bit variables. An important and unique

    feature of the microcontroller architecture is that theALU can manipulate 1 bit as well as 8 bit data

    types. It performs the Operations over the operands held by the temporary registers TMP1 and

    TMP2.The temporary registers cannot be accessed by the user.

    3.6.3 ACCUMULATOR (ACC):

    It is referred to as register A or Acc.It is an 8 bit register. It holds the source

    operand and stores the result of arithmetic operations. It is used as the source or destination register

    for logical operations. It is either explicitly or implicitly specified in the instructions.

    3.6.4 B REGISTER:

    It is a special function register. It can be used to store one of the operands in multiply

    and divide instructions. For all other instructions it is used as a scratch pad.

    3.6.5 PROGRAM STATUS WORD (PSW):

    It is one of the special function registers .It is an 8 bit register. It is a set of

    Flags that indicate the status of the microcontroller.

    CARRY BIT (CY):

    This bit holds the carry bit in case of arithmetic operations. It also serves the purpose of

    accumulator in case of Boolean operations. It is set to one when there is a carry out from the D7 bit.

    It can also be rest or cleared through instructions.

    CY AC FO RS1 RS0 OV -- P

  • 7/28/2019 Smoke Detector Using Zigbee

    18/82

    18

    AUXILLARY CARRY (AC):

    It is used in BCD operations usually. This bit is raised when a carry occurs from lower nibble to the

    higher nibble during arithmetic operations on BCD numbers.

    FLAG 0 (F0):Flag 0 is available to the user for general purpose.

    REGISTER SELECT BITS (RS1 AND RS0):

    The two bits RS1 and RS0 are used to select one of the four available register banks

    As below:

    OVERFLOW FLAG (OF):

    The overflow flag was created specifically for the purpose of informing the programmer that the

    result of the signed number operation is erroneous. If the result of an operation on signed numbers

    is too big for a register, an overflow has occurred and the programmer must be notified.

    PARITY (P):

    The parity bit reflects the number of 1s in the accumulator.

    P=0 implies that accumulator contains an even number of 1s.

    P=1 implies that the accumulator contains odd number of 1s.

    D1 bit is a user definable flag and is reserved for future use.

    3.5.6 SPECIAL FUNCTION REGISTER BANK (SFR):

    It is a set of special function registers that can be addressed using their respective addresses

    allotted to them. The addresses lie in the range 80H-FFH.

    RS1 RS0 REGISTER BANKS ADDRESS

    0 0 0 00H-07H

    0 1 1 08H-0FH

    1 0 2 10H-17H

    1 1 3 18H-1FH

  • 7/28/2019 Smoke Detector Using Zigbee

    19/82

    19

    3.5.7 INPUT-OUTPUT (I/O) PORTS (P0-P3):

    These four latches-drivers pairs have been allotted to the four parallel I/O ports. These latches have

    been allotted addresses in the special function register bank. Using these allotted addresses, the user

    can communicate with the ports.

    3.5.8 BUFFER:

    It is a special function register and consists of two registers namely transmit buffer and the

    receive buffer. The transmit buffer receives data parallely and transmits serially. The receive buffer

    on the other hand is serial in parallel out register.

    3.5.9 TIMING AND CONTROL UNIT:

    It derives the timing and control information required for the internal operation of the circuit

    and the control information required for controlling the external bus.

    3.5.10 OSCILLATOR:

    It generates the basic timing clock signal required for the operation of the circuit using a

    crystal oscillator connected externally.

    3.5.11 EPROM AND PROGRAM ADDRESS REGISTER:

    These blocks provide on chip EPROM and a mechanism to internally address the EPROM.

    3.5.12 RAM AND RAM ADDRESS REGISTER:

    They provide 128 bytes of RAM and a mechanism to internally address the RAM

  • 7/28/2019 Smoke Detector Using Zigbee

    20/82

    20

    3.6 PIN DESCRIPTION OF AT89S52:

    3.7 Pin Description

    3.7.1VCC (PIN 40)

    Supply voltage.

    3.7.2 GND (PIN 20)

    Ground.

    3.7.3 Port 0 (PIN 32-39)

    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 and outputs the code bytes dur-ing program verification.

    External pull-ups are required during program verification.

    3.7.4 Port 1 (PIN 1-8)

    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 inter-

    nal pull-ups and can be used as inputs. As inputs, Port 1 pins that are externally being pulled low

  • 7/28/2019 Smoke Detector Using Zigbee

    21/82

    21

    will source current (IIL) because of the internal pull-ups. In addition, P1.0 and P1.1 can be

    configured to be the timer/counter 2 external count input (P1.0/T2) and the timer/counter 2 trigger

    input (P1.1/T2EX), respectively, as shown in the following table. Port 1 also receives the low-order

    address bytes during Flash programming and verification.

    3.7.5 Port 2 (PIN 21-28)

    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 emits the high-order address byte during

    fetches from external program memory and during accesses to external data memory that use 16-bit

    addresses (MOVX @ DPTR). In this application, Port 2 uses strong internal pull-ups when emitting

    1s. During accesses to external data memory that use 8-bit addresses (MOVX @ RI), Port 2 emits

    the contents of the P2 Special Function Register. Port 2 also receives the high-order address bits

    and some control signals during Flash program-ming and verification. Port Pin Alternate Functions

    P1.0 T2 (external count input to Timer/Counter 2), clock-out P1.1 T2EX (Timer/Counter 2

    capture/reload trigger and direction control) P1.5 MOSI (used for In-System Programming) P1.6

    MISO (used for In-System Programming) P1.7 SCK (used for In-System Programming)

    3.7.6 Port 3 (PIN 10-17)

    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

    AT89S52, as shown in the following table.

    3.7.7 RST (PIN 9)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.

    3.7.8 ALE/PROG (PIN 30)

  • 7/28/2019 Smoke Detector Using Zigbee

    22/82

    22

    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. 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. Port Pin Alternate FunctionsP3.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) P3.6 WR

    (external data memory write strobe) P3.7 RD (external data memory read strobe)

    3.7.9 PSEN (PIN 29)

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

    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 exter-nal data memory.

    3.7.10 EA/VPP (PIN 31)

    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.

    3.7.11 XTAL1 (PIN 19)

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

    3.7.12 XTAL2 (PIN 18)

    Output from the inverting oscillator amplifier.

  • 7/28/2019 Smoke Detector Using Zigbee

    23/82

    23

    CHAPTER-4

    GAS SENSOR

  • 7/28/2019 Smoke Detector Using Zigbee

    24/82

    24

    GAS SENSOR

    INTRODUCTION:

    A CO gas sensor according to the present invention includes a gas collecting container for

    collecting a measured gas therein; a detecting section provided within the gas collecting

    container and having at least a pair of electrodes positioned through electrolyte; and a voltage

    applying apparatus for applying voltage to the detecting section. One of the electrodes of the

    detecting section is a detection electrode having the capability of adsorbing at least one of

    hydrogenous gas and CO gas when a voltage is applied and then oxidizing it. By introducing a

    measured gas into a gas collecting container of the CO gas sensor and carrying out electrolysis

    according to a potential sweep method or a pulse method with the measured gas being in contact

    with the detecting section, a CO gas concentration in the measured gas can be measured based on

    an electrical current value obtained at the detecting section and changes of the electrical current

    with elapse of time. According to the CO gas sensor of the present invention, it is possible to

    accurately carry out detection and measurement of the concentration of CO gas when CO gas is

    to be detected or measured even in a gaseous atmosphere containing a relatively large amount of

    hydrogen gas and CO2 gas.

    DESCRIPTION:

    FIELD OF THE INVENTION

    The present invention relates to a CO gas sensor for measuring the concentration of CO gas

    contained in a gaseous phase and to a method of measuring the concentration of CO gas, and in

    particular relates to a CO gas sensor for measuring the concentration of CO gas in a gaseous

    atmosphere containing relatively high concentrations of hydrogen gas and carbon dioxide gas, afuel cell power generating apparatus equipped with such CO gas sensor, and a method of

    measuring the concentration of CO gas.

  • 7/28/2019 Smoke Detector Using Zigbee

    25/82

    25

    BACKGROUND ART

    In many cases, hydrogen gas is used as a fuel gas for fuel cells. As such hydrogen gas, a

    hydrogen gas rich reforming gas which is obtained by reforming methanol or the like is used.

    When manufacturing such a reforming gas, a tiny amount of carbon monoxide (CO), namely

    several tens ppm to several hundred ppm, is present as impurities. For this reason, when such a

    reforming gas is used as a fuel gas for a fuel cell, the CO gas is adsorbed on the surface of the

    platinum catalyst of the fuel cell electrodes, thus hindering ionization of the hydrogen gas and

    lowering the output of the fuel cell. In order to take appropriate measures to counter such a

    problem caused by the CO gas, it is necessary to continuously monitor the concentration of CO

    gas in the reforming gas used in the fuel cell.

    Conventionally, as for the most commonly used CO gas sensor, there are known a controlled

    potential analysis type CO gas sensor and a semiconductor type CO gas sensor. However, for the

    reasons given below, neither of these CO gas sensors is appropriate for detecting CO gas in a

    reforming gas.

    Namely, the reforming gas contains hydrogen gas used as a fuel in the fuel cell for the amount of

    about 75% thereof. In comparison with this, the reforming gas contains a relatively tiny amount

    of CO gas as described above. Therefore, it becomes necessary to detect or measure CO gas in a

    hydrogen gas atmosphere containing a relatively large amount of hydrogen gas. However, in the

    case where the concentration of CO gas is measured in such a hydrogen gas rich atmosphere

    using these CO gas sensors, there is a problem that it is difficult to accurately detect (qualitative

    analysis) or measure (quantitative analysis) such CO gas with either type of CO gas sensor due to

    influence of the hydrogen gas rich atmosphere in which interference by hydrogen gas occurs.

    In view of the problem mentioned above, it is an object of the present invention to provide a CO

    gas sensor which can accurately carry out detection (qualitative analysis) and measurement

    (quantitative analysis) of the concentration of CO gas when CO gas is detected or measured in a

    gaseous atmosphere containing a relatively large amount of hydrogen gas and carbon dioxide

    gas, a fuel cell power generating apparatus equipped with such a CO gas sensor, and a method of

    measuring the concentration of CO gas.

  • 7/28/2019 Smoke Detector Using Zigbee

    26/82

    26

    CHAPTER-5

    Relay

  • 7/28/2019 Smoke Detector Using Zigbee

    27/82

  • 7/28/2019 Smoke Detector Using Zigbee

    28/82

    28

    diode inside the relay case. Alternatively a contact protection network, consisting of a capacitor

    and resistor in series, may absorb the surge. If the coil is designed to be energized with AC, a

    small copper ring can be crimped to the end of the solenoid. This "shading ring" creates a small

    out-of-phase current, which increases the minimum pull on the armature during the AC cycle.[1]

    By analogy with the functions of the original electromagnetic device, a solid-state relay is made

    with a thyristor or other solid-state switching device. To achieve electrical isolation an

    optocouplercan be used which is a light-emitting diode (LED) coupled with a photo transistor.

    Types of relay

    Latching relay

    A latching relay has two relaxed states (bistable). These are also called 'keep' or 'stay' relays.

    When the current is switched off, the relay remains in its last state. This is achieved with a

    solenoid operating a ratchet and cam mechanism, or by having two opposing coils with an over-

    center spring or permanent magnet to hold the armature and contacts in position while the coil is

    relaxed, or with a remnant core. In the ratchet and cam example, the first pulse to the coil turns

    the relay on and the second pulse turns it off. In the two coil example, a pulse to one coil turns

    the relay on and a pulse to the opposite coil turns the relay off. This type of relay has the

    advantage that it consumes power only for an instant, while it is being switched, and it retains its

    last setting across a power outage. Reed relay

    A reed relay has a set of contacts inside a vacuum orinert gas filled glass tube, which protects

    the contacts against atmospheric corrosion. The contacts are closed by a magnetic field generated

    when current passes through a coil around the glass tube. Reed relays are capable of faster

    switching speeds than larger types of relays, but have low switch current and voltage ratings. See

    also reed switch.

    Mercury-wetted relay

    A mercury-wetted reed relay is a form of reed relay in which the contacts are wetted with

    mercury. Such relays are used to switch low-voltage signals (one volt or less) because of its low

    contact resistance, or for high-speed counting and timing applications where the mercury

    eliminates contact bounce. Mercury wetted relays are position-sensitive and must be mounted

    http://en.wikipedia.org/wiki/Relay#cite_note-0#cite_note-0http://en.wikipedia.org/wiki/Thyristorhttp://en.wikipedia.org/wiki/Optocouplerhttp://en.wikipedia.org/wiki/Light-emitting_diodehttp://en.wikipedia.org/wiki/Solenoidhttp://en.wikipedia.org/wiki/Reed_relayhttp://en.wikipedia.org/wiki/Vacuumhttp://en.wikipedia.org/wiki/Inert_gashttp://en.wikipedia.org/wiki/Corrosionhttp://en.wikipedia.org/wiki/Coilhttp://en.wikipedia.org/wiki/Reed_switchhttp://en.wikipedia.org/wiki/Mercury_(element)http://en.wikipedia.org/wiki/Mercury_(element)http://en.wikipedia.org/wiki/Reed_switchhttp://en.wikipedia.org/wiki/Coilhttp://en.wikipedia.org/wiki/Corrosionhttp://en.wikipedia.org/wiki/Inert_gashttp://en.wikipedia.org/wiki/Vacuumhttp://en.wikipedia.org/wiki/Reed_relayhttp://en.wikipedia.org/wiki/Solenoidhttp://en.wikipedia.org/wiki/Light-emitting_diodehttp://en.wikipedia.org/wiki/Optocouplerhttp://en.wikipedia.org/wiki/Thyristorhttp://en.wikipedia.org/wiki/Relay#cite_note-0#cite_note-0
  • 7/28/2019 Smoke Detector Using Zigbee

    29/82

    29

    vertically to work properly. Because of the toxicity and expense of liquid mercury, these relays

    are rarely specified for new equipment. See also mercury switch.

    Polarized relay

    A Polarized Relay placed the armature between the poles of a permanent magnet to increase

    sensitivity. Polarized relays were used in middle 20th Century telephone exchanges to detect

    faint pulses and correct telegraphic distortion. The poles were on screws, so a technician could

    first adjust them for maximum sensitivity and then apply a bias spring to set the critical current

    that would operate the relay.

    Machine tool relay

    A machine tool relay is a type standardized for industrial control of machine tools, transfer

    machines, and other sequential control. They are characterized by a large number of contacts

    (sometimes extendable in the field) which are easily converted from normally-open to normally-

    closed status, easily replaceable coils, and a form factor that allows compactly installing many

    relays in a control panel. Although such relays once were the backbone of automation in such

    industries as automobile assembly, the programmable logic controller (PLC) mostly displaced

    the machine tool relay from sequential control applications.

    Contactor relay

    A contactor is a very heavy-duty relay used for switching electric motors and lighting loads.

    High-current contacts are made with alloys containing silver. The unavoidable arcing causes thecontacts to oxidize and silver oxide is still a good conductor. Such devices are often used for

    motor starters. A motor starter is a contactor with overload protection devices attached. The

    overload sensing devices are a form of heat operated relay where a coil heats a bi-metal strip, or

    where a solder pot melts, releasing a spring to operate auxiliary contacts. These auxiliary

    contacts are in series with the coil. If the overload senses excess current in the load, the coil is

    de-energized. Contactor relays can be extremely loud to operate, making them unfit for use

    where noise is a chief concern.

    Solid-state relay

    Solid state relay, which has no moving parts 25 amp or 40 amp solid state contactors

    A solid state relay (SSR) is a solid state electronic component that provides a similar function to

    an electromechanical relay but does not have any moving components, increasing long-term

    reliability. With early SSR's, the tradeoff came from the fact that every transistor has a small

    http://en.wikipedia.org/wiki/Mercury_switchhttp://en.wikipedia.org/wiki/Crossbar_switchhttp://en.wikipedia.org/wiki/Form_factorhttp://en.wikipedia.org/wiki/Programmable_logic_controllerhttp://en.wikipedia.org/wiki/Contactorhttp://en.wikipedia.org/wiki/Electric_motorhttp://en.wikipedia.org/wiki/Silverhttp://en.wikipedia.org/wiki/Solid_state_(electronics)http://en.wikipedia.org/wiki/Solid_state_relayhttp://en.wikipedia.org/wiki/Solid_state_(electronics)http://en.wikipedia.org/wiki/Electromechanicalhttp://en.wikipedia.org/wiki/Electromechanicalhttp://en.wikipedia.org/wiki/Solid_state_(electronics)http://en.wikipedia.org/wiki/Solid_state_relayhttp://en.wikipedia.org/wiki/Solid_state_(electronics)http://en.wikipedia.org/wiki/Silverhttp://en.wikipedia.org/wiki/Electric_motorhttp://en.wikipedia.org/wiki/Contactorhttp://en.wikipedia.org/wiki/Programmable_logic_controllerhttp://en.wikipedia.org/wiki/Form_factorhttp://en.wikipedia.org/wiki/Crossbar_switchhttp://en.wikipedia.org/wiki/Mercury_switch
  • 7/28/2019 Smoke Detector Using Zigbee

    30/82

    30

    voltage drop across it. This voltage drop limited the amount of current a given SSR could handle.

    As transistors improved, higher current SSR's, able to handle 100 to 1,200 amps, have become

    commercially available. Compared to electromagnetic relays, they may be falsely triggered by

    transients.

    Solid state contactor relay

    A solid state contactor is a very heavy-duty solid state relay, including the necessary heat sink,

    used for switching electric heaters, small electric motors and lighting loads; where frequent

    on/off cycles are required. There are no moving parts to wear out and there is no contact bounce

    due to vibration. They are activated by AC control signals or DC control signals from

    Programmable logic controller (PLCs), PCs, Transistor-transistor logic (TTL) sources, or other

    microprocessor controls.

    Buchholz relay

    A Buchholz relay is a safety device sensing the accumulation of gas in large oil-filled

    transformers, which will alarm on slow accumulation of gas or shut down the transformer if gas

    is produced rapidly in the transformer oil.

    Forced-guided contacts relay

    A forced-guided contacts relay has relay contacts that are mechanically linked together, so that

    when the relay coil is energized or de-energized, all of the linked contacts move together. If one

    set of contacts in the relay becomes immobilized, no other contact of the same relay will be ableto move. The function of forced-guided contacts is to enable the safety circuit to check the status

    of the relay. Forced-guided contacts are also known as "positive-guided contacts", "captive

    contacts", "locked contacts", or "safety relays".

    Overload protection relay

    One type ofelectric motoroverload protection relay is operated by a heating element in series

    with the electric motor . The heat generated by the motor current operates a bi-metal strip or

    melts solder, releasing a spring to operate contacts. Where the overload relay is exposed to the

    same environment as the motor, a useful though crude compensation for motor ambient

    temperature is provided.

    http://en.wikipedia.org/wiki/Ampshttp://en.wikipedia.org/wiki/Electric_motorhttp://en.wikipedia.org/wiki/Programmable_logic_controllerhttp://en.wikipedia.org/wiki/Transistor-transistor_logichttp://en.wikipedia.org/wiki/Buchholz_relayhttp://en.wikipedia.org/wiki/Transformerhttp://en.wikipedia.org/wiki/Electric_motorhttp://en.wikipedia.org/wiki/Electric_motorhttp://en.wikipedia.org/wiki/Solderhttp://en.wikipedia.org/wiki/Solderhttp://en.wikipedia.org/wiki/Electric_motorhttp://en.wikipedia.org/wiki/Electric_motorhttp://en.wikipedia.org/wiki/Transformerhttp://en.wikipedia.org/wiki/Buchholz_relayhttp://en.wikipedia.org/wiki/Transistor-transistor_logichttp://en.wikipedia.org/wiki/Programmable_logic_controllerhttp://en.wikipedia.org/wiki/Electric_motorhttp://en.wikipedia.org/wiki/Amps
  • 7/28/2019 Smoke Detector Using Zigbee

    31/82

    31

    CHAPTER-6DESIGN AND IMPLEMENTATION

    LIST OF COMPONENTS

  • 7/28/2019 Smoke Detector Using Zigbee

    32/82

    32

    6.1 DESIGN AND IMPLEMENTATION

    .Power supply circuit supplies +5V DC to all the passive components like resistors, capacitors,

    IC and Microcontrollers.

    BLOCK DIAGRAM

    MICRO

    CONTROLLER

    PORER

    SUPPLY

  • 7/28/2019 Smoke Detector Using Zigbee

    33/82

  • 7/28/2019 Smoke Detector Using Zigbee

    34/82

  • 7/28/2019 Smoke Detector Using Zigbee

    35/82

    35

    (v) Capacitors in Series

    Fig 6.7: Capacitors in series

    When capacitors are connected in series (figure 5) their combined resistance is less than any of

    the individual capacitances. There is a special equation for the combined capacitance of two

    capacitors C1 and C2:

    C = (C1C2)/(C1+C2)

    6.3. RESISTORS

    Fig 6.8: Resistors

    Type : passive

    Electronic symbol : (Europe)

    (US)

    http://en.wikipedia.org/wiki/Electronic_symbolhttp://en.wikipedia.org/wiki/File:Resistor_symbol_America.svghttp://en.wikipedia.org/wiki/File:Resistor_symbol_Europe.svghttp://en.wikipedia.org/wiki/File:3_Resistors.jpghttp://en.wikipedia.org/wiki/File:Resistor_symbol_America.svghttp://en.wikipedia.org/wiki/File:Resistor_symbol_Europe.svghttp://en.wikipedia.org/wiki/File:3_Resistors.jpghttp://en.wikipedia.org/wiki/File:Resistor_symbol_America.svghttp://en.wikipedia.org/wiki/File:Resistor_symbol_Europe.svghttp://en.wikipedia.org/wiki/File:3_Resistors.jpghttp://en.wikipedia.org/wiki/File:Resistor_symbol_America.svghttp://en.wikipedia.org/wiki/File:Resistor_symbol_Europe.svghttp://en.wikipedia.org/wiki/File:3_Resistors.jpghttp://en.wikipedia.org/wiki/Electronic_symbol
  • 7/28/2019 Smoke Detector Using Zigbee

    36/82

    36

    A resistor is a two-terminal electronic component that produces a voltage across its

    terminals that is proportional to the electric current through it in accordance with Ohm's law:

    V = IR

    Resistors are elements of electrical networks and electronic circuits. The primary

    characteristics of a resistor are the resistance, the tolerance, maximum working voltage and the

    powerrating. Other characteristics include temperature coefficient, noise, and inductance.

    http://en.wikipedia.org/wiki/Terminal_%28electronics%29http://en.wikipedia.org/wiki/Electronic_componenthttp://en.wikipedia.org/wiki/Voltagehttp://en.wikipedia.org/wiki/Proportionality_%28mathematics%29#Direct_proportionhttp://en.wikipedia.org/wiki/Electric_currenthttp://en.wikipedia.org/wiki/Ohm%27s_lawhttp://en.wikipedia.org/wiki/Electrical_networkshttp://en.wikipedia.org/wiki/Electrical_resistancehttp://en.wikipedia.org/wiki/Engineering_tolerance#Electrical_component_tolerancehttp://en.wikipedia.org/wiki/Electric_power#In_circuitshttp://en.wikipedia.org/wiki/Temperature_coefficienthttp://en.wikipedia.org/wiki/Electrical_noisehttp://en.wikipedia.org/wiki/Inductancehttp://en.wikipedia.org/wiki/Inductancehttp://en.wikipedia.org/wiki/Electrical_noisehttp://en.wikipedia.org/wiki/Temperature_coefficienthttp://en.wikipedia.org/wiki/Electric_power#In_circuitshttp://en.wikipedia.org/wiki/Engineering_tolerance#Electrical_component_tolerancehttp://en.wikipedia.org/wiki/Electrical_resistancehttp://en.wikipedia.org/wiki/Electrical_networkshttp://en.wikipedia.org/wiki/Ohm%27s_lawhttp://en.wikipedia.org/wiki/Electric_currenthttp://en.wikipedia.org/wiki/Proportionality_%28mathematics%29#Direct_proportionhttp://en.wikipedia.org/wiki/Voltagehttp://en.wikipedia.org/wiki/Electronic_componenthttp://en.wikipedia.org/wiki/Terminal_%28electronics%29
  • 7/28/2019 Smoke Detector Using Zigbee

    37/82

    37

    CHAPTER-7

    LCD

  • 7/28/2019 Smoke Detector Using Zigbee

    38/82

    38

    LCD INTERFACING

    Introduction

    The most commonly used Character based LCDs are based on Hitachi's

    HD44780 controller or other which are compatible with HD44580. In this

    tutorial, we will discuss about character based LCDs, their interfacing

    with various microcontrollers, various interfaces (8-bit/4-bit),

    programming, special stuff and tricks you can do with these simple

    looking LCDs which can give a new look to your application.

    Pin Description

    The most commonly used LCDs found in the market today are 1 Line, 2

    Line or 4 Line LCDs which have only 1 controller and support at most of

    80 characters, whereas LCDs supporting more than 80 characters make

    use of 2 HD44780 controllers.

    Most LCDs with 1 controller has 14 Pins and LCDs with 2 controller has

    16 Pins (two pins are extra in both for back-light LED connections). Pindescription is shown in the table below.

    Pin No. Name Description

    Pin no. 1 VSS Power supply (GND)

    Pin no. 2 VCC Power supply (+5V)

    Pin no. 3 VEE Contrast adjust

    Pin no. 4 RS

    0 = Instruction input

    1 = Data input

    Pin no. 5 R/W0 = Write to LCD module

    1 = Read from LCD module

    Pin no. 6 EN Enable signal

    Pin no. 7 D0 Data bus line 0 (LSB)

    Pin no. 8 D1 Data bus line 1

  • 7/28/2019 Smoke Detector Using Zigbee

    39/82

    39

    Pin no. 9 D2 Data bus line 2

    Pin no. 10 D3 Data bus line 3

    Pin no. 11 D4 Data bus line 4

    Pin no. 12 D5 Data bus line 5

    Pin no. 13 D6 Data bus line 6

    Pin no. 14 D7 Data bus line 7 (MSB)

    DDRAM - Display Data RAM

    Display data RAM (DDRAM) stores display data represented in 8-bit

    character codes. Its extended capacity is 80 X 8 bits, or 80 characters.

    The area in display data RAM (DDRAM) that is not used for display can

    be used as general data RAM. So whatever you send on the DDRAM is

    actually displayed on the LCD. For LCDs like 1x16, only 16 characters

    are visible, so whatever you write after 16 chars is written in DDRAM but

    is not visible to the user.

    CGROM - Character Generator ROM

    Now you might be thinking that when you send an ASCII value to

    DDRAM, how the character is displayed on LCD? So the answer is

    CGROM. The character generator ROM generates 5 x 8 dot or 5 x 10 dot

    character patterns from 8-bit character codes (see Figure 5 and Figure 6

    for more details). It can generate 208 5 x 8 dot character patterns and 32

    5 x 10 dot character patterns. User defined character patterns are also

    available by mask-programmed ROM.

    As you can see in both the code maps, the character code from 0x00 to

    0x07 is occupied by the CGRAM characters or the user defined

    characters. If user wants to display the fourth custom character then the

    code to display it is 0x03 i.e. when user sends 0x03 code to the LCD

    http://www.8051projects.net/lcd-interfacing/basics.phphttp://www.8051projects.net/lcd-interfacing/basics.phphttp://www.8051projects.net/lcd-interfacing/basics.phphttp://www.8051projects.net/lcd-interfacing/basics.phphttp://www.8051projects.net/lcd-interfacing/basics.phphttp://www.8051projects.net/lcd-interfacing/basics.php
  • 7/28/2019 Smoke Detector Using Zigbee

    40/82

    40

    DDRAM then the fourth user created character or pattern will be

    displayed on the LCD.

    CGRAM - Character Generator RAM

    As clear from the name, CGRAM area is used to create customcharacters in LCD. In the character generator RAM, the user can rewrite

    character patterns by program. For 5 x 8 dots, eight character patterns

    can be written, and for 5 x 10 dots, four character patterns can be

    written.

    BF - Busy Flag

    Busy Flag is a status indicator flag for LCD. When we send a command

    or data to the LCD for processing, this flag is set (i.e. BF =1) and as soon

    as the instruction is executed successfully this flag is cleared (BF = 0).

    This is helpful in producing and exact amount of delay for the LCD

    processing.

    To read Busy Flag, the condition RS = 0 and R/W = 1 must be met and

    The MSB of the LCD data bus (D7) act as busy flag. When BF = 1 means

    LCD is busy and will not accept next command or data and BF = 0

    means LCD is ready for the next command or data to process.

    Instruction Register (IR) and Data Register (DR)

    There are two 8-bit registers in HD44780 controller Instruction and Data

    register. Instruction register corresponds to the register where you sendcommands to LCD e.g. LCD shift command, LCD clear, LCD address etc.

    and Data register is used for storing data which is to be displayed on

    LCD. When send the enable signal of the LCD is asserted, the data on

    the pins is latched in to the data register and data is then moved

    http://www.8051projects.net/lcd-interfacing/basics.phphttp://www.8051projects.net/lcd-interfacing/basics.php
  • 7/28/2019 Smoke Detector Using Zigbee

    41/82

    41

    automatically to the DDRAM and hence is displayed on the LCD.

    Data Register is not only used for sending data to DDRAM but also for

    CGRAM, the address where you want to send the data, is decided by the

    instruction you send to LCD.

    4-bit programming of LCD

    In 4-bit mode the data is sent in nibbles, first we send the higher nibble

    and then the lower nibble. To enable the 4-bit mode of LCD, we need to

    follow special sequence of initialization that tells the LCD controller that

    user has selected 4-bit mode of operation. We call this special sequence

    as resetting the LCD. Following is the reset sequence of LCD.

    Wait for about 20mS

    Send the first init value (0x30)

    Wait for about 10mS

    Send second init value (0x30)

    Wait for about 1mS

    Send third init value (0x30)

    Wait for 1mS

    Select bus width (0x30 - for 8-bit and 0x20 for 4-bit)

    Wait for 1mS

    The busy flag will only be valid after the above reset sequence. Usually

    we do not use busy flag in 4-bit mode as we have to write code for

    reading two nibbles from the LCD. Instead we simply put a certain

    amount of delay usually 300 to 600uS. This delay might vary depending

    on the LCD you are using, as you might have a different crystal

  • 7/28/2019 Smoke Detector Using Zigbee

    42/82

    42

    frequency on which LCD controller is running. So it actually depends on

    the LCD module you are using.

    In 4-bit mode, we only need 6 pins to interface an LCD. D4-D7 are thedata pins connection and Enable and Register select are for LCD control

    pins. We are not using Read/Write (RW) Pin of the LCD, as we are only

    writing on the LCD so we have made it grounded permanently. If you

    want to use it, then you may connect it on your controller but that will

    only increase another pin and does not make any big difference.

    Potentiometer RV1 is used to control the LCD contrast. The unwanted

    data pins of LCD i.e. D0-D3 are connected to ground.

    Sending data/command in 4-bit Mode

    We will now look into the common steps to send data/command to LCD

    when working in 4-bit mode. In 4-bit mode data is sent nibble by nibble,

    first we send higher nibble and then lower nibble. This means in both

    command and data sending function we need to separate the higher 4-

    bits and lower 4-bits.

    The common steps are:

    Mask lower 4-bits

    Send to the LCD port

    Send enable signal

    Mask higher 4-bits

    Send to LCD port

    Send enable signal

    http://www.8051projects.net/lcd-interfacing/lcd-4-bit.phphttp://www.8051projects.net/lcd-interfacing/lcd-4-bit.php
  • 7/28/2019 Smoke Detector Using Zigbee

    43/82

    43

    CHAPTER-8POWER SUPPLY

  • 7/28/2019 Smoke Detector Using Zigbee

    44/82

    44

    POWER SUPPLY

    8.1 1N4007:

    8.1.1 FEATURES:

    Low forward voltage drop

    High surge current capability

    8.1.2 ABSOLUTE MAXIMUM RATINGS:

    Symbol Parameter Value Unit

    IO verage Rectified Current 0.375 lead length

    @ TA=750C

    1.0

    If(surge) Peak forward surge current

    8.3ms single half-sine-waveSuperimposed on rated load

    30

    PD Total Device Dissipation

    Derate above 250C

    2.5

    20

    W

    mW/C

    RJA Thermal Resistance, Junction to Ambient 50 C/W

    Tstg Storage Temperature Range -55 to +175 C

    TJ Operating Junction Temperature -55 to +150 C

  • 7/28/2019 Smoke Detector Using Zigbee

    45/82

  • 7/28/2019 Smoke Detector Using Zigbee

    46/82

    46

    8.2 3-TERMINAL 500mA VOLTAGE REGULATOR:(KA7805, KA7812)

    8.2.1 FEATURES:

    Output current of 500mA

    Output Voltages of 5V,12V

    Thermal overload protection

    Short circuit protection

    Output transistor Safe Operating Area Protection

    8.2.2 DESCRIPTION:

  • 7/28/2019 Smoke Detector Using Zigbee

    47/82

    47

    The 3-Terminal Regulator is available in TO-220/D-PAK package and with several fixed output

    voltages, making them useful in a wide range of applications. Each type employs internal current

    limiting, thermal shutdown and safe operating area protection, making it essentially indestructible.

    If adequate heat sinking is provided, they can deliver 1A output current. Although it is designed as

    a fixed voltage regulator primarily, the device can be used with external components to obtain

    adjustable voltages and currents.

    8.2.3. INTERNAL BLOCK DIAGRAM:

    SERIESPASS

    ELEMENT

    Current

    Generator

    SOA

    protection

    Startingcircuit

    Referencevoltage

    Error

    Amplifier

    Thermal

    protection

    Input Output

    Gnd

  • 7/28/2019 Smoke Detector Using Zigbee

    48/82

  • 7/28/2019 Smoke Detector Using Zigbee

    49/82

    49

    0=8V to 18V

    Dropout voltage VDrop 0=1A,TJ=+25C

    Short Circuit Current ISC I=35V,TA=25C 30 M A

    Peak current PK J=25C 2

    8.2.6 ELECTRICAL CHARACTERISTICS OF 7812 REGULATOR:

    Parameter Symbol Conditions Min. Typ. Max Unit

    Output voltage V0 J=+25C 11.5 2.0 .5

    5mAI01A,

    015W,V1=7V to 20V

    11.4 2.0 .6

    Line Regulation Regline TJ=25C O=14.5V

    30V

    10.0 40

    MV

    I=16V

    V

    .0 120

    Load Regulation Regload TJ=25C I0=5mA

    1. 5mA

    11 240

    MV

    0=250mA

    750mA

    0 120

    Quiescent Current 0 TJ=+25C .1 .0 mA

    Quiescent Current Change IQ I0=5mA to 1A 1 5 mA

    I=14.5V to 30V . 5 0

    Output voltage drift V0/T I0=5mA mV/C

    Output noise voltage VN F=10Hz to 10kHz 6 V/V0

    Ripple Rejection RR F=120Hz

    V0=15V to 25V

    5 71 DB

    Dropout voltage VDrop I0=1A,TJ=+25C

    Short Circuit Current ISC VI=35V,TA=25C 30 mA

    Peak current IPK J=25C 2.2

  • 7/28/2019 Smoke Detector Using Zigbee

    50/82

    50

    8.2.7 TYPICAL PERFORMANCE CHARACTERISTICS:

    fig. peak output current

    Fig: output voltage

  • 7/28/2019 Smoke Detector Using Zigbee

    51/82

    51

    8.3 B

    C 547 TRANSISTOR:

    8.3.1 GENERAL DIAGRAM:

    Collector

    1

    Base

    2

    3

    Emitter

  • 7/28/2019 Smoke Detector Using Zigbee

    52/82

    52

    8.3.2 MAXIMUM RATINGS:

    Rating Symbol BC547 Unit

    Collector-Emitter voltage VCE0 45 Vdc

    Collector-Base voltage VCB0 50 Vdc

    Emitter-Base voltage VEB0 6.0 Vdc

    Collector current continuous Ic 100 MAdc

    Total device Dissipation @TA=25C

    Derate above 25C

    PD 625

    50

    mW

    mW/C

    8.3.3 THERMAL CHARACTERISTICS:

    Characteristics Symbol Max. Unit

    Thermal resistance, junction to ambient R_JA 00 C/W

    Thermal resistance, junction to case R_JC 3.3 C/W

    8.3.4 ELECTRICAL CHARACTERISTICS:

    1. OFF CHARACTERISTICS:

    Characteristic Symbol Min. Typ. Max. Unit

    Collector-emitter breakdown voltage

    IC=1.0mA,IB=0)

    V(BR)CE0 45

    Collector-base breakdown voltage

    dc)

    V(BR)CB0 50

    Emitter-base breakdown voltage

    IE=10A,IC=0)

    V(BR)EB0 6.0

    Collector cutoff current

    (VCE=50V,VBE=0)

    (VCE=30V,TA=125C)

    ICES 0.2

    -

    15

    4.0

    nA

    A

  • 7/28/2019 Smoke Detector Using Zigbee

    53/82

    53

    2. ON CHARACTERISTICS:

    Characteristic Symbol Min. Typ. Max. Unitcurrent gain

    IC=2.0mA,VCE=5.0V)

    hFE 10 800

    Collector-emitter saturation voltage

    IC=10mA,IB=0.5mA)

    IC=100mA,IB=5.0mA)

    IC=10mA)

    VCE(sat)

    0.09

    0.2

    0.3

    0.25

    0.6

    0.6

    Base-emitter On voltage

    IC=2.0mA,VCE=5.0V)

    IC=10mA,VCE=5.0V)

    IBE(on)

    0.55 0.7

    0.77

    Base-emitter saturation voltage VBE(sat) 0.7

    3. SMALL CHARACTERISTICS:

    Characteristic Symbol Min. Typ. Max. Unit

    Current gain Band Width Product

    IC=10mA,VCE=5.0,f=100Mhz)

    fT 150 300 MHz

    Output capacitance

    (VEB=0.5V,IC=0,f=1.0Mhz)

    Cobo - 1. 7 4.5 pF

    Input capacitance

    (VEB=0.5V,IC=0,f=1.0Mhz)

    Cibo 10 pF

    Small signal current gain

    IC=2.0mA,VCE=5.0V,f=1.0khz)

    Hfe 125 900

    Noise Figure

    (IC=0.2mA,VCE=5.0V,Rs=2K,

    F =1.0khz,f=200hz)

    NF 2 .0 10 dB

  • 7/28/2019 Smoke Detector Using Zigbee

    54/82

    54

    8.4 POWER SUPPLY

    8.4.1 OPERATION:

    . The input voltage to the diodes 1 and 2 is supplied from a transformer and is equal to the peak

    AC voltage of the secondary winding of the transformer as shown in graph 1.

    . The circuit consisting of the combination of the two diodes is called full wave rectifier and the

    output of this is graph 2 which contains high ripple.

    . These diodes combined with a capacitor are known as full wave rectifier with a capacitor.

    . This capacitor is known as filtering capacitor improves the output of the rectifier considerably and

    the output of this stage is shown in graph 3.

    . The efficiency of this rectifier is 81.2%.

    . The resistor is used to limit the voltage and current those are supplied to the regulator in order to

    avoid the regulator from getting damaged.

    . The diode 3 is used to protect the diodes 1 and 2 from the back current discharged by the

    capacitor.

    VIN (ac)

    VIN (ac)

    Vout (dc)1 2 3

    Regulator|

    |

    |

    ||

    ||

    2|

    |

    |

    ||

    ||

    3|

    |

    |

    ||

    ||

    4

  • 7/28/2019 Smoke Detector Using Zigbee

    55/82

    55

    . The output at this point is not completely regulated since there is still some amount of ripple

    present in the rectified voltage.

    . Therefore a regulator is used to ensure low voltage ripple and excellent load and line voltage

    regulation.

    . The graph 4 gives the output of the regulator and this voltage is 99.9% regulated.

    . The resistor after the regulator is used to limit the current supplied to the LED.

    .When the voltage supplied is greater than 3.8V, the LED will glow.

    . The regulated DC voltage output is taken across the capacitor and is further supplied to other

    applications.

    8.4.2 OUTPUT AT DIFFERENT STAGES OF THE POWER SUPPLY:

    Voltage

    T

    T

    T

    T

    1

    2

    3

    4

  • 7/28/2019 Smoke Detector Using Zigbee

    56/82

    56

    CHAPTER-9

    KEIL VISION3

    SOFTWARE

  • 7/28/2019 Smoke Detector Using Zigbee

    57/82

    57

    9. KEIL VISION3 SOFTWARE

    9.1 VISION3 OVERVIEW:

    The Vision3 IDE is a windows based software development platform that combines a

    robust editor, project manager, and integrated make facility. Vision3 integrates all tools

    including the C compiler, macro assembler, linker/locator, and HEX file generator. Vision3

    helps expedite the development process of our embedded applications by providing the

    following:

    Full-featured source code editor

    Device database for configuring the development tool setting

    Project manager for creating and maintaining our projects

    Integrated make facility for assembling, compiling, and linking our embedded

    applications

    Dialogs for all development tool settings

    True integrated source level Debugger with high-speed CPU and peripheral simulator

    Advanced GDI interface for software debugging in the target hardware and for

    connection to Keil ULINK

    Flash programming utility for downloading the application program into Flash ROM

    Links to development tools manuals, device datasheets and users guides

    .In the Build Mode, we maintain the project files and generate the

    application. In the Debug Mode, we verify our program either with a powerful CPU and

    peripheral simulator or with the Keil ULINK USB-JTAG Adapter (or other AGDI drivers) that

    connect the debugger to the target system. The ULINK allows us also to download our

    application into Flash ROM of our target system.

  • 7/28/2019 Smoke Detector Using Zigbee

    58/82

    58

    9.2 FEATURES and BENEFITS:

    Feature BenefitThe Vision3 Simulator is the only

    Debugger that completely simulates all

    on-chip peripherals.

    Write and test the application code before production

    hardware is available. Investigate different hardware

    configurations to optimize the hardware design.

    Simulation capabilities may be expanded

    using the Advanced Simulation Interface

    (AGSI).

    Sophisticated systems can be accurately simulated

    by adding our own peripheral drivers.

    The Code Coverage feature of the

    Vision3 Simulator provides analysis of

    our programs execution.

    Safety-critical systems can be thoroughly tested and

    validated. Execution analysis reports can be viewed

    and printed for certification requirements.

    The Vision3 Device Database

    automatically configures the

    development tools for the target micro

    controller.

    Mistakes in tool settings are practically eliminated

    and tool configuration time is minimized.

    The Vision3 IDE integrates additional

    third-party tools like VCS, CASE, and

    FLASH/Device Programming.

    Quickly access development tools and third-party

    tools. All configuration details are saved in the

    Vision3 project.

    Identical Target Debugger and Simulator

    User Interface.

    Shortens our learning curve.

    Vision3 incorporates project manager,

    editor, and debugger in a single

    environment.

    Accelerates application development. While editing,

    we may configure debugger features. While

    debugging, we may make source code modifications.

  • 7/28/2019 Smoke Detector Using Zigbee

    59/82

  • 7/28/2019 Smoke Detector Using Zigbee

    60/82

    60

    The tabs of the Project Workspace give us access to:

    Files and Groups of the project.

    CPU Registers during debugging.

    Tool and project specific on-line Books.

    Text Templates for often used text blocks.

    Function in the project for quick editor navigation.

    The tabs of the Output Window provides: Build messages and fast error access;

    Debug Command input/output console; Find in Files results with quick file access.

    The Memory Window gives access to the memory areas in display various formats.

    The Watch and Call Stack Window allows us to review and modify program variables and

    displays the current function call tree.

    The Workspace is used for the file editing, disassembly output, and other debug

    information.

    The Peripheral Dialogs help us to review the status of the on-chip peripherals in the

    microcontroller.

    9.4 SOFTWARE DEVELOPMENT LIFE CYCLE:

    When you use the Keil Vision3, the project development cycle is

    roughly the same as it is for any other software development project.

    1. Create a project, select the target chip from the device database, and configure the tool

    settings.

    2. Create source files in C or assembly.

    3. Build our application with the project manager.

    4. Correct errors in source files.

    5. Test the linked application.

  • 7/28/2019 Smoke Detector Using Zigbee

    61/82

  • 7/28/2019 Smoke Detector Using Zigbee

    62/82

    62

    files and organize them into a project that defines our target application. Vision3 automatically

    compiles, assembles, and links our embedded application and provides a single focal point for

    our development efforts.

    9.4.2 C COMPILER & MACRO ASSEMBLER:

    Source files are created by the Vision3 IDE and are passed to the C or EC++ Compiler

    or Macro Assembler. The compiler and assembler process source files and create re-locatable

    object files.

    9.4.3 LIBRARY MANAGER:

    The library manager allows us to create object library from the object files created by the

    compiler and assembler. Libraries are specially formatted, ordered program collections of object

    modules that may be used by the linker at a later time. When the linker processes a library, only

    those object modules in the library that are necessary to create the program are used.

    9.4.4 LINKER/LOCATOR:

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

    from libraries and those created by the compiler and assembler. An executable program file (also

    called absolute object module) contains no re-locatable code or data. All code and data reside at

    fixed memory locations. This executable program file may be used:

    To program an Flash ROM or other memory devices,

    With the Vision3 Debugger for simulation and target debugging,

    With an in-circuit emulator for the program testing.

    9.4.5 VISION3 DEBUGGER:

    The Vision3 symbolic, source-level debugger is ideally suited for fast, reliable program

    debugging. The debugger includes a high-speed simulator that let us simulate a microcontroller

  • 7/28/2019 Smoke Detector Using Zigbee

    63/82

    63

    system including on-chip peripherals and external hardware. The attributes of the chip you use

    are automatically configured when we select the device from the Device Database.

    The Vision3 Debugger provides several ways for us to test our programs on real target

    hardware. Use the Keil ULINK USB-JTAG adapter for Flash downloading and software

    test of our program via on-chip debugging system like the Embedded ICE macro cell that

    is integrated in many ARM devices.

    Use the AGDI interface to attach use the Vision3 Debugger front end with our target

    system using other debuggers like Monitor, In-System Debugger, or Emulator.

    9.5 USER INTERFACE:

    The Vision3 User Interface consists of menus, toolbar buttons, keyboard shortcuts,

    dialog boxes, and windows that you use as you interact with and manage the various aspects of

    your embedded project.

    The menu bar provides menus for editor operations, project maintenance, development

    tool option settings, program debugging, external tool control, window selection and

    manipulation, and on-line help.

    The toolbar buttons allow you to rapidly execute Vision3 commands. A Status Bar

    provides editor and debugger information. The various toolbars and the status bar can be

    enabled or disabled from the View Menu commands.

    Keyboard shortcuts offer quick access to Vision3 commands and may be configured via

    the menu command Edit-Configuration-Shortcut key.

    The following sections list the Vision3 commands that can be reached by menu

    commands, toolbar buttons, and keyboard shortcuts. The Vision3 commands are grouped

    mainly based on the appearance in the menu bar:

    File Menu and File Commands

    Edit Menu and Edit Commands

    View Menu

  • 7/28/2019 Smoke Detector Using Zigbee

    64/82

    64

    Project Menu and Project Commands

    Debug Menu and Debug Commands

    Peripherals Menu

    9.5.1. FILE MENU AND COMMANDS:

    File Menu Tool bar Short cut Description

    New... Ctrl+N Create a new source or text file

    Open Ctrl+O Open an existing file

    Close Close the active file

    Save Ctrl+S Save the active file

    Save as... Save and rename the active file

    Save All Save all open source and text files including project

    and the active file

    Device Database Maintain the Vision3 device database

    License

    Management

    Maintain and review the installed software

    components

    Print Setup... Setup the printer

    Print Ctrl+P Print the active file

    Print Preview Display pages in print view

    1 .. 10 Open the most recent used source or text files

    Exit Quit Vision3 and prompt for saving files

  • 7/28/2019 Smoke Detector Using Zigbee

    65/82

    65

    9.5.2 PERIPHERALS MENU:

    Menu Item

    Reset CPU

    Sets CPU to reset state.

    Interrupts

    Opens dialog for the interrupt controller.

    I/O Ports

    Opens dialogs for the on-chip I/O Ports.

    Serial

    Opens dialogs for the on-chip Serial Port.

    Timer

    Opens dialogs for the on-chip Timers/Counters.

    Watchdog

    Opens dialogs for the on-chip Watchdog Timer.

    A/D Converter

    Opens dialogs for the on-chip Analog to Digital Converter.

    D/A Converter

    Opens dialogs for the on-chip Digital to Analog Converter.

    IC Controller

    Opens dialogs for the on-chip IC Controller.

    CAN Controller

    Opens dialogs for the on-chip CAN Controller.

  • 7/28/2019 Smoke Detector Using Zigbee

    66/82

    66

    9.6 CREATING APPLICATIONS:

    Create a Project: explains the steps required to setup a simple application and to

    generate HEX output.

    Project Target and File Groups: shows how to create application variants and

    organized the files that belong to a project.

    Tips and Tricks: provides information about the advanced features of the

    Vision3 Project Manager.

    9.6.1 CREATE A PROJECT:

    Vision3 includes a project manager which makes it easy to design applications for an

    ARM based microcontroller. We need to perform the following steps to create a new project:

    Create Project file and Select CPU

    Project Workspace-Books

    Create New Source Files

    Add Source Files to the Project

    Create Files Groups

    Set tool Options for Target Hardware

    Configure the CPU Start-up Code

    Build Project and Generate Application Program Code

    Create a HEX File for PROM Programming

    9.6.2 Description:

    Create Project file and Select CPU:

    To create a new project file, go to the Vision3 menu and select Project New

    Vision Project. The Create New Project dialog asks us for the new project file name. At this

  • 7/28/2019 Smoke Detector Using Zigbee

    67/82

    67

    time navigate to the folder where our new project will reside. It's a good idea to use a separate

    folder for each project. Use the icon Create New Folder in this dialog to create a new empty

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

    creates a new project file with the name PROJECT1.UV2which contains a default target and file

    group name. We can see these names in the Project WorkspaceFiles.

    Select Microcontroller from Device Database:

    When we create a new project Vision3 asks us to select a CPU for our project. The

    Select Device dialog box shows the Vision3 device database. Just select the microcontroller

    you use. For the example in this chapter we are using the Philips LPC2106 controller. This

    selection sets necessary tool options for the LPC2106 device and simplifies the tool

    configuration.

    Copy and Add the CPU Start-up Code:

    An embedded program requires CPU initialization code that needs to match the

    configuration of our hardware design. This Start-up Code depends also on the tool chain that we

    are using. Since we might need to modify that file to match our target hardware, the file should

    be copied to our project folder.

    http://www.keil.com/support/man/docs/uv3/uv3_ca_projtargfilegr.htm
  • 7/28/2019 Smoke Detector Using Zigbee

    68/82

  • 7/28/2019 Smoke Detector Using Zigbee

    69/82

    69

    Configure Start-up Code:

    The CPU Start-up Code (on most ARM targets the file name is Startup.S) may be open

    from the Project WorkspaceFiles Tab. Most start-up files have embedded comments for the

    Vision3 Configure Wizard which provides menu driven selections.

  • 7/28/2019 Smoke Detector Using Zigbee

    70/82

    70

    The default settings of the Start-up Code give a good starting point on most single chip

    applications. However you need to adapt the configuration for your target hardware. CPU/PLL

    clock and BUS system is target specific and cannot be automatically configured. Some devices

    provide options to enable or disable on-chip components (for example on-chip xdata RAM on

    8051 variants).We must ensure that the settings in the start-up file match the other settings in

    your project. The button Edit as Text opens the Start-up Code in a standard editor window and

    allows us to review the source code of this file.

    Build a Project:

    Typically, the tool settings under Options Target are all we need to start a new application.

    We may translate all source files and link the application by clicking on the Build Target toolbar

    button.

  • 7/28/2019 Smoke Detector Using Zigbee

    71/82

  • 7/28/2019 Smoke Detector Using Zigbee

    72/82

    72

    We may start our PROM programming utility after the make process when us specify the

    program under the option UserRun User Program #1 as explained under Start ExternalTools

    9.7 PROJECT TARGETS AND FILE GROUPS:

    By using different Project Targets Vision3 lets us create several programs from a

    single project. We may need one target for testing and another target for a release version of your

    application. Each target allows individual tool settings within the same project file. Files Groups

    let us group associated files together in a project. This is useful for grouping files into functional

    blocks or for identifying engineers in our software team. We have already used file groups in our

    example to separate the CPU related files from other source files. With these techniques it is

    easily possible to maintain complex projects with several 100 files in Vision3.

    The dialog Project-Components, Environment, Books-Project Components allows us

    to create project targets and file groups. We have already used this dialog to add system

    configuration files in a file group. An example project structure is shown below.

  • 7/28/2019 Smoke Detector Using Zigbee

    73/82

    73

    The Project Workspaceshows all groups and the related files. Files are built and linked in the

    same order as shown in this window. You can move file positions with Drag & Drop . We may

    select a target or group name and Clickto rename it. The local menu opens with a right mouse

    Click and allows you for each item:

    to set tool options

    to remove the item

    to add files to a group

    to open the file.

    In the build toolbar you can quickly change the current project target to build.

    9.7.1 TIPS AND TRICKS:

    The following section discusses advanced techniques we may use with the Vision3 Project

    Manager.

  • 7/28/2019 Smoke Detector Using Zigbee

    74/82

    74

    Start External Tools after Build Process shows how to execute programs after a

    successful build command which is useful for post-processing as required for symbol

    information by some emulators or programmers.

    Specify a Separate Folder for Listing and Object Files lets us direct the object and

    listing files of your project to specific folders.

    Use a CPU that is not in the Vision Device Database explains how to define new

    Devices that can be selected from the Device Database.

    Create a Library File gives us the tool setup that is required for creating library files.

    File Extensions allows us to set the file extension for the various file types of a project.

    Import Project Files from Vision Version 1 explains you how to import existing

    Vision Version 1 *.PRJ files.

    Version and Serial Number Information allows you to view project specific tool

    version information.

    File and Group Specific Options are set via Options for ... in context menu that opens via a

    right mouse click on an item in the Project Workspace.

    Options for ... provides the following configuration options:

    Properties Dialog allows us to set file and group specific options.

    Include Always specific Library Modules specify library modules that should be always

    included in a project.

  • 7/28/2019 Smoke Detector Using Zigbee

    75/82

  • 7/28/2019 Smoke Detector Using Zigbee

    76/82

    76

    CHAPTER-10

    CODE

  • 7/28/2019 Smoke Detector Using Zigbee

    77/82

    77

    CHAPTER-11

    TESTING

  • 7/28/2019 Smoke Detector Using Zigbee

    78/82

    78

    TESTING THE CIRCUIT

    11.1BASIC TESTS:

    It is essential to conduct certain preliminary tests prior to testing the software to prevent the damageof the electronic components.

    11.2CHECKING THE POWER SUPPLY:

    The power supply circuit is expected to produce a constant dc power supply of 5V (or 12V).The

    magnitude of the dc voltage given by the circuit depends upon the voltage regulator used.

    To test the circuit, a 9-0-9 step down transformer (12-0-12V) is used. The primary is connected

    to 230V AC and the secondary is connected to the full wave rectifier part of the circuit. Upon

    switching on of the mains, the LED must glow and the voltage across the output terminals must

    show 5V (or 12V).

    11.3CHECKING THE ICs:

    The pins of various ICs used are to be checked properly for their default status in order to ensure

    smooth functioning.

    The power supply is connected to the chips and voltages across corresponding pins are

    checked using a digital multimeter.By default, the input ports of the microcontroller are configured

    to 1 and the output ports are configured to 0.

    When the microcontrollers havent been connected, the address and data pins of the

    encoder and decoders default to 0.

  • 7/28/2019 Smoke Detector Using Zigbee

    79/82

  • 7/28/2019 Smoke Detector Using Zigbee

    80/82

    80

    CONCLUSION

    A multi system controller allows several electronic gadgets to be controlled by a

    single device. This enables automation in any environment that has several electronic devices.

    During the course of our project, we have developed a working model to demonstrate the

    functioning of a multi system controller using RF communication. The device developed is simple

    and controls three devices i.e. bulbs, fan and a remote controlled car. This device is capable of

    controlling devices that run on both ac and/or dc power supply.

    12.1 FUTURE SCOPE:

    With increased complexity, this device can be successfully used in any environment where

    automation is desired.

  • 7/28/2019 Smoke Detector Using Zigbee

    81/82

    81

    APPENDIX

  • 7/28/2019 Smoke Detector Using Zigbee

    82/82

    APPENDIX

    BIBLIOGRAPHY

    REFERENCE BOOKS:

    8051 MICROCONTROLLERS AND EMBEDDED SYSTEMS- MAZIDI & MAZIDI

    ADVANCED MICROPROCESSORS AND PERIPHERALS- RAY AND BHURCHANDI

    REFERENCE SITES:

    www.keil.com

    www.wisegeek/microcontroller.com

    www.wikipedia.com

    www.mytutorialcafe.com

    www.avrfreaks.com

    www.softpedia.com

    www.rfsolutions.co.uk

    www.freewebs.com

    www.tpub.co