Sunteți pe pagina 1din 38

Preface

ACKNOWLEDGEMENT
Many lives & destinies are destroyed due to the lack of proper guidance, directions & opportunities. It is in this respect we feel that we are in much better condition today due to continuous process of motivation & focus provided by our parents & teachers in general. The process of completion of this project was a tedious job & requires care & support at all stages. We would like to highlight the role played by individuals towards this. We are very thankful to Asst. Prof. Deepak Kumar, Head of Department, for his kind support & faith in us. We would like to express our sincere thanks, with deep sense of gratitude to our project coordinator Er. Payal for his keen interest in our project We are also thankful to all visible & invisible hands which helped us to complete this project with a feeling of success.

Shweta Fulara (4509224) Tarun Bala (4509202) Neha Rani (4509203) Vinod Gera (4509221)

LIST OF FIGURES:

CONTENTS

Chapter 1

INTRODUCTION

INTRODUCTION:
Road traffic injuries are a leading cause of death around the world. In the US, one third of all road accident fatalities are due to alcohol-impaired driving. There is great public concern regarding drunk driving, and a new highway bill pending before the US Congress would instruct all 50 states to require motorists convicted of driving under the influence of alcohol to equip their cars with an interlock system1. (An interlock system is a device that would shut down the vehicle when a specific amount of alcohol is detected2.) The personal breath analyzer market, currently valued at US200 million, is expected to grow rapidly as bills such as this are passed in multiple countries and as drivers become aware of the increased penalties for drunk driving. Alcohol gas sensors are devices that can measure concentrations of alcohol gas over a specified range. They have applications in personal breath analyzers, interlock systems or even mobile phones3. Most alcohol gas sensors in the market can be classified into two categories: 1. Semiconductor gas sensors utilize small, heated (350-450 C) beads of a transition metal oxide, across which a voltage is applied to produce a small standing current. The conductivity of the beads is dependent on the alcohol gas concentration and the alcohol level is thus determined by measuring the resistance across the beads. 2. Electrochemical gas sensors are based on electrochemical reactions in which alcohol in the gas phase is oxidized on a catalytic electrode surface to generate a quantitative electrical response. The electrical response is then used to determine the alcohol gas concentration. The manufacturing process of an electrochemical gas sensor is relatively more complicated (and thus more costly) than that of a semiconductor gas sensor. Semiconductor gas sensors, although having lower sensitivity and specificity than electrochemical gas sensors, have a higher potential for mass adoption due to their lower cost (up to 10 times lower). The main issues with semiconductor gas sensors result from the use of sensing materials (e.g., SnO2, ZnO or Fe2O3), which have several flaws including high operating temperatures, high energy consumption, low sensitivity and selectivity to ethanol. Although a noble metal catalyst can be added to improve performance, it also increases manufacturing costs and can reduce the operating life of the sensor. Therefore, there is a need for a low-cost semiconductor gas sensor that overcomes the shortcomings of existing sensing materials to address the needs of the market. Technology Summary: Alcohol Gas Sensor

360ips Partner Solution The technology developed by 360ips partner provides an improved semiconductor alcohol gas sensor through the use of a novel sensing material. The sensing material is comprised of cadmium sulfide-coated carbon nanotubes, and it is compatible with existing semiconductor alcohol gas sensor manufacturing processes. The partners alcohol gas sensor provides the following advantages: 6 @ 50-100 ppm benzene/methylbenzene at 1000ppm

Patents 360ips partner has one pending patent on this novel sensor technology. 360ip is seeking interested parties for the licensing, further development and commercialization of this technology-based solution.

Chapter 2 LIST OF COMPONENTS 1. Microcontroller 2. Crystal oscillator 3. Capacitor 33pF 4. Capacitor 25v,10uF 5. Resistance 10k 6. regulator 7805 7. 10 k resistance network 8. Pcb 9. Transistor cl100 10. In 4007 diode 11. Transformer 12-0-12 12. MQ 3 Sensor 13. 25V 2200uF Capacitor 14. 10K Potential meter 15. ADC 0804 IC 16. 150 pf capacitor 17. 16x2 LCD 18. 220ohm resistance 01 01 02 01 10 2 3 1 1 08 01 01 01 03 01 01 01 04

Chapter 3

THEORY OF ARCHITECTURE

THEORY OF ARCHITECTURE

BLOCK DIAGRAM

ALCOHAL SENSOR

ANALOG TO DIGITAL CONVERTER

POWER SUPPLY

MICRO CONTROLLER

BUZZER DRIVER

BUZZER

CRYSTAL OSCILLATOR

Alcohol Gas Sensor MQ-3 SEN-08880


Description: This alcohol sensor is suitable for detecting alcohol concentration on your
breath, just like your common breathalyzer. It has a high sensitivity and fast response time. Sensor provides an analog resistive output based on alcohol concentration. The drive circuit is very simple, all it needs is one resistor. A simple interface could be a 0-3.3V ADC.

Features:

5V DC or AC circuit Requires heater voltage Operation Temperature: -10 to 70 degrees C Heater consumption: less than 750mW

Dimensions:

16.8mm diameter 9.3 mm height without the pins

ADC 0804 IC:


ADC0804 is a single channel analog to digital convertor i.e., it can take only one analog signal. An ADC has n bit resolution (binary form) where n can be 8,10,12,16 or even 24 bits. ADC 0804 has 8 bit resolution. The higher resolution ADC gives smaller step size. Step size is smallest change that can be measured by an ADC. For an ADC with resolution of 8 bits, the step size is 19.53mV (5V/255).

The time taken by the ADC to convert analog data into digital form is dependent on the frequency of clock source. ADC0804 can be given clock from external source. It also has an internal clock. However the conversion time cannot be more than110us. To use the internal clock a capacitor and resistor is connected to pin 19 and 4 as shown in the circuit diagram. The frequency is given by the relation f= 1/ (1.1RC). The circuit uses a resistance of 10k and a capacitor of 150pF to generate clock for ADC0804. Vin, which is the input pin, is connected to a preset to provide analog input.

Pin Description 1. CS, Chip Select: This is an active low pin and used to activate the ADC0804. 2. RD, Read: This is an input pin and active low. After converting the analog data, the ADC stores the result in an internal register. This pin is used to get the data out of the ADC 0804 chip. When CS=0 & high to low pulse is given to this pin, the digital output is shown on the pins D0D7. 3. WR, Write: This is an input pin and active low. This is used to instruct the ADC to start the conversion process. If CS=0 and WR makes a low to high transition, the ADC starts the conversion process.

4. CLK IN, Clock IN: This is an input pin connected to an external clock source. 5. INTR, Interrupt: This is an active low output pin. This pin goes low when the conversion is over. 6. Vin+ : Analog Input . 7. Vin- : Analog Input. Connected to ground. 8. AGND: Analog Ground. 9. Vref/2: This pin is used to set the reference voltage. If this is not connected the default

reference voltage is 5V. In some application it is required to reduce the step size. This can be done by using this pin. 10. DGND: Digital Ground. 11-18. Output Data Bits (D7-D0). 19. CLKR: Clock Reset. 20. Vcc: Positive Supply

About the 8051


The Intel 8051 is an 8-bit microcontroller which means that most available operations are limited to 8 bits. There are 3 basic "sizes" of the 8051: Short, Standard, and Extended. The Short and Standard chips are often available in DIP (dual in-line package) form, but the Extended 8051 models often have a different form factor, and are not "drop-in compatible". All these things are called 8051 because they can all be programmed using 8051 assembly language, and they all share certain features (although the different models all have their own special features). Some of the features that have made the 8051 popular are:

4 KB on chip program memory. 128 bytes on chip data memory(RAM). 4 reg banks. 128 user defined software flags.

8-bit data bus 16-bit address bus 32 general purpose registers each of 8 bits 16 bit timers (usually 2, but may have more, or less). 3 internal and 2 external interrupts. Bit as well as byte addressable RAM area of 16 bytes. Four 8-bit ports, (short models have two 8-bit ports). 16-bit program counter and data pointer. 1 Microsecond instruction cycle with 12 MHz Crystal.

8051 models may also have a number of special, model-specific features, such as UARTs, ADC, OpAmps, etc...

Typical applications
8051 chips are used in a wide variety of control systems, telecom applications, robotics as well as in the automotive industry. By some estimations, 8051 family chips make up over 50% of the embedded chip market.

Pin diagram of the 8051 DIP

Basic Pins
PIN 9: PIN 9 is the reset pin which is used to reset the microcontrollers internal registers and ports upon starting up. (Pin should be held high for 2 machine cycles.) PINS 18 & 19: The 8051 has a built-in oscillator amplifier hence we need to only connect a crystal at these pins to provide clock pulses to the circuit.

PIN 40 and 20: Pins 40 and 20 are VCC and ground respectively. The 8051 chip needs +5V 500mA to function properly, although there are lower powered versions like the Atmel 2051 which is a scaled down version of the 8051 which runs on +3V. PINS 29, 30 & 31: As described in the features of the 8051, this chip contains a built-in flash memory. In order to program this we need to supply a voltage of +12V at pin 31. If external memory is connected then PIN 31, also called EA/VPP, should be connected to ground to indicate the presence of external memory. PIN 30 is called ALE (address latch enable), which is used when multiple memory chips are connected to the controller and only one of them needs to be selected.We will deal with this in depth in the later chapters. PIN 29 is called PSEN. This is "program store enable". In order to use the external memory it is required to provide the low voltage (0) on both PSEN and EA pins.

Ports
There are 4 8-bit ports: P0, P1, P2 and P3. PORT P1 (Pins 1 to 8): The port P1 is a general purpose input/output port which can be used for a variety of interfacing tasks. The other ports P0, P2 and P3 have dual roles or additional functions associated with them based upon the context of their usage.The port 1 output buffers can sink/source four TTL inputs. When 1s are written to portn1 pins are pulled high by the internal pull-ups and can be used as inputs. PORT P3 (Pins 10 to 17): PORT P3 acts as a normal IO port, but Port P3 has additional functions such as, serial transmit and receive pins, 2 external interrupt pins, 2 external counter inputs, read and write pins for memory access. PORT P2 (pins 21 to 28): PORT P2 can also be used as a general purpose 8 bit port when no external memory is present, but if external memory access is required then PORT P2 will act as an address bus in conjunction with PORT P0 to access external memory. PORT P2 acts as A8A15, as can be seen from fig 1.1 PORT P0 (pins 32 to 39) PORT P0 can be used as a general purpose 8 bit port when no external memory is present, but if external memory access is required then PORT P0 acts as a multiplexed address and data bus that can be used to access external memory in conjunction with PORT P2. P0 acts as AD0-AD7, as can be seen from fig 1.1 PORT P10: asynchronous communication input or Serial synchronous communication output.

Oscillator Circuits
The 8051 requires an external oscillator circuit. The oscillator circuit usually runs around 12MHz, although the 8051 (depending on which specific model) is capable of running at a maximum of 40MHz. Each machine cycle in the 8051 is 12 clock cycles, giving an effective

cycle rate at 1MHz (for a 12MHz clock) to 3.33MHz (for the maximum 40MHz clock). The oscillator circuit generates the clock pulses so that all internal operations are synchronized.

Internal Architecture

Internal schematics of the 8051.

Data and Program Memory


The 8051 Microcontroller can be programmed in PL/M, 8051 Assembly, C and a number of other high-level languages. Many compilers even have support for compiling C++ for an 8051. Program memory in the 8051 is read-only, while the data memory is considered to be read/write accessible. When stored on EEPROM or Flash, the program memory can be rewritten when the microcontroller is in the special programmer circuit.

Program Start Address


The 8051 starts executing program instructions from address 0000 in the program memory. The A register is located in the SFR memory location 0xE0. The A register works in a similar fashion to the AX register of x86 processors. The A register is called the accumulator, and by default it receives the result of all arithmetic operations.

Special Function Register


The Special Function Register (SFR) is the upper area of addressable memory, from address 0x80 to 0xFF. A, B, PSW, DPTR are called SFR.This area of memory cannot be used for data or program storage, but is instead a series of memory-mapped ports and registers. All port input and output can therefore be performed by memory mov operations on specified addresses in the SFR. Also, different status registers are mapped into the SFR, for use in checking the status of the 8051, and changing some operational parameters of the 8051.

General Purpose Registers


The 8051 has 4 selectable banks of 8 addressable 8-bit registers, R0 to R7. This means that there are essentially 32 available general purpose registers, although only 8 (one bank) can be directly accessed at a time. To access the other banks, we need to change the current bank number in the flag register.

A and B Registers
The A register is located in the SFR memory location 0xE0. The A register works in a similar fashion to the AX register of x86 processors. The A register is called the accumulator, and by default it receives the result of all arithmetic operations. The B register is used in a similar manner, except that it can receive the extended answers from the multiply and divide operations. When not being used for multiplication and Division, the B register is available as an extra general-purpose register.

Crystal oscillator

A miniature 4 MHz quartz crystal enclosed in a hermetically sealed HC-49/US package, used as the resonator in a crystal oscillator. A crystal oscillator is an electronic oscillator circuit that uses the mechanical resonance of a vibrating crystal of piezoelectric material to create an electrical signal with a very precise frequency. This frequency is commonly used to keep track of time (as in quartz wristwatches), to provide a stable clock signal for digital integrated circuits, and to stabilize frequencies for radio transmitters and receivers. The most common type of piezoelectric resonator used is the quartz crystal, but other piezoelectric materials including polycrystalline ceramics are used in similar circuits. Quartz crystals are manufactured for frequencies from a few tens of kilohertz to tens of megahertz. More than two billion crystals are manufactured annually. Most are used for consumer devices such as wristwatches, clocks, radios, computers, and cell phones. Quartz crystals are also found inside test and measurement equipment, such as counters, signal generators, and oscilloscopes.

BUZZER:
A buzzer or beeper is an audio signalling device, which may be mechanical, electromechanical, or piezoelectric. Typical uses of buzzers and beepers include alarm devices, timers and confirmation of user input such as a mouse click or keystroke.

TYPES OF BUZZER

Mechanical
A joy buzzer is an example of a purely mechanical buzzer.

Electromechanical
Early devices were based on an electromechanical system identical to an electric bell without the metal gong. Similarly, a relay may be connected to interrupt its own actuating current, causing the contacts to buzz. Often these units were anchored to a wall or ceiling to use it as a sounding board. The word "buzzer" comes from the rasping noise that electromechanical buzzers made.

Piezoelectric

Piezoelectric disk beeper A piezoelectric element may be driven by an oscillating electronic circuit or other audio signal source, driven with a piezoelectric audio amplifier. Sounds commonly used to indicate that a button has been pressed are a click, a ring or a beep.

POWER SUPPLY:

CHAPTER 4

DETAILED WORKING

DETAILED WORKING CIRCUIT DIAGRAM

EXPLANATION OF CKT. DIAGRAM:


The MQ3 sensor sense the alcohol, depending on the concentration of alcohol present the sensor produces a analog signal. The sensitivity of MQ3 sensor is varied using a potentiometer. This analog signal is converted to digital signal using the analog to digital converter ADC 0804. The available signal is now applied to the micro-controller 8051 to which an LCD is attached & also 2 switches are connected to port3. The LCD displays the amount of alcohol sensed and also the amount of alcohol used as reference. If the amount of alcohol sensed is more than the reference value of alcohol then a buzzer is drive indicating the amount of alcohol consumed is more & the person should not be allowed to drive.

WORKING :
This alcohol sensor detects the concentration Of alcohol gas in the air and outputs its reading as an analog voltage the concentration sensing range of 0.04 mg/ltr to 4 mg/ltr is suitable for breathalyzers (the legal limit of breath alcohol concentrations or BrAC, in most US states is 0.08 gm/210ltrs , or 0.38 mg/ltr). The sensors can operate at temp from -10 to 50 degree C and consumes less than 150 mA at 5v. Connecting 5V across the heating (H) pins keeps the sensor hot enough to function correctly. Connecting 5V at either the A or B pins causes the sensors to emit an analog voltage on the other pins. A resistive load between the output pins and ground sets the sensitivity of the detector.

How it works :
How does it work? The core system is the cube. As you can see in this cross-sectional view, basically, it is an Alumina tube cover by SnO2, which is tin dioxide. And between them there is an Aurum electrode, the black one. And also you can see how the wires are connected. So, why do we need them? Basically, the alumina tube and the coils are the heating system, the yellow, brown parts and the coils in the picture.

Working Process :
If the coil is heated up,

SnO2 ceramics will become the semi - conductor, so there are more movable electrons, which means that it is ready to make more current flow.

Then, when the alcohol molecules in the air meet the electrode that is between alumina and tin dioxide, ethanol burns into acetic acid then more current is produced. So the more alcohol molecules there are, the more current we will get. Because of this current change, we get the different values from the sensor.

Microcontroller Connections
Here is the schematic. It is pretty simple. First, you can use 5v. And as you can see one of H pins goes to the power and the other one is connected to the ground. And the pin A is connected between the power and the pin H and the pin B is goes to the microcontroller. Also between the ground and the Arduino, you need the resistor. Before you connect the resistor if you use the pot, you can tune the resistor for getting more accurate values. In the datasheet they say you can used 100k om to 470k om.

Typical Behavior
If you blow, it will react. Depending on the environment, it gives you little bit of different values. But in my case, it gives me 200 as the lowest value and 1000 as the highest value. And when it detects the alcohol in the air, actually it is pretty sensitive, the value gets higher very quickly but you have to wait for about 1 to 5 minutes to reset it. So that means getting values is fast but resetting is so slow. And the sensitivity of this sensor is affected by time span. When I used an old sensor, the range of value was smaller than the new ones.

PROGRAM: //********port pins name declaration***************/ R_S Bit p1.0 R_W Bit p1.1 Enable Bit p1.2 Lcd_Port Equ P0

//************************************************* //********* Adc Pins Declaration *************/ Read Bit P1.3 Write Bit p1.4 Interupt Bit p1.5 Adc_Port Equ p2 ;0a0h //************data segment declaration*************/ DSEG AT 0030H Temp : DS 4 Time: DS 3

//**************************************************

//***********code segment starts here **************/ CSEG AT 0000H org 0000h acall init_LCD clr p1.6 clr p1.7

; relay 1 ; relay 2

mov r0,#00h

;; compensation reg

loop :

mov Temp,#080h call sendCmd2LCD

upper_1 : next_char:

mov dptr,#Display clr a movc a,@a+dptr jz Disp_2 mov Temp,a acall sendData2LCD inc dptr sjmp next_char

Disp_2:

mov Temp,#0c3h call sendCmd2LCD

mov dptr,#Display2 next_char2: clr a movc a,@a+dptr jz Go_4_adc Go_4_adc:

mov Temp,#0c0h call sendCmd2LCD

//*********** Adc Initialization ********* mov Adc_Port,#0ffh setb Interupt Start_conv: clr Write ; Send low to High pulse to START conv. nop setb Write Wait_4_conv:jb Interupt,Wait_4_conv clr Read ; Conversion End mov a,Adc_Port

ret_form_comp: call Hex_2_Ascii mov Temp,Save_1 acall sendData2LCD mov Temp,Save_1+1 acall sendData2LCD mov Temp,Save_1+2 ; Send 1st digit

; Send 2nd digit

; Send 3rd digit

acall sendData2LCD

resum_Srvc:

mov Temp,#0c0h call sendCmd2LCD

setb Read

; Ready for Next Round

call time_pass ljmp Start_conv //***************************************************/

Hex_2_Ascii: mov b,#100 div ab orl a,#30h mov Save_1,a

mov a,b mov b,#10 div ab orl a,#30h mov Save_1+1,a mov a,b orl a,#30h mov Save_1+2,a ret

sendCmd2LCD: clr R_W clr R_S nop mov Lcd_Port,Temp setb Enable nop nop clr Enable ret sendData2LCD: clr R_W setb R_S nop mov Lcd_Port,Temp setb Enable nop nop clr Enable ret

delay_sec_LCD: MOV R3,#250 _LOOP7: MOV R2,#255 _LOOP8: DJNZ R2,_LOOP8 DJNZ R3,_LOOP7 NOP

delay_miNT_LCD: MOV R7,#2 _LOOP_F: MOV R3,#50 _LOOP9: MOV R2,#255 _LOOP6: DJNZ R2,_LOOP6 DJNZ R3,_LOOP9 ; DJNZ R7,_LOOP_F NOP RET init_LCD: call delay_sec_LCD mov Temp,#30H call sendCmd2LCD mov Temp,#38H call sendCmd2LCD mov Temp,#08H call sendCmd2LCD mov Temp,#01H call sendCmd2LCD mov Temp,#06H call sendCmd2LCD mov Temp,#0cH call sendCmd2LCD mov Temp,#14H call sendCmd2LCD mov Temp,#080H call sendCmd2LCD ret Busy_Flag: setb Lcd_Port.7 setb R_W clr R_S

wait4Send:

clr Enable setb Enable jb Lcd_Port.7,wait4Send ret

time_pass: st_hr:

mov tmod,#01 mov Time,#22 mov tl0,#00h mov th0,#00h setb tr0

jnb tf0,$ clr tr0 clr tf0 djnz Time,st_hr ret org 300h Display: db 'Alcohal Sensor',0 Display2: db '*C',0

end

Chapter 5

APPLICATIONS & FUTURE SCOPE

Applications:

Vehicle alcohol detector. Portable alcohol detector.

BIBLIOGRAPHY:

S-ar putea să vă placă și