Sunteți pe pagina 1din 44

AUTOMATIC BOTTLE FILLING SYSTEM

Thesis submitfuil in partful fulJillment of the requiremen8 the degee


lor
oI
Bachelor of TechnologSr

In Instrumentation E ngineering

by

Sandhan Jyoti Dutta (Gau4-l l/74)


Pooja Bhattacharjee (Gau-C-tt ll-203)
Nirmal Basumatary (Gau-C-l l/89)

Under the guidance of


Mr. Dipenkar Sutradhar

DEPARTMf, NT OF INSTRUMENTATION ENGINEERING


atdq fuftr|-+t els-{t-{rs
"i-:en=T
CENTRAL INSTITUTE OF' TECHNOLOGY KOKRAJHAR
(A Centrally Funded Institute under Ministry of HRD, Govt. of India)
BODOLAND TERRITORIAL AREAS DISTRICTS :: KOKRAJHAR
:: ASSAM::783370
Website: www.cit ac.in
MAY 2OI5
DECLARATION
WE hErEbY dECIATE thAt WOrK ENtitICd *ATITOMATIC
BOTTLE FILLING SYSTEM',, iS
AN
authentic record of our own work carried out at centrar Institute
of rechnology, Kokrajhar, for
the award of degree of B Tech' in Instrumentation Engineering. project
comprises of our
original work pursued under the guidance
of Mr. Dipankar sutradhar. The results
embodied
in this report have not been submitted
to any other Institute or University for any
award. The
information provided is correct to the
best ofour knowledge and belief

Date: I 8n May, 201 5

(SANDHAN JYOTI DUTTA)


University Roll: Gau-C-l | /74
University Registration No:
014612 of the year 201t-12

(POOJA BHATTACHARJEE)
University Roll: Gau_c_l I /l_203
University Registration No: 0gIgl5 of

the year 201 2- | .3

(NIRMAL BASUMATARY)
Universiry Roll: Gau -C_l l/g9
University Registration No:
014654 ofthe year 201| _12
DEPARTMENT OF INSTRUMENTATION ENGINEERING
CENTRAL INSTITUTE OF TECHNOLOGY, KOKRAJHAR
May 2015

CERTIFICATE

This is to c€rtify that Sandhan Jyoti Dutta, Poojo Bhsttacharjee, Nirmel Basumatery have
uccessfully complaed their project entitled 'AUTOMATIC BOTTLE FILLING SYSTEM'
which is a bonafide work carried out by themselves in partial fulfillment of Bachelor of
Technology in Instrurnentation Engineering from Central lnstitute oftechnology, Kokajhar.

Sr"V"'
(Ject Duttr)
HOD
Dept' of lnstrumentation Engineering
DEPARTMENT OF INSTRUMENTATION ENGINEARING
CENTRAL INSTITUTE OF TECIINOLOGY, KOKRAJHAR
Mav 2015

CERTIFICATE

This is to certiry that Sandhan Jyoti Dutta, Pooja Bhattscharjee and Nirmal Basumstary
have successfully completed theh project entitled "AUTOMATIC BOT'TLE FILLING
SYSTEM" which is a bonafide work carried out by tiemselves in panial fulfillment of
Bachelor of Technology in lnsfumentation Engineering from Central Institute of technology,
Kokrajhar. The work was carried out under my supervision during the academic session Aug
,2014-Mry, 2015.

(Dipankar Sutradhar)

Dept' of lnstrurnentation Engineering


DEPARTMENT OF INSTRUMENTATION ENGINEERING
CENTRAL INSTITUTE OF TECHNOLOGY, KOKRAJHAR
May 2015

CERTIFICATE BY THE BOARD OF EXAMINERS

This is to certifr that the project work entitled .AUTOMATIC BOTTLE FTLLING
SYSTEM" submitted by Sandhan Jyoti Dutt4 pooja Bhattacharjee, Nirmal Basumatary to the
Deparrnent of Instrumentation Enginecring of central Institute of rechnology, Kokajhar has
been examined and evaluated.

The project work has been prepared as per the regulations of central Institute of rechnology
and qualifies to be accepted in partial fulfilment of the requirement for the degree ofB. Tech.

Project Co.ordinator Board of Exrminers

Jr/A/Y- trJ-'
ACKNOWLEDGEMENT

On the very outset of this report, we would like to extend our sincere & heartfelt

obligation towards all the person who helped us in this project. Without their active guidance,
help, cooperation & encouragement, we could not have made these project work.

First and foremost, we would like to express our sincere gratitude to our guidg Mr.
Dpankar Sutradhar, we were privileged to experience a sustained help and involved interest
fiom his side. This bucked our enthusiasm even further and encouraged us to boldly step into
what was a totally dark and unexplored area before us. He always fuelled us to think out ofthe
box. I would like to thank the entire staff member for motivation guidance and support.

We are indebted to a number of friends and well-wishers who have extended their co-
opoation and help in the preparation of the project. Last but not the least; it goes incomplete
without saying that we are deeply indebted to our parents for their support and their patience.

g^'t\*IS &Sh^
Sandhan Jvoti Dutta

Wj" 6fuu"t*
Pooja Bhattacharjee

D*
Min n al Satr>t't wttl latt/
Nirmal Basumatary
ABSTRACT

In this era of industrializatior\ the automation world is shrinking the need of humans to assist
machinery. Looking at the present scenario an automatic bottle filling system which uses

ultasonic sensors for the level m@surement and a solenoid valve in order to fill the liquid in the

bcde is desigrcd. Traditional methods of bottle filling involved placing bottles onto a conveyor
and filling only one bottle at a time in order to overcome this short come this project presents a
nodel filling bottles simultaneously. Microcontoller is used as the controller to control the
sutomatic functioning of this machine which consists of a conveyor belt and a filling station
.The successful implementation ofa proximity sensor using IR sensor for the bottles canied by

the conveyor belt can be depicted from the project, this IR sensor stops the gear motor to initiate
0re filling process. The frlling section is initiated with the help ofa nozzle and solenoid valve.
This project stands out of all the other filling system as it uses an ultrasonic sensor which gives

I great deal of accurary as it avoids human intervention and as a result enors are negligible. The

Butomatic filling machine is developed with the aim that it paves a new path to automation with
cost effectiveness. Thus, this project marks an effective and accruate process of bottle filling.

Keywords: Microconboller, Gear Motor, Nozzlq Ultrasonc sensor

vrl
CONTENTS

Title page i
Declaration ii
Certificate iii
Acknowledgement vi
Abstract vii
Comots viii
List of Figures x

CHAPTER I

INTRODUCTION

l.l In$odlction
t.2 Objective

CHAPTER2
BACKGROUND THEORY

2.1 Literatue Review

2. l. I Loading section
2. 1.2 Detection section
2.1.3 Solenoid control

2. 1.4 Filling section

2.2 Der;ign
2.2.1 Microcontrol ler

2.2.2 Water level sersor

2.2.3 DC gear motor

2.2.4 Conveyor belt

2.3 lludware Components

vIl
CHAPTER-3

SYSTEM DESIGN

3.1Block Diagram
7
3.2 Flow chart
8
3.3 Circuit Diagram of Motor Driver
9
3.3. 1 Circuit Description
9
3.4 Circuit Diagram of Ultrasonic Sensor
t0
3.4. I Circuit Description
l0
3.5 Configuring 805 I microcontroller l0
3.6 Working
ll
3.7 Algorithm
l2
3.8 Application
l3
CHAPTER 4
RESULT AND DISCUSSIONS

4.1 Result
t4
CHAPTER-5
CONCLUSION AND FUTURE WORK

5.1 Conclusion
t5
5.2 Future Scope
l5
5.3 Reference
l6
APPENDIX

Appendix A: Source code of motor


Appendix B: Source code for ultrasonic sensor
Appendix c: Darasheet of AT89c52
Appendix D: Datasheet of LM293d

tx
List of Figures

Page No
Fig 2. l: IR Detection
2
Fig 2.2: Microcontroller
3
Fig 2.3: Ulnasonic sansor
4
Fig 2.4: DC Gear motor
f
Fig 2.5: Conveyor Belt
5
Fig 3.1: Block diagram of the project
7
Fig 3.2: Flow Chart
8
Fig 3.3: Schematic circuit in proteus
9
Fig 3.4: Schematic circuit of ultrasoruc sensor
l0
CHAPTER I

INTRODUCTION

l.llntroduction
A plant has many sections like processing; rnanufacruring packing storage etc. In this project
we have concentrated on a specific part of plant, which is filling of bottles. The field of
automation has had a notable impact in a wide range of industries beyond manufactunng.
Autornation is the use of control systems and information technologies to reduce the need for
human work in the production of goods and services. In the scope of industrialization
sutomation is a step beyond mechanization. Automation greatly decreases the need for human
and meftal requirements as well. Automation plays an increasingly imponarr role in the world
economy. One of the important applications of automation is in the soft drink and other
bevoage industries, where a particular liquid has to be filled continuously. For these kinds of
application therend is switching from the individual device or machine toward continuous
automation solutions. The aim of this project is to design an microcortroller based automatic
bctle filling system that sense the presence of bottle and level of liquid in it and then fills it
accordingly up to a fixed level. In this project we dweloped proximity sensor using infiared that
detects the presence of bottle and for detecting Ievel we have used ultrasonic sensors .Here we
used nozle to control tte f ling of liquid wfiich is dependent on the solenoid tap. There are
various process to measur€ liquid level counting frorn a droping of simple measuring scale to
complex capacitive liquid level sensor but, these processc require direct contact with the
container ard the liquid, which can again be a source of various errors. Therefore, we have
mrne up with an idea of using a difrerent source of measuring i.e., the ulbasonic distance
measurement apparahs is the untotrched measure and has the simple structue, inexpensive cost

, no electromagnetic interferences .

1.2 Objective
The project is aimed to meet dre following objectives:
. To design and implement automated liquid filling machine
o To learn the concept of electrical DC moto system
. To apply selector conveyor conc€pt
o To implonent hardware installatio4 wiring mechanical mounting
o To learn microconfoller progrsmming
CHAPTER 2
BACKGROUND THEORY
2.1 Literature Review
Tlrcre are a few reviews done
understanding on th" 0",","0,"11
"l'J
:il::::ilJ:H,:'"::*i::;., fi:ffi :T:
gained from diffoent joumars,
internet sources, books and previous
proJects. The focus of this
project is to anaryze principre
and method on the usage of automatic
fiting method and the
ultasonic technique of riquid lever
m@surement. There are four basic
operationar parts in this
project namely roading sectioq
detection of bottre, solenoid control and rever detection.

2.1.1 Loading Section


The loading section was designed
to store the enpty boftre before the process
was started.
Microcontro'er sends the signal to the gear motor and it starts
rotating and empty bottle comes
in dre belt and moves till it reaches the nozzle opening where
there is a IR sensor which detects
fte bottle and the filling starts.

2.1.2 D etection Secti on


IR Senson work by using a specific
liglrt sensor to detect a select light
wavelength in the Infia_
Red (rR) spectrum By using
an LED which produces right at
the same waverength as what the
sensor is rooking for' we can rook
at the intensity of the received right.
when an object is crose
to the sensor' the right from the LED
bounces off the object and into
the right sensor. This
results in a large jump in the intensity,
which we already know can be detected
usmg
threshold.

.Jc .a,r.d p-Fn. _ no rR rgar. .r.oc-d b, orE.

Fig 2. l: IR Detection
2.1.3 Solenoid Control
The term refers to a variety of transducer devices that convert energy into linear motion. The
term is also often used to refer to a solenoid valvg which is an integrated device containing an

eleclromechanical solenoid which actuates either a pneumatic or hy&aulic valve, or a solenoid

switch, which is a specific type of relay that internally uses an electromechanical solenoid to
operate an electrical switch; for examplq an noz.z)e starter solenoid, which is an

elecromechanical solenoid used in our project

2.1.4 Filling Section.


The filling section comprises of the nozzle and the solenoid tapping .The solenoid taps the
nozzle to open and the filling starts .the nozzle is accompanied with a ulnasonic sensor module

HCSRO4 which keeps a vigil on the liquid level of the bottle. As the level is reached the nozzle
stops and the signal is received by the microcontroller which in turn sends the sigul to the gear

mdd which moves the bottle till the end

2.2 Design
The design of ttre project has an electronic and mechanical s€tup which contains certain

building blocks of the project which are discussed below.

2.2.1 Microcontroller
Microco roller is a computer or a chip that is programmed to perform almost any control
sequencing monitoring and display the function. Because of its relatively low cost, it becomes

the natural choice to the designer. Microcontroller is designed to be all of that in one. lts great
advantage is no other extonal components are needed for its application because all necessary
peripherals are already built into it. Thus, we can save the time' space and cost.

Fig 2.2:AT89C52 Chip


Featurcs
. 8K Byes of In-System Reprogrammable Flash Memory
. Endurance: 1.000 Writey'Erase Cycles
. Fully Static Operation: 0 Hz to 24 MHz
. Tlreelevel Program Memory Lock
. 256 x 8-bit Internal RAM
. 32 Programmable VO Lines
. Three 16-bit Timer/Counters
. Eight Interrupt Sources
. Programmable Soial Channel
. Low-power Idle and Power-down Modes

2.2.2 W ater Level Sensor

To make special water level sensor we have used ultrasonic sensor module. Ultrasonic sensors
(also known as ransceivers when they both send and receive) work on a principle
similar to
mdar or sonar which waluate atributes of a target by interpreting the echoes from radio or
sound waves respectively. ultrasonic sensors generate high fiequency sound waves and
evaluate the echo which is received back by the sensor. Sensors calculate the time interval

between sending the signal and receiving the echo to determine the distance to an obiect.

Fig 2.3: Ultrasonic Sensor

2.2.3 DC Geared Motor


Motor with metal gearbox
I. 12VDC
2. No load current 800mA (Max| Load current 9.5 A
3. Rated Torque- l0Kg-cm

4. Rated speed -30 rpm


Fig. 2.4: DC Motor
2.2.4 Conveyor Design
conveyor suppries a reliabre means when we
need to transport burk of objects continuously.
This machine can be divided into nvo
categories: intermittent and continuous types. There are
vsnous types of conveyor belt like wheel conveyor, roller
conveyor, chain conveyor, screw
conveyor.

l) Conveyor Belt length: 0.6m


2) Rollo diameter: 0.0350m

3) Speed ofConveyor Belt: 0.06m/ (Considerinr


s
hertia of Bottle)
4) According to formula:

V=pirD*N/60 m/s
N= (60*vy (Pi*D)
N= (60,r0.06y (3. 1410.035)
N=32.74 RPM
From this Data standard Motor is selected
having specification:
N=30 Rpt\4 Torque: l0kg_c

Fig 2.4:Conveyor Belt


2.3 Conponents Used
The components used in our project are:

l. Microcontroller: A1'89C52

2. Ulrasonic module: HCSRO4

3. L293D Motor Driver

4. IR Module

5. Gear Motor

6. Crysal: 11.0952 MLlz

7. Capacitors: l00uf, 33pf(coamic), IOuf (electrolytic)

8. Reset switch-l

9. Cormecting wires

10. LM 7805 voltage regulator

I l. JHD162A' Dsplay

12. Resistance

13. Diode lN4007

14. Transfonner
CHAPTER 3

SYSTEM DESTGN

3.l BlockDiagram

Fig.3.l Block diagram of the project


3.2 Flow of program

Valve on

Delay(Tsec)

Motor rotates conveyor


belt

Fig 3.2: Flow chart


33 Circuit Diagram

R3 :-- O:

fG
a a r^-l

'': '::i-

.r arfi
1..
','.

Fig 3 .3 : Circuit diagram of motor driver

3.3.1 Circuit description of Motor Driver

Tlrc pin 2l of the microcontroll€r is connected to the input port of motor driver IC and the other
input of the motor driver is grounded with the EN pin connected to the EN of the
microcontroller. The pin 23 of the microcontroller is connected to the IR rnodrle and pin 22 is
connected to the solenoid section ofthe circuit. The pin 2 and 6 of the motor driver is the output
ptrt and are connected to the motor
3.4 Circuit Diagram of Ultrasonic sensor

.I

ll

Fig 3.4:Circuit Diagram Of Ultrasonic Level Measurement

3.4.1 Circuit Description of Ultrasonic Module:

A I l.0592MHz crystal is connected to the pin 18 and 19 of th€ microconfoller. The crystal
provides basic clock pulse to the microcontroller. Pin 39, 38 and 37 of the microcontroller are

connected to the RS, RW and EN pin of the JHDI62A display. Pin I to 7 of the microcontroller
is connected to the data port pins D0 to D7 of the LCD respectively. Preset lOk is used to
connolling the conhast and brightness of the LCD. Pin 12 and 15 of the microcontroller are
connected to the echo and trigger of the ultrasonic module.

10
3.4 Circuit Diagram of Ultrasonic sensor

Fig 3.4:Circuit Dagram Of Ultrasonic Level Measurement

3.4.1 Circuit Description of Ultrasonic Module:

A l l.0592MHz crystal is cormected to the pin l8 and 19 of the microcontroller. The crystal
provides basic clock pulse to the microcontroller. Pin 39, 38 and 37 of the microcontroller are

comected to the RS, RW and EN pin of dre JHDI62A display. Pin I to 7 of the microcontroller
is corurected to the data port piru D0 to D7 of the LCD respectively. preset lOk is used to
controltng the contrast and brightness of the LCD. Pin 12 and 15 of the microcontrolla are
connected to the echo and trigger ofthe ulfasonic module.

10
3.5 Configuring the 80Sl microcontroller:
To inta face the sensor to AT89C52 mrcrocontroller we need
two I/O pins. One of them is
aft€rnal interrupt pin(INT0 or INT|) for measuring
the pulse width at the echo pin. and any
other pin say P3.5 for fiigger.

STEPI. Connect the trigger pin ofsensor to p3.5 ofATggCSl


STEP2. Connect the echo pin ofthe sensor to INTO (p3.2)
ofAT89C5l
srEH!. configure trre TII\'IERO of 80-5 r in I6 bit mode witrr.,GA]'E' bit e*bred. tf trre GATE
pin is enabled and timer mn control bit TR' is set, the TIMER' wi be controlled by rNT, pin,
when INT0 is high then the TIMER' starts counting. whenever INT' goes low TIMER0 hords
rts count.

3.6 Working
The aim of this project is to construct an automatic bottre fiting system
using ATg9c52,
ulbasonic module HCSRO4 .urtrasonic is one of the
effective methods in the field of tiquid
level measurement' rn the process of ultrasonic propagatio&
reflectlon and refraction wi occru
on the interface of the two different mediums between transmltted pulse and the received
"echo" Normally empty boules will be kept in the conveyor
beh and as the gear molor runs the
conveyor belt, the bottre moves and wit stop when the bottle reaches the exact position
beneath
the nozzle and it is detected by the IR sensor. The bottle starts filrin& the HCSRO4
starts
sensing the rever and if in case tre bottle is empty
or not in a requ'ed rever the nozzle or the
solenoid valve w r opan untir it gets the required rever
disprayed in the LCD. This mechanism
will sense thefilled bottle at the end point and the microcontrolrer wi
send a command to the
motor &iver circuit to stop the conveyor belt. After that
the conveyor bert will move until the
next bottle arrives. And the process repeats with
every bottre that needs to be fi ed. In liquid
filling unit it corsists of overhead liquid tan( one IR sensor.
and flow control (sorenoid) varve
connected to liquid tank. Aft"' inspection done
by the inspection
unit the container comes below
the solenoid valve there one IR sensor placed below
the valve and when it sense the container
6e conveyor stops, then the solenoid varve get oN and filrs
the liquid to the component based
on the instruction . Liquid filting starts a.!i soon as the conveyor stops. Solenoid contror varves
are electromagnetic pl'nger valves which control flow rates of liqurds or gases.
The input to
solenoid valve is given by microconaolrer through a pull
circuit. The fiming of sorenoid valve
and conveyor stopping is sa by the timers used in program. we can change the timing based on
the requirement. The overhead liquid tank wifl suppry riquid to the bottres. The liquid revel is
sensed with the help of urtrasonic sensors i.e HCSRO4. After the
standard liquid revel is reached
the solenoid valve gets OFF and conveyor starts
to run and automatically cycle repeats.

11
L Solenoid valve to control the flow of liouid
2. Liquid filled tank

3. Pipe connected to solenoid valve

3.7 Algorithm
:>Send a l0 micro second high pulse at tigger
Initially P3.5=0;
P3.5=l;
Delay (10 micro second);

P3.5{;
:> 'WAIT" until the sensor aansmits the eight 40KHz pulses and signal reflection, Initially
the "ECHO" pin is low when the transmitter completes the pulse the pin goes high then our

TIMERO starts cumting .Whan input at INTO goes low timer holds count. Logic for waiting:
while(INTF:O); *trile(INT0:l );
:>TIMER0 value = time taken by the signal to (go forward+ come back) It means the signal
taces the whole distance twice. So time taken by the signal to travel the distance = TIMERO
value/2 ULTRASONIC pulse travels with the speed of sound 133.97ir/s

Range of targeFvelocity *time


:> 13397 ' TIMER0/2
==> 6699 i TIMER0
At I l.0592MHz TIMERO gets incremented for lmicrosecond
MNGE = 6699 ir/seconds r TIMER0 micro seconds
= 6699 in/seconds I TIMER0 * (10^-6) seconds

as (lmicro second= 10^-6 seconds)


= 6699 inlseconds I TIMERO * (10^-6) seconds

= (6699 + TIMER0/ ( 1000000) in


= (TIMERO in/149.27
RANGE of targa =.(TIMER0 inyl49
By using the formula we can calculate the range of the target easily
3.8 Applications
This system is used in many applications where the filling of large numbo of bottles are
rquired maintaining catain liquid level. Typical industries include
r Food and Beverage
o Chemical
o Cosmetics

r Pharmaceutical

l5
Chapter 4
RESULTS AND DISCUSSIONS
4.1 Result
This project work has proposed an application of automation illustrating a microcontroller based

fully automatic liquid filling system. We have successfully carried out our project and
developed an automatic bottle filling system using the untouched level measuement method
.The system meets the demand of high-speed production using the least mechanism
requirement. The system has proved to work effectively avoiding unnecessary spill m wastage
of liquids. The system also provides high accuracy and precision in pro'portion of liquids.
Designing this system gave us interesting expoience in working with Microcontroller chip.
Also orn project is a combination of electronics and mechanical work. This provides us
knowledge and makes us aware of what all factors we need to consider while designing a
project based on automation.

t4
Chapter 5
CONCLUSION
5.1 Conclusion
Thus we assembled a circuit which works on IR detection and ultrasonic liquid level .The
irylernenation of ultrasonic sensor was carried out effectively in the pro.ject which adds to the
uoique functioning of the project .This project as a journey where we acquired knowledge and
also gained some insights into the subject which we have shared in this report. The system can

perform the task of autonomous quality control system used in industrial production and it is

most suitable for small Scale industries as definite process is set by programming. Our aim of
fris work is to establish a flexiblg economical, easily configurablg reliable system which
l' nakc our project eco friendly.ln this project we successfully established a relation between the

ultrasonic sensor and the liquid level using the 8051 microcontroller. The liquid level is
successfirlly transmitted to the microcontroller via ultrasonic trans-receiver.

5.2 Future Scope

More features can be added to this system as follows: sealing and capping operations can be

fuplemented using achrators.


REFERENCES
1. Automatic Bottle Filling Using Microconnoller Volume Correr:tion" Ashwini p.
Somawa Supriya B. Asu&ar 2,Sachin A. International Jounal ofEngineering Research

& Technology (JERT)VoI. 2 Issue 3, March - 2013 ISSN: 22784181


Contactless Liquid-Level M€asurement through Opaque Container using Millimeter
Wave Sensor,Tatsuo Nakagawa, Akihiko Hyodq Kenichi Osada, Hideaki Kurata and
Shigeru OhoCentral Research Laboratory Hitachi Ltd., Tokyo, Japan

Development of a Ultasonic Instrun!€nt for the Sealed Container's Liquid Level


Measurement Lei Cherq Xinmin Dong and Jie Han Ping Yglnstitute of Vibration
Engineering College of Mechanical and Elecfical Engineering,Zhengzhou
University, Proceedings of the 6th World Congress on Intelligent control and
Automatioq June 2l -23,2006, Daliaq China.
4. Electonics for you, February 2008 edition ,EFY Group Publication (tndia), New Delhi
5. IEEE Transactions on Ultrasorics, Ferroelectrics, and Frequency Control, vol 6l,no 10.

October 2014 16270885-3010 c 2014 IEEE Bayesian Approximation Enor Approachin


Full-Wave Ultrasormd Tomography,Janne Koponen, Tomi Huttunerq Tanja Tarvainen
International Journal of Emerging Technology and Advanced Engineering Website: m
lnvw.ijetae.com (ISSN 2250-2459(Online),Volume 4, Special Issue l, February20l4)
lnternational Conferelce on Adlanced Developments in Engineuing and Technology

OCADET-I4), INDIA
7. Intemational Joumal of Emerging Technology and Advanced Engineoing Website:
www.ijetae.com (ISSN 2250-2459)Volume 2, Issue 8, August 20t2

TO
for motor driver

Ml=P2^0;

q=P2 l;

FP2"2;

dela(int 0

Ml=l;

sr--0;

Ml=0;
cr= l;

delay( I 000);

cr:O;

delay(300);
ENDIX B

for ultrasonic sensor


#includeceg52.l>

*{efine First_Line 0x80


lldefi ne Second_Line 0xc0

#define Curser_On OxOf

#define Curser_Off 0x0c

ttdefi ne Clear_Display 0x0 I


#tefine Data_Port Pl

sbit Lcd_rs = P0^0;

sbit Lcd_rw = P0^ I ;

sbit Lcd_en = P0^2;

sbit ItX= P3^2;


sbit TX= P3"5;

void Distance_MeasureQ;

void Lcd8_lni();
void LcdS_Comrnand(unsigned char);

void Lcd8_Write(unsigned char,unsigned char);

void Lcd8_Display(unsigned char,const unsigned charr,unsigned inQ;

void Lcd8_Decimal2(unsigned char,unsigned char);

void Lcd8_Decimal3(unsigned char,"ncigned char);

void Lcd8_Decimal4(unsigned char,unsigned int);

void Delay(unsigned int);

void delo;

unsigned

chari,inch I,incM,result,obj_distancgrept,secj,a=0,c:ekc,cu=Oxc0,Ie[20],num[20],n,v[20];

unsigned long int counf={,count I =0;

void maino

I
nA=l;
ETFI;
TMOD=0x01;
TH0=TLFOx00;
TRO-I;
rdty241'
LcdS_lnitQ ;Delay(65000);

Lcd8_Display(0x80,"LJltrasonic ",l6);
Lcd8_Display(Oxc0," ",16);
Delay(65000); Delay(65000);

Lcd8_Display(0xC0,"Distance: ",16);

while(l )

{
Dstance_Measur{);

)
)
void Distance_Measur{

{
counFcount I =0;
THHxOO;TL0:Ox00;
TR0=0;

for(i=0;i< l0;it-r)
{
TX{;
DelM1000);
TX=l;
Delay(10);
TX=O;

while(RX:0);
TRo=1;
while(Rx: I );
TR0={;
counFTHo<<8;
counFcountlTL0;
THFTLFOx00;
count I =count l+count;
Dela(s000);

)
counFcount l/ l0;
inch I =counto/o 10000/ 1000;

incM=counP/o I 000/ I 00;

r€sulF(inch I I l0Finch2;

obj_distance-result-2;
kd8_Decimal3 (0XCb,obj_distance);

)
void Lcd8 InitQ

{
LcdS_Command(0x38); //to select frrnction set

Lcd8_Command(ox06); //entry mode set


LcdS_Command(0x0c); //display on

kd8_Command(Ox0 I ); //clear display

void Lcd8_Command(unsigned char com)

{
Data_Port=com;

Lcd_en= l;
Lcd_rs=Lcd_rw--0;
Delay(125);
Lcd_en=O;

Delay(125);

void Lcd8_Write(unsigned char conr,unsigned char lr)

t
kd8_Command(com);
Data_PorFlr; // Data
Lcd_en=Lcd_n= l;
Lcd_rw:0t
Delay(125);
Lcd_en=O;

Delay(125);
)
void Lcd8_Display(ursigned char corn const unsigned char tword,unsigned int n){

unsigned char Lcd_i;

for(Lcd_i=0;Lcd_i<n;Lcd_i++)

{
Lcd8_Write(com+Lcd_i, wordpcd_il ) ;

)
)
void Lcd8_DecimaD(unsigned char conr,unsigned char val)

{
unsigned int Lcd_hr,Lcd_Llcd_o:

Lcd_ln:val% 100;
Lcd_t=Lcd_hr/ l 0;
Lcd_elcd_M/ol0;
Lcd8_Write(corl! Lcd_t+0x30);Lcd8_Writ{com+ l, Lcd_o|0x3 0);

]
void Lcd8_Decinal3(unsigned char conqunsigned char val)

t
unsigned int Lcd_[Lcd_hr,Lcd_t,Lcd_o;

Lcd_h=vaU 100;

Lcd_tu=val% I 00;
Lcd_t=Lcd_h/ l0;
Lcd_rlcd_hrolo I 0;
LcdS_Writ{cor4 Lcd_h+Ox3 0);Lcd8_Write(com+ l, Lcd_t+Ox3 0);

Lcd8_Write(com+2. Lcd_o'-0x30);
void Delay(uruigned int del)

{
while(del--);

t
OFTEE PROTOTYPE
;

with MCS-s1" Products


I ot In-Systsm Roprogrammable Ftash M€mory
1,000 Writs/Eraso Cycles
i Op€ration: 0 Hz to 24 MHz
Program Memory Lock
lnternal RAlt
l/O Lines
Ti.ner/Counters
Sourcos
l.
*
I
Se.ial Channel
ldle and Powerdown Modas 8-bit
t
t:
Microcontroller
t is a low-power, high-performance CMOS 8-bit microcomputer with gK
with 8K Bytes
i Flash programmable and erasable read only memory (pEROM). The device
Flash
:ured using Atmel's high-density nonvolatile memory lechnology and is
I with the industry-standard 80C51 and 80C52 instruction set and Dinout.
Flash allows the program memory to be raprogrammed in-system or by a
I nonvolatile memory programmer. By combining a versatile g-bit CpU AT89C52
on a monolithic chip, the Atmel ATB9C52 is a powerful microcomDurer
a highly-flexibl€ and cost-efiec1ive solution to many embedded control
l
I
Not Recommended
fior New Designs.
t POFP/TQFP
Use AT89S52.
I

m 7 (^07)

!l)P3s
FSEN

SiSeFriIJ PLCC
,4,9

(rNm)P32

Rev 0313H-O200
6;6j-
rt 6lr
r_ r si i:
res
-
' Compatible with MCS-51 Products
. 8yt€s ol In-System Roprogrammabl€ Flash Memory
8K

' Endurance:'l.000 Wrile/Erase Cycles


, tult Static Operation: 0 Hz to 24 MHz
, Ihr€slevel Program Memory Lock
. 256 x 8+it Internal RAM
I
. Pogrammabl€ l/O Lines
. Throe 16-bit Timer/Count€rs
, Eight Intarrupt Sourcos
, Pogrammable Serial Channel
. low-oower ldle and Powerdown Modes
8-bit
Microcontroller
Description
lhe AT89C52 is a low-power, high-performance CN4OS 8-bit microcomputer with 8K
with 8K Bytes
bytes of Flash programmable and erasable read only memory (PEROM). The device
b manufactured using Atmel's high-density nonvolatile ntemory technology and is
compatible with the industry-standard 80C51 and 80C52 instructjon set and pinout.
lle on-chip Flash allows the program memory to be reprogrammed in-system or by a
mnventional nonvolatile memory programmer. By combining a versatile 8-bit CPU
wilh Flash on a monolithic chip, the Atmel AT89C52 is a powerful microcomputer
which provides a highly-flexible and cost-effective solution to many embedded control
applications.
Not Recommended
Pin Configurations for New Designs.
POFP/TOFP Use AT89S52.

:,

PLCC

Rcv 0313H-02/0".
flmEt
-
Diagram
P0.0 -- P0.7 PZO - F2.7

FSEF
FFG

RST

AT89C52
AT89C52

AT89C52 provides lhe following standard features: 8K Port 2


of Flash, 256 bytes o{ RAM, 32 l/O lines, three 16-bit Port 2 is an 8-bit bi{irectional l/O port with intemal pullups.
a six-vector two-level interrupt architecture, The Port 2 output buffers can sink/source four TTL inputs.
serial port, on-chip oscillator, and clock cir- When 'ls are written to Port 2 pins, they are pulled high by
addition, the AT89C52 is designed with static logic
. In the inlernal pullups and can be used as inputs. As inputs,
operation do\ryn to zero frequency and supports two Port 2 pins that are externally being pulled low will source
selectable powsr saving modes. The ldle Mode current (lrl) because of ihe internal pullups.
the CPU whila allowing the RAM, timer/counters, Port 2 emits the high-order address byte during fetches
port, and interrupt system to continue functioning.
from external program memory and during accesses to
Powsr-down mode saves the RAM contents but external dala memory that use lGbil addresses (MOVX @
the oscillator, disabling all othsr chip tunctions until DPTR). In this application, Port 2 uses strong internal pul-
nsxt hardware reset.
lups when emitting 1s. During accesses to exlernal data
memory that use 8-bit addresses (Movx @ Rl), Port 2
Description emits the contents of the P2 Special Function Register.
Port 2 also receives the high-order address bits and some
vollage. control signals during Flash programming and verification.
Port 3
Port 3 is an 8-bit bi.directional UO port with intemal pullups.
The Port 3 output buffers can sink/source four TTL inputs.
When 'ls are written to Port 3 pins, they are pulled high by
0 is an 8-bit oDen drain bi-directional l/O Dort. As an the intemal pullups and can be used as inputs. As inputs,
port, each pin can sink eight TTL inputs. When 1s Port 3 pins that are externally being pulled low will source
written to port 0 pins, the pins can be used as high- current (ltL) because of the pullups
inputs.
Port 3 also serves the functions of various special features
0 can also be configured to be the multiplexed low- of the AT89C51, as shown in the following table.
address/data bus during accesses to external pro-
Port 3 also receives some control signals for Flash pro-
and data memory. In this mode, P0 has internal
gramming and vsrification.

0 also receives the code bytes during Flash program- Port Pin Alternaia Functions
and outpuls the code bytes during program P3.0 FiXD (serial input po.t)
External pullups are required during program
P3.1 TXO (serial output port)
P3.2 lNT0 (external interrupt 0)
1 is an 8-bit bi{irectional l/O port with intemal pullups. P3.3 iNfi (external intenupt 1)
Port 1 outout buffers can sink/source four TTL inouts.
P3.4 T0 (timer 0 external input)
1s are written to Port 1 pins, they are pulled high by
internal pullups and can be used as inputs. As inputs, P3.5 Tl (timer 1 external input)
1 pins that are externally being pulled low will source P3.6 WR (external data memory write strobe)
(lrL) because of the intemal pullups.
P3.7 R-D (external data memory read strobe)
addition, P1.0 and P1.'l can be configured to be the
ter 2 external count input (P1.0/T2) and the RST
2 trigger input (P1 .1fizEx), respeclively, as
Reset input. A high on lhis pin for two machins cyclss while
in the following lable.
'l also receives the low-order address bytes during the oscillator is running resets the device.
programming and verification. ALE/PJOG-
Address Latch Enabls is an oulput pulse for latching the
low byte of the address during accesses to extemal mem-
ory. This pin is also the program puts€ input (FROG) during
Flash programming.
In normal operation, ALE is emitted al a constant rate of 1/6
the oscillator frequency and may be used for external
AT89C52
AT89C52 provides the following standard fealures:8K
Porl2
btbs of Flash, 256 bytes of RAM, 32 UO tines, three .16-bil
Port 2 is an 8-bit bidirectional l/O port with intemal pullups.
ftner/counters, a six-vector two-level interrupt architecture,
The Port 2 output buffers can sink/source four ffl inputs.
a full-duplex serial port, on_chip oscillator, and clock
orlry. In addition. the ATg9C52 is designed with static
cir_
logic
yfll"_11" written to port 2 pins, they are purreo nigh Lt
rne Internat pullups and can be used as inputs.
br.operation down lo zero frequency and supports two As inputs.
Port 2 pins that are externally being pulled low
Sonware setectable power saving modes. The ldle Mode will souice
current (lrr) because of the internal pullups.
rlops the CPU. while allowing the RAM, timer/counters,
$nal port, and interrupt system to continue functioning. Port 2 emits the high-order address byte during fetches
Ine power-down mode saves the RAM contents from external program memory and during acc.-esses
to
bJt
li€szes.the oscillalor, disabling a other chip functions until :{9rl'.at.data memory that use 16-bit addresses (MOVX @
OPTR). In this application, port 2 uses strong internal pJ_
f|e next hardware reset.
lups when emitting 1s. During accesses to external
data
memory that use 8-bit addresses (MOVX
Pin Description @ Rl), port 2
emits the contents of the p2 Special Function RegLter.
vcc Port 2 also receives the high-order address bits
Supply voltage.
and some
control signals during Flash programming and verification.
GiID Port 3
Ground.
Port 0
l:1 I1.."j 8-bil bi-direcrionat t/O pod w h inremat pu ups.
I ne Hon J output buffers can sink/source
four TTL inputs.
Porl 0 is an 8-bit open drain bi-directional l/O port. y'*n to pon
3 pins, rhey are purreo rrigh ot
As an lfl^]-"_?:"
lne Intemal pullups and can be
output.port. each pin can sink eight TTL inputs. When used as inputs. As inputs.
1s Port 3 pins that are externally being pulled low
arew-nlten porl 0 pins, the pins can be used as high_ will source
.to currsnt (lL) because of the pu ups.
mpedance inputs.
Port 0 can also be configured to be lhe multiplexed low_ Port 3 also serves the functions of various special
features
order address/data bus during accesses to external pro- of the AT89CS1, as shown in the following t;bte.
gram and data memory. In this mode, p0 has Port 3 also receives soms control signals for Flash pro_
inteinal
pullups. grammtng and verification.
Port 0 also receives the code bytes during Flash program_
Pon Pin Alt mate Functions
ming and outpuls the code bytes during pro!ram
verification. External pullups are riquired Orri-ng P3.0
pr6ra; RXD (serial input port)
verifica tio n. P3.1 (""tut olprt pott)
Port 'l
_I9
P3.2 lNm (externat intenupt O)
8-bit bi{irectionat t/O port with internat pu[ups.
l:n 1 ". "_"
Ine pon 1 outpul buffers can sinusource four TTL inputs.
P3.3 iNTT (external intenupt 1)

wrinen to port .l pins, they are pu ed high by P3.4 T0 (timer 0 externat input)
If".L]r "1"pullups and can
lhe rnternal be used as inputs. As inputi P3.5 T1 (timer 1 external input)
Port 1 pins that are extsrnally being pulled low will
source
cunent (l[) because of the intemal pu ups. 1q WR (external data memory write strobe)
In addition, P1.0 and p1..t can be configured to
be lhe
P3.7 m (external data memory read strobe)
timer/counter 2 external count input (pi.0/T2) and the
limer/counter_2 trigger Input (p1.1/T2EX), respectively, RST
as
shown in the following table. Reset input. A high on this pin for two machine cycles
while
Port 1 also receives the low-order address bytes the osci alor is running resets the device.
during
Flash programming and verification
ALE/PRG
Port Pin Altomata Functions Address Larch Enable is an output pulse for latching the
low byte of the address during accesses to external
P1.0 T2 (external count input to Timer/Counter 2). mem_
ory. rhrsprn is atso the program putse inpul
cloc*out 1FR6G; Ouring
Frash programming.
P1.1 T-2EX (Tim€r/Counter 2 capture/reload trigger and In normal operation, ALE is emiftsd at a constant
direction control) rate of 1/6
the oscillator frequency and may be used for external
I
| 0mrng

1ffiil:
or clocklng purposes.
skipped
Note, however, that one
durins each access to exrernat ALE
4EE-_
datl
EefVpp
il"1
l
mi'#*i;*r"n',',r;:ii",:r."^y:.,,v set ns o, o or ;fi[*lrip!;li::"i'-Ti:;:il]itrt]1f,frl;
,n", n i".' L,i'r L ili',",,";
, w_eaklv purled high. setrina ,,.'. ,t,il:J:,::";:
;3.1 , :,ruini"in""1,,:1i:i
oflect if the microcontroller
eLE-ii.Jii"";ll''njj""jl,:i:
,TiJ:;"1,",T,""il
:I'rnarrv ratched on resel. eo- *,,i i;

is'in exrernar execution mode. be strapped to vcc for internat


program
"r"""?:;l:
This Pin also,reeives.the.l2-volt
!l]i[r
s,or" Enabre is the rsac programming enabre
vo'-
sram memory. -r strobe to extarnar pro-
irt"ir!ki"r'ijiX,?"5!X'n o."nr;;;ne wiren r z-voir
When the AT89C52 is
executino (

&l:il ffTiT;ffiH"::';,,,flii l::s'"*1fi:: ,ipil,::rrrrr,rreosci,,aror


skipped during internat
amp,irie, ano ,npu'o rhe
clock operating circuit. '
€acn access to extemal data mero,lil. ".
XrAL2
output from the inverting oscillator
Table 1. AT89cs2 sFR Map and amplifier.
Reset values
OFSH

OFOH
00000000

OESH

ACC
00000000

PSW
00000000

T2CON T2MOD RCAP2L RCAP2H


00000000 XXXXXXOO rL2 fH2
00000000 00000000 00000000 o0000000

IP
xx000000

P3
11111111

IE
0x000000

P2
11111111

scoN SAUF
00000000 XXXXXXXX

11111111

TCON TMOO TLO TL1


00000000 00000000 THO TH1
00000000 00000000 o0000000 00000000
PO
80H DPL
11111111 DPH
00000111 00000000 00000000 PCON
0xxx0000
AT89C52
u93. L293D
QUADRUPLE HALF.H DRIVERS
SLRSOOAC - SFPTEMBER 1986 - REVISED NOVEMBEB 2OO4

Featuring Unitrode L293 and L293D L293...NORNEPACKAGE


Products Now From Texas Instruments L293D...NEPACKAGE
a (roP vtEw)
Wide Supply-Voltage Range: 4.5 V to 36 V
a Separate Input-Logic Supply 1,2EN Vcc,
a Internal ESD Protection 1A 4A
1Y 4Y
a Thermal Shutdown
a High-Noiselmmunity Inputg
HEAT SINK AND / I HEAT SINK AND
GFOUND \ I GFiOUND
a Functionally Similar to SGS L293 and 2Y 3Y
SGS 1293D 2A 3A
Output Current 1 A Per Channel vccz 3,4EN
(600 mA for 1293D)
a Peak Output Current 2 A Per Channel L293... DWP PACKAGE
(TOP VtEW)
(1.2 A lor 1293o)
. Output Clamp Diodes tor Inductive 1,2EN Vccr
Transient Suppression (L2930) '1A
4A
.1Y
4Y
description/ordering information NC NC
The L293 and L293D are quadruple high-current NC NC
half-H drivers. The 1293 is designed to provide NC NC
a ')
bidirectional drive currents of up to I A at voltages HEAT SINK AND J ( HEAT SINK AND
from 4.5 V to 36 V. The L293D is designed to GFoUND ) r GROUND
provide bidirectional drive currents of up to \
600-mA at voltages trom 4.5 V to 36 V Both NC NC
devrces are designed to drive inductive loads such NC NC
as relays, solenoids, dc and bipolar stepping 2Y 3Y
motors, as well as other high-currenvhigh-voltage 2A 3A
loads in positive-supply applicataons. Vccz 3,4EN
All inputs are TTL compatjbte. Each output is a
complete totem-pole drive circuit, with a
Darlington transistor sink and a pseudo-
Darlington source. Drivers are enabled in pairs, with drivers 1 and 2 enabled by 1,2EN and
drivers 3 and 4
enabled by 3,4EN when an enable input is high, the associated drivers are enabled, and their outputs are
active
and in phase with their inputs. When the enable input is low, those drivers are disabled, and their
outputs are
otf and in the high-impedance state. With the proper data inputs, each pair of drivers forms a tull-H (oibrioge.l
reversible drive suitable tor solenoid or motor aoolications.

ORDERING INFORMATION
T4 PACKAGET
ORDEBAALE TOP.SIDE
PAFT NUiIBER MARKING
HSOP (DWP) Tube ol20 L293DWP L293DWP
PDIP (N) Tube ot 25 1293N
0-C lo 70 C L293N
Tube ot 25 L293NE L293NE
POrP (NE)
Tube ot 25 L293DNE L293DNE
' racKage orawrngs slanoard paching quanlties, thefihal data, syrnbolization, and PCB design guidelines are avaitabte at
wwwti.convsc/package

Please be aware that an imporiant notice conceming availabilrty, standard warranly. and use in
cnlicat applicat ons ol
Texas Inslrumenrs semiconductor producrs and discraimers thereto appears al lhe end ol this
data sheer.

pnOoUCTlO Drtr rtrmrrjoi it cs.nt .r or oudEttn orL


P'odrir b rFonmod F $. r.fr 01 T.r4 t^.tru4.dr
conrd m lr- convlghr 2004 Ie.ds In\t ulrLnls t.c^,pn.i'cd
r,*fi,$:i,i.ll*f;"_,*ru{6o..m,norsny,Etu,h
If TEXAS
INSTRUMENTS
POST OFFTCE BOX 655303 a OATLAS TEXAS 7s26s
[293, 12930
OUADRUPLE HALF-H DBIVEBS

NOVEMBER

description/ordering intormation (continued)


on the L293' external high-speed output clamp diodes should be used tor inductive transient suppressron.
A V651 terminal, separate trom vcc2, is provided for the logic inputs to minimjze device power
djssrpalon.
The L293and L293D are characterized for operation lrom O"C to 70"C.

block diagram

vccr
o
lr --.t16ts
I
I

ltl Jr-;

13

12
rl
H
l=

irr
vccr

Outsut diodes are intremat in 12930.

FU CTION TAALE
(ech d.ivor)
rNPurst oulPuT
A EN
H H H
L L
X L z
H = high level, L = low level, X = ifielevant,
z = high impedance (otf)
r In the themal shuldown mode, tfie outsut,s
in lhe high-impedance slate, regardtess ol
the input levels.

S r.tt
INSTRUMENTS
POSTOFFTCE BOX 65s303. OAttA9. TEXAS 7s26s
t.zgg, L2E|D
OUADRUPLE HAI-F"H DilVERS
aLASoCC - sEPtEllgEF |*8- REUAED O\iE ACn Sa
loglc dlagEm

tA IY
1,2!r
2A x
JT t\t
&.lx
.A 4Y

sch€madcs of Inpuls and ouFufs (I2ql)


EOIIYALET{T OF EACI{ IIPUT TYHCAL OF At|- OUTPUTS

S rs,n"
INSTRI.JMENTS
F03t 6FO€ aor( dd[}. OA.llA, IEXAA 7ra.5
1293, L293D
QUADRUPLE HALF.H DRIVEBS
SLRSOOAC - SEPTEMAFR I986 - REVISED NOVEMSER ?OO4

schematics ot inputs and outputs (L293D)

EOUIVALENT OF EACH INPUT TYPICAL OF ALL OUTPUTS

absolute maximum ratings over operating free,air temperature range (unless otherwlse noted)t
1l

...... -3VtoV692+3V

rloi"" z si owp p""k"g"


""j
Maximum junction temperature, T; .....
Storage temperature range, Tstg
Istresses beyond those listed under "absolute maximum €tings" may cause permanenl damage ro
the device. These are slress ratingo onry, and
tunctional operaticn ol the device at lhes€ or any other conditions beyond those indicaled
uncier '?ecommended operating conditions" is not
impried. Erposure lo absorute-marimum-rated conditions lorextended periods may
allect device reriabirity.
NOTES: 1. Allvoltage values are with resp€ct to the net, ork ground terminal_
2 Maximum power dissipation is a lunclion ol TJ{max), dJA, and TA- The maxrrhum
allowable F,ower dissipation at any a owable
ambient temperalure is Po = fiJ{ma() - Tr/gJA. Operating at the absotute maximum TJ
ol tso.c can atfeci retiabitity.
3. The package thermal impedance is calculated jn accorc,ance with JESD 5t -z_

Sn*t
INSTRUMENTS
Pqsr oFFrc€ Box 0s5303 . oaLLAS, TEXAS /5?6s

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