Metal Gas Detec Robo
Metal Gas Detec Robo
Metal Gas Detec Robo
Chapter 3
HARDWARE DESCRIPTION
3.1 Microcontroller
Figure 3.1.1 AT89S52 Microcontroller with Driver Circuit . When we have to learn about a new computer we have to familiarize about the machine capability we are using, and we can do it by studying the internal hardware design (devices Architecture), and also to know about the size, number and the Size of the registers. A microcontroller is a single chip that contains the Processor (the CPU), non-volatile memory for the program (ROM or flash), volatile memory for input and output (RAM), a clock and an I/O control unit. Also called a "computer on a chip," billions of microcontroller
units (MCUs) are embedded each year in a myriad of products from toys to appliances to automobiles. For example, a single vehicle can use 70 or more microcontrollers.
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 Powerdown mode saves the RAM con-tents but freezes the oscillator, disabling all other chip functions until the next interrupt.
A T 8 9 S 5 2
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 internal Pull-ups and can be used as inputs. As inputs,Port1 pins that are externally being pulled low will source current
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 pin P1.0 P1.1 P1.5 P1.6 P1.7 AlterNet function T2(external count input to timer/counter2),clock out T2EX(Timer/counter2 capture trigger direction control) MOSI(used for in-system programming) MISO(used for in-system programming) SCK(used for in-system programming)
Port 1 also receives the low-order address bytes during Flash programming and verification.
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 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 pullups 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. Port3 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-up sand can be used as inputs. As inputs,
Port 3 pins that are externally being pulled Low will source current 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.
Port pin P3.0 P3.1 P3.2 P3.3 P3.4 P3.5 P3.6 P3.7
Alternate function RXD(serial input port) TXD(serial output port) INTO (external interrupt 0) INT1 (external interrupt 1) T0 (timer 0 external input) T01(timer 01external input) WR(external data memory write storable) RD(external data memory read storable)
7
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 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. XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier that can be Configured for use as an on-chip oscillator, as shown in Figure 3.1.4. Either a quartz crystal or Ceramic resonator may be used. To drive the device from an external clock source, XTAL2 Should be left unconnected while XTAL1 is driven, as shown in Figure 3.1.5 There are no requirements on the duty cycle of the external clock signal, since the input to the internal clocking Circuitry is through a divide-by-two flip-flop, but minimum and maximum voltage high and low Time specifications must be observed.
10
3.1.2.5 Registers
In the CPU, registers are used to store information temporarily. That information could be a byte of data to be processed, or an address pointing to the data to be fetched. In the 8051 there is only one data type: 8 bits. With an 8- bit data type, any data larger than 8 bits has to be broken into 8-bit chunks before it is processed. The most commonly used registers of the 8051 are A(accumulator), B, R0, R1, R2, R3, R4, R5, R6, R7, DPTR (data pointer) and PC (program counter). All the above registers are 8-bit registers except DPTR and the program counter. The accumulator A is used for all arithmetic and logic instructions.
Program Counter and Data Pointer The program counter is a 16- bit register and it points to the address of the next instruction to be executed. As the CPU fetches op-code from the program ROM, the program counter is incremented to point to the next instruction. Since the PC is 16 bit wide, it can access
11
program addresses 0000 to FFFFH, a total of 64K bytes of code. However, not all the members of the 8051 have the entire 64K bytes of on-chip ROM installed. The DPTR register is made up of two 8-bit registers, DPH and DPL, which are used to furnish memory addresses for internal and external data access. The DPTR is under the control of program instructions and can be specified by its name, DPTR. DPTR does not have a single internal address; DPH and DPL are assigned an address each.
Flag bits and the PSW Register Like any other microprocessor, the 8051 have a flag register to indicate arithmetic conditions such as the carry bit. The flag register in the 8051 is called the program status word (PSW) register. The program status word (PSW) register is an 8-bit register. It is also referred as the flag register. Although the PSW register is 8-bit wide, only 6 bits of it are used by the microcontroller. The two unused bits are user definable flags. Four of the flags are conditional flags, meaning they indicate some conditions that resulted after an instruction was executed. These four are CY (carry), AC (auxiliary carry), P (parity), and OV (overflow). The bits of the PSW register are shown below:
CY AC --
Carry flag Auxiliary carry flag Available to the user for general purpose Register bank selector bit 1 Register bank selector bit 0 Overflow flag User definable bit Parity flag
CY (The Carry Flag) This flag is set whenever there is a carry out from the d7 bit. This flag bit is affected after an 8-bit addition or subtraction. It can also be set to 1 or 0 directly by an instruction such as SETB C and CLR C where SETB C stands for set bit carry and CLR C for clear carry.
12
AC (The Auxiliary Carry Flag) If there is carry from D3 to D4 during an ADD or SUB operation, this bit is set: otherwise cleared. This flag is used by instructions that perform BCD arithmetic. P (The Parity Flag) The parity flag reflects the number of 1s in the accumulator register only. If the register A contains an odd number of 1s, then P=1. Therefore, P=0 if Ahas an even number of 1s. OV (The Overflow Flag) This flag is set whenever the result of a signed number operation is too large, causing the high order bit to overflow into the sign bit. In general the carry flags is used to detect errors in unsigned arithmetic operations.
13
14
issuing the Chip Erase instruction. In this mode, chip erase is self-timed and takes about 500 ms. During chip erase, a serial read from any address location will return 00H at the data output.
16
pins. b. Set RST pin to H. If a crystal is not connected across pins XTAL1 and XTAL2, apply a 3 MHz to 33 MHz clock to XTAL1 pin and wait for at least 10 milliseconds. 2. Enable serial programming by sending the Programming Enable serial instruction to pin MOSI/P1.5. The frequency of the shift clock supplied at pin SCK/P1.7 needs to be less than the CPU clock at XTAL1 divided by 16. 3. The Code array is programmed one byte at a time in either the Byte or Page mode. The write cycle is self-timed and typically takes less than 0.5 ms at 5V. 4. Any memory location can be verified by using the Read instruction which returns the content at the selected address at serial output MISO/P1.6. 5. At the end of a programming session, RST can be set low to commence normal device operation. Power-off sequence (if needed): 1. Set XTAL1 to L (if a crystal is not used). 2. Set RST to L. 3. Turn VCC power off. Data Polling: The Data Polling feature is also available in the serial mode. In this mode, during a write cycle an attempted read of the last byte written will result in the complement of the MSB of the serial output byte on MISO.
17
3.2.1 FEATURES
Input voltage levels are compatible with standard MOS levels Output voltage levels are compatible with EIA/TIA-232-E levels Single Supply voltage: 5V Low input current: 0.1A at A= 25 Output current: 24mA Latching current not less than 450mA at A= 25 The transmitter outputs and receiver inputs are protected to 15kV Air ESD
18
MAX232 (+5V -> +-12V converter) Serial port male 9 pin connector (SER)
20
21
Its filter section uses switched capacitor technology for both the high and low group filters and for dial tone rejection. Its decoder uses digital counting techniques to detect and decode all 16 DTMF tone pairs into a 4-bit code. External component count is minimized by provision of an on-chip differential input amplifier, clock generator, and latched tri-state interface bus. Minimal external components required includes a low-cost 3.579545 MHz color burst crystal, a timing resistor, and a timing capacitor. The filter section is used for separation of the low-group and high group tones and
22
it is achieved by applying the DTMF signal to the inputs of two sixth order switched capacitor band pass filters, the bandwidths of which corresponds to the low and high group frequencies. The filter section also incorporates notches at 350 and 440 Hz for exceptional dial tone rejection. Each filter output is followed by a single order switched capacitor filter section which smoothes the signals prior to limiting. Limiting is performed by high-gain comparators which are provided with hysteresis to prevent detection of unwanted low-level signals. The outputs of the comparators provide full rail logic swings at the frequencies of the incoming DTMF signals. Following the filter section is a decoder employing digital counting techniques to determine the frequencies of the incoming tones and to verify that they correspond tothe standard DTMF frequencies. DTMF Tone The DTMF technique outputs distinct representation of 16 common alphanumeric characters (0-9, A-D, *, #) on the telephone. The lowest frequency used is 697Hz and the highest frequency used is 1633Hz, as shown in Table 1.
FREQUENCY
1209 HZ
1336 HZ 2 5 8 0
1477 HZ 3 6 9 #
1633 HZ A B C D
1 4 7 *
23
The DTMF keypad is arranged such that each row will have its own unique tone frequency and also each column will have its own unique tone frequency. Above is a representation of the typical DTMF keypad and the associated row/column frequencies. By pressing a key, for example 5, will generate a dual tone consisting of 770 Hz for the low group and 1336 Hz for the high group.
Table 3.4.2: Digits vs. input data vs. tone output frequency (serial mode) Digit D4 D3 D2 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 0 1 1 1 1 1 D1 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 0 1 1 0 0 1 1 1 D0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 0 1 0 1 0 1 1 Tone Output Frequency (Hz) 697 + 1209 697+ 1336 697+ 1477 770 + 1209 770+ 1336 770+ 1477 852+ 1209 852+ 1336 852 +1477 941 +1336 941 +1209 941 +1477 697 +1633 770 +1633 852 +1633 941+1633 697 770 852 941 1209 1336 1477 1633
24
Figure 3.5.1 Basic Gas Sensor Gas sensor has recently attracted much attention due to increasing demand of environmental monitoring and other gas detecting applications. Among different types of gas sensor, thin film gas sensor has been much of interest because of microelectronic batch- fabricated compatibility, reproducibility, and ability to form multilayer device structures. In this work, thin film based gas sensing circuit is designed for immediate applications of CO detection for environmental monitoring. Ion assisted deposition (IAD) process offers several advantages for gas sensor fabrication, including reactive deposition for gas-sensitive metal- oxide material optimization and improved thin film adhesion for better device reliability. The metal oxide layer was deposited on alumina or glass substrates. The sensors were tested with reducing gases, in the temperature range between 200oC and 350 oC and the electrical change in gas sensor is detected. Gas sensors interact with a gas to initiate the measurement of its concentration. The gas sensor then provides output to a gas instrument to display the measurements. Common gases measured by gas sensors include ammonia, aerosols, arsine, bromine, carbon dioxide, carbon monoxide, chlorine, chlorine dioxide, Diborane, dust, fluorine, germane, halocarbons or refrigerants, hydrocarbons, hydrogen, hydrogen chloride, hydrogen cyanide, hydrogen fluoride, hydrogen selenide, hydrogen sulfide, mercury vapor, nitrogen dioxide, nitrogen oxides, nitric oxide, organic solvents, oxygen, ozone, phosphine, silane, sulfur dioxide, and water vapor. Important measurement specifications to consider when looking for gas sensors include the response time, the distance, and the flow rate. The response time is the amount of time required from the initial contact with the
25
gas to the sensors processing of the signal. Distance is the maximum distance from the leak or gas source that the sensor can detect gases. The flow rate is the necessary flow rate of air or gas across the gas sensor to produce signal. Gas sensors can output a measurement of the gases detected in a number of ways. These include percent LEL, percent volume, trace, leakage, consumption, density, and signature or spectra. The lower explosive limit (LEL) or lower flammable limit (LFL) of a combustible gas is defined as the smallest amount of the gas that will support a self-propagating flame when mixed with air (or oxygen) and ignited. In gas-detection systems, the amount of gas present is specified in terms of % LEL: 0% LEL being a combustible gas-free atmosphere and 100% LEL being an atmosphere in which the gas is at its lower flammable limit. The relationship between % LEL and % by volume differs from gas to gas. Also called volume percent or percent by volume, percent volume is typically only used for mixtures of liquids. Percent by volume is simply the volume of the solute divided by the sum of the volumes of the other components multiplied by 100%. Trace gas sensors given in units of concentration: ppm. Leakage is given as a flow rate like ml/min. Consumption may also be called respiration given in units of ml/L/hr. Density measurements are given in units of density: mg/m^3. A signature or spectra measurement is a spectral signature of the gases present; the output is often a chromatogram. Common outputs from gas sensors include analog voltage, pulse signals, analog currents and switch or relays. Operating parameters to consider for gas sensors include operating temperature and operating humidity.
26
Gas sensor has 6 pin as shown below, and how to connect to circuit is shown above. There is no polarity in gas sensors because these consist of heating coil
Working: Gas sensor output voltage changes as it detect gas, for example at no Gas it produces 1.2 Volt and when it detects Gas its voltage output changes to 3 volt. So by using op-amp as comparator we detect weather gas is present or not.
CIRCUIT DIAGRAM
FEATURES High sensitivity to LPG, natural gas , town gas Small sensitivity to alcohol, smoke. Fast response . Stable and long life Simple drive circuit
APPLICATIONS OF GAS SENSORS They are used in gas leakage detecting equipments in family and Industry, are suitable for detecting of LPG, natural gas, town gas, avoid the noise of alcohol and cooking fumes and cigarette smoke. (i) Gas Leak Protection: - These are areas of industry where the possibility of flammable gas build-up is small, but the consequences of a gas escape could be catastrophic. These tend to be industries which by their nature have large volumes of gases piped around the works:
(ii) Confined Space Entry The most prominent application for portable gas detection instruments. The instrument is used to check the atmosphere of sewers, tanks and other vessels prior to entry for maintenance purposes. These instruments invariably are 'multi-gas'. They have 3 or even 4 sensors included in the package. Large volumes of these instruments are purchased by: Public utilities - especially water and telecoms Chemical and petrochemical - for entry into vessels Cabling contractors
28
Landfill operators
(iii) Hazardous Area: Working Areas of industry where the build-up of flammable gas or vapour is an ever present danger. These instruments are very often the same multi-gas instruments used for confined space entry, but there are areas where single gas monitors ('explosimeters') are used. Typical industrial sectors here are:
Note: Use cigarette Lighter for getting LPG gas SPECIFICATIONS A. Standard work condition Symbol Parameter name Vc Circuit voltage Heating voltage V H Load resistance P L Heater resistance R H P Heating consumption H B. Environment condition Symbol Parameter name Tao Using Tem Tas Storage Tem RH Related humidity Oxygen concentration O2 Technical condition 5V0. 1 5V0. 1 20K 31 10 % 800mw less than Technical condition -10-50 -20-70 less than 95%Rh 21%(standard condition)Oxygen concentration can affect sensitivity Remar ACks OR DC ACOR DC Room Tem
Remar ks
minimum over 2%
value is
29
Inductive proximity sensors operate under the electrical principle of inductance. Inductance is the phenomenon where a fluctuating current, which by definition has a magnetic component, induces an electromotive force (emf) in a target object. To amplify a devices inductance effect, a sensor manufacturer twists wire into a tight coil and runs a current through it. An inductive proximity sensor has four components; The coil, oscillator, detection circuit and output circuit. The oscillator generates a fluctuating magnetic field the shape of a doughnut around the winding of the coil that locates in the devices sensing face. When a metal object moves into the inductive proximity sensors field of detection, Eddy circuits build up in the metallic object, magnetically push back, and finally reduce the Inductive sensors own oscillation field. The sensors detection circuit monitors the oscillators strength and triggers an output from the output circuitry when the oscillator becomes reduced to a sufficient level. The inductive proximity sensor work by setting up a high frequency field. If a target nears the field will it induce eddy current. These currents consume power because of resistance, so energy in the field is lost, and the signal amplitude decreases. The detector examines field magnitude to determine when it has decreased enough to switch. An inductive sensor is able to detect the presence of some metallic materials. This type of sensor consists of four stages.
30
1 2 3 4
Oscillator stage The oscillator consist of capacitor that stores energy in its electrical field and an inductor that stores energy in magnetic field.
Demodulator stage As the current flows back and forth between the capacitor and the coil, a sine
31
Trigger stage The DC voltage from the demodulator is fed into the scmitt trigger. A primary function of this trigger is to produce two different voltages that transition from one to the other very rapidly.
Output stage The primary function of the output stage is to provide a sensor output signal that is sufficient enough for the load to which it is connected. Also, two of the output terminals are used for the power supply connections for the sensor.
1 No physical contact with the object to be detected, thus avoiding wear and enabling fragile or freshly painted objects to be detected.
32
3 Fast response.
6 Solid state technology : no moving parts, therefore service life of sensor independent of the number of operating cycles.
Give Applications
3.6 GLOBAL SYSTEM FOR MOBILE COMMUNICATION (GSM)DEFINITIONGlobal System for Mobile Communication (GSM) is a globally accepted standard 1982 to create a common European mobile telephone standard that would formulate specifications for a pan-European mobile cellular radio system operating at 900 MHz.
GSMThroughout the evolution of cellular telecommunications, various systems have been developed without the benefit of standardized specifications. This presented many problems directly related to compatibility, especially with the development of digital radio technology. The GSM standard is intended to address these problems. From 1982 to 1985 discussions were held to decide between building an analog or digital system. After multiple field tests, a digital system was adopted for GSM. The next task was to decide between a narrow or broadband solution. In May 1987, the narrowband time division multiple access (TDMA) solution was chosen. A summary of GSM milestones is given in table below:
33
YEAR 1982 1986 1987 1988 1989 1990 1991 1992 1993 1995
MILESTONES GSM formed Field test TDMA chosen as access method Memorandum of understanding signed Validation of GSM system Pre-operation system Commercial system start-up Coverage of larger cities/airports Coverage of main roads Coverage of rural areas
SIM300PRODUCT CONCEPTDesigned for global market, SIM 300 is a Tri-band GSM/GPRS engine that works on frequencies EGSM 900 MHz, DCS 1800 MHz and PCS 1900 MHz. SIM300 provides GPRS multi-slot class 10/class 8 (optional) capability and support the GPRS coding schemes CS-1, CS-2, CS-3 and CS-4.
34
With a tiny configuration of 40mm x 33mm x 2.85mm, SIM300 can fit almost all the space requirement in our application, such as smart phones.PDA phone and other mobile device. The physical interface to the mobile application is made through a 60 pins board-to-board connector, which provides all hardware interfaces between the module and customers boards except the RF antenna interface. The keypad and SPI LCD interface will give you the flexibility to develop customized applications. Two serial ports can help us easily develop our applications. Two audio channels include two microphones inputs and two speaker outputs. This can be easily configured by AT commands.
SIM300 provide RF antenna interface with two alternatives: antenna connector and antenna pad. The antenna connector is MURATA MM9329-2700. And customers antenna can be soldered to the antenna pad. The SIM300 is designed with power saving technique, the current consumption to as low as 2.5mA in SLEEP mode.
35
Fig.PCB of SIM300.
36
37