BACHELOR OF ENGINEERING
ELECTRONICS AND COMMUNICATION ENGINEERING
Of Anna University
September 2015
V Ganesh (13L217)
M Gokularam(13L218)
P.S.Guru Balajee(13L219)
Dissertation submitted in partial fulfilment of the requirements for the degree of
BACHELOR OF ENGINEERING
ELECTRONIC AND COMMUNICATION ENGINEERING
Of Anna University
September 2015
..
Faculty guide
ACKNOWLEDGEMENT
I am indebted to Dr. S. SUBHA RANI, Professor and Head of the Department of Electronics
and Communication Engineering, for her continued support and motivation.
I would like to express my gratitude to my technical report guide Dr.D. Sivaraj and
Mr.K.Rajasekar, Department of Electronics and Communication Engineering, for their
constant motivation, direction and guidance throughout the entire course of our technical
report.
I thank all the staff members of the Department of Electronics and Communication
Engineering for their support.
Last but not the least I thank the Almighty and my family members who have been a guiding
light in all our endeavours.
Table of Contents
Objective and need for the Project......................................................................6
Objective of Project...................................................................................... 6
Project overview............................................................................................. 7
Block Diagram............................................................................................. 7
Circuit Schematic and Explanation..................................................................8
Flowchart and C program.................................................................................9
Keil Program[C code] for alcohol detector......................................................11
Simulation and Hardware implementation.........................................................16
Simulation Results...................................................................................... 16
Hardware Implementation...........................................................................17
Conclusion................................................................................................... 18
Future Scope................................................................................................ 18
Reference..................................................................................................... 18
LIST OF FIGURES
ABSTRACT
This project report deals with the design and testing of alcohol detector
with the 8051 series of ATMELs microcontrollers. This project uses the 8051
variant AT89S52 (8052). The program for configuring the microcontroller was
written in Keil microvision 3 IDE, designed for ATMEL 8051 series
microcontrollers.
CHAPTER I
Objective and need for the Project
Many accidents happen in this fast moving day to day world. And one of
the main reasons for these accidents are drunken driving. Due to this very
reason, even innocent people are affected too. So a constant check is needed in
this issue by the government to strictly avoid drinking during driving. And for
this we need a device to detect the presence of alcohol in human without and
interference of environment.
So this calls for a perfect engineered design to maintain accuracy and
detection. The only solution to such problem is the usage of an alcohol detector.
The alcohol detector is the widely used device in the present day world by the
police and the government to inspect a persons status. Hence alcohol detectors
have evolved to a greater extent in this present day world that it has become an
integral part of the traffic world.
Objective of Project
The objective of the project is to design a fool proof alcohol detector to
detect the presence of alcohol in human breath. It also needs to provide the
numerical value of the alcohol content to know the extent of alcohol
consumption. For this digital devices such as microcontrollers are used to
achieve high accuracy and speed for instantaneous detection.
CHAPTER II
6
Project overview
Block Diagram
The figure above shows the circuit schematic of the alcohol detector in
Proteus Simulation software. Here we can see the regular connections such as
the crystal oscillator connected to pin 18, 19. Here as mentioned above, instead
of using the sensor, for the purpose of demonstration, we have used a
potentiometer. And it is given to a ADC. The ADC is also supplied with the
required clock frequency with the RC network. Then the converted data is taken
and given to the controller via port 2.
Now the processes are done in the microcontroller and the data to be
displayed are given to the LCD display via port 1. Then the additional data to be
given to the LCD display such as write, enable, etc. are given via some of the
pins of port 3.
CHAPTER III
The above flowchart shows the main procedure to get the final result. That is,
we first blow on the sensor, then the amount of alcohol is calculated and the
result is given according to the threshold value.
This flowchart depicted above shows the signal conditioning and display
unit in an outline. In signal conditioning, the alcohol vapour concentration is
given to the sensor and it produces a resistance change. This resistance change
9
This flow chart describes the working of the LCD. Here when powered
ON, the LCD is initialised. That is the function sets are sent in one by one and
each digits are displayed one by one according to the clock cycle. After
displaying the digits, it clears the whole display and waits for the next set of
data to display. Due to high clock frequency, we observe the digits as stable
ones.
#include<reg51.h>
unsigned char adc,i;
unsigned char drunk[]={0x44,0x52,0x55,0x4e,0x4b,0x20,0x20};//both
the arrays store the ascii values
unsigned char
normal[]={0x4e,0x4f,0x52,0x4d,0x41,0x4c,0x20,0x20};//for the words
'drunk' and 'normal'
unsigned char h,t,o;
sbit rs=P3^2;
sbit rw=P3^3;
sbit en=P3^4;
sbit rd=P3^7;
sbit wr=P3^6;
sbit intr=P3^5;
void delay(unsigned int x)
{
while(x--);
}
void main()
{
//Initialise lcd
rs=0;
rw=0;
en=1;
delay(1500);
//clear display and move to home
//------------------------------
P1=0x01;
en=0;
11
delay(1500);
en=1;
P1=0x03;
en=0;
delay(1500);
en=1;
//-------------------------------
en=1;
//------------------------------rs=0;
P1=0x80; //set cursor to first line first position
en=0;
delay(1500);
en=1;
//------------------------------
//------------------------------
while(1)
{
rd=1;
wr=1;
while(intr);
wr=0;
rd=0;
adc=P2;
if(adc<127)
{
rs=0;
P1=0x85;//set cursor to 6th position on first line
en=0;
delay(1500);
en=1;
delay(1500);
for(i=0;i<7;i++)
13
{
rs=1;
P1=normal[i];
en=0;
delay(1500);
en=1;
}
}
if(adc>127)
{
rs=0;
P1=0x85;
en=0;
delay(1500);
en=1;
delay(1500);
for(i=0;i<7;i++)
{
rs=1;
P1=drunk[i];
en=0;
delay(1500);
en=1;
}
}
h=adc/100;
individual
t=(adc%100)/10;
values)
o=adc%10;
rs=1;
P1=0x30+t;
en=0;
delay(1500);
en=1;
rs=1;
P1=0x30+o;
en=0;
delay(1500);
en=1;
}
}
CHAPTER IV
Simulation and Hardware implementation
Simulation Results
15
The figures shown above is the simulation of the alcohol detector circuit
in Proteus Simulation software. We can clearly observe the working of the
device in both the test conditions. The first figure displays the output when the
condition is DRUNK and the second image shows the output when the
condition is NORMAL. The following content shows the hardware
implementation.
16
Hardware Implementation
Conclusion
From this report it can be seen that implementation and realisation of
alcohol detector is a challenging, yet a vital one. It gives us a wide idea about
the field of coding in embedded systems. It also helps us to realise the
architecture of 8051. On realisation, it justifies that simulation and the working
is the same. So the design of alcohol detector at its simplest is conveyed in all
possible ways. Similar works can also be done with such technical knowledge.
17
Future Scope
Alcohol detector designed in this project is the simplest one compares to
the present day equipment. The future scope for this alcohol detector can be
extended to various degrees. They are
Camera
A camera can be interfaced with this device to immediately capture the
face of the person who is drunk. It gives us an advantage to get more details
about the accust.
GPS
GPS can be interfaced with this device to trace the exact location of the
crime. It gives us more details and also easy for us to track the device if lost or
in theft.
Printer
A thermal printer interfaced with this device can be of immense use to
immediately print the fine receipt like bus ticket issuer.
Card Swiper
An attached card swiper can be used to pay the fine on the spot for time
saving. It also gives extra accounting purpose.
Reference
1. The 8051 microcontroller Architecture, Programming and applications
Kenneth J. Ayala
2. The 8051 microcontroller and embedded systems Muhammad Ali
Mazidi and Janice Gillespie Mazidi
3. Architecture and Programming of 8051 microcontrollers
Mikroelektronika.
4. ATMELs AT89S52 hardware description datasheets.
18