Sunteți pe pagina 1din 4

CONSTRUCTION

DEEPAK GUPTA

EM TESTED
EM TESTED

Alcohol Sensing EM TES


TED

Using 8051 Deepak Gupta

The main purpose behind this project is "Drunk


driving detection". Now a days, many accidents are
happening because of the alcohol consumption of
the driver or the person who is driving the vehicle.
Thus Drunk driving is a major reason of accidents in
almost all contries all over the world. Alcohol
Detector in Car project is designed for the safety of
the people seating inside the car. This project
should be fitted / installed inside the vehicle.
This project will sense the amount of alcohol
consumed by the person and it will display the same
to the LCD. This product can be used for identifying
whether is person is drunk, which is used by traffic
police across many countries
The main unit of this project is an "Alcohol sensor". If
the person inside car has consumed alcohol then it
is detected by the sensor. The sensor used for this
purpose is MQ303A Alcohol Sensor. The sensor is •8K Bytes of In-System Programmable (ISP) Flash
connected to the ADC0804 which is further Memory –Endurance: 1000 Write/Erase Cycles
interfaced to 8051 controller. The sensed value is • 4.0V to 5.5V Operating Range
displayed on the 16x2 LCD.
PDIP
Component Used
AT89s52 (T2) P1.0 1 40 VCC
The 89s52 is an 8-bit microprocessor originally (T2 EX) P1.1 2 39 P0.0 (AD0)
designed in the 1980's by Intel that has gained great P1.2 3 38 P0.1 (AD1)
P1.3 4 37 P0.2 (AD2)
popularity since its introduction. Its standard form
P1.4 5 36 P0.3 (AD3)
includes several standard on-chip peripherals, (MOSI) P1.5 6 35 P0.4 (AD4)
including timers, counters, and UART's, plus 4kbytes (MOSI) P1.6 7 34 P0.5 (AD5)
of on-chip program memory and 128 bytes (note: (SCK) P1.7 8 33 P0.6 (AD6)
bytes, not Kbytes) of data memory, making single- RST 9 32 P0.7 (AD7)
chip implementations possible. Its hundreds of (RXD) P3.0 10 31 EA/VPP
(TXD) P3.1 11 30 ALE/PROG
derivatives, manufactured by several different (INT0) P3.2 PSEN
12 29
companies (like Philips) include even more on-chip (INT1) P3.3 13 28 P2.7 (A15)
peripherals, such as analog-digital converters, (T0) P3.4 14 27 P2.6 (A14)
pulse-width modulators, I2C bus interfaces, etc. (T1) P3.5 15 26 P2.5 (A13)
Costing only a few dollars per IC, the 8051 is (WR) P3.6 16 25 P2.4 (A12)
(RD) P3.7 17 24 P2.3 (A11)
estimated to be used in a large percentage of all XTAL2 18 23 P2.2 (A10)
embedded system products. XTAL1 19 22 P2.1 (A9)
GND 20 21 P2.0 (A8)
Features
CONSTRUCTION

J1

16X2 LCD DISPLAY


VCC

10
11
12
13
14
15
16
J2

1
2
3
4
5
6
7
8
9
VCC
A
VCC ADC0804 H H
R4 B A
10K
R5
R2 U1 8051 CON6A
VCC U2
1 2 39 21 18 6 10K
3 38 P0.0/AD0 P2.0/A8 22 17
DB0 +IN 7
4 37 P0.1/AD1 P2.1/A9 23 16
DB1 -IN VCC
P0.2/AD2 P2.2/A10 DB2 9
5 36 24 15
6 35
P0.3/AD3 P2.3/A11
25 14
DB3 VREF/2
P0.4/AD4 P2.4/A12 DB4 R3
7 34 26 13 4 C1 150pf
8 33
P0.5/AD5 P2.5/A13
27 12
DB5 CLKIN 19 10K
P0.6/AD6 P2.6/A14 DB6 CLKR
9 32 28 11
P0.7/AD7 P2.7/A15 DB7
2
1 10 5
RD 3
RESISTOR SIP9 P1.0 P3.0/RXD INTR W/R
2 11 1
22pf

AGND
P1.1 P3.1/TXD CS
3 12

GND
P1.2 P3.2/INTO
4 13 20 VCC
P1.3 P3.3/INT1 VCC/VREF
5 14
P1.4 P3.4/T0
6 15
P1.5 P3.5/T1
Y1 7 16

10
8
P1.6 P3.6/WR
8 17
22pf P1.7 P3.7/RD
CRYSTAL
19 30
X1 ALE
18 29
X2 PSEN
vcc
31
EA
9
RST
GND
10uf

40
VCC
20
8.2k

• Fully Static Operation: 0 Hz to 33 MHz timer/counters, serial port, andinterrupt system to


• Three-level Program Memory Lock continue functioning. The Power-down mode saves
• 256 x 8-bit Internal RAM the RAM con-tents but freezes the oscillator,
• 32 Programmable I/O Lines disabling all other chip functions until the next
• Three 16-bit Timer/Counters
• Eight Interrupt Sources
• Full Duplex UART Serial Channel chip Select 1 11 VCC
• Low-power Idle and Power-down Modes
• Interrupt Recovery from Power-down Mode Read 2 12 Clock
• Watchdog Timer
• Dual Data Pointer Write 3 13 D0
• Power-off Flag
• Low EMI (inhibit ALE) . Clock IN 4 14 D1
• Wake up from power down by an external
interrupt Interrupt 5 ADC0804 15 D2
The AT89S52 provides the following standard
Vin (+) 6 16 D3
features: 8K bytes of Flash, 256 bytesof RAM, 32
I/O lines, Watchdog timer, two data pointers, three
Vin (-) 7 17 D4
16-bit timer/counters, asix-vector two-level
interrupt architecture, a full duplex serial port, on- 8 18 D5
Analog GND
chip oscillator,and clock circuitry. In addition, the
AT89S52 is designed with static logic for Vref / 2 9 19 D6
operationdown to zero frequency and supports two
software selectable power saving modes.The Idle Digital GND 10 20 D7
Mode stops the CPU while allowing the RAM,
CONSTRUCTION

interruptor hardware reset. when Vin is Vref, the output is 11111111 (255
ADC0804 decimal).
The output of the pressure transducer is an analog For input voltages between 0 and Vref, the output
signal .To interface with the microcontroller it is increases linearly with Vin; therefore, we can
needed to change this signal in to digital value develop a simple ratio for the ADC:
because the microcontroller and other digital Solving for output gives the following:
devices works on the digital data . For this purpose where
ADC is used. We used an IC(ADC0804) which output = decimal output value of an 8-bit ADC
gave an 8 bit digital value for the input analog Vin = analog input voltage to the ADC
valued signal. ADC0804 is used to convert analog Vref = ADC reference voltage
voltage produced from differential pressure To start the conversion process, a start-conversion
transducer to digital signal. The analog voltages pulse is sent to the ADC. The ADC then samples the
from 0 to 5v are converted using adc-0804 to analog input and converts it to binary. When
digital number from 0 to 255. completed, the ADC activates the data-ready
Analog signals are very common inputs to output. This signal can be used to alert the
embedded systems – Most transducers and sensors computer to read in the binary data.
are analog. Special devices needed to interface the Figure shows an 8-bit ADC (ADC0804).
analog systems to digital systems. ADC (Analog to Packaged as a 20-pin DIP, this device can operate
Digital Converter) is used between signal input and on a single 5-Vdc power supply and requires an
the embedded system. DAC (Digital to Analog external resistor and capacitor to complete the
Converter) between embedded system and analog ADC circuit. The start-conversion pulse is applied
to pin 3 (WR), and the data-ready signal comes
from pin 5 (INTR). This particular ADC can be
output 255 connected in a free-running mode where it
= (for 8 bits)
Vin Vref performs one conversion after the other as fast as it
can. Notice also that the pin labeled Vref/2 (pin 9)
Solving for output gives the following must be set at half of the actual Vref. For example, if
the requirements call for an analog voltage range
Vin X 255 of 0-5 Vdc, then pin 9 would be set to 2.5 Vdc. The
Output = Vref time to complete a conversion is approximately
100 µs (micro-seconds), making it almost 700
times slower than the DAC0808
signal output.An analog-to-digital converter (ADC) MQ303A Alcohol Sensor
is a circuit that converts an analog voltage into a MQ303A is semiconductor sensor is for Alcohol
digital word. A typical ADC consists of a single IC detection,It has good sensitivity and fast response
with a few support components.Analog-to-digital
conversion is a more complicated process (than for Model No. MQ303A
the DAC), and the hardware requires some Sensor Type Semiconductor
conversion time, which is typically in the Standard Encapsulation Metal
microsecond range. The conversion time required Detection Gas Alcohol

depends on the type of ADC, the applied clock Concentration 20-1000ppm Alcohol

frequency, and the number of bits being converted. Heater Voltage V H 0.9V ± 0.1V AC or DC
≤6V DC
The input Vin can be any voltage between 0 V and Loop Voltage Vc
Load, ResistanceR L Adjustable
Vref. When Vin is 0 Vdc, the output is 00000000;
Heater, Resistance R H 4.5Ω ± 0.5 Ω(Room Tem.)
Heater Current IH 120±20mA
Vref
Heater Power PH ≤ 140 mW
Sensor, Consumption, PS ≤10 mW
Start conversion Data ready
Sensing, Resistance, Rs 4KΩ-400KΩ(in air)
Clock
Sensitivity S Rs(in air)/Rs(125ppmAlcohol)≥3
ADC Digital
Vin (analog voltage input) Slope α 0.50 ± 0.15(R300ppm/R100ppm Alcohol)
output
Tem. Humidity 20℃±2℃;65%±5%RH
Standard test circuit Vc:3.0 V±0.1 V DC ;VH: 0.9 V±0.1 V DC
Preheat time Over 48 hours
CONSTRUCTION

ret
delay:
mov r1,#255
l2: mov r0,#255
l1: djnz r0,l1
djnz r1,l2
ret
command:
clr p1.2
mov p0,r1
setb p1.0
call delay
clr p1.0
ret
data2:
setb p1.2
to alcohol,suitable for portable alcohol detector. mov p0,r4
setb p1.0
Features call delay
* High sensitivity clr p1.0
* Fast response and resume ret
* Long life and low cost data1:
* Mini Size setb p1.2
mov p0,r3
Code setb p1.0
org 0X00 call delay
mov r1,#38H clr p1.0
call command ret
mov r1,#0EH epr:
call command setb p1.2
mov r1,#06H mov p0,r2
call command setb p1.0
mov r1,#01H call delay
call command clr p1.0
start: ret
clr p3.5 conversion:
nop mov b,#10
setb p3.5 div ab
wait:jb p3.2,wait mov r2,b
acall read mov b,#10
acall conversion div ab
call data2 orl a,#30h
call data1 mov r4,a
call epr mov a,b
call delay mov r1,#01H orl a,#30h
call command mov r3,a
call delay mov a,r2
jmp start orl a,#30h
read: mov r2,a
clr p3.4 ret
mov a,p2 end
mov 30h,a
setb p3.4

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