Вы находитесь на странице: 1из 66

ABSTRACT

A Boiler or steam generator is employed wherever a source of system is required.


A boiler incorporates a firebox or furnace in order to burn the fuel and generate
heat; The heat is initially transferred to water to make steam; this produces
saturated steam at ebullition temperature. Higher the furnace temperature, faster
the steam production. The saturated steam thus produced can then either be used
immediately to produce power via a turbine and alternator, or else may be further
superheated to a higher temperature; This notably reduces suspended water content
making a given volume of steam produce more work.

In this paper, we propose the parameters like the temperature of the steam, the
level of water, control of feed water pump, Pressure of the steam has to be
measured and critically monitored for reliable and safe operation of the generation
unit. This kind of operation with critical importance can be carried out efficiently
and implemented employing Programmable Logic Controller (PLC).Experimental
results are presented.

1
LIST OF TABLES

Table No. Name of Table Page No.

3.1 Definition Of Sensor 10


 Level sensor
 Pressure sensor
 Temperature sensor

3.2 Features of sensor 12


 Level sensor
 Pressure sensor
 Temperature sensor

4.1 DIFFERENT SECTIONS OF THE PROJECT: 20


 Boiler Section
 Controlling Section
 Water Supply Section
 Power Supply Section

4.2 STAGES OF PROJECT DESIGN 21

2
LIST OF FIGURES

Figure No. Name of the Figure Page no.

1.1 Overall Block Diagram 06

3.1 PIR sensors 11

4.1 Microcontroller 14

4.2 40 lead PDIP 17

4.3 Internal Block Diagram 18

4.4 ADC 26

4.5 ADC (interfacing with 28

3
Microcontroller) Block
Diagram

4.6 ADC (pin diagram) 29

4.7 Buzzer 31

4.8,4.9 Voltage Regulator 33

4.11 Power Supply 34

LIST OF SYMBOLS

PLC Programmable Logic Controller


CPU Central Processing Unit

4
1. INTRODUCTION

Programmable Logic Controls can provide the right solution at the right time.
Using the PLC can extend your performance gains across the business with, the
only integrated control and information platform that runs discrete, motion, drives,
process and safety control, assuring the different automation technologies work
together. While using PLC the entire manufacturing cycle will be simple and
power full technology.

In this system we have to measure load with the help of CT (in case of AC/DC
Motor) or PT (in case of Steam Turbine/ Hydraulic drive) & water is measure by
The Water Flow Meter & all above input are feed to PLC. Controller is calculating
with input & set point. On the controller’s output Control valve will be operating &
you will find the actual result as per you get.

In this project the water level of the boiler tank is monitored with the aid of an
analog interface with the Programmable logic controller (PLC).The level is then
controlled by controlling the feed water input which is affected on a DC motor.
The temperature in the same way is measured using a temperature sensor and the
measured analog value is interfaced with the PLC. The response given by the PLC
to control the temperature is carried out by controlling the induction heater. The
control action required to stabilize the temperature and the level within the safe
limits can be effectively optimized by using Programmable Logic Controller
(PLC).Thus the boiler management system is designed in this project using PLC.

5
1.1 BLOCK DIAGRAM:

Pressure
Sensor

Temperature Buzzer
Sensor
Power Programmable
Supply Logic Controller
DC Motor
Liquid Level
Sensor

Power
Supply

Figure 1.1 Overall Block Diagram.

6
2. VOLATILE ORGANIC COMPOUNDS

2.1 DEFINITION

Volatile organic compounds (VOCs) refer to organic chemical compounds which


have significant vapor pressures and which can affect the environment and human
health. VOCs are numerous, varied, and ubiquitous. Although VOCs include both
man-made and naturally occurring chemical compounds, it is the anthropogenic
VOCs that are regulated, especially for indoors where concentrations can be
highest. VOCs are typically not acutely toxic but have chronic effects. Because the
concentrations are usually low and the symptoms slow to develop, analysis of
VOCs and their effects is a demanding area.

2.2 Biologically derived VOCs


The majority of VOCs arise from plants. An estimated 1150 Tg C/yr (Tg = 1012
grams) are produced annually by plants, the main constituent being isoprene. This
value excludes biogenic methane. Anthropogenic (human produced) emissions are
about 10% of the biological level. One indication of this flux is the strong odor
emitted by many plants. The emissions are affected by a variety of factors, such as
temperature, which determines rates of volatilization and growth, and sunlight,
which determines rates of biosynthesis. Emission occurs almost exclusively from
the leaves, the stomata in particular. A major class of VOCs are terpenes, such as
myrcene. Providing a sense of scale, a forest 62,000 km2 in area (the U.S. state of
Pennsylvania) is estimated to emit 3,400,000 kilograms of terpenes on a typical
August day during the growing season. Induction of genes producing volatile
organic compounds and subsequent increase in volatile terpenes has been achieved
in maize using (Z)-3-Hexen-1-ol and other plant hormones.

2.3 Health risks


Respiratory, allergic, or immune effects in infants or children are associated with
man-made VOCs and other indoor or outdoor air pollutants.

Some VOCs, such as styrene and limonene, can react with nitrogen oxides or with
ozone to produce new oxidation products and secondary aerosols, which can cause

7
sensory irritation symptoms. Unspecified VOCs are important in the creation of
smog.

Health effects include:

Eye, nose, and throat irritation; headaches, loss of coordination, nausea;


damage to liver, kidney, and central nervous system. Some organics can
cause cancer in animals; some are suspected or known to cause cancer in
humans. Key signs or symptoms associated with exposure to VOCs include
conjunctival irritation, nose and throat discomfort, headache, allergic skin
reaction, dyspnea, declines in serum cholinesterase levels, nausea, emesis,
epistaxis, fatigue, dizziness.
The ability of organic chemicals to cause health effects varies greatly from
those that are highly toxic, to those with no known health effect. As with
other pollutants, the extent and nature of the health effect will depend on
many factors including level of exposure and length of time exposed. Eye
and respiratory tract irritation, headaches, dizziness, visual disorders, and
memory impairment are among the immediate symptoms that some people
have experienced soon after exposure to some organics. At present, not
much is known about what health effects occur from the levels of organics
usually found in homes. Many organic compounds are known to cause
cancer in animals; some are suspected of causing, or are known to cause,
cancer in humans.

2.4 VOCs Sensors

VOCs in the environment or certain atmospheres can be detected based in different


principles and interactions between the organic compounds and the sensor
components. There are electronic devices that can detect ppm concentrations
despite the non-selectivity. Others can predict with reasonable accuracy the
molecular structure of the volatile organic compounds in the environment or
enclosed atmospheres and could be used as accurate monitors of the Chemical
Fingerprint and further as health monitoring devices.

8
3 PIR SENSOR

3.1 General Description


The PIR (Passive Infra-Red) Sensor is a pyroelectric device that detects
motion by measuring changes in the infrared levels emitted by surrounding objects.
This motion can be detected by checking for a high signal on a single I/O pin.

3.2 Features

 Single bit output


 Small size makes it easy to conceal
 Compatible with all Parallax microcontrollers

3.3 Application Ideas

 Alarm Systems
 Halloween Props
 Robotics

3.4 Theory of Operation

Pyroelectric devices, such as the PIR sensor, have elements made of a crystalline
material that generates an electric charge when exposed to infrared radiation. The
changes in the amount of infrared striking the element change the voltages
generated, which are measured by an on-board amplifier. The device contains a
special filter called a Fresnel lens, which focuses the infrared signals onto the
element. As the ambient infrared signals change rapidly, the on-board amplifier
trips the output to indicate motion.

9
3.5 Pin Definitions and Ratings

Pin Name Function


- GND Connects to Ground or
Vss
+ V+ Connects to +5 VDC
or Vdd
OUT Output Connects to an I/O pin
set to INPUT mode
Table 3.1 pin def. & ratings of PIR sensor.

3.6 Connecting and Testing

Connect the 3-pin header to your circuit so that the minus (-) pin connects to
ground or Vss, the plus (+) pin connects to +5 volts or Vdd and the OUT pin
connects to your microcontroller’s I/O pin. One easy way to do this would be to
use a standard servo/LCD extension cable, available separately from Parallax
(#805-00002). This cable makes it easy to plug sensor into the servo headers on
our Board Of Education or Professional Development Board. If you use the Board
Of Education, be sure the servo voltage jumper (located between the 2 servo
header blocks) is in the Vdd position, not Vin. If you do not have this jumper on
your board you should manually connect to Vdd through the breadboard.

You may also plug the sensor directly into the edge of the breadboard and connect
the signals from there. Remember the position of the pins when you plug the
sensor into the breadboard.

Once the sensor warms up (settles) the output will remain low until there is motion,
at which time the output will swing high for a couple of seconds, then return low.
If motion continues the output will cycle in this manner until the sensors line of
sight of still again.

10
3.7 Calibration

The PIR Sensor requires a ‘warm-up’ time in order to function properly. This is
due to the settling time involved in ‘learning’ its environment. This could be
anywhere from 10-60 seconds. During this time there should be as little motion as
possible in the sensors field of view.

3.8 Sensitivity

The PIR Sensor has a range of approximately 20 feet. This can vary with
environmental conditions. The sensor is designed to adjust to slowly changing
conditions that would happen normally as the day progresses and the
environmental conditions change, but responds by toggling its output when sudden
changes occur, such as when there is motion

PIR SENSOR

Figure 3.1 PIR sensors

11
FEATURES:-
S.NO. PARAMETER VALUE
1 Power source 220-240V/AC,100-
130V/AC
2 Rated load 100W(max.)
3 Detection distance 8m(max.<24)
4 Detection range 100°/360°
5 Ambient light <2Lux-daylight
6 Duration time 5-480S
7 Power frequency 50-60Hz
8 Switch function auto / off / on

Table 3.2 Features of PIR sensor.

12
4 HARDWARE REQUIREMENTS

• Microcontroller
• PIR
• ADC
• Buzzer
• PC

13
4.1 MICROCONTROLLER:-

Figure 4.1 Microcontroller interfacing with the sub-


components.

14
AT89s52 Microcontroller:

Features:

 Compatible with MCS®-51 Products


 8K Bytes of In-System Programmable (ISP) Flash
Memory –
Endurance: 1000 Write/Erase Cycles
 4.0V to 5.5V Operating Range
 Fully Static Operation: 0 Hz to 33 MHz
 Three-level Program Memory Lock
 256 x 8-bit Internal RAM
 32 Programmable I/O Lines
 Three 16-bit Timer/Counters
 Eight Interrupt Sources
 Full Duplex UART Serial Channel
 Low-power Idle and Power-down Modes
 Interrupt Recovery from Power-down Mode
 Watchdog Timer
 Dual Data Pointer
 Power-off Flag
 Fast Programming Time
 Flexible ISP Programming (Byte and Page Mode)
 Green (Pb/Halide-free) Packaging Option

15
Description:

The AT89S52 is a low-power, high-performance


CMOS 8-bit microcontroller with 8K bytes of in-system
programmable Flash memory. The device is
manufactured using Atmel’s high-density nonvolatile
memory technology and is compatible with the Indus-try-
standard 80C51 instruction set and pin out. The on-chip
Flash allows the program memory to be reprogrammed
in-system or by a conventional nonvolatile memory pro-
grammer. By combining a versatile 8-bit CPU with in-
system programmable Flash on a monolithic chip, the
Atmel AT89S52 is a powerful microcontroller which
provides a highly-flexible and cost-effective solution to
many embedded control applications. The AT89S52
provides the following standard features: 8K bytes of
Flash, 256 bytes of RAM, 32 I/O lines, Watchdog timer,
two data pointers, three 16-bit timer/counters, a six-
vector two-level interrupt architecture, a full duplex serial
port, on-chip oscillator, and clock circuitry. In addition,
the AT89S52 is designed with static logic for operation
down to zero frequency and supports two software
selectable power saving modes. The Idle Mode stops the
CPU while allowing the RAM, timer/counters, serial port,
and interrupt system to continue functioning. The Power-
down mode saves the RAM con-tents but freezes the
oscillator, disabling all other chip functions until the next
interrupt or hardware reset.

16
Figure 4.2 Pin Diagram for 40-lead PDIP Microcontroller.

17
Figure 4.3 Architecture of Microcontroller.

18
Pin Description

VCC Supply voltage.

GND Ground.

Port 0

Port 0 is an 8-bit open drain bidirectional I/O port. As


an output port, each pin can sink eight TTL inputs. When
1s are written to port 0 pins, the pins can be used as
high-impedance inputs. Port 0 can also be configured to
be the multiplexed low-order address/data bus during
accesses to external program and data memory. In this
mode, P0 has internal pull-ups. Port 0 also receives the
code bytes during Flash programming and outputs the
code bytes during program verification. External pull-
ups are required during program verification.

Port 1

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

19
Table 4.1 Alternate Functions of Port 1 of Microcontroller.

Port 2

Port 2 is an 8-bit bidirectional I/O port with internal


pull-ups. The Port 2 output buffers can sink/source four
TTL inputs. When 1s are written to Port 2 pins, they are
pulled high by the internal pull-ups and can be used as
inputs. As inputs, Port 2 pins that are externally being
pulled low will source current (IIL) because of the internal
pull-ups. Port 2 emits the high-order address byte during
fetches from external program memory and during
accesses to external data memory that uses 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 uses 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 programming 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-
20
System Programming) P1.7 SCK (used for In-System
Programming)

Port 3

Port 3 is an 8-bit bidirectional I/O port with internal


pull-ups. The Port 3 output buffers can sink/source four
TTL inputs. When 1s are written to Port 3 pins, they are
pulled high by the internal pull-ups and can be used as
inputs. As inputs, Port 3 pins that are externally being
pulled low will source current (IIL) because of the pull-
ups. Port 3 receives some control signals for Flash
programming and verification. Port 3 also serves the
functions of various special features of the AT89S52, as
shown in the following table.

Table 4.2 Alternate Functions of Port 3 of Microcontroller.

21
RST

Reset input. A high on this pin for two machine


cycles while the oscillator is running resets the device.
This pin drives high for 98 oscillator periods after the
Watchdog times out. The DISRTO bit in SFR AUXR
(address 8EH) can be used to disable this feature. In the
default state of bit DISRTO, the RESET HIGH out feature is
enabled.

ALE/PROG

Address Latch Enable (ALE) is an output pulse for


latching the low byte of the address during accesses to
external memory. This pin is also the program pulse input
(PROG) during Flash programming. In normal operation,
ALE is emitted at a constant rate of 1/6 the oscillator
frequency and may be used for external timing or
clocking purposes. Note, however, that one ALE pulse is
skipped during each access to external data memory. If
desired, ALE operation can be disabled by setting bit 0 of
SFR location 8EH. With the bit set, ALE is active only
during a MOVX or MOVC instruction. Otherwise, the pin is
weakly pulled high. Setting the ALE-disable bit has no
effect if the microcontroller is in external execution mode.

PSEN

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

22
PSEN activations are skipped during each access to
external data memory.

EA/VPP

External Access Enable. EA must be strapped to GND


in order to enable the device to fetch code from external
program memory locations starting at 0000H up to
FFFFH. Note, however, that if lock bit 1 is programmed,
EA will be internally latched on reset. EA should be
strapped to VCC for internal program executions. This pin
also receives the 12-volt programming enable voltage
(VPP) during Flash programming.

XTAL1

Input to the inverting oscillator amplifier and input


to the internal clock operating circuit.

XTAL2

Output from the inverting , oscillator amplifier.

Memory Organization

MCS-51 devices have a separate address space for


Program and Data Memory. Up to 64K bytes each of
external Program and Data Memory can be addressed.

Program Memory

23
If the EA pin is connected to GND, all program
fetches are directed to external memory. On the
AT89S52, if EA is connected to VCC, program fetches to
addresses 0000H through 1FFFH are directed to internal
memory and fetches to addresses 2000H through FFFFH
are to external memory.

Data Memory

The AT89S52 implements 256 bytes of on-chip RAM.


The upper 128 bytes occupy a parallel address space to
the Special Function Registers. This means that the upper
128 bytes have the same addresses as the SFR space but
are physically separate from SFR space. When an
instruction accesses an internal location above address
7FH, the address mode used in the instruction specifies
whether the CPU accesses the upper 128 bytes of RAM or
the SFR space. Instructions which use direct addressing
access the SFR space. For example, the following direct
addressing instruction accesses the SFR at location 0A0H
(which is P2). MOV 0A0H, #data Instructions that use
indirect addressing access the upper 128 bytes of RAM.
For example, the following indirect addressing instruction,
where R0 contains 0A0H, accesses the data byte at
address 0A0H, rather than P2 (whose address is 0A0H).
MOV @R0, #data Note that stack operations are
examples of indirect addressing, so the upper 128 bytes
of data RAM are available as stack space.

Watchdog Timer (One-time Enabled with Reset-out)

The WDT is intended as a recovery method in


situations where the CPU may be subjected to software
upsets. The WDT consists of a 14-bit counter and the

24
Watchdog Timer Reset (WDTRST) SFR. The WDT is
defaulted to disable from exiting reset. To enable the
WDT, a user must write 01EH and 0E1H in sequence to
the WDTRST register (SFR location 0A6H). When the WDT
is enabled, it will increment every machine cycle while
the oscillator is running. The WDT timeout period is
dependent on the external clock frequency. There is no
way to disable the WDT except through reset (either
hardware reset or WDT overflow reset). When WDT over-
flows, it will drive an output RESET HIGH pulse at the RST
pin.

Using the WDT

To enable the WDT, a user must write 01EH and


0E1H in sequence to the WDTRST register (SFR location
0A6H). When the WDT is enabled, the user needs to
service it by writing 01EH and 0E1H to WDTRST to avoid
a WDT overflow. The 14-bit counter overflows when it
reaches 16383 (3FFFH), and this will reset the device.
When the WDT is enabled, it will increment every
machine cycle while the oscillator is running. This means
the user must reset the WDT at least every 16383
machine cycles. To reset the WDT the user must write
01EH and 0E1H to WDTRST. WDTRST is a write-only
register. The WDT counter cannot be read or written.
When WDT overflows, it will generate an output RESET
pulse at the RST pin. The RESET pulse duration is
98xTOSC, where TOSC = 1/FOSC. To make the best use
of the WDT, it should be serviced in those sections of
code that will periodically be executed within the time
required to prevent a WDT reset.

25
WDT during Power-down and Idle

In Power-down mode the oscillator stops, which


means the WDT also stops. While in Power-down mode,
the user does not need to service the WDT. There are two
methods of exiting Power-down mode: by a hardware
reset or via a level-activated external interrupt which is
enabled prior to entering Power-down mode. When
Power-down is exited with hardware reset, servicing the
WDT should occur as it normally does whenever the
AT89S52 is reset. Exiting Power-down with an interrupt is
significantly different. The interrupt is held low long
enough for the oscillator to stabilize. When the interrupt
is brought high, the interrupt is serviced. To prevent the
WDT from resetting the device while the interrupt pin is
held low, the WDT is not started until the interrupt is
pulled high. It is suggested that the WDT be reset during
the interrupt service for the interrupt used to exit Power-
down mode. To ensure that the WDT does not overflow
within a few states of exiting Power-down, it is best to
reset the WDT just before entering Power-down mode.
Before going into the IDLE mode, the WDIDLE bit in SFR
AUXR is used to determine whether the WDT continues to
count if enabled. The WDT keeps counting during IDLE
(WDIDLE bit = 0) as the default state. To prevent the
WDT from resetting the AT89S52 while in IDLE mode, the
user should always set up a timer that will periodically
exit IDLE, service the WDT, and reenter IDLE mode. With
WDIDLE bit enabled, the WDT will stop to count in IDLE
mode and resumes the count upon exit from IDLE.

26
27
4.2 ADC

Figure 4.4 Interfacing ADC with other components of the system.

28
ADC 0808/0809:

General Description

The ADC0808, ADC0809 data acquisition component


is a monolithic CMOS device with an 8-bit analog-to-
digital converter, 8-channel multiplexer and
microprocessor compatible control logic. The 8-bit A/D
converter uses successive approximation as the
conversion technique. The converter features a high
impedance chopper stabilized comparator, a 256R
voltage divider with analog switch tree and a successive
approximation register. The 8-channel multiplexer can
directly access any of 8-single-ended analog signals. The
device eliminates the need for external zero and full-scale
adjustments. Easy interfacing to microprocessors is
provided by the latched and decoded multiplexer address
inputs and latched TTL TRI-STATE® outputs. The design
of the ADC0808, ADC0809 has been optimized by
incorporating the most desirable aspects of several A/D
conversion techniques. The ADC0808, ADC0809 offers
high speed, high accuracy, minimal temperature
dependence, excellent long-term accuracy and
repeatability, and consumes minimal power. These
features make this device ideally suited to applications
from process and machine control to consumer and
automotive applications. For 16-channel multiplexer with
common output (sample/hold port) see ADC0816 data
sheet. (See AN-247 for more information.)

Features

 Easy interface to all microprocessors

29
 Operates ratio metrically or with 5 VDC or analog
span
 Adjusted voltage reference
 No zero or full-scale adjust required
 8-channel multiplexer with address logic
 0V to 5V input range with single 5V power supply
 Outputs meet TTL voltage level specifications
 Standard hermetic or molded 28-pin DIP package
 28-pin molded chip carrier package
 ADC0808 equivalent to MM74C949
 ADC0809 equivalent to MM74C949-1

Key Specifications

 Resolution 8 Bits
 Total Unadjusted Error ±1⁄2 LSB and ±1 LSB
 Single Supply 5 VDC
 Low Power 15 mW
 Conversion Time 100 μs

Block Diagram:

30
Figure 4.5 ADC Block Diagram.

Pin Diagram:

31
Figure 4.6 Pin Diagram for ADC.

Functional Description:

Multiplexer:
32
The device contains an 8-channel single-ended
analog signal multiplexer. A particular input channel is
selected by using the address decoder. Table 1 shows the
input states for the address lines to select any channel.
The address is latched into the decoder on the low-to-
high transition of the address latch enable signal.

Table 4.3 Channel Selection for 8-channel MUX.

4.3 BUZZER

33
Figure 4.7 Buzzer.

A buzzer or beeper (BUZZERS)is a signaling device, usually electronic,


typically used in automobiles, household appliances such as a microwave oven, or
game shows. It most commonly consists of a number of switches or sensors
connected to a control unit that determines if and which button was pushed or a
preset time has lapsed, and usually illuminates a light on the appropriate button or
control panel, and sounds a warning in the form of a continuous or intermittent
buzzing or beeping sound. Initially this device was based on an electromechanical
system which was identical to an electric bell without the metal gong (which
makes the ringing noise). Often these units were anchored to a wall or ceiling and
used the ceiling or wall as a sounding board. Another implementation with some
AC-connected devices was to implement a circuit to make the AC current into a
noise loud enough to drive a loudspeaker and hook this circuit up to a cheap 8-ohm
speaker. Nowadays, it is more popular to use a ceramic-based piezoelectric
sounder which makes a high-pitched tone. Usually these were hooked up to
"driver" circuits which varied the pitch of the sound or pulsed the sound on and off.

Features
• Rated Frequency: 3,100Hz
• Operating Voltage: 3 - 20Vdc
• Current Consumption: 14mA @ 12Vdc
• Sound Pressure Level (30cm): 73dB @ 12Vdc

34
• King State Buzzer - KPE-200
• Dimensions: 22.5mm Diameter, 19mm High, 29mm between mounting holes

4.4 Voltage Regulator:

Figure 4.8 Voltage Regulator.


Features:

• Output Current up to 1A
• Output Voltages of 5, 6, 8, 9, 10, 12, 15, 18, 24V
• Thermal Overload Protection
• Short Circuit Protection
• Output Transistor Safe Operating Area Protection

35
Figure 4.9 Internal Block Diagram for Voltage Regulator.
Description:
The KA78XX/KA78XXA series of three-terminal
positive regulator are available in the 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 shut down and
safe operating area protection, making it essentially
indestructible. If adequate heat sinking is provided, they
can deliver over 1A output current. Although designed
primarily as fixed voltage regulators, these devices can
be used with external components to obtain adjustable
voltages and currents.

36
4.5 POWER SUPPLY:

Power supply is a reference to a source of electrical


power. A device or system that supplies electrical or
other types of energy to an output load or group of loads
is called a power supply unit or PSU. The term is most
commonly applied to electrical energy supplies, less often
to mechanical ones, and rarely to others.

A 230v, 50Hz Single phase AC power supply is given


to a step down transformer to get 12v supply. This
voltage is converted to DC voltage using a Bridge
Rectifier. The converted pulsating DC voltage is filtered
by a 2200uf capacitor and then given to 7805 voltage
regulator to obtain constant 5v supply. This 5v supply is
given to all the components in the circuit. A RC time

37
constant circuit is added to discharge all the capacitors
quickly. To ensure the power supply a LED is connected
for indication purpose.

38
OVERALL CIRCUIT DIAGRAM

39
5 MARKOV MODEL OF DIGITAL APPROXIMATION

Once the wavelet coefficients are obtained ,a MM based


classification procedure, similar to theone in [7], is carried out
for VOC gas leak detection. There are three types of events to be
classified: a walking person a gas leak and a no-activity event.
Two three-state Markov models are used to model a VOC gas
40
leak and a walking person. In the training step, two threshold
values are defined in the wavelet domain for each model, T1 < 0
and T2 > 0.Since the wavelet signal is a zero mean signal, T2 =
−T1.The same threshold values are used in each model. Let the
three states be S0, S1 and S2. States of wavelet coefficients are
defined as follows:

if (w[k] < T1)


then state S0
else if (T1 < w[k] < T2)
then state S1
else
state S2 is attained accordingly
end

Thresholds are defined such that the wavelet coefficientsof the


no-activity event remain in state S1. The system is instate S1 as
long as there is not any significant activity in theviewing range
of the PIR sensor. Therefore, although thereare three events to
be classified, only two Markov models are used, one for a
walking person and the other for a gasleak as shown in Figure 5.
No-activity event is detected bycontrolling whether the system
remains in S1 or not.
During the training phase, only the state transition probabilities
pa(i, j) and pb(i, j) are estimated for each model.During the
classification process, we only use two models Corresponding to
the VOC gas leak and walking person eventsas the system
mostly remains in state S1 when there is no activity,The state
transition probability, p(1, 1), is very close to1 and others are
close to 0. To decide the class affiliation ofa test signal, state
vector and the corresponding number of
41
Fig. 5.1 Markov models and state transition definitions for (a)
’VOC gas leak’ and (b) ’walking person’ classes

Transitions of the signal are determined. Let C be the state


sequence of the test signal and tij be the number of transitions
From i − th state to j − th state. Then the probabilities for
The state sequence C of belonging to ’gas leak’ and ’walking
person’classes are computed as follows:
Pa,b(C) =Li=1pa,b(Ci+1|Ci) =2i=02j=0(pa,b(i, j))tij , (1)
where L is the length of the state sequence C of the test signal.
During the classification phase, the state sequence of the
42
test signal C is divided into windows of length 25 and each
window is fed into the ’gas leak’ and the ’walking person’
models. The model yielding the highest probability is
determined and monitored at the end of each 4 seconds period,
as the result of the analysis of PIR sensor data. To avoid
multiplications during classification, we use Eq. 2 instead of
Eq.1.
Pa,b(C) =2i=2j=0tij log10(pa,b(i, j)) (2)

Log values are obtained from a look-up table. The decision


Algorithm is as follows:

if Pa(C) > Pb(C)


Then the test window is affiliated with the ’gas leak’ class
Else
The window is affiliated with the ’walking person’ class
End
if ptest(1, 1) > 0.8
The test window is affiliated to the ’no-activity’ class
End

6 SOFTWARE REQUIREMENTS

1. EMBEDDED C
2. Lab VEIW

43
6.1 INTRODUCTION
The C programming language is perhaps the most popular programming language
for programming embedded systems.
Most C programmers are spoiled because they program in environments where not
only is there a standard library implementation, but there are frequently a number
of other libraries available for use. The cold fact is, that in embedded systems,
there rarely are many of the libraries that programmers have grown used to, but
occasionally an embedded system might not have a complete standard library, if
there is a standard library at all. Few embedded systems have capability for
dynamic linking, so if standard library functions are to be available at all, they
often need to be directly linked into the executable. Oftentimes, because of space
concerns, it is not possible to link in an entire library file, and programmers are
often forced to "brew their own" standard c library implementations if they want to
use them at all. While some libraries are bulky and not well suited for use on
microcontrollers, many development systems still include the standard libraries
which are the most common for C programmers.
C remains a very popular language for micro-controller developers due to the code
efficiency and reduced overhead and development time. C offers low-level control
and is considered more readable than assembly. Many free C compilers are
available for a wide variety of development platforms. The compilers are part of an
IDEs with ICD support, breakpoints, single-stepping and an assembly window.
The performance of C compilers has improved considerably in recent years, and
they are claimed to be more or less as good as assembly, depending on who you
ask. Most tools now offer options for customizing the compiler optimization.
Additionally, using C increases portability, since C code can be compiled for
different types of processors.

EXAMPLE:
An example of using C to change a bit is below
Clearing Bits

PORTH &= 0xF5; // Changes bits 1 and 3 to zeros using C

44
PORTH &= ~0x0A; // Same as above but using inverting the bit mask - easier to see which bits
are cleared

Setting Bits

PORTH |= 0x0A; // Set bits 1 and 3 to one using the OR

In assembly this would be


Clearing Bits

BCLR PORTH,$0A ;Changes bits 1 and 3 to zeros using 68HC12 ASM

Setting Bits

BSET PORTH,$0A ;Changes bits 1 and 3 to ones using 68HC12 ASM

Bit Fields

Bit fields are a topic that few C programmers have any experience with, although it
has been a standardized part of the language for some time now. Bit fields allow
the programmer to access memory in unaligned sections, or even in
sections smaller than a byte. Let us create an example:

struct _bitfield {
flagA : 1;
flagB : 1;
nybbA : 4;
byteA : 8;
}

The colon separates the name of the field from its size in bits, not bytes. Suddenly
it becomes very important to know what numbers can fit inside fields of what
length. For instance, the flagA and flagB fields are both 1 bit, so they can only hold

45
boolean values (1 or 0). the nybbA field can hold 4 bits, for a maximum value of
15 (one hexadecimal digit).

fields in a bitfield can be addressed exactly like regular structures. For instance, the
following statements are all valid:

struct _bitfield field;


field.flagA = 1;
field.flagB = 0;
field.nybbA = 0x0A;
field.byteA = 255;

The individual fields in a bit field do not take storage types, because you are
manually defining how many bits each field takes. I wish that's how Richie had
done it. However, I'm pretty sure that: Each bit field requires a storage type such
as "unsigned". However, the fields in a bitfield may be qualified with the
keywords "signed" or "unsigned", although "signed" is implied, if neither is
specified.
If a 1-bit field is marked as signed, it has values of +1 and 0
It is important to note that different compilers may order the fields differently in a
bitfield, so the programmer should never attempt to access the bitfield as an integer
object. Without trial and error testing on your individual compiler, it is impossible
to know what order the fields in your bitfield will be in.
Also bitfields are aligned, like any other data object on a
given machine, to a certain boundary.

C COMPILERS FOR EMBEDDED SYSTEMS

Perhaps the biggest difference between C compilers for embedded systems and C
compilers for desktop computers is the distinction between the "platform" and the
"target". The "platform" is where the C compiler runs -- perhaps a laptop running
Linux or a desktop running Windows. The "target" is where the executable code
generated by the C compiler will run -- the CPU in the embedded system, often
without any underlying operating system.

46
The GCC compiler is the most popular C compiler for embedded systems. GCC
was originally developed for 32-bit Princeton architecture CPUs. So it was
relatively easily ported to target ARM core microcontrollers such as XScale and
Atmel AT91RM9200; Atmel AVR32 AP7 family; MIPS core microcontrollers
such as the Microchip PIC32; and Freescale 68k/ColdFire processors.
The people who write compilers have also (with more difficulty) ported GCC to
target the Texas Instruments MSP430 16-bit MCUs; the Microchip PIC24 and
dsPIC 16-bit Microcontrollers; the 8-bit Atmel AVR microcontrollers; the 8-bit
Freescale 68HC11 microcontrollers.
Other microcontrollers are very different from a 32-bit Princeton architecture CPU.
Many compiler writers have decided it would be better to develop an independent
C compiler rather than try to force the round peg of GCC into the square hole of 8-
bit Harvard architecture microcontroller targets:
SDCC - Small Device C Compiler for the Intel 8051, Maxim 80DS390, Zilog Z80,
Motorola 68HC08, Microchip PIC16, Microchip
There are some highly respected companies that sell commercial C compilers. You
can find such a commercial C compiler for practically every microcontroller,
including the above-listed microcontrollers. Popular microcontrollers not already
listed (i.e., microcontrollers for which the only known C compiler is a commercial
C compiler) include the Cypress M8C MCUs; Microchip PIC10 and Microchip
PIC12 MCUs; etc

SPECIAL FEATURES:

The C language is standardized, and there are a certain number of operators


available that everybody knows and loves. However, many microprocessors have
capabilities that are either beyond what C can do, or are faster than the way C does
it. For instance, the 8051 and PIC microcontrollers both have assembly instructions
for setting and checking individual bits in a byte. C can affect bits individually
using clunky structures known as "bit fields", but bit field implementations are
rarely as fast as the bit-at-a-time operations on some microprocessors.

47
Bit Fields

Bit fields are a topic that few C programmers have any experience with, although it
has been a standardized part of the language for some time now. Bit fields allow
the programmer to access memory in unaligned sections, or even in
sections smaller than a byte. Let us create an example:

struct _bitfield {
flagA : 1;
flagB : 1;
nybbA : 4;
byteA : 8;
}

The colon separates the name of the field from its size in bits, not bytes. Suddenly
it becomes very important to know what numbers can fit inside fields of what
length. For instance, the flagA and flagB fields are both 1 bit, so they can only hold
boolean values (1 or 0). the nybbA field can hold 4 bits, for a maximum value of
15 (one hexadecimal digit).
fields in a bitfield can be addressed exactly like regular structures. For instance, the
following statements are all valid:

struct _bitfield field;


field.flagA = 1;
field.flagB = 0;
field.nybbA = 0x0A;
field.byteA = 255;

The individual fields in a bit field do not take storage types, because you are
manually defining how many bits each field takes. I wish that's how Richie had
done it. However, I'm pretty sure that: Each bit field requires a storage type such
as "unsigned". However, the fields in a bitfield may be qualified with the
keywords "signed" or "unsigned", although "signed" is implied, if neither is
specified.
If a 1-bit field is marked as signed, it has values of +1 and 0 .It is important to note
that different compilers may order the fields differently in a bitfield, so the
programmer should never attempt to access the bitfield as an integer object.
48
Without trial and error testing on your individual compiler, it is impossible to
know what order the fields in your bitfield will be in.
Also bitfields are aligned, like any other data object on a given machine, to a
certain boundary.

const

A "const" in a variable declaration is a promise by the programmer who wrote it


that the program will not alter the variable's value.
There are 2 slightly different reasons "const" is used in embedded systems.
One reason is the same as in desktop applications:
Often a structure, array, or string is passed to a function using a pointer. When that
argument is described as "const", such as when a header file says

void print_string( char const * the_string );

, it is a promise by the programmer who wrote that function that the function will
not modify any items in the structure, array, or string. (If that header file is
properly #included in the file that implements that function, then the compiler will
check that promise when that implementation is compiled, and give an error if that
promise is violated).
On a desktop application, such a program would compile to exactly the same
executable if all the "const" declarations were deleted from the source code -- but
then the compiler would not check the promises.
When some other programmer has an important piece of data he wants to pass to
that function, he can be sure simply by reading the header file that that function
will not modify those items. Without that "const", he would either have to go
through the source code of the function implementation to make sure his data isn't
modified (and worry about the possibility that the next update to that
implementation might modify that data), or else make a temporary copy of the data
to pass to that function, keeping the original version unmodified.

49
6.2 LabVIEW

Lab VIEW is a program development application, much like various commercial C


or BASIC development systems, or National Instruments LabWindows.However,
Lab VIEW is different from those applications in one important respect. Other
programming systems use text-based languages to create lines of code,while Lab
VIEW uses a Graphical programming language , to create programs in block
diagram form.
You can use Lab VIEW with little programming experience. Lab VIEW uses
terminology, icons, and ideas familiar to scientists and engineers and relies on
graphical symbols rather than textual language to describe programming actions.
Lab VIEW has extensive libraries of functions and subroutines for most
programming tasks. For Windows, Macintosh, and Sun, Lab VIEW contains
application specific libraries for data acquisition and VXI instrument control. Lab
VIEW also contains application-specific libraries for GPIB and serial instrument
control, data analysis, data presentation, and data storage.LabVIEW includes
conventional program development tools, so you can set breakpoints, animate
program execution to see how data passes through the program, and
Single-step through the program to make debugging and program development
easier.

50
WORKING OF LabVIEW

Lab VIEW includes libraries of functions and development tools designed


specifically for instrument control. For Windows, Macintosh, and Sun, Lab VIEW
also contains libraries of functions and development tools for data acquisition. Lab
VIEW programs are called virtual instruments (Vis)because their appearance and
operation imitate actual instruments. However, they are analogous to functions
from conventional language programs. VIs have both an interactive user interface
and a source code equivalent, and accept parameters from higher-level Visited
following are descriptions of these three VI features

 VIs contains an interactive user interface, which is called the front Panel,
because it simulates the panel of a physical instrument. The front panel can
contain knobs, push buttons, graphs, and other controls and indicators. You
input data using a keyboard and mouse, and then view the results on the
computer screen.
 VIs receives instructions from a block diagram, which you construct in G.
The block diagram supplies a pictorial solution to a programming problem.
The block diagram contains the source code for the VI.
 VIs use a hierarchical and modular structure. You can use them as top-level
programs, or as subprograms within other programs or subprograms. A VI
within another VI is called a subVI.The icon and connector pane of a VI
work like a graphical parameter list so that other VIs can pass data to it as a
subVI.

51
Virtual Instruments
Lab VIEW programs are called virtual instruments (VIs). VIs has three main parts:
the front panel, the block diagram, and the icon/connector.
OBJECTIVE
To open, examine, and operate a Vi and to familiarize yourself with the basic
concepts of a virtual instrument.
LabVIEW Programs Are Called Virtual Instruments(VIs):-

Front Panel
Controls = Inputs
Indicators = Outputs

52
Block Diagram
Accompanying“program”for front panel Components“wired” together

53
VI Block Diagram

Block
Diagram
Toolbar

SubVI

54
OPERATION ON VIs.
Creating a VI
Front Panel Window

Block Diagram Window

55
Control Indicator Terminals

56
6.3 PROGRAM USED

#include<reg51.h>
sfr adcout=0xa0;
sbit A1=P1^0;
sbit B1=P1^1;
sbit C1=P1^2;
sbit relay1=P1^3;
sbit relay2=P1^4;
void delay(unsigned char value2);
void adata(unsigned int);
unsigned char a,b,c,d;
void serialint()
{
SCON=0x50;
TMOD=0X20;
TH1=0XFD;
TR1=1;
}
void txs(unsigned char kk)
{
TI=0;
SBUF=kk;
while(TI==0);
TI=0;
}
void conv(unsigned int value1)
{
unsigned int huns,tens,ones;
huns=(value1/100);

57
txs(huns+0x30);
tens=((value1/10)%10);
txs(tens+0x30);
ones=(value1%10);
txs(ones+0x30);
}
void adata(unsigned int adcout)
{
unsigned char val=0;
val=val|(adcout&0x80)>>7;
val=val|(adcout&0x40)>>5;
val=val|(adcout&0x20)>>3;
val=val|(adcout&0x10)>>1;
val=val|(adcout&0x8)<<1;
val=val|(adcout&0x4)<<3;
val=val|(adcout&0x2)<<5;
val=val|(adcout&0x1)<<7;
conv(val);
}
void delay(unsigned char value2)
{
int i,j;
for(i=0;i<=value2;i++)
{
for(j=0;j<=1000;j++)
{
}
}
}

void main()
58
{
relay1=relay2=0;
serialint();
while(1)
{
while(RI==0)
{
A1=0;B1=0;C1=0;
delay(50);
txs('P');
adata(adcout);
delay(100);

A1=1;B1=0;C1=0;
delay(50);
txs('Q');
adata(adcout);
delay(100);

}
switch(SBUF)
{
case 'B': relay1=1;RI=0;break;
case 'C': relay2=1;RI=0;break;
case 'D': relay1=0;RI=0;break;
case 'E': relay2=0;RI=0;break;

}
}
}

59
2)
<html>
<body>
<pre>
<h1>µVision3 Build Log</h1>
<h2>Project:</h2>
C:\Documents and Settings\Embedded02\Desktop\BACK
UP\Atmel Pgm\ADC+Serial\AJENT.uv2
Project File Date: 11/20/2010

<h2>Output:</h2>

60
7 EXPERIMENTAL RESULTS

The detection range of the PIR sensor is 5 meters, but in our


experiments we record VOC gas leak and walking person
sequences at a distance of up to 3 meters because we use the
PIR sensor without the Fresnel lens on it. As a result, after
3 meters the strength of the PIR output signal decreases and
the sensor is not able to respond to the changes. We used a
bottled gas which contains a mixture of butane and propane
gases, in ratios of %70 and %30, respectively. We recorded
the VOC gas leak signal by releasing gas vapor from the
container when it is 10 cm, 1 meter and 3 meters away from the
Sensor. We first started recording the background and then Start
the VOC gas leak without entering the viewing range of the
sensor. In 4 of 32 gas leak experiments, we used a 1 meter long
pipe between the sensor and the bottled gas to have controlled
experiments making sure that the sensor signal is due
to the gas vapor. Since the PIR sensor also reacts to the ordinary
motion ofhot bodies, we recorded signals due to a person
walking in the viewing range of the PIR sensor on a straight line
which is tangent to a circle with a radius of 1, 2 and 3 meters
and the sensor being at the center. We also record waving arm
movements at distances of 1, 2 and 3 meters to the sensor.
We use the threshold values, (T1 = −T2 = 10) to estimate
the reference transition probabilities. Threshold values
are greater than 2.5σ of the background signal. The state
sequence is divided into windows of lengths 25, each covering
a time frame of 4 seconds. At the end of each time frame, the
result of the analysis is monitored. If two consequent frames
are analyzed as gas leak, we trigger an alarm. Moreover,
61
if the probability of a transition from S1 to S1, ptest(1, 1),
is greater than 0.8, we decide that there is no-activity. The
results for the MM analysis are presented in Table 1.
OurTable 1. Classification results
for 32 VOC gas leak and 50non-gas test sequences. The system
triggers an alarm when a VOC gas leak is detected in the
viewing range of the PIR sensor.
Test Seq. # of Test # of False # of Missed # of
Sequences Alarms Leaks Detect.
Gas Leak 32 - 2 30
Non-Gas 50 5 - -method successfully detects VOC gas leak for
30 of the 32gas leak test sequences. The two missed leaks
belong to cases that are at a distance greater than 3 meters to the
sensor. The strength of the output signal of the PIR sensor
decreases for the leaks far away from the sensor and they are
analyzed as a no-activity event. Our system triggers a false
alarm for 5 of 50 non-gas test sequences. Three of them belong
to the walking person and two of them belong to the arm waving
experiments. If a person is at a distance of up to 1m, we do not
encounter any false alarms. However, when the person is far
away, the strength of the sensor output signal decreases, as a
result walking event may be confused as a gas leak. Therefore,
the range of our VOC sensor is 1 meter and it can be placed
facing valves and other possible leak locations. We also carried
out experiments with different sensors. For example, a ME-O2
electrochemical gas sensor has a response time of about 30
seconds , a MQ-4 gas sensor has a response time longer than 5
minutes and a hydrogen selective gas sensor described in has a
response time of 50 seconds. On the other hand, we can detect a
gas leak with a PIR sensor at 8 seconds.

62
8 CONCLUSION

In our project, we proposed and


implemented a novel and cost efficient method for VOC gas
detection by using a PIR sensor. We used the fact that the sensor
has spectral response in the infrared part of the spectrum
intersecting with the absorption bands of butane and propane
gases. Gas vapor spread out gradually, whereas the IR radiation
propagation is very rapid. Therefore, unlike conventional
detectors, infrared sensor has fast response time.

Markov models (MM) which are tailored


for VOC gas detection are used and they process the wavelet
transformed sensor data. The algorithm is computationally
efficient and it can be implemented using a low-cost digital
signal processor.
In future, steps to increase the range of PIR
sensor can be worked upon. Better understanding of simulation
software like LABVIEW would help in effective
troubleshooting in real time applications.

63
REFERENCES

[1] J. G. Crowder, S. D. Smith, A. Vass, and J. Keddie, Mid-


infrared Semiconductor
Optoelectronics, chapter Infrared Methods for Gas Detection,
pp. 595–613, Springer Berlin / Heidelberg, 2006.
[2] Cambridge Sensotec, “Gas analysis methods,” http://pdf.
directindustry.com/pdf/cambridgesensotec/gasdetectionmethod
-explained/14678-44117-42.html, Accessed at May 2009.
[3] D.D. Lee and D.S. Lee, “Environmental gas sensors,”
Sensors Journalize, vol. 1, no. 3, pp. 214–224, Oct 2001.
[4] Figaro Engineering Inc., “Tgs 2610 - for the detection of lp
gas,” .
[5] E. Bakker and M. Telting-Diaz, “Electrochemical sensors,”
Anal. Chem., vol. 74, 2002.
[6] N. Aschen brenner, “Laser diode measures carbon monoxide

64
traces,http://w1.siemens.com/innovation/en/news_events/ct_pres
semitteilungen/index/e_research_news/2009/e_22_resnews_091
htm, Accessed at May 2009.

[7] B.U. T¨oreyin, E.B. Soyer, O. Urfalioglu, and A.E. Cetin,


“Flame Detection System Based on Wavelet Analysis of PIR
Sensor Signals with an HMM Decision Mechanism,” in 16th
European Signal Processing Conference (EUSIPCO 2008),
2008.

[8] Yuan Y. Tan, Wavelet Theory and Its Application to Pattern


Recognition (Machine Perception & Artificial Intelligence),
World Scientific Publishing Company.
[9] E. Bala and A.E. Cetin, “Computationally efficient wavelet
affine invariant.functions for shape recognition,” vol. 26, no. 8,
2004.
[10] Hanwei Electronics, “ME-O2 Electrochemical Gas Sensor,”
http://www.diytrade.com/china/4/products/5010173/O2_electroc
hemical_gas_sensors.html, Accessed at May 2009.
[11] Hanwei Electronics, “Technical Data MQ4 Gas Sensor,”
http://www.hwsensor.com/English/PDF/sensor/MQ-4.pdf,
Accessed at May 2009.
[12] Woosuck Shin, Masahiko Matsumiya, Noriya Izu, and
Norimitsu Murayama,“Hydrogen-selective thermoelectric gas
sensor,” Sensors and Actuators B: Chemical, vol. 93, no. 1-3,
pp. 304 – 308, 2003, Proceedings of the Ninth International
Meeting on Chemical Sensors.

65
66

Вам также может понравиться