Smoke Detector Using Zigbee

Published on July 2016 | Categories: Documents | Downloads: 48 | Comments: 0 | Views: 306
of 82
Download PDF   Embed   Report

Comments

Content

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 1

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 Development Placements 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 NSIC’s efforts in assisting other countries with infrastructure facilities and support service has been worthy.

2

.

CHAPTER-1
GENERAL OVERVIEW

3

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 user’s 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.

4

1.3 METHODOLOGY:

Specifications

Analysis

Product Design

Highlevel Design

Lowlevel Design

Test Design

Test Cases

Coding & Unit Testing

Documentation

Successful

System Test

Integration

Failure

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. 5

  

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 didn’t work for a 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.

6

CHAPTER-2
INTRODUCTION

7

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.2 INTRODUCTION 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 8

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 their duty 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.

9

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 nonbeacon-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 lower protocol layers—the 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/s per channel 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.

10

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 paper published 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.

11

.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

12

CHAPTER-3
MICROCONTROLLER

13

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 and yet 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

Memory (RAM/ROM)

Micro controller

I/O ports

Peripherals

14

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 Atmel’s 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

15

3.5 BLOCK DIAGRAM OF THE MICROCONTROLLER:

Fig 3.5 Block Diagram of the Microcontroller

16

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.2 ARITHMETIC 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 the ALU 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.

CY AC
CARRY BIT (CY):

FO RS1 RS0 OV --

P

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.

17

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:

RS1

RS0 REGISTER BANKS

ADDRESS

0 0 1 1

0 1 0 1

0 1 2 3

00H-07H 08H-0FH 10H-17H 18H-1FH

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.

18

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

19

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 internal pull-ups and can be used as inputs. As inputs, Port 1 pins that are externally being pulled low 20

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)
21

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 Functions P3.0 RXD (serial input port) P3.1 TXD (serial output port) P3.2 INT0 (external interrupt 0) P3.3 INT1 (external interrupt 1) P3.4 T0 (timer 0 external input) P3.5 T1 (timer 1 external input) 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.

22

CHAPTER-4
GAS SENSOR

23

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, a fuel cell power generating apparatus equipped with such CO gas sensor, and a method of measuring the concentration of CO gas.

24

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.

25

CHAPTER-5
Relay

26

Relay
A relay is an electrical switch that opens and closes under the control of another electrical circuit. In the original form, the switch is operated by an electromagnet to open or close one or many sets of contacts. Because a relay is able to control an output circuit of higher power than the input circuit, it can be considered to be, in a broad sense, a form of an electrical amplifier. Small relay as used in electronics A simple electromagnetic relay, such as the one taken from a car in the first picture, is an adaptation of an electromagnet. It consists of a coil of wire surrounding a soft iron core, an iron yoke, which provides a low reluctance path for magnetic flux, a moveable iron armature, and a set, or sets, of contacts; two in the relay pictured. The armature is hinged to the yoke and mechanically linked to a moving contact or contacts. It is held in place by a spring so that when the relay is de-energised there is an air gap in the magnetic circuit. In this condition, one of the two sets of contacts in the relay pictured is closed, and the other set is open. Other relays may have more or fewer sets of contacts depending on their function. The relay in the picture also has a wire connecting the armature to the yoke. This ensures continuity of the circuit between the moving contacts on the armature, and the circuit track on the Printed Circuit Board (PCB) via the yoke, which is soldered to the PCB. When an electric current is passed through the coil, the resulting magnetic field attracts the armature, and the consequent movement of the movable contact or contacts either makes or breaks a connection with a fixed contact. If the set of contacts was closed when the relay was deenergised, then the movement opens the contacts and breaks the connection, and vice versa if the contacts were open. When the current to the coil is switched off, the armature is returned by a force, approximately half as strong as the magnetic force, to its relaxed position. Usually this force is provided by a spring, but gravity is also used commonly in industrial motor starters. Most relays are manufactured to operate quickly. In a low voltage application, this is to reduce noise. In a high voltage or high current application, this is to reduce arcing. If the coil is energized with DC, a diode is frequently installed across the coil, to dissipate the energy from the collapsing magnetic field at deactivation, which would otherwise generate a voltage spike dangerous to circuit components. Some automotive relays already include that 27

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 optocoupler can 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 overcenter 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 or inert 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

28

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 normallyclosed 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 the contacts 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 29

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 able to 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 of electric motor overload 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.

30

CHAPTER-6
DESIGN AND IMPLEMENTATION LIST OF COMPONENTS

31

6.1 DESIGN AND IMPLEMENTATION

.

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

IC and Microcontrollers.

BLOCK DIAGRAM

PORER SUPPLY

MICRO CONTROLLER

32

6.2. CAPACITORS (a) INTRODUCTION

Fig6.2:Examples of capacitor package

Fig6.3: Electrolytic capacitors

A capacitor or condenser is a passive electronic component consisting of a pair of conductors separated by a dielectric. When a voltage potential difference exists between the conductors, an electric field is present in the dielectric. This field stores energy and produces a mechanical force between the plates. The effect is greatest between wide, flat, parallel, narrowly separated conductors. Capacitors are widely used in electronic circuits to block the flow of direct current while allowing alternating current to pass, to filter out interference, to smooth the output of power supplies, and for many other purposes.

(i)Unpolarised
Unpolarised capacitors don't mind which direction they are charged up from, the potential difference across them can be in either direction.

33

Fig 6.4: Unpolarised capacitor

(ii) Polarised capacitor:

Polarised capacitors have a positive and a negative connection, if connected the wrong way round they will leak and often go pop! While not a huge disaster, it does make a mess you will have to clear up and the fluids inside them can be quite nasty so be careful when using them.

Fig 6.5: polarised capacitor

(iv) Capacitors in Parallel

Fig 6.6- Capacitors in Parallel

When capacitors are connected in parallel (fig 4) their combined capacitance is equal to the individual capacitance added together. For eg: if capacitors C1 and C2 are connected in series their combined resistance, C is given by:

C=C1+C2

34

(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 = (C1×C2)/(C1+C2)

6.3. RESISTORS

Fig 6.8: Resistors
Type Electronic symbol : : passive (Europe) (US)

35

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 power rating. Other characteristics include temperature coefficient, noise, and inductance.

36

CHAPTER-7 LCD

37

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 LCD’s 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). Pin description is shown in the table below.

Pin No. Pin no. 1 Pin no. 2 Pin no. 3 Pin no. 4

Name VSS VCC VEE RS

Description Power supply (GND) Power supply (+5V) Contrast adjust 0 = Instruction input 1 = Data input 0 = Write to LCD module 1 = Read from LCD module Enable signal Data bus line 0 (LSB) Data bus line 1

Pin no. 5 Pin no. 6 Pin no. 7 Pin no. 8

R/W EN D0 D1

38

Pin no. 9 Pin no. 10 Pin no. 11 Pin no. 12 Pin no. 13 Pin no. 14

D2 D3 D4 D5 D6 D7

Data bus line 2 Data bus line 3 Data bus line 4 Data bus line 5 Data bus line 6 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

39

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 custom characters 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 send commands 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
40

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

41

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 the data 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 4bits 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

42

CHAPTER-8
POWER SUPPLY

43

POWER SUPPLY 8.1 1N4007: 8.1.1 FEATURES:
  Low forward voltage drop High surge current capability

8.1.2 ABSOLUTE MAXIMUM RATINGS:
S Symbol IO Parameter Value 1.0 A Unit Average Rectified Current 0.375” lead length @ TA=750C If(surge) Peak forward surge current 8.3ms single half-sine-wave Superimposed on rated load PD RөJA Total Device Dissipation Derate above 250C Thermal Resistance, Junction to Ambient 2.5 20 50 W mW/°C ° C/W 30 A

Tstg TJ

Storage Temperature Range Operating Junction Temperature

-55 to +175 -55 to +150

°C °C

44

8.1.3 ELECTRICAL CHARACTERISTICS:
Parameter Peak repetitive reverse voltage Max. RMS Voltage DC Reverse Voltage(Rated VR) Max. Forward @ 1.0A Max. Reverse Current @ rated VR TA=250C TA=1000C Max. Full Load Reverse Current, Full cycle TA=750C 15 Pf 1N4007 1000 700 1000 1.1 5.0 500 30 µA Units V V V V µA

Typical Junction Capacitance VR=4.0V,f=1.0MHz

8.1.4 TYPICAL CHARACTERISTICS:

45

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:

46

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:

Input SERIES PASS ELEMENT

Output

Current Generator

SOA protection

Starting circuit

Reference voltage

Error Amplifier

Thermal protection

Gnd

47

8.2.4 ABSOLUTE MAXIMUM RATINGS:
PARAMETER Input voltage (for V0=5V,12V) Thermal resistance junction- Cases (T0-220) Thermal resistance junction- Air (T0-220) Operating Temperature Range Storage TemperatureRange SYMBOL I JC JA OPR STG 5 ~ + 125 55 ~ +125 VALUE 5 C/W C/W C C UNIT

8.2.5 ELECTRICAL CHARACTERISTICS OF 7805 REGULATOR:
Parameter Y Symbol C Conditions . Min Output voltage V 0 T J=+250C 5mA≤I0≤1A, 4. 8 4. 75 5. 0 5. 2 5. 0 5. 25 V T yp. Max. U Unit

P 0≤15W,V1=7V to 20V L Line Regulation R Regline T J =250CV0=7V to 25VV I=8V to 12V 2 L Load Regulation Regload T J=250C I0 =5mA to 1.5mA I0=250mA t o 750mA Quiescent Current QuiescentCurrent Change O Output voltage drift O Output noise voltage R Ripple Rejection Q Δ IQ T J=+250C D =5mA to 1A V I=7V to 25V Δ VO/δT I 0=5Ma VN RR 5. 0 8. 0 0. 03 0. 5 0. 3 1. 3 - 0.8 4 2 MV/°C µ V/V0 D B 48 MA Ma 4 5 0 9 1 00 MV 4. 0 1 00 1. 6 50 mV

F NO=10Hz to 10kHz F R=120Hz 6 2

7 3 -

V 0=8V to 18V Dropout voltage Short Circuit Current Peak current VDrop I 0=1A,TJ=+25°C ISC I PK V I=35V,TA=25°C T J=25°C 2 V MA A

2 30 2. 2 -

8.2.6 ELECTRICAL CHARACTERISTICS OF 7812 REGULATOR:
Parameter Output voltage Symbol V0 Conditions T J=+25°C 5mA≤I0≤1A, P 0≤15W,V1=7V to 20V Line Regulation Regline TJ=25°CVO=14.5V to 30V V o2V Load Regulation Regload TJ=25°C I0=5mA to 1. 5mA I 0=250mA to 750mA Quiescent Current I 0 TJ=+25°C I0=5mA to 1A V I=14.5V to 30V Output voltage drift Output noise voltage Ripple Rejection δV0/δT VN RR I0=5mA 5 .1 0. 1 0 .5 -1 7 6 71 8 .0 0. 5 1. 0 mV/°C µ V/V0 DB mA mA Quiescent Current Change δIQ 5. 0 120 11 240 MV I=16V 3 .0 120 10.0 2 40 MV Min. T Typ. Max 11.5 1 2.0 12.5 V 11.4 1 2.0 12.6 Unit

F=10Hz to 10kHz F=120Hz V0=15V to 25V 5 5

Dropout voltage Short Circuit Current Peak current

VDrop ISC IPK T

I0=1A,TJ=+25°C VI=35V,TA=25°C J=25°C

-

2 2 30

-

V mA A

-

2.2 -

49

8.2.7 TYPICAL PERFORMANCE CHARACTERISTICS:

fig. peak output current

Fig: output voltage

50

8.3 C 547 TRANSISTOR:

B

8.3.1 GENERAL DIAGRAM:

Collector 1

Base 2

3 Emitter

51

8.3.2 MAXIMUM RATINGS:
Rating Collector-Emitter voltage Collector-Base voltage Emitter-Base voltage Collector current continuous Total device Dissipation @TA=25°C Derate above 25°C Symbol BC547 VCE0 VCB0 VEB0 Ic PD 45 50 6.0 100 625 50 Unit Vdc Vdc Vdc MAdc mW mW/°C

8.3.3 THERMAL CHARACTERISTICS:
Characteristics Thermal resistance, junction to ambient Symbol Max. Unit °C/W R_JA 2 00

Thermal resistance, junction to case

R_JC 8 3.3

° C/W

8.3.4 ELECTRICAL CHARACTERISTICS: 1. OFF CHARACTERISTICS:
Characteristic Collector-emitter breakdown voltage ( IC=1.0mA,IB=0) Collector-base breakdown voltage ( dc) V(BR)CB0 50 V Symbol Min. Typ. Max. Unit V V(BR)CE0 45 -

Emitter-base breakdown voltage ( IE=10µA,IC=0) Collector cutoff current (VCE=50V,VBE=0) (VCE=30V,TA=125°C)

V(BR)EB0

6.0 -

-

V

ICES

-

0.2

15

nA

-

-

4.0

µA 52

2. ON CHARACTERISTICS:
Characteristic D current gain ( IC=2.0mA,VCE=5.0V) Collector-emitter saturation voltage ( ( ( IC=10mA,IB=0.5mA) IC=100mA,IB=5.0mA) IC=10mA) Base-emitter On voltage ( ( IC=2.0mA,VCE=5.0V) IC=10mA,VCE=5.0V) Base-emitter saturation voltage VBE(sat) IBE(on) 0.55 0 0.7 0.7 0.77 V VCE(sat) 0.09 0.2 0.3 V 0.25 0.6 0.6 V Symbol hFE Min. Typ. 1 10 Max. 800 Unit

3. SMALL CHARACTERISTICS: Characteristic Current gain Band Width Product ( IC=10mA,VCE=5.0,f=100Mhz) Output capacitance (VEB=0.5V,IC=0,f=1.0Mhz) Input capacitance (VEB=0.5V,IC=0,f=1.0Mhz) Small signal current gain ( IC=2.0mA,VCE=5.0V,f=1.0khz) Noise Figure (IC=0.2mA,VCE=5.0V,Rs=2KΩ, F =1.0khz,δf=200hz) NF 2 .0 10 dB Hfe 125 900Cibo 10 pF Cobo 1. 7 4.5 pF Symbol Min. fT Typ. Max. Unit MHz

150 300 -

53

8.4 POWER SUPPLY

VIN (ac)

VIN (ac)

2 | | | | | | |

3 | | | | | | |

Regulator 4
1 2 3 | | | | | | |

Vout (dc)

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.

54

. 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

1

T

2

T

3

T

4

T

55

CHAPTER-9
KEIL µVISION3 SOFTWARE

56

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 user’s 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.

57

9.2 FEATURES and BENEFITS:
Feature Benefit

The µVision3 Simulator is the only Write and test the application code before production Debugger that completely simulates all hardware is available. Investigate different hardware on-chip peripherals. configurations to optimize the hardware design.

Simulation capabilities may be expanded Sophisticated systems can be accurately simulated using the Advanced Simulation Interface by adding our own peripheral drivers. (AGSI). The Code Coverage feature of the Safety-critical systems can be thoroughly tested and µVision3 Simulator provides analysis of validated. Execution analysis reports can be viewed our program’s execution. The µVision3 Device configures and printed for certification requirements. Database Mistakes in tool settings are practically eliminated the and tool configuration time is minimized.

automatically

development tools for the target micro controller. The µVision3 IDE integrates additional Quickly access development tools and third-party third-party tools like VCS, CASE, and tools. All configuration details are saved in the FLASH/Device Programming. µVision3 project.

Identical Target Debugger and Simulator Shortens our learning curve. User Interface. µVision3 incorporates project manager, Accelerates application development. While editing, editor, and debugger in a single we may configure debugger features. While

environment.

debugging, we may make source code modifications.

58

9.3 ENVIRONMENT:
The µVision3 screen provides us with a menu bar for command entry, a tool bar where we can rapidly select command buttons, and windows for source files, dialog boxes, and information displays. µVision3 lets us simultaneously open and view multiple source files. µVision3 has two operating modes:

9.3.1 BUILD MODE:
Allows us to translate all the application files and to generate executable programs. The features of the Build Mode are described under Creating Applications.

9.3.2 DEBUG MODE:
Provides us with a powerful debugger for testing our application. The Debug Mode is described in Testing Programs. In both operating modes we may use the source editor of µVision3 to modify our source code. The Debug mode adds additional windows and stores an own screen layout. The following picture shows a typical configuration of µVision3 in the Debug Mode.

59

         

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.

60

The following block diagram illustrates the complete µVision3 software development cycle. Each component is described below.

µVision3 IDE with editor and make

C Compiler

Macro Assembler

C Library

Library Manager

User Library

Library/ Locator

µVision3 Debugger

Third party Emulator

CPU and peripheral interfacing

Keil ULINK JTAG Adapter

AGDI Target Interface

9.4.1 µVISION3 IDE:
The µVision3 IDE combines project management, a rich-featured editor with interactive error correction, option setup, make facility, and on-line help. Use µVision3 to create our source 61

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

62

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

63

  

Project Menu and Project Commands Debug Menu and Debug Commands Peripherals Menu

9.5.1. FILE MENU AND COMMANDS:

File Menu New... Open Close Save Save as... Save All

Tool bar Short cut Description Ctrl+N Ctrl+O Create a new source or text file Open an existing file Close the active file Ctrl+S Save the active file Save and rename the active file Save all open source and text files including project and the active file

Device Database License Management Print Setup... Print Print Preview 1 .. 10 Exit Ctrl+P

Maintain the µVision3 device database Maintain components Setup the printer Print the active file Display pages in print view Open the most recent used source or text files Quit µVision3 and prompt for saving files and review the installed software

64

9.5.2 PERIPHERALS MENU:
Menu Item Reset Sets CPU to reset state. Interrupts Opens dialog for the interrupt controller. I/O 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 Ports CPU

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

Opens dialogs for the on-chip Digital to Analog Converter. I²C Opens dialogs for the on-chip I²C Controller. CAN Opens dialogs for the on-chip CAN Controller. Controller Controller

65

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 66

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.UV2 which contains a default target and file group name. We can see these names in the Project Workspace — Files.

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.

67

For most devices, µVision3 asks us to copy the CPU specific Start-up Code to your project. This is required on almost all projects (exceptions are library projects and add-on projects). The Start-up Code performs configuration of the microcontroller device and initialization of the compiler run-time system. Therefore we should answer with YES to this question.

Add Source Files to Project:
Once we have created our source file we can add this file to our project. µVision3 offers several ways to add source files to a project. For example, we can select the file group in the Project Workspace — Files page and click with the right mouse key to open a local menu. The option Add Files opens the standard files dialog. Select the file MAIN.C we have just created.

 Setting Tool Options:

µVision3 lets us set options for your target hardware. The dialog Options for Target opens via the toolbar icon or via the Project — Options for Target menu item. In the Target tab you specify all relevant parameters of your target hardware and the on-chip components of the device we have selected. The following dialog shows the settings for our example. 68

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 Workspace — Files Tab. Most start-up files have embedded comments for the µVision3 Configure Wizard which provides menu driven selections.

69

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.

70

When we build an application, µVision3 displays errors, warnings, and any other messages in the Output Window — Build page. Double-click on a message to open the corresponding source file. After building the project, may:  Modify existing source code or add new source files to the project. The Build Target toolbar button translates only modified or new source files and generates the executable file. µVision3 maintains a file dependency list and knows all include files used within a source file. Even the tool options are saved in the file dependency list, so that µVision3 rebuilds files only when needed. With the Rebuild Target command, all source files are translated, regardless of modifications.  Test Programs with µVision3 Debugger: The µVision3 Debugger offers two operating modes: simulator that allows you to verify your application on our PC, or Target Debugging with an Evaluation Board or our hardware platform  Program your application into Flash ROM. µVision3 integrates command-line driven Flash Utilities or can use the ULINK USB-JTAG Adapter for Flash programming. We may need to create a HEX file to use Flash programming utilities.

 Create HEX File:
Once we have successfully generated our application we can start debugging. After we have tested our application, it is required to create an Intel HEX file to download the software into an EPROM programmer or simulator. µVision3 creates HEX files with each build process when Create HEX file under Options for Target — Output is enabled. The FLASH Fill Byte, Start and End values direct the OH166 utility to generate a sorted HEX files; sorted files are required for some Flash programming utilities.

71

We may start our PROM programming utility after the make process when us specify the program under the option User — Run 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.

72

The Project Workspace shows 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 Click to 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. 73



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.

74



Use a Custom Translator shows how to pre-process files with a custom specific translator.



Different Compiler and Assembler Settings allows us to change tool options for a file group or even a single file.

9.8 DEBUG FUNCTIONS:
We use Debug Functions to:      Extend the capabilities of the µVision3 Debugger. Generate external interrupts, Log memory contents to a file, Update analog input values periodically, Input serial data to an on-chip serial port,

9.9 SIMULATION:
The µVision3 Debugger incorporates a C script language you can use to create Signal Functions. Signal functions let us simulate analog and digital input to the microcontroller. Signal functions run in the background while µVision3 simulates our target program. The µVision3 simulator simulates the timing and logical behaviour of serial communication protocols like UART, I²C, SPI, and CAN. But µVision3 does not simulate the I/O port toggling of the physical communication pins on the I/O port.To provide fast simulation speed and optimum access to communication peripherals, the logic behaviour of communication peripherals is reflected in virtual registers that are listed with the DIR VTREG command. This has the benefit that we can easily write debug functions that stimulate complex peripherals.

75

CHAPTER-10
CODE

76

CHAPTER-11
TESTING

77

TESTING THE CIRCUIT 11.1 BASIC TESTS:
It is essential to conduct certain preliminary tests prior to testing the software to prevent the damage of the electronic components.

11.2 CHECKING 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.3 CHECKING 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 haven’t been connected, the address and data pins of the encoder and decoders default to 0.

78

CHAPTER-12
CONCLUSION

79

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.

80

APPENDIX

81

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.com www.electronics4u.com www.ipic.co.jp www.electronics.howstuffworks.com www.consumer.phillips.com www.amazon.co.uk www.directron.com www.remotecontroltechnology.com www.zilog.com www.atmel.com

82

Sponsor Documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close