Upload
sujeet-kumar
View
185
Download
5
Embed Size (px)
Citation preview
INTERACTIVE VOICE RESPONSE SYSTEM A project submitted in partial fulfillment for the requirement of the award of the degree of
Bachelor of Engineering
In
Electronics & Communication
By:
Sam Abhinav Kullu (2k7/EC/690)
Sandeep Kumar (2k7/EC/691)
Sudhanshu Bhasin (2k7/EC/699)
Sujeet Kumar (2k7/EC/700)
Under the guidance of
Mrs. Priyanka Jain
Assistant Professor
Department of Electronics & Communication Engineering
Delhi College of Engineering
University Of Delhi
Year 2011
DECLARATION
We hereby declare that the work which is being presented in the major project entitled "Interactive Voice Response System" in the partial fulfillment for the award of degree of Bachelor of Engineering in Electronics & Communication submitted to Delhi College Of Engineering, University of Delhi, is an authentic record of our own work carried out under the supervision of Mrs. Priyanka Jain, Assistant Professor, Department Of Electronics & Communication, Delhi College Of Engineering, University of Delhi. We have not submitted the matter represented in this dissertation for the award of any other degree or diploma or any other purpose whatever.
Sam Abhinav Kullu (2k7/EC/690)
Sandeep Kumar (2k7/EC/691)
Sudhanshu Bhasin (2k7/EC/699)
Sujeet Kumar (2k7/EC/700)
CERTIFICATE It is to certify that dissertation, entitled " Interactive Voice Response System " submitted by the following students in partial
fulfillment of the requirements of the award of the degree of
bachelor of engineering in electronics and communication,
submitted in the department of electronics and communication
engineering, Delhi college of engineering, Delhi, is an authentic
record of student's own work carried out by them under the guidance
and supervision.
Sam Abhinav Kullu (2k7/EC/690)
Sandeep Kumar (2k7/EC/691)
Sudhanshu Bhasin (2k7/EC/699)
Sujeet Kumar (2k7/EC/700)
It is also certified that this dissertation has not been submitted for the award of any other degree or diploma in any other college/university.
Mrs. Priyanka Jain
Assistant Professor
Electronics & Comm. Engineering
Department
Delhi College of Engineering
4
Acknowledgement
It is great pleasure to have the opportunity to extent our heartiest felt gratitude to everybody who helped us throughout the course of this dissertation. It is distinct pleasure to impress our deep sense of gratitude and indebtedness to our learned supervisor Assistant Professor Mrs Priyanka Jain, Electronics & Communication Deptt. submitted to Delhi College of Engineering, University of Delhi for their invaluable guidance, encouragement and patient review. Their continuous inspiration only had made us complete this dissertation. We are also thankful to our friends and classmates for their unconditional support and motivation for this dissertation.
5
Table of Contents
Chapter 1 Introduction .............................................................................................. 3
1.1 Description....................................................................................................... 4
1.2 Objective .....……………………………………………………………...…....6
1.3 Layout of chapters... …………………………………………………………...6
Chapter 2 Literature Survey.………………………………………………………..7
2.1 History and technology background.............................................................. 8
2.2 Typical Uses .............................................................................. ……………9
2.3 Potential Uses ………………………………………………………………..11
2.4 Criticism …………………………………………….……………………….13
Chapter 3 General Overview of IVRS System……………………………………15
3.1 What is IVRS?......................................................................................16
3.2 Technology used……………………………………………………………..17
3.3 Block diagram………………………………………………………………..20
3.4 Components…………...……………………………….……………….…....21
3.5 Explanation………… ………………………………………………….…..21
3.5.1 Telephone …………………….……………………………………..….21
3.5.2 DTMF signaling.….……………………………………………………...23
3.5.3 Ring detector………..……………………………………………….…...25
3.5.4 ON-OFF hook stimulator…….. ……………………………………..….26
3.5.5 Microcontroller.……………………………………………………….....26
3.5.6 Voltage convertor………..………………………………………………27
3.5.7 PC serial port....……………………………………………………….....27
3.5.8 Interfacing circuit………..……………………………………………….28
3.6 Hardware describtion..……………………………………………………..…28
3.6.1 Microcontroller.…………………….……………………………………28
3.6.2 DTMF decoder.…………………………………………………………...30
6
3.5.3 Ring detector………..………………………………...……………….…..56
3.5.4 ON-OFF hook stimulator…….. ……………………...………………..….28
Chapter 4 Circuit Explanation…………………………………………………….…41
4.1 Circuit diagram…………………………………………………………………42
4.2 Circuit operation……………………………………………………......………42
4.2.1 Telephone ring sensor………………………………………………...……44
4.2.2 ON-OFF hook stimulator ……………………………………………….....48
4.2.3 PC serial port ………………………………………………...…………….51
Chapter 5 Software description……………………………………………….….…..56
5.1 Visual basic 6.0 ……….………………………………….…………...…….…57
5.2 Visual basic (serial communication)…..………………………….…………….58
5.2.1 Introduction…………………….……………………………………….....59
5.2.2 Communication control……………………….……………………………60
Chapter 6 Methodology……………………………..……..………………................64
6.1 Microcontroller ………………………………………………..…………….....65
6.1 Visual basic ………………………………………………..………….…….....66
Chapter 7 Conclusions And Future Enhacement…………………………...……..70
. 7.1 Conclusions …………………………………………………………….………71
7.2 Future Enhacement …………………………………………………….……....71
Appendices………………………………………………………………..………..….72
Source Code………………………………………………………….……………..….72
References……………...……………………..………………………………….…….85
7
CHAPTER 1
INTRODUCTION
8
1.1 DESCRIPTION
Now-a-days every inst i tu t ion needs automat ion. As a par t o f
co l lege automat ion, we have decided to do a pro ject “Voice
Interact ive System for Col lege Automat ion” . Our pro ject a l lows
the user to know the student ’s rank in any exam through the
te lephone l ine wi thout in ter ference o f the col lege author i ty . In
the hardware side embedded system has been used. A 40 p in
microcontro l ler 89C2051 is used because o f i t s compat ib i l i ty wi th
our hardware. This microcontro l ler contro ls the whole hardware.
Telephone l ine is used for communicat ion purpose. Visual Basic
has been used for so ftware programming.
In our Project a 20 p in Microcontro l ler AT89C2051 is used to
contro l the whole hardware. The Microcontro l ler senses the
DTMF signal through the DTMF decoder IC MT8870 and i t
responds according to the decoded signal . The c i rcui t has an
inbui l t Phone Ring sensor c i rcu i t and the system wil l take over
the phone automat ical ly using a 12 V relay. The microcontro l ler
wi l l receive the s ignal f rom the distance te lephone and i t decodes
the s ignal and fetches the data f rom the PC through the ser ia l
9
port , based on the te lephone s ignal , and sends the data through
the te lephone l ine.
Fig. 1.1 IVR SYSTEM
10
1.2 OBJECTIVE
The object ive o f our pro ject is to know the student’s rank in an
entrance exam qu ick ly through the te lephone wi thout the
in ter ference o f co l lege author i ty . By d ial ing the provided
te lephone number, one can d ig up the in format ion o f the student .
One o f the advantages is the t ime spending for col lege o f f ic ia ls
in answer ing phone cal ls f rom outs iders wi l l be reduced.
1.3 LAYOUT OF CHAPTERS
In next chapters, we give review of the IVR system, a detailed introduction to the
technology, Hardware used and show its distinctiveness from other softwares. This
is followed by a description of the proposed methodology for developing IVR
SYSTEM.
11
CHAPTER 2
LITERATURE SURVEY
12
2.1 HISTORY
The blueprint for IVR began in 1941, when Bell System developed a new tone
dialing methodology. Bell unveiled the first telephone that could dial area codes
using Dual Tone Multi Frequency DTMF technology at the Seattle World Fair in
1962. DTMF telephones enabled the use of inband signaling.
Despite the fact that more companies began using the system in the 1970s to
automate tasks in call centers, the technology was still costly and complicated
which made for low market penetration. However, by the 1980s a number of new
competitors entered the market and uptake of IVR technology started to increase.
When call centers began to migrate to multimedia contact centers in the late 90's,
companies began to invest in web-enablement and Computer Telephony
Integration (CTI) with IVR systems. IVR became vital for call centers deploying
universal queuing and routing solutions and acted as an agent which collected
customer data to enable intelligent routing decisions.
13
Having remained technologically static since its development in the 1980s, speech
recognition started to become more common and cheaper to deploy. This was due
to increased Computer Processing Power and the migration of Speech applications
from propriety code to the VXML standard. The introduction of the VXML
standard also simplified the integration process between IVR systems and any back
end hosts.
2.2 TYPICAL USES
• IVR systems are typically used to service high call volumes, reduce cost and
improve the customer experience. Examples of typical IVR applications are:
telephone banking, televoting, and credit card transactions. Large companies
use IVR services to extend the business hours of operation.
• Call centers use IVR systems to identify and segment callers. The ability to
identify customers allows the ability to tailor services according to the
customer profile. It also allows the option of choosing automated services.
Information can be fed to the caller allowing choices such as: wait in the
queue, choose an automated service, or request a callback (at a suitable time
and telephone number). The use of computer telephony integration (CTI)
will allow the IVR system to look up the caller line identification (CLI) on a
network database and identify the caller. This is currently accurate for about
14
80% of inbound calls. In the cases where CLI is withheld or unavailable, the
caller can be asked to identify themselves by other methods such as a PIN or
password. The use of DNIS will ensure that the correct application and
language is executed by the IVR system.
• The use of IVR and voice automation enables a company to improve its
customer service and lower its costs, due to the fact that callers’ queries can
be resolved without the cost of a live agent who, in turn, can be directed to
deal with specific areas of the service. If the caller does not find the
information they need, or require further assistance, the call is then
transferred to an agent who can deal with them directly through CTI
integration. This makes for a more efficient system in which agents have
more time to deal with complex interactions, for example, customer
retention, up selling, cross selling and issue resolution. This way, the
customer is more likely to be satisfied with a personalised service and the
interaction is likely to be more fulfilling and rewarding for the agent, as
opposed to dealing with basic enquiries that require yes/no responses, such
as obtaining customer details. Employee satisfaction is important in the
telecommunications industry due to the fast turnover of staff, IVR is
therefore one way of retaining a workforce and allowing them to do a more
effective job.
15
• IVR also enables customer prioritisation. In a system whereby individual
customers may have a different status, for example, a bronze, gold or
platinum card holder, the service will automatically prioritise the individuals
call and, in the case of a platinum card holder, move them to the front of the
calling queue.
2.3 POTENTIAL USES
• Voice-Activated Dialers
(VAD) Voice-activated IVR systems are now used to replace the
switchboard or PABX (Private Automatic Branch eXchange) operators and
are used in many hospitals and large businesses to reduce the caller waiting
time. An additional function is the ability to allow external callers to page
hospital staff and transfer the inbound call to the paged person.
• Entertainment and Information
The largest installed IVR platforms are used for applications such as tele-
voting on TV game shows such as Pop Idol and Big Brother which can
generate enormous call spikes. Often the network provider will have to
deploy Call gapping in the Public network to prevent Network overload.
The following are some of the more common uses of an IVR:
16
o Mobile (Pay as you go Top up)
o Telephone Banking (Balance, payments, and transfers)
o Mobile Purchases (particularly for mobile content, such as ringtones and
logos)
o Caller identification and routing
o Order Placements (Credit Card Payments)
o Airline (Ticket booking, Flight arrivals, Flight departures, Checkin)
o Adult entertainment (Dating, Chat line etc)
o Weather forecasts
• Clinical Trials
IVR systems are used by pharmaceutical companies and contract research
organizations to conduct clinical trials and manage the large volumes of data
generated. The caller will respond to questions in their preferred language
and their responses will be logged into a database and possibly recorded at
the same time to confirm authenticity. Applications include patient
randomization and drug supply management.
• Outbound Calling
17
IVR systems can be used for outbound calls, as IVR systems are more
intelligent than Dialler systems, they can recognise different line conditions.
o RNA Ring No Answer
o Answered by Voicemail or Answering machine (In this circumstances they
can leave a message)
o Fax Tone (IVR can leave a Fax Message based upon a TIFF Image)
o Answer (IVR can tell the customer who is calling and ask them to wait for
an agent)
o Recognise Divert messages and abandon call.
IVR uses Call Progress Detection to monitor Line conditions, and report to
the IVR Database.
2.4 CRITICISM
IVR is sometimes criticized as being unhelpful and difficult to use due to poor
design and lack of appreciation of the caller's needs.[4] Some callers object to
providing voice response to an automated system and prefer speaking with a
human respondent. A properly designed IVR application should provide the caller's
needs promptly and with a minimum of complexity.[neutrality disputed] However some
18
companies use IVR to reduce operational costs and will not offer similar services
using agents. Such services tend to frustrate customers who feel that their right to
speak to an agent is being restricted. Companies that deploy such services tend to
ignore customer opinion. Such services are used in debt recovery and giveaways
(Such as Concert tickets, Satellite/Cable Receivers etc).
19
CHAPTER 3
GENERAL OVERVIEW
OF
IVRS
20
3.1 What is IVR System ?
Interactive Voice Response (IVR ) system is an interactive technology that allows
a computer to detect voice and keypad inputs. IVR technology is used extensively
in telecommunications, but is also being introduced into automobile systems for
hands-free operation. Current deployment in automobiles revolves around satellite
navigation, audio and mobile phone systems. In telecommunications, IVR allows
customers to access a company’s database via a telephone touchtone keypad or by
speech recognition, after which they can service their own enquiries by following
the instructions. IVR systems can respond with pre-recorded or dynamically
generated audio to further direct users on how to proceed. IVR systems can be used
to control almost any function where the interface can be broken down into a series
of simple menu choices. In telecommunications applications, such as customer
support lines, IVR systems generally scale well to handle large call volumes.
It has become common in industries that have recently entered the telecom
industry to refer to an Automated Attendant as an IVR. The terms Automated
Attendant and IVR are distinct and mean different things to traditional telecom
professionals, whereas emerging telephony and VoIP professionals often use the
21
term IVR as a catch-all to signify any kind of telephony menu, even a basic
automated attendant.
3.2 Technologies Used
DTMF signals (entered from the telephone keypad) and natural language speech
recognition interpret the caller's response to voice prompts.
Other technologies include the ability to speak complex and dynamic information
such as an e-mail, news report or weather information using Text-To-Speech
(TTS). TTS is computer generated synthesized speech that is no longer the robotic
voice generally associated with computers. Real voices create the speech in tiny
fragments that are spliced together (concatenated) before being played to the caller.
An IVR can be utilized in several different ways:
1. Equipment installed on the customer premise
2. Equipment installed in the PSTN (Public Switched Telephone Network)
3. Application service provider (ASP).
4. Hosted IVR
A simple voicemail system is different from IVR in that it is person to person
whereas an IVR is person to computer. IVR voiceforms can be used to provide a
22
more complex voicemail experience to the caller. For example, the IVR could ask
if the caller wishes to hear, edit, forward or remove a message that was just
recorded.
An automatic call distributor (ACD) is often the first point of contact when calling
many larger businesses. An ACD uses digital storage devices to play greetings or
announcements, but typically routes a caller without prompting for input. An IVR
can play announcements and request an input from the caller. This information can
be used to profile the caller and route the call to an agent with a particular skillset.
(A skillset is a function applied to a group of call-center agents with a particular
skill.)
Interactive voice response can be used to front-end a call center operation by
identifying the needs of the caller. Information can be obtained from the caller
such as account numbers. Answers to simple questions such as account balances or
pre-recorded information can be provided without operator intervention. Account
numbers from the IVR are often compared to caller ID data for security reasons
and additional IVR responses are required if the caller ID data does not match the
account record.
IVR call flows are created in a variety of ways. A traditional IVR depended upon
proprietary programming or scripting languages, whereas modern IVR applications
23
are structured similar to WWW pages, using VoiceXML[1], CCXML[2], SRGS[3],
SALT or T-XML languages. The ability to use XML developed applications
allows a Web server to act as an application server, freeing the developer to focus
on the call flow. It was widely believed that developers would no longer require
specialized programming skills, however this has been proven to be misguided as
IVR applications need to understand the human reaction to the application
dialogue. This is the difference between a good user experience and IVR hell.
Higher level IVR development tools are available in recent years to further
simplify the application development process. A call flow diagram can be drawn
with a GUI tool and the application code (VoiceXML or SALT) can be
automatically generated. In addition, these tools normally provide extension
mechanisms for software integration, such as HTTP interface to web site and Java
interface for connecting to a database.
In telecommunications, an audio response unit (ARU) is a device that provides
synthesized voice responses to touch-tone keypresses (DTMF) by processing calls
based on (a) the call-originator input, (b) information received from a database,
and (c) information in the incoming call, such as the time of day.
ARUs increase the number of information calls handled and to provide consistent
quality in information retrieval.
24
3.3 BLOCK DIAGRAM
DTMF DECODER
RING DETECTOR
ON/OFF HOOK
SIMULATOR
MICROCONTROLLER
INTERFACING CIRCUIT
VOLTAGECONVERTER
PC SERIALPORT
PC SPEAKER
OUT
PERSONALCOMPUTER
TELEPHONE LINE
Figure 3 .1 Bas i c B lock D iagram
25
3.4 COMPONENTS
The above Block d iagram consist o f fo l lowing Blocks
1. Telephone sect ion
2. DTMF Decoder
3. Ring Detector
4. ON/OFF hook Simulator
5. Microcontro l ler
6. Voltage converter
7. PC Seria l Por t
8. Personal Computer (PC)
3.5 EXPLANATION
3.5.1. TELEPHONE
Invented by Bel l and h is assistant , Thomas A. Watson, the
te lephone marked a s igni f icant development in the history o f
e lectr ical communicat ion systems. In the ear l iest magneto-
telephone o f 1876, the speaker’s voice was converted into
electr ical energy pat te rns that could be send over reasonably long
d istances over wi res to a receiver, which would convert these
energy pat terns back into the or ig inal sound waves for the
l i stener.
26
Outgoing Cal l
The dial pad, a lso cal led keypad or touch- tone pad, is used to d ia l
te lephone numbers as wel l as in teract wi th voice processing
system such as a voice mai l and interact ive voice response ( IVR).
The address s ignal ing for an outgoing cal l can be accompl ished
by 3 d i f ferent methods: pulse d ial ( rotary) , real tone mul t ip le
f requency (DTMF), or mult i frequency (MF)
Mult i -Frequency (MF):
I t however became more popular wi th the in t roduct ion o f dual
tone mul t ip le frequency (DTMF) mode o f d ia l ing. Single chip
DTMF encoders/decoders are avai lable today, which make the
designing such systems easy and re l iable
Mult i - f requency signal ing is s imi la r to DTMF and is used on
t runk c i rcui t , pay te lephones. Combinat ion o f two tones is used to
t ransmit s ignal ing in format ion, MF and DTMF signals are more
rel iable and considerably faster than pulse d ial . In both methods,
d ig i ts are t ransmit ted at the rate of about 7 d igi ts per second.
27
Incoming cal l
When a te lephone set i s cal led, the local exchange generates a
h igh r ing vol tage o f about 90-105Vol ts AC wi th a f requency o f
20Hz superimposed over the minus ( - ) 48Vol t DC. A capaci tor in
the phone passes the AC but b lock DC. Upon detect ing the AC
vol tage, the phone provides an aud ib le s ignal that a l tos the user
o f an incoming ca l l . Each te lephone set provide a ringer
equ iva lent number (REN) as def ined wi th in FCC part 68 and EIA
RS-470.The REN is used to ensure that the local exchange can
provide the correct amount o f power requi red to r ing the
te lephone. I t descr ibes the frequency range, power range, and
b ias vo l tage range o f the te lephone set . When the phone is
answered, DC cur rent begins to f low in the loop. The local
exchange the current f low and removes the super imposed r ing
vol tage. The -48Vol ts DC that i s a lways on the l ine operates the
te lephone when i t is be ing used.
3 .5.2 DTMF SIGNALING
DTMF stands for Dual Tone Mul t ip le Frequency. I t i s a tone
consist ing o f two frequencies super imposed. Indiv idual
f requencies are chosen such that i t i s easy to design f i l ters and
easy to t ransmit the tones through a te lephone l ine having
bandwidth o f approximate ly 3.5 kHz. DTMF was not intended to
be used for data t ransfer , i t was meant to be used for sending the
28
contro l s ignals along the te lephone l ine. Wi th standard decoders
i t is possib le to send 10 beeps per second i .e. , f ive b i ts per
second. DTMF standard speci f ies 50ms tones and 600ms durat ion
between two successive tones.
Tab le.3 .2 DTMF Keypad Frequencies
Generat ing DTMF
DTMF signals can be generated through dedicated ICs or by using
RC networks connected to a microprocessor. MT8880 is an
example o f a dedicated IC. But gett ing the lat ter method work is
a b i t d i f f icu l t i f h igh accuracy is needed. The crystal f requency
needs to be sacr i f i ced for a non standard cyc le length. Hence th is
1209 Hz 1336 Hz 1477 Hz 1633 Hz
697 Hz 1 2 3 A
770 Hz 4 5 6 B
852 Hz 7 8 9 C
941 Hz * 0 # D
29
method is used for simple appl icat ions. Most o f ten, a PIC micro
cou ld be used for the above purpose.
Decoding DTMF
Detect ing DTMF with sat is factory prec is ion is a hard th ing.
Of ten, a ded icated IC such as MT8870 is used for this purpose. I t
uses two 6 th order band-pass f i l ters using swi tched capaci tor
f i l ters and i t suppresses any harmonics. Hence they can produce
pret ty good s ine waves from d istorted input . Hence i t i s
prefer red. Again microprocessors can a lso be used, but the ir
app l icat ion is l imi ted.
3.5.3. RING DETECTOR:
I t is used to detect the r ing s ignal f rom the te lephone l ine. I t
g ives out a logica l output to the microcontro l ler . An optocoupler
MCT2E is used as r ing detector .
I f r ing is present – logic 0
E lse- logic 1
Normal t ime vol tage in te lephone l ine=48V d.c
OFF hook vol tage-12V d.c
Ring signal vo l tage-75V a.c
30
3.5.4. ON–OFF HOOK SIMULATOR
I t i s used to p ickup the te lephone elect ronical ly . A 12 vol t d .c
s ignal i s obta ined by p lacing a resistor across the te lephone l ine.
I t i s used to detect whether the Hand set i s in ON hook condi t ion
or OFF hook cond i t ion so as to send the in format ion to the
microcontro l ler . A 12 V relay is used for the purpose.
3.5.5. MICROCONTROLLER
A by-product o f microprocessor development was the
microcontro l ler . The same fabr icat ion techniques and
programming concepts that make possib le the genera l-purpose
microprocessor also y ie lded the microcontro l ler .
Micro contro l lers are not as wel l known to the general publ ic , or
to many in the technica l communi ty , as are the more g lamorous
microprocessor. The publ ic i s, however, very wel l aware that
“something” is responsib le for a l l o f the smart VCRs, c lock
radios, washers and dryers, v ideo games, te lephones, microwaves,
TVs, automobi les, toys, vending machines, cop iers, e levators,
i rons, and a myriad o f other ar t ic les that are in tel l igent and
“programmable”. Companies are also aware that being
31
compet i t ive in th is age o f the microchip requires the ir products,
or the machinery they use to make those products, to have some
“smar ts” .
3.5.6. VOLTAGE CONVERTER
This is used to convert TTL logic vol tage in to RS232 vol tage.
TTL Logic: log ic 1= 5v
log ic 0= GND
RS232 : log ic 1= +9v
log ic 0= -9v
IC MAX232 is used as vol tage converter . An external crystal
osci l la tor i s used for i t s operat ion.
3.5.7. PC SERIAL PORT
This port i s used to get data from microcontro l ler to personal
computer in ser ia l manner. Al l IBM PC and compat ib le computers
are typ ical ly equ ipped wi th two ser ia l por ts and one paral le l port .
Al though these two types o f ports are used for communicat ing
wi th external devices, they work in d i f ferent ways.
32
A para l le l por t sends and receives data eight b i ts at a t ime over 8
separate wi res. This al lows data to be t ransfer red very quick ly;
however, the cable requi red is more bulky because of the number
o f ind iv idual wi res i t must conta in. Paral le l por ts are typ ical ly
used to connect a PC to a pr inter and are rarely used for much
else. A ser ia l port sends and receives data one b i t a t a t ime over
one wire. Whi le i t takes e ight t imes as long to t ransfer each byte
o f data th is way, only a few wires are requi red.
In fact , two-way ( fu l l duplex) communicat ions is possib le wi th
only three separate wi res - one to send, one to receive, and a
common signal ground wire.
3.5.8. INTERFACING CIRCUIT
This is used to in ter face the audio signal f rom the computer to
the te lephone l ine
3.6 HARDWARE DESCRIPTION
3.6.1 MICROCONTROLLER
The AT89C2051 is a low-vo l tage, h igh-per formance CMOS 8-bi t
microcomputer wi th 2 Kbytes o f Flash programmable and erasable
read only memory (PEROM). The device is manufactured using
33
Atmel ’s h igh densi ty nonvolat i le memory technology and is
compat ib le wi th the industry standard MCS-51 instruct ion set and
p inout . By combining a versat i le 8-b i t CPU wi th Flash on a
monol i th ic ch ip, the Atmel AT89C2051 is a powerfu l
microcomputer which provides a h ighly f lex ib le and cost
e f fect ive so lu t ion to many embedded contro l appl icat ions.
The AT89C2051 prov ides the fo l lowing standard features: 2
Kbytes o f Flash, 128 bytes o f RAM, 15 I /O l ines, two 16-bi t
t imer/counters, f ive vector two- level in terrupt archi tecture, a fu l l
duplex ser ia l por t , a precis ion analog comparator , on-chip
osci l la tor and c lock c i rcu i t ry .
In addi t ion, the AT89C2051 is designed wi th s tat ic logic for
operat ion down to zero f requency and supports two software
se lectable power saving modes. The Id le Mode stops the CPU
whi le a l lowing the RAM, t imer/counters, ser ia l por t and interrupt
system to cont inue funct ioning. The Power Down Mode saves the
RAM contents but f reezes the osci l lator d isabl ing al l o ther chip
funct ions unt i l the next hardware reset .
3.6.1.1 Pin Conf igura t ion
The microcontro l ler AT89C2051 is avai lable in 20 p in Dual
In l ine Package (DIP).
34
Figure.3.5 Pin d iagram of AT89C2051
3.6.2 DTMF Decoder
The MT8870 is a s ingle chip DTMF receiver in corpora t ing
swi tched capaci tor f i l ter technology and an advanced d ig i ta l
count ing / averaging algor i thm for per iod measurement. The
funct ional b lock d iagram of MT8870 is shown in the below f igure
depic ts the in ternal work ing of this device.
35
Figure.3.8 Funct ional d iagram of IC MT8870
The DTMF signal i s f i rs t buf fered by input op-amp that a l lows
adjustment gain and choice o f input conf igurat ion. The input
stage is fo l lowed by a low pass RC act ive f i l ter , which per forms
ant a l ias ing funct ion. Dia l tone at 350 and 440Hz is then rejected
by a 3r d o rder swi tched capaci tor notch f i l ter . The s ignal is st i l l
in i t s indiv idual components by two 6t h order swi tched capaci tor
band pass f i l ter . Each component smoothed by an output f i l ter
and squared by a hard l imi t ing comparator. The two resul t ing
rectangular waveforms are then appl ied to a d ig i tal c i rcu i t , where
36
a count ing algor i thm measures and averages there per iods. An
accurate reference clock is der ived f rom an inexpensive external
3.58MHz crystal .
The t ime requi red to detect a val id tone pai r tdP is a funct ion o f
decode algor i thm, tone f requency, and the previous state o f the
decoded logic. Est (ear ly , s teer ing output) ind icates that two
tones o f val id f requency have been detected and in it iates an RC
t iming c i rcui t . I f both tones are present fo r a minimum guard
t ime, determined by an external RC network, the DTMF signal i s
decoded and the resul t ing data latched on the output register. The
delayed steer ing output (stD) is ra ised to indicate that new data is
avai lable. (The output corresponding to each key pressed is
shown in the t ru th tab le)
3 .6.2.1Tone detect ion
After receiv ing a DTMF tone the DTMF decoder (MT8870) p laces
the corresponding b inary number on i ts out put (StD) goes h igh to
state that new data is avai lable. The detect ion o f the delayed
steer ing output is to the durat ion o f the received DTMF receiver
has al ready been explained.
37
Figure.3.9 Pin Diagram of IC MT8870
3 .6.2.3 Funct iona l Descr ip t ion
The MT8870D/MT8870D-1 monol i th ic DTMF receiver o f fers
smal l s ize, low power consumpt ion and h igh per formance. I ts
archi tecture consists o f a band spl i t f i l ter sect ion, which
separates the h igh and low group tones, fo l lowed by a d ig i ta l
count ing sect ion which ver i f ies the f requency and durat ion o f
the received tones before passing the corresponding code to
the output bus.
Fi l ter Sect ion
Separat ion o f the low-group and h igh group tones is achieved by
app ly ing the DTMF signal to the inputs o f two s ix th-order
swi tched capaci tor band pass f i l ters, the bandwidths o f which
38
cor respond to the low and h igh group frequencies. The f i l ter
sect ion also incorporates notches at 350 and 440 Hz for
except ional d ia l tone re ject ion (see Figure 3). Each f i l te r output
i s fo l lowed by a s ingle order swi tched capaci tor f il ter sect ion
which smoothes the s ignals pr ior to l imi t ing. L imi ting is
per formed by h igh-gain comparators which are prov ided wi th
hysteresis to prevent detect ion of unwanted low- level s ignals.
The outputs o f the comparators provide fu l l ra i l log ic swings at
the frequencies of the incoming DTMF signals.
Decoder Sect ion
Fol lowing the f i l ter sect ion is a decoder employing d ig i ta l
count ing techniques to determine the Frequencies o f the incoming
tones and to ver i fy that they correspond to standard DTMF
f requencies. A complex averaging algor i thm protects against tone
s imulat ion by ext raneous signals such as voice whi le provid ing
to lerance to smal l f requency deviat ion and var iat ions. This
averaging algor i thm has been developed to ensure an opt imum
combinat ion o f immuni ty to ta lk-o f f and to lerance to the presence
o f in ter fer ing f requencies ( th i rd tones) and noise. When the
detector recognizes the presence o f two va l id tones ( th is is
re ferred to as the “s ignal condi t ion” in some industry
speci f icat ions) the “Ear ly Steer ing”(ESt ) output wil l go to an
act ive state. Any subsequent loss o f signal condi t ion wi l l cause
ESt to assume an inact ive state. The steer ing c ircui t works in
39
reverse to va l idate the inter d ig i t pause between signals. Thus, as
wel l as reject ing s ignals too shor t to be considered val id , the
receiver wi l l to lerate s ignal in ter rupt ions (dropout) too shor t to
be considered a va l id pause. This faci l i ty , together wi th the
capabi l i ty o f select ing the steer ing t ime constants external ly,
a l lows the designer to ta i lor per formance to meet a wide var iety
o f system requi rements.
3.6.2.4 Guard Time Adjustment
In many s i tuat ions not requ ir ing select ion o f tone durat ion and
inter d ig i ta l pause, the s imple steer ing c i rcui t shown in Figure 4
is app l icable. Component values are chosen according to the
formula:
tREC=tDP+tGTP
t ID=tDA+tGTA
The va lue o f tDP is a device parameter and tREC is the
min imum signal durat ion to be recognized by the receiver .
Di f ferent steer ing arrangements may be used to select
independent ly the guard t imes for tone Present ( tGTP) and tone
absent ( tGTA). This may be necessary to meet system
speci f icat ions which p lace both accept and reject limi ts on both
tone durat ion and interd ig i ta l pause. Guard t ime adjustment a lso
al lows the designer to ta i lor system parameters such as ta lk o f f
and noise immuni ty . Increasing tREC improves ta lk-of f
40
per formance s ince i t reduces the probabi l i ty that tones s imulated
by speech wi l l maintain signal condi t ion long enough to be
registered. Al ternat ively , a relat ively short tREC wi th a long tDO
would be appropr iate for ext remely noisy. Environments such as
fast acquisi t ion t ime and immunity to tone drop-outs are requi red.
3.6.2.6 Features
• Complete DTMF Receiver recommended for most appl icat ions,
leav ing R to be se lected by the designer
• Low power consumption
• In ternal gain set t ing ampl i f ier
• Central o f f ice qual i ty
• Power-down mode
• Inhib i t mode
• Backward compat ib le wi th MT8870C/MT8870C-1
3.6.2.7 Appl icat ions
• Paging systems
• Repeater systems/mobi le rad io
• Credi t card systems
• Remote contro l
• Personal computers
41
• Telephone answering machine
3.3 VOLTAGE CONVERTER (MAX232)
Th e MAX220–MAX249 fami ly o f l ine dr ivers/ receivers is
in tended for a l l EIA/TIA-232E and V.28/V.24 communicat ions
in ter faces, part icu lar ly appl icat ions where ±12V is not avai lable.
These par ts are especial ly usefu l in bat tery-powered systems,
s ince the i r low-power shutdown mode reduces power dissipat ion
to less than 5µW.
Feature
• Operate from Single +5V Power Supply
• Low-Power Receive Mode in Shutdown
• Meet Al l EIA/TIA-232E and V.28 Speci f icat ions
• Mult ip le Dr ivers and Receivers
• 3-State Dr iver and Receiver Outputs
42
3.6.3.1 PIN Diagram
F igure 3.10Pin Diagram of MAX232
Since the RS232 is not compat ible wi th today’s mic roprocessors
and microcontro l lers, we need a l ine dr iver (vol tage converter) to
convert the RS232’s s ignals to TTL vol tage levels that wi l l be
acceptable to the 8051’s TxD and RxD pins. One example o f such
a converter i s MAX232 f rom Maxim Corp. The MAX 232 converts
f rom RS232 vol tage levels to TTL vo l tage levels, and v ice versa.
One advantage of the MAX232 chip is that i t uses a+5V power
source which is the same as the source vol tage for the 8051.
43
3 .3.2 Funct iona l Diagram of MAX232
F igure 3.11 Funct ional Diagram of MAX232
The MAX232 has two sets o f l ine dr ivers for t ransfer r ing and
receiv ing data, as shown in Figure 10-7. The l ine dr ivers used for
TxD are cal led T1 and T2 whi le the l ine d r ivers for Rxd are
designated as R1 and R2. In many appl icat ions only one o f each
is used for example, T1 and R1 are used together for TxD and
44
RxD of the 8051 and the second set i s le f t unused. Not ice in
MAX232 that the T1 l ine d r iver has a designat ion o f T1 in and T1
out on p in numbers 11 and 14, respect ive ly . The T1 in p in is the
TTL side and is connected to TxD of the microcontrol le r, whi le
T1 out is the RS232 side that is connected to the RxD pin o f the
RS232 DB connector.
The R1 l ine dr iver has a designat ion o f R1 in and R iout on p in
numbers 13 and 12, respect ively . The R1 in (p in 13) is the RS232
s ide that i s connected to the TxD p in o f the RS232 DB connector,
and R1 out (p in 12) is the TTL s ide that i s connected to the RxD
pin o f the microcontro l ler . See f igure 10-7. Not ice the nul l
modem connect ion where RxD for one is TxD for the other .
MAX232 requi res four capaci tors ranging f rom 1 to 22F. The
most widely used value for these capaci tors is 22nf.
3.3.3 APPLICATIONS
• Portable Computers
• Low-Power Modems
• In ter face Translat ion
• Bat tery-Powered RS-232 Systems
• Mult id rop RS-232 Networks
45
CHAPTER 4
CIRCUIT EXPLANATION
46
4.1 CIRCUIT DIAGRAM
Figure 4.1 Circuit Diagram with landline interface
47
4.2 CIRCUIT OPERATION
• When the telephone is in the idle condition, the voltage will be -48V.
• When the ringing occurs, it will be 125V peak to peak AC signal superimposed on -48V.
• The opto isolator is used to isolate the microcontroller from high voltage AC
signals and it consists of GaAs infrared emitting diode optically coupled to a monolithic silicon phototransistor.
• The microcontroller will detect the ring through the port 1.5 and it will count the number of rings.
• After a fixed number of rings, the microcontroller will send a signal to the relay and then the automatic off-hooking of the telephone takes place. At the same time, microcontroller will transmit ‘Z’ to the computer which is an indication to play the ‘Welcome’ message.
• The relay used is DPDT type and after automatic off-hooking takes place, the relay connects the telephone lines to the decoder IC 8870 and isolation transformer.
• The transformer used is a line transformer used to isolate voice card from high voltages.
• As the telephone lines are connected to the voice card, the caller gets to hear the stored messages and asks the caller to enter the roll number of the student whose result is to be known. After the caller dials the roll number from the touch tone keypad of his telephone, that number will be decoded by the decoder IC 8870 and the decoded information will be sent to the computer via the microcontroller.
48
• Computer on receiving the decoded information will check the database to access the result of the student whose roll number is entered.
• Then the computer will send the desired information to the voice card and the caller will get to hear the result of the student on his telephone through the voice card.
4.2.1 Telephone Ring sensor
This Ci rcui t can be used to connect any te lephone to the
te lephone l ine. When the te lephone handsets are in on-hook
posi t ion, the current through the optocoupler LEDs is inadequate
to act ivate thei r inbui l t t ransistors. However the r ing s ignal
passes to te lephone in paral le l s ince the te lephone l ine is
connected to the te lephone instruments through combinat ion o f
inbui l t LEDs o f optocouplers in paral le l wi th reverse d iodes
whi le the ‘ - ‘marked te lephone l ine is connected to the relay.
In i t ia l ly when the handsets o f a l l the te lephones are on the
cradles, the optocoupler wi l l not conduct adequately and as such
the emit ters o f inbui l t t ransistors o f optocouplers are at low
level . The t ransistor output avai lable at the emit ters are inver ted
to logic 1 state and appl ied to the Microcontro l ler.
In th is c i rcu i t optocoupler i s used to sense the r ing signal . A r ing
vol tage f rom exchange is around 70 to 90vol t (25 HZ AC) come
49
via te lephone l ines. The te lephone l ine is connected to the r ing
sensor (optocoupler IC MCT2E) wi l l detect th is s ignal and the
capaci tor C2 (1µ f/25v) bypasses the 13.5mA to60maA, AC
r inging current so that the optocoupler get turned ON ( the d iode
ant iparal le l wi th the LED) an optocoupler provide condi t ion
dur ing the negat ive hal f cycle o f the r inging current . As the
resul t , t ransistor T1 gets forward b iased and i t conducts, pul l ing
i t ’s co l lector towards ground. This wi l l turn ON the re lay by
provid ing the magnet iz ing current . This wi l l Ceases the DC
vol tage across the phone l ine. The audio signal is extended to the
ON/OFF hook detector (Optocoupler IC). I f the te lephone hand set
i s ON hook cond i t ion means the te lephone L ine consist o f 48v, to
get a c losed loop connect ion wi th the exchange for
communicat ion. Here an optocoupler i s used for ON/OFF hook
detect ion, i t gets th is 48v as input and the photodiode acqui re a
conduct ion vol tage around 12v by the use o f resistor R1. The
conduct ion o f photodiode emi ts l ight towards photo t ransistor and
thereby i t gets the GND, which connect a 10k resistor (R2) across
the Telephone Line. So that the exchange detect a signal f rom the
subscr ibers, that the subscr iber was ready for communicat ion. I f
the te lephone l ine is used for message Tx and Rx means, the hand
set is f i rst p icked up to conform that the incoming signal is Voice
or Message .Af ter that the subscr iber can p lace the hand set wi th
the base set . Once the hand set i s p icked up means the µ c wi l l
sent a acknowledgement signal to the µ c at the designat ion s ide
.so that the hook detector wi l l p rov ide vol tage drop in the Land
50
l ine vol tage, there by a c losed loop c ircui t i s formed between
Subscr ibers and Telephone exchange.
I f i t i s a Voice s ignal means the ON/OFF hook detector funct ion
is same and the Hand set i s used for Voice communicat ion. Once
the hand set i s p laced wi th the base set a fter the voice or message
communicat ion means the Relay connected wi th Ring sensor get
de-energized and Telephone l ine is d isconnected by the µ c.
Optocoupler ( IC MCT2E)
The MCT2E opto isolators consist o f a gal l ium arsenide in f rared
emit t ing d iode dr iv ing a si l icon photot ransistor in a 6-p in dual
in- l ine package.
F igure.4.2.1 Photo transistor Optocouple
Feature
51
• UL recognized (Fi le # E90700)
• VDE recognized (Fi le # 94766)
• MCT2 and MCT2E are also avai lable in whi te package by
speci fy ing -M suff ix , eg. MCT2-M
Schematic d iagram
F igure 4.3 Schemat ic d iagram of optocoupler
Appl icat ion
• Power supp ly regulators
• Dig i ta l log ic inputs
• Microprocessor inputs
52
4.2.2 ON/OFF HOOK SIMULATOR
During r ing s ignal 70 to 90V rms a t 20 -25HZ AC wi ll come
through the te lephone l ine from the Exchange bat tery. The
outgoing signal ing re fers s ignal reaching the exchange from the
subscr ibers te lephone, indicat ing ON-hook, OFF- hook, hang up,
d ia l ing etc. Once the hand set is p icked up means it is in o f f hook
condi t ion and now the vol tage reduces to 47v to 48v and ( i t i s
g iven to input on ON/OFF hook detector optocoupler IC)Cradle
swi tch c loses to form a c losed loop ci rcui t wi th the exchange
bat tery and the te lephone c ircui t . This c i rcu i t i s re ferred as the
local loop c ircui t . Exchange bat tery vol tages are typ ical ly 48
vol ts. The loop cur rent is used by the exchange to establ ish
ON/OFF hook status o f the te lephone. I f the loop cur rent i s
13.5mA to 60mA the exchange detects i t as OFF hook condi t ion
and i f the loop cur rent is less than 7.5mA the exchange interprets
i t as ON hook condi t ion.
The operated l ine vol tage is about 50v DC and the incoming
voice vol tage to the te lephone instrument var ies f rom 0.5v to 1
vol t and the maximum out going voice vol tage is abut 2v rms.The
r ing signal is 70- 90v rms at 20 -25HZ. In pulse d ial ing
te lephones register s ignal ing is known as DC loop signal ing. In
th is case the d ialed number is conveyed to the exchange by
“make” and “break” o f loop c ircui t .
53
When a r ing signal i s present , the microcontro l ler wi l l
swi tch on the RELAY to achieve OFF hook condi t ion.
4.2.2.1 RELAY
The re lay is one o f the most widely used components in industr ia l
e lectronics. In combinat ion wi th t ransistors, SCRs, e lect ron tubes,
and other c i rcu i t e lement , th is electromagnet ic device per forms
count less tasks. This re lays are used as protect ive dev ice for
swi tching, for ind icat ing and for t ransmission.
Transmission relays are used in conjunct ion wi th t ransformers,
inductors, capaci tors in power system and in te lephone and in
other communicat ion systems. Relays are e lect ro magnet ical ly
operated remotely contro l led swi tches wi th one or more sets o f
contacts. When energ ized, the relay operates to open o r c lose i ts
contacts or to open some contacts and close others. Contacts which
are open when the re lay is not energized are cal led normal ly open
(NO) or simply open contacts. Contacts, which are closed when the
relay is not energ ized, are cal led normal ly c losed contacts.
F igure.4.4 Relay
54
Relay contact are held in thei r normal posi t ion e i ther by spr ing or
by some gravi ty act ivated mechanism. An ad justment or adjustments
are usual ly prov ided to set rest rain ing force to cause the re lay to
operate wi th in predetermined ci rcui t condi t ions.
Relays are e lect ro magnet ic components which has an operat ing coi l
and contact . The coi l shal l be energized wi th AC or DC supply.
Accordingly re lays are avai lable wi th AC\DC operat ing coi ls o f
var ious magni tudes say from 6V DC to 220 V DC or for AC vol tages
ranging from 20V AC to 440 AC.
The operat ing pr incip le o f re lays is as fo l lows when the coi l is
energized, an i ron core at tached to th is assembly gets magnet ized.
This then at t racts an armature which has elect r ica l connected to i t .
The elect r ica l terminals should be fabr icated in such away that there
shal l be one common terminal ; one normal ly c losed (NC) contact
and one normal ly open (NO) contacts. When the relay is not
energized the connect ion is c losed between common and NO
contacts th is state is reversed when the relay is energized th is re lay
c i rcu i t shal l be used to swi tch on other power c i rcu i ts, using low
contro l vo l tage. The power c i rcu it and contro l c i rcu i t are pract ical ly
i so lated.
55
4.2.3 Serial Ports in Computer
Al l IBM PC and compat ib le computers are typ ical ly equ ipped
wi th two ser ia l por ts and one paral le l port . Al though these two
types o f por ts are used for communicat ing wi th external devices,
they work in d i f fe rent ways.
A para l le l por t sends and receives data eight b i ts at a t ime over 8
separate wi res. This al lows data to be t ransfer red very quick ly;
however, the cable requi red is more bulky because of the number
o f ind iv idual wi res i t must conta in. Paral le l por ts are typ ical ly
used to connect a PC to a pr inter and are rarely used for much
else. A ser ia l port sends and receives data one b i t a t a t ime over
one wire. Whi le i t takes e ight t imes as long to t ransfer each byte
o f data th is way, only a few wires are requi red. In fact , two-way
( fu l l duplex) communicat ions is possib le wi th only three separate
wi res - one to send, one to receive, and a common signal ground
wire.
RS-232C
RS-232 stands for Recommend Standard number 232 and C is the
latest rev is ion o f the standard. The ser ia l por ts on most
computers use a subset o f the RS-232C standard. The fu l l RS-
232C standard speci f ies a 25-pin "D" connector of which 22 p ins
are used. Most o f these p ins are not needed for normal PC
56
communicat ions, and indeed, most new PCs are equipped wi th
male D type connectors having only 9 p ins.
Pin deta i ls of PC ser ia l port
RICTSRTSDSR
GNDDTRTDRDCD
RS232Connector
67895
4321
9 P in Connector on a DTE device (PC
connect ion)
P in
Number Direct ion of s ignal :
1 Carr ier Detect (CD) ( from DCE) Incoming s ignal f rom
a modem
2 Received Data (RD) Incoming Data from a DCE
3 Transmit ted Data (TD) Outgoing Data to a DCE
4 Data Terminal Ready (DTR) Outgoing handshaking
s ignal
5 Signal Ground Common re ference vol tage
57
6 Data Set Ready (DSR) Incoming handshaking signal
7 Request To Send (RTS) Outgoing f low contro l s ignal
8 Clear To Send (CTS) Incoming f low contro l s ignal
9 Ring Indicator (RI) ( f rom DCE) Incoming s ignal f rom
a modem
Table 4.1 Pins o f RS232
4.3 POWER SUPPLY
58
F igure 4.5 Power Supply Uni t
The power supply sect ion is the important one. I t should del iver
constant output regulated power supply for successfu l work ing o f
the pro ject . A 0-12V/500mA t ransformer is used for our purpose;
the pr imary o f th is t ransformer is connected in to main supply
through on/o f f swi tch& fuse for protect ing f rom overload and
short c i rcu i t p rotect ion. The secondary is connected to the d iodes
convert f rom 12V AC to 12V DC vol tage, which is fu rther
regulated to +5v, by using IC 7805.
4.3.1 Regulator IC (LM 7805)
The LM7805 monol i th ic 3- terminal posi t ive vo l tage regulators
employ in ternal cur rent- l imi t ing, thermal shutdown and safe-area
compensat ion, making them essent ia l ly indestruct ib le. I f adequate
heat s ink ing is provided, they can del iver over 1.0A output
cur rent . They are in tended as f ixed vol tage regulators in a wide
range o f appl icat ions inc luding local (on-card) regulat ion for
e l iminat ion o f noise and d ist r ibut ion problems associated wi th
s ingle-point regulat ion. In addi t ion to use as f ixed vol tage
regulators, these devices can be used wi th external components to
obtain ad justable output vol tages and currents.
Considerab le ef for t was expended to make the ent i re ser ies o f
regulators easy to use and minimize the number o f external
components. I t is not necessary to bypass the output, a l though
59
th is does improve t ransient response. Input bypass ing is needed
only i f the regulator i s located far f rom the f i l ter capaci tor o f the
power supply.
F igure.4.6 Pins of LM780
60
CHAPTER 5
SOFTWARE DESCRIPTION
61
5.1 Visual Basic 6.0
Visual Basic (Visual Beginners Al l purpose symbol ic
Inst ruct ion Code) is the most popular programming language for
world ’s most popular operat ing system. Visual Basic is the f i rst
language people consider when they want rapid appl icat ion
development for the window envi ronment . Visual Basic is
evo lved from the or ig ina l BASIC language, which is widely used
language. Ex ist ing ob jects are dragged & dropped in to the p lace
instead o f wr i t ing numerous codes. Whi le wr i t ing the programs,
we are able to see how the programs run dur ing the run t ime. This
is great advantage over other programming language. VB is based
on an event dr iven method model; i t a lso has a set o f debugging
tools. The pr imary reason behind select ing VB was because the
inter face was so l i t t le compared to o ther tools.
Proper t ies
The propert ies descr ibe the appearance o f the GUI component .
When adding a component , the Name property should be set
immediately , according to the three- let ter mnemonic naming
convent ions. The propert ies are d isplayed in the Propert ies
Window in Name/Value pai rs in alphabet ical order.
Event Procedures
62
An event procedure is a p iece o f code that responds to
events that can occur for that object . Most of the events are
generated by the user, enabl ing them to d ic tate the order o f
execut ion.
5.2. Visual Basic (Seria l Communication)
5.2.1 Int roduct ion
This chapter d iscusses how Visual Basic can be used to access
ser ia l communicat ion funct ions. Windows hides much o f the
complexi ty o f ser ia l communicat ions and automat ically puts any
received characters in a receive buf fer and characters sent in to a
t ransmission buf fe r. The receive bu ffer can be read by the
program whenever i t has t ime and the t ransmi t buffer is empt ied
when i t is f ree to send characters.
5.2.2 Communicat ions contro l
Visual Basic a l lows many addi t ional components to be added to
the too lbox. The Microsoft Comm. component is used to add a
ser ia l communicat ion faci l i ty . In order to use the Comms
component the f i les MSCOMM16.OCX ( for a 16-bi t module) or
MSCOMM32.OCX ( for a 32-bi t module) must be present in the
\WINDOWS\SYSTEM directory. The class name is MSComm. The
63
communicat ions contro l prov ides the fo l lowing two ways for
handl ing communicat ions
Event -dr iven
Event-dr iven communicat ions is the best method o f handl ing
ser ia l communicat ion as i t f rees the computer to do other th ings.
The event can be def ined as the recept ion o f a character , a change
in CD (carr ier detect ) or a change in RTS (request to send). The
OnComm event can be used to capture these events. and also to
detect communicat ions errors.
Pol l ing
CommEvent propert ies can be tested to determine i f an event or
an error has occurred. For example, the program can loop wai t ing
for a character to be received. Once i t i s the character i s read
f rom the receive buf fer. This method is normal ly used when the
program has t ime to pol l the communicat ions receiver or that a
known response is imminent .
Visual Basic uses the standard Windows dr ivers for the ser ia l
communicat ion ports (such as ser ia lu i .d l l and ser ial .vxd) . The
communicat ion contro l i s added to the appl icat ion for each port .
The parameters (such as the b i t rate, par i ty , and so on) can be
changed by select ing Contro l Panel ? System ? Device Manager ?
Ports (COM and LPT) ? Port Set t ings. The sett ings o f the
64
communicat ions port ( the IRQ and the port address) can be
changed by se lect ing Contro l Panel? System? Dev ice Manager?
Ports (COM and LPT)? Resources for IRQ and Addresses.
Proper t ies
The Comm component is added to a form whenever ser ia l
communicat ions are requi red. By defaul t , the f i rs t created object
i s named MSComm1 ( the second is named MSComm2, and so on) .
I t can be seen that the main propert ies o f the object are:
CommPort , DTREnable, EOFEnable, Handshaking, InBufferSize,
Index, InputLen, InputMode, Left , Name, Nul lDiscard,
OutBuf ferSize, Par i tyReplace, RThresho ld, RTSEnable, Set t ings,
SThreshold, Tag and Top.
Set t ings
The Set t ings property sets and returns the RS-232 parameters,
such as baud rate, par i ty , the number o f data b i t , and the number
o f stop b i ts. I ts syntax is :
[ form.] MSComm.Set t ings = setS tr[$]
where the st rStr i s a st r ing which contains the RS-232 set t ings.
This str ing takes the form:
"BBBB,P,D,S"
65
where
BBBBdefines the baud rate,
P the par i ty ,
D the number of data b i ts , and
S the number o f stop b i ts.
The fo l lowing l is ts the va l id baud rates (defaul t is 9600Baud):
110, 300, 600, 1200, 2400, 9600, 14400, 19200, 38400, 56000,
128000, 256000.
The val id par i ty va lues are (defaul t is N) : E (Even), M (Mark) , N
(None), O (Odd), S (Space).
The val id data b it values are (defaul t is 8) : 4, 5, 6, 7 or 8.
The val id stop b it values are (defaul t is 1) . 1, 1.5 or 2.
An example o f set t ing a contro l por t to 4800Baud, even par i ty , 7
data b i ts and 1 stop b i t is: Com1.Set t ings = "4800,E,7,1"
CommPort
The CommPort property sets and returns the communicat ion port
number. I ts syntax is:
[ form.] MSComm.CommPort = portNumber[%]
which defines the portNumber from a value between 1 and 99. A
value o f 68 is returnedi f the por t does not ex ist .
66
PortOpen
The PortOpen property sets and returns the state o f the
communicat ions por t . I ts syntax is :
[ form.] MSComm.PortOpen = [{True | False}]
A True set t ing opens the port , whi le a False c loses the port and
clears the receive andtransmi t buf fers ( th is automat ical ly happens
when an appl icat ion is c losed). The fo l lowing example opens
communicat ions port number 1 (COM1:) at 4800 Baud wi th even
par i ty , 7 data b i ts and 1 stop b i t :
Input t ing data
The three main propert ies used to read data from the receive
buf fer are Input , InBuf fer Count and InBuf ferSize.
Input
The Input property returns and removes a str ing o f characters
f rom the receive buf fer . I ts syntax is:
[ form.] MSComm.Input
To determine the number o f characters in the bu ffer the
InBuf ferCount property is tested ( to be covered in the next
67
sect ion) . Set t ing InputLen to 0 causes the Input property to read
the ent i re contents o f the receive buf fer.
InBuf ferSize
The InBuf ferSize property sets and returns the maximum number
o f characters that can be received in the receive buf fer (by
defaul t i t is 1024 bytes). I ts syntax is :
[ form.] MSCommInBuf ferSi ze = [numBytes%]
The s ize o f the buf fer should be set so that i t can store the
maximum number o f characters that wi l l be received before the
app l icat ion program can read them from the buf fer .
The InBuf fe rCount property re turns the number o f characters in
the receive buf fe r. I t can also be used to c lear the buf fer by
set t ing the number o f characters to 0. I ts syntax is :
[ form. ]MSCommInBuf ferCount= [count%]
68
CHAPTER 6
METHODOLOGY
69
6.1 Micro Control ler
Algor i thm
STEP 1: Star t the program
STEP 2: Check whether r ing s ignal is present or not.
STEP 3: I f r ing signal is present , make te lephone OFF HOOK and
send ‘Z’ s ignal to Personal Computer, e lse go to STEP 2.
STEP 4: Get the DTMF signal through the DTMF decoder.
STEP 5: Send the DTMF data to the pc through the ser ia l por t and
go to STEP 4.
70
6.2 VISUAL BASIC
Algor i thm
STEP 1: Star t the program
STEP 2: Check for the data ‘Z’ .
STEP 3: I f data is present, p lay the welcome message, else go
to step 2.
STEP 4: Play the message to enter the ro l l number.
STEP 5: Check whether Rol l number is entered or not.
STEP 6: I f yes, check the database for that ro l l number and te l l
the rank to user.
71
CHAPTER 7
APPLICATIONS
72
7.1 BANKING & FINANCE Technological innovations have brought about not just new types of electronic money, but also new bank-customer relationships. These relationships are fuelling the demand for more and more innovative banking services such as: • Call Center with Customer Relationship Management Software • Credit Card Activation System • Credit Card Authorization • Forex Enquiry by Speech Recognition • Stock Quote By Speech Recognition • Telephone Banking System • Telephone Loan Approval • Trade & Account Inquiry Service • Voice Recording System
8.2 EDUCATION Apart from providing an environment for learning, educational establishments are now improving their quality of service, offering a better level of support to both students and to the public through: • Enquiry Hotline • Library Book Renewal • Student Registration System • Student Result Declaration System 8.3 GOVERNMENT In order to improve the efficiency of information accessibility, many government departments such as the Labour Department, the Education Department, the Immigration Department, the Inland Revenue and the Department of Health, have already implemented IVRS systems to provide hotline services.
73
8.4 TELECOMMUNICATIONS In this highly competitive industry, we can help telecom service providers (wire line or wireless) to develop infrastructure and add value to their services through: • Prepaid Roaming • Postpaid Calling Card, Prepaid Calling Card, and Wireless Prepaid (or Mobile Prepaid) • Mobile Number Portability • Number Change Announcement • Fax Stored-And-Forward Service • Signaling Protocol Converters • Telecom Call Center
74
CHAPTER 8
Conclusion
&
Future Enhancement
75
7.1 CONCLUSION
The system designed will be intelligent for interaction and will suitably provide a good response to the caller who will access it. It will be truly a responsible system for human mankind. We will make it better than the present scenario system. It will be digitally accessed and will have a strong data base and can be operated easily and of low cost. And the future will show that every organization will be using our system.
7.2 FUTURE ENHANCEMENT
In future, the concept of Interactive Voice Response System can be used in various transport departments like Bus transport, Metro rail, Railways and Airports as the transport companies not only need to be fast and responsive, but also need to provide customers with an easily accessible information system providing: • Information Enquiry • Schedule Enquiry • SISR Information Enquiry • Teleticketing System So, in near future, all the information regarding routes, timings etc. will be known through the Interactive Voice Response System.Also, this concept may be implemented in Cinema halls and Multiplexes where the caller will get to know the timings of his favourite movies as well as he can book his tickets through this system.
76
APPENDIX 1
Source Code
77
Microcontroller Code
org 0000h
sjmp power_on
org 0003h
LJMP ISR
org 000bh
LJMP COUNTER
org 0013h
reti
org 001bh
reti
org 0023h
LJMP SERIAL
reti
power_on:
mov ie,#00h
mov ip,#00h
mov p0,#0FFH
MOV P1,#0FFH
MOV P2,#11111011B
MOV P3,#0FFH
78
RAM:
MOV R0,#07FH
CLR:
MOV @R0,#00H
DJNZ R0,CLR
INITIALIZE:
MOV IE,#10010011B
MOV IP,#00010000
MOV TMOD,#26H
MOV TH1,#0FDH ;SET BAUD RATE 9600 B/S
MOV SCON,#50H ;SETS SERIAL MODE 1,8-BIT DATA,1 STOP,1 START BIT
SETB TR1
SETB TCON.0
MAIN:
MOV TH0,#100
MOV TL0,#100
SETB TR0
M: SJMP M
DELAY:
MOV 30H,#3
79
RAJ2:
MOV 31H,#23
RAJ1:
MOV 32H,#234
RAJ:
DJNZ 32H,RAJ
DJNZ 31H,RAJ1
DJNZ 30H,RAJ2
RET
ISR:
MOV A,P1
SUBB A,#192 ;WHEN WE RESET DTMF IC ,THEN ALSO IT COMES TO ISR BCOZ IT GETS
AN INTERRUPT
MOV SBUF,A ;SBUF=0000(P0.3-P0.0)
RETI
COUNTER:
SETB P2.2 ;OFF-HOOKS RELAY
CLR P2.0 ;SWITCH ON THE EXTRA LED CONNECTED IN SINK
MOV SBUF,#'Z'
RETI
80
SERIAL: JB RI,TRANS
CLR TI
RETI
TRANS: CLR P2.2
SETB P2.0
CLR RI
RETI
Visual Basic Code
Option Explicit
' Plays the sound specified by
' lpszPlaySound. This function is
' limited to .wav files.
Private Declare Function sndPlaySound _
Lib "winmm.dll" _
Alias "sndPlaySoundA" ( _
ByVal lpszSoundName As String, _
ByVal uFlags As Long) _
As Long
Private Const SND_NOWAIT As Long = &H2000 ' Don't wait if the driver is busy
81
Private Const SND_SYNC As Long = &H0 ' Play synchronously (default)
Private Const SND_FLAGS As Long = SND_SYNC Or SND_NOWAIT ' Combination of two constants
above
Private Sub Form_Load()
' Fire Rx Event Every single Bytes
MSComm1.RThreshold = 1
' When Inputting Data, Input 1 Byte at a time
MSComm1.InputLen = 1
' 9600 Baud, No Parity, 8 Data Bits, 1 Stop Bit
MSComm1.Settings = "9600,N,8,1"
' Disable DTR
MSComm1.DTREnable = False
' Open COM1
MSComm1.CommPort = 1
MSComm1.PortOpen = True
End Sub
Private Sub MSComm1_OnComm()
82
Dim Data As String, X As Integer, i As Integer
Static z As Integer
Static y As Integer
Adodc1.Recordset.MoveFirst
X = Adodc1.Recordset.Fields("ASCII").Value
' If comEvReceive Event then get data and display
If MSComm1.CommEvent = comEvReceive Then
Data = MSComm1.Input 'get data
If z = 1 Then
GoTo elec
z = 0
ElseIf y = 1 Then
GoTo civ
y = 0
End If
If Data = "Z" Then
' Call sndPlaySound to play our file
Call sndPlaySound("D:\ivrs" & "\bugsbunny1.wav", SND_FLAGS)
83
ElseIf Data = "1" Then
z = 1
Call sndPlaySound("D:\ivrs" & "\bugsbunny1.wav", SND_FLAGS)
Print "1 detected"
ElseIf Data = "2" Then
Adodc1.RecordSource = "CIVIL"
Adodc1.Refresh
Print "2 detected"
y = 1
End If
GoTo out
elec:
Print "entered elec"
Do
' For i = 1 To 10
If X = Asc(Data) Then
Select Case X
Case 49
Call sndPlaySound("D:\ivrs" & "\daffyduck1.wav", SND_FLAGS)
Print X
Case 50
Call sndPlaySound("D:\ivrs" & "\familyguy1.wav", SND_FLAGS)
84
Print X
Case 51
Call sndPlaySound("D:\ivrs" & "\daffyduck2.wav", SND_FLAGS)
Print X
Case 52
Call sndPlaySound("D:\ivrs" & "\austinpowers.wav", SND_FLAGS)
Print X
Case 53
Call sndPlaySound("D:\ivrs" & "\goodmorningvietnam.wav", SND_FLAGS)
Print X
Case 54
Call sndPlaySound("D:\ivrs" & "\jamesbond.wav", SND_FLAGS)
Print X
Case 55
Call sndPlaySound("D:\ivrs" & "\robocop(2).wav", SND_FLAGS)
Print X
Case 56
Call sndPlaySound("D:\ivrs" & "\robocop.wav", SND_FLAGS)
Print X
Case 57
Call sndPlaySound("D:\ivrs" & "\starwars.wav", SND_FLAGS)
Print X
End Select
Exit Do
85
Else
Adodc1.Recordset.MoveNext
X = Adodc1.Recordset.Fields("ASCII").Value
'Print x
End If
'Next i
Loop Until Adodc1.Recordset.EOF = True
z = 0
Adodc1.Recordset.MoveFirst
GoTo out
civ:
Print "entered civil"
Do
' For i = 1 To 10
If X = Asc(Data) Then
Select Case X
Case 49
Call sndPlaySound("D:\ivrs" & "\daffyduck1.wav", SND_FLAGS)
Print X
Case 50
Call sndPlaySound("D:\ivrs" & "\familyguy1.wav", SND_FLAGS)
86
Print X
Case 51
Call sndPlaySound("D:\ivrs" & "\daffyduck2.wav", SND_FLAGS)
Print X
Case 52
Call sndPlaySound("D:\ivrs" & "\austinpowers.wav", SND_FLAGS)
Print X
Case 53
Call sndPlaySound("D:\ivrs" & "\goodmorningvietnam.wav", SND_FLAGS)
Print X
Case 54
Call sndPlaySound("D:\ivrs" & "\jamesbond.wav", SND_FLAGS)
Print X
Case 55
Call sndPlaySound("D:\ivrs" & "\robocop(2).wav", SND_FLAGS)
Print X
Case 56
Call sndPlaySound("D:\ivrs" & "\robocop.wav", SND_FLAGS)
Print X
Case 57
Call sndPlaySound("D:\ivrs" & "\starwars.wav", SND_FLAGS)
Print X
End Select
Exit Do
87
Else
Adodc1.Recordset.MoveNext
X = Adodc1.Recordset.Fields("ASCII").Value
'Print x
End If
'Next i
Loop Until Adodc1.Recordset.EOF = True
y = 0
Adodc1.Recordset.MoveFirst
GoTo out
End If
out: Print "out"
End Sub
Private Sub Form_Unload(Cancel As Integer)
MSComm1.PortOpen = False 'Close the COMM port
End Sub
Private Sub cmdfirst_Click()
Adodc1.Recordset.MoveFirst
88
End Sub
Private Sub cmdlast_Click()
Adodc1.Recordset.MoveLast
End Sub
Private Sub cmdnext_Click()
Adodc1.Recordset.MoveNext
End Sub
Private Sub cmdprevious_Click()
Adodc1.Recordset.MovePrevious
End Sub
'ElseIf Data = "1" Then
'Call sndPlaySound("F:" & "\911.wav", SND_FLAGS)
'ElseIf Data = "2" Then
'Call sndPlaySound("F:" & "\ghostbustersray.wav", SND_FLAGS)
89
REFERENCES
Websites: 1. http://en.wikipedia.org/wiki/Interactive_voice_response 2. http://web.cmc.net.in/products/ivrs/ivrs.asp 3. http://www.blissit.org/ivrs.htm 4. http://www.kleward.com/ivr_solutions.htm 5.http://en.wikipedia.org/wiki/Special:Search?search=information+on+IVR+system 6. http://www.sciencedirect.com/science?_ob=ArticleURL&_udi=B6VRG- 4C0RRMJ-4&_user=7427940&_coverDate=08%2F05%2F2004&_alid=810799566&_rdoc= 6&_fmt=high&_orig=search&_cdi=6234&_docanchor=&view=c&_ct=7&_acct= C000050221&_version=1&_urlVersion=0&_userid=7427940&md5=58db2884bc bc7ed43d9119ed01eefe1a Books: 1. Thiagarajan Vishwanathan/Telecommunication Switching System & Networks/India PRI Pvt.ltd/Second Edition 2. Kenneth J.Ayala/The 8051 Microcontroller Architecture ,Programming and Applications/India/PRI Pvt.ltd/Second Edition 3. Douglas V.Hall/Microcontroller and Interfacing/New York/TMH Publishing Company Pvt Ltd/Second Edition