Upload
others
View
3
Download
0
Embed Size (px)
Citation preview
AUTOMATIC DOOR LOCK WITH SPEECH
RECOGNITION
A final project report
presented to
the Faculty of Engineering
By
Stevanus Kurniadi
002200900009
in partial fulfillment
of the requirements of the degree
bachelor of Science in Electrical Engineering
President University
April 2013
ii
DECLARATION OF ORIGINALITY
I declare that this final project report, entitled “ Automatic Door Lock with Speech
Recognition “ is my own original piece of work and, to the best of my knowledge and
belief, has not been submitted, either in whole or in part, to another university to obtain a
degree. All sources that are quoted or referred to are truly declared.
Cikarang, Indonesia, March 2013
Stevanus Kurniadi
iii
APPROVAL PAGE
AUTOMATIC DOOR LOCK WITH SPEECH
RECOGNITION
By
Stevanus Kurniadi
002200900009
Approved by
Dr.-ing Erwin Sitompul, M.Sc,
Final Project Supervisor
Dr.-ing Erwin Sitompul, M.Sc,
Head of Study Program
Electrical Engineering
Dr.-ing Erwin Sitompul, M.Sc,
Acting Dean of Faculty of Engineering
iv
“God doesn't require us to succeed, He only requires that you try.”
( Mother Teresa )
v
ACKNOWLEDGMENT
Firstly, I would like to deliver my greatest gratitude to my God Almighty, Jesus
Christ for His love, grace, and blessing so that I could be in the final journey of my
undergraduate program at President University which is the thesis preparation.
This thesis is dedicated to all people who have given me a lot of support and
motivation, especially for my beloved parents, Mr. Sutrasman and Mrs. Njoen Tjoei Jahja
who always give me strength when I need it. For my only brother, Theodorus Kurniadi
who always supports me and reminds me to do my job in the first place as the student.
They taught me to achieve the best result in every part of my life, without them I cannot
stand still.
I would also thank my final project advisor, Dr.-ing Erwin Sitompul, M.Sc who
also acting as a Dean of Faculty Engineering for the precious supervision, advice, and
guidance. My deep appreciation too for all electrical enginnering lecturers for the best
guidance that they gave me since I enter President University. By their support, I am able
to get huge amount of knowledge in Electrical Engineering through many process of
studying.
I wish to deliver to many people that have give me a lot of love and leading
experience in the President University, for PUSU 2009- 2010, PUSC 2010-2011, my
beloved COOL family ( especially Ko Timothy Nathaniel Halim and Joshua Liberty ), my
cell community, SAFETY ( Yemima, Elliot, Fendy, Rifka, Carla, Joseph, Zefa, Amos,
Febe, Mayang ), for SafetyBelt and Coolkas juniors who alway support me, for PUVC who
always encourage me ( Vincent, Felu, Shentya, Suri, and Lycke ), and the last is for all
people that always motivated me and encouraged me, whose name could not mentioned
one by one in this final project, for their valuable assistance to me.
February 25,2013
Stevanus Kurniadi
vi
ABSTRACT
In this globalization era, many people get used to live in hectic situation. When they get up
in the morning, people usually rush to their office or to the place where they do their
activity. People tend to forget to lock the door.Even when one remember to lock the door,
he or she may forget where the key is.As we know, the globalization era is in line with the
rapid technology development. This phenomenon results in the behavior of people that
they tend to find the instant way in fulfilling their needs. This instant way is meant to make
people’s live easier. Nowadays, Speech Recognition technology is utilized to improve the
security. From these points of view, the idea to design and to implement an “Automatic
Door Lock with Speech Recognition“ came up.This final project concentrates in designing
the hardware and the software that will work as an integrated system of automatic door
lock, equipped with a speech recognition device. Through this function, the user will be
able to record his or her voice in the form of short words. After the recording, the door will
be lock and in order to open it, the user must say the same word as whatalready recorded
before. The combination of automatic door lock and speech recognition are meant to work
together.
Keywords: Voice Recognition (VR), door lock, recording.
vii
TABLE OF CONTENTS
DECLARATION OF ORIGINALITY .......................................................................... ii
APPROVAL PAGE ...................................................................................................... iii
ACKNOWLEDGMENT ................................................................................................ v
ABSTRACT .................................................................................................................. vi
TABLE OF CONTENTS ............................................................................................. vii
LIST OF FIGURES ....................................................................................................... ix
LIST OF TABLES ........................................................................................................ xi
CHAPTER 1 INTRODUCTION ................................................................................... 1
1.1 Final Project Background .................................................................................... 1
1.2 Problem Statement .............................................................................................. 2
1.3 Final Project Objectives ...................................................................................... 2
1.4 Final Project Scopes and Limitations .................................................................. 3
1.5 Final Project Outline ........................................................................................... 4
CHAPTER 2 DESIGN SPECIFICATION .................................................................... 6
2.1 Introductory Remarks .......................................................................................... 6
2.2 Main Components ............................................................................................... 6
2.2.1 Arduino Mega 2560 ......................................................................................... 6
2.2.2 Light Emitting Diode ..................................................................................... 10
2.2.3 EasyVR (Easy Voice Recognition) ............................................................... 12
2.2.4 Grove Relay ................................................................................................... 19
2.2.5 Solenoid Door Lock ...................................................................................... 20
2.2.6 AC/DC Adaptor ............................................................................................. 22
2.3 Supporting Components .................................................................................... 23
2.3.1 Voltage Regulator .......................................................................................... 23
2.4 Software of the Circuit ...................................................................................... 25
CHAPTER 3 DESIGN IMPLEMENTATION ............................................................ 28
3.1 System Design ................................................................................................... 28
3.2 Basic Concept .................................................................................................... 32
3.3 Programming Implementation........................................................................... 33
viii
3.3.1 EasyVR Commander ..................................................................................... 33
3.3.2 Arduino Programming Implementation ........................................................ 39
3.3.3 Main Programming Code Explanation .......................................................... 44
CHAPTER 4 RESULT AND DISCUSSION .............................................................. 48
4.1 Results ............................................................................................................... 48
4.2 Discussions ........................................................................................................ 54
4.2.1 Door Lock ...................................................................................................... 54
4.2.2 Speech Recognition ....................................................................................... 56
4.3 Strengths and Weaknesses ................................................................................ 59
CHAPTER 5 CONCLUSION AND RECOMMENDATION ..................................... 60
5.1 Conclusions ....................................................................................................... 60
5.2 Recommendation ............................................................................................... 61
REFERENCES ............................................................................................................. 63
APPENDIX .................................................................................................................. 65
ix
LIST OF FIGURES
Figure 2.1Arduino Mega 2560 ............................................................................................ 6
Figure 2.2 Pin Configuration Arduino Mega 2560 ............................................................. 7
Figure 2.3 Light Emitting Diode ( LED ) ........................................................................... 9
Figure 2.4 Anode and Cathode of LED .............................................................................. 10
Figure 2.5 Configuration of LED ...................................................................................... 11
Figure 2.6 Easy Voice Recognition Toolkit ...................................................................... 12
Figure 2.7 EasyVR Motherboard....................................................................................... 13
Figure 2.8 EasyVR in Bridge Mode with the Arduino ...................................................... 15
Figure 2.9 EasyVR in Adapter Mode with the Arduino .................................................... 16
Figure 2.10 Schematic of Voice Recognition ..................................................................... 17
Figure 2.11 Mechanism Signal in Speech Recognition ...................................................... 17
Figure 2.12 Discrete Signal Accepted by the Voice Recognition Module ......................... 18
Figure 2.13 Various Phonemes of Basic Sounds ................................................................ 18
Figure 2.14 Grove-Relay Module ........................................................................................ 19
Figure 2.15Grove-Relay Module Schematic ....................................................................... 19
Figure 2.16 Solenoid Door Lock ......................................................................................... 21
Figure 2.17Adaptor AC DC ................................................................................................ 23
Figure 2.18Voltage Regulator 7812 IC and Voltage Regulator 7808 IC ............................ 24
Figure 2.197812 IC Circuit .................................................................................................. 25
Figure 2.20Preview of EasyVR Commander ...................................................................... 26
Figure 2.21Preview of Arduino Software............................................................................ 27
Figure 2.22USB Printer Cable ............................................................................................. 27
Figure 3.1 Block Diagram ................................................................................................. 28
Figure 3.2 Device Design .................................................................................................. 30
Figure 3.3 Main Application Window of EasyVR Commander ....................................... 34
Figure 3.4 Connect Mode in EasyVR Commander ........................................................... 35
Figure 3.5 Connected from the EasyVR Commander to the EasyVR............................... 35
Figure 3.6 Warning and Error Command in EasyVR Commander ................................... 36
Figure 3.7 Add Command in EasyVR Commander .......................................................... 37
Figure 3.8 Add New Word to the Group in EasyVR Commander .................................... 38
x
Figure 3.9 Train command for the New Word to do Speech Recognition ........................ 38
Figure 3.10 Generate Code Icon in EasyVR Commander .................................................. 39
Figure 3.11 Flow Chart of Mechanism Device ................................................................... 47
Figure 4.1 Automatic Door Lock with Speech Recognition ............................................. 48
Figure 4.2The Miniature of the Door .................................................................................. 49
Figure 4.3 The Circuit of the Automatic Door Lock ......................................................... 49
Figure 4.4 The Device’s Power Supply Plug In ................................................................ 50
Figure 4.5 The First Password Said Correctly ................................................................... 51
Figure 4.6 The Second Password Said Correctly .............................................................. 52
Figure 4.7 The Solenoid Door Lock in Lock Condition and in Unlock Condition ........... 52
Figure 4.8 The Door Lock Open the Miniature Door........................................................ 53
Figure 4.9 Heat Sink and the Use of the Heat Sink to the Voltage Regulator .................. 54
Figure 4.10 Roll of Thermally Conductive Tape ................................................................ 55
Figure 4.11 The Upper Part of 7812 IC ............................................................................... 55
Figure 4.12 Flush Mounting in Built-In Microphone .......................................................... 57
Figure 4.13 No Obstruction, Large Hole in Built-In Microphone ..................................... 58
Figure 4.14 Insulation Issue in Built-In Microphone ......................................................... 58
Figure 5.1 External Speaker 8Ω ....................................................................................... 61
Figure 5.2 4x4 Keypad ..................................................................................................... 62
xi
LIST OF TABLES
Table 2.1 EasyVR Pin Assignment .................................................................................... 14
Table 2.2 Solenoid Door Lock Specification ...................................................................... 22
Table 4.1 Examples of Problematic Recognition Sets Correction ...................................... 56
1
CHAPTER 1
INTRODUCTION
1.1 Final Project Background
A door is the important element in the house, since people will come in and come out the
house by going through the door only. The access to pass a certain door is furthermore
limited by using a door lock with a key suited to the lock. People with busy activities
sometimes forget about the key, or even theyforget to lock the door.The vital one is when
they already lock the door but forget where they have put the key. Without paying more
concern to the key of the door, people can lost their key and lose the access to go through
the door.
Security plays an important role in human life. A more complex security system can give
the user more sense of security. As an example, let us take a dormitory area, where many
students live together in one student house. The habit of some students is not to keep a key
for their own. They just put the key in a secret place where all who have the right can get
the key when they want to come inside the building. Some examples of secret place are
inside of a shoe or under the chair outside the building. Unrightful person can easily get
access to the key. If the person ants to do robbery, it can not be done easily.
As we know, the globalization era is in line with the rapid technology development. This
phenomenon results in the behavior of people that they tend to find the instant way in
fulfilling their needs. This instant way is meant to make people’s live easier. Many people
are already familiar to high technology implementation in their daily life. Implementing
high security level in simple way is the one that people need in this technology era.
Speech recognition is one of the simplest ways to operate and perform something. People
just need to speak so the task or the job will be done. People would rather perform their
regular task of locking and unlocking the doorwith Speech Recognition technology instead
of using normal key, for example. Another example, people would probably want to
activate the television without pressing the remote controller. They just need to say a word
then the television will be switch on by itself. From these points of view, the idea to
2
design and to implement an “Automatic Door Lock with Speech Recognition“ came up.In
other words, security measure and advance technology will be combined into one device
thatwill provide high security but easy in use.
1.2 Problem Statement
This final project concentrates in designing the hardware and the software that will work as
an integrated system of automatic door lock, equipped with a speech recognition section.
This door lock can be locked or can be unlocked by itself,driven by the output of other part
of the circuit.
One part of circuit functions as the speech recognition. Through this function, the user will
be able to record his or her voice in the form of one or words for a few seconds. After
recording, the user can start to order the circuit to recognize his or her voice.By speaking
out the same words in the same intonation, the user will be able to open the door lock
easily.Through this, the security of the door lock will be increased.
Both automatic door lock and speech recognition functions are combined to work together.
So, the input in the form of voice will come to the circuit of the speech recognition first.
After receiving the voice, the circuit of the speech recognition will process the voice and
send an output to the circuit of the automatic door lock. The microcomputer, as part of the
circuit of the automatic door lock will decide whether the lock should be opened or not.
1.3 Final Project Objectives
The objective of this final project is to invent a devicethat can improve the security of the
door which is the only way that people must pass if they want to go inside a building. The
automatic door lock designed in this final project features speech recognition as the the
innovation of the security system. With a simple speech command or complex speech
command, the automatic door lock will be able to lock or to unlock the door. The user does
not need to hold the key of the door anymore. The door now can be locked or unlocked by
speaking out a previously recorded simple speech command or complex speech command
to the device.By constructing this device, the author expects to achieve the following
objectives :
3
1. To design an automatic door lock and implement the speech recognition to make
the device more simple to control. This technology will be very useful in the future
since the need of device for high security with easy operation is increasing. By
using this device, the user has the choice whetherthe user wants the password to be
simple or to be complex.
2. To additionally implement the Arduino Mega 2560 in interface with the EasyVR
(Easy Voice Recognition), in order to maximize the use of the the EasyVR in
recognizing, detecting, and giving the signal. Both these components will function
as the main and the supporting part that play a big role in the whole circuit.
1.4 Final Project Scopes and Limitations
Because of the limitation of time and resources in the final project preparation, there will
be exact scope and limitations in doing this final project to make the device can work
effectively and perfectly. The final project will be conducted under the following scopes:
This final project will discuss on how to make an Automatic Door Lock with
Speech Recognition by using several electronic components such as Arduino Mega
2560, speech recognition circuit (Easy Voice Recognition), relay, LED, resistor,
voltage regulator, solenoid door lock.
A voltage regulator is utilized in the circuit to guarantee the appropriate voltage
source for the Arduino Mega 2560 and the solenoid door. The regulator used by the
author is 7812 IC which steadily supplies the solenoid door with 12 V, and 7808 IC
which steadily supplies 8V to the Arduino Mega 2560. The latter will also provide
5V as Vcc (digital supply voltage).
The C programming language is used because its ease of use as a high level
language. In addition, it provides low-level access to memory.
The EasyVR Commander is used to record new word and the program that are
demanded by the user. This commander will give the code that can be opened in
Arduino software.
The Arduino software is used to program the input and the output, based on the
generated code given by EasyVR Commander. In this software, the user can set the
output and all the actions by using the template that is already given by the Easy
VR Commander.
4
In conducting this project, there are several limitations to be considered :
The final project uses the speech recognition to detect and filter the speech from the
user with its own mechanism and scope range. Therefore, this device will do its job
effectively with some specifications and requirements. The sensitivity of the device
will depend on the condition of operation area.
The signal that comes from the EasyVR and will go through Arduino Mega 2560 is
only available in second unit. So, there will be a delay in actions between input and
output.
1.5 Final Project Outline
The final project reports consists of five chapters and is oulined as follows :
Chapter 1 : Introduction. This chapter consists of problem background, Final Project
Statement, Final Project Objective, Final Project Scope, Final Project Limitation, and Final
Project Outline.
Chapter 2 : Design Specification. This chapter gives the information about the list of
the hardware (main components and supporting components) and the software used in this
project along with their functions. This chapter also discusses how the circuit system works
and how the interfacing among the hardware components is done. In this chapter, the
author will explain about the theory that is used in this final project.
Chapter 3 : Design Implementation. This chapter will deliver the implementation of
the design presented in the previous chapter. It covers the implementation for software and
hardware. This chapter also explains the circuitry design steps when using the design
software and the programming.
Chapter 4 : Project Result, Analysis, and Discussion. This chapter show the
important results of the project. This chapter also presents the project circuit in details
based on the interface between hardware and software and the detail about the hardware
and software. This chapter also covers the analysis of the results of the projectand the
discussion about the final project. It also explains the strengths and the weaknesses of the
circuit.
5
Chapter 5 : Conclusions and Recommendations. This chapter concludes the whole
content of the final project report. The recommendations are presented for some
improvements or developments of the current project.
6
CHAPTER 2
DESIGN SPECIFICATION
2.1 Introductory Remarks
This chapter will explain all the theory of the main components and the supporting
components that the author used in finishing this device. There will be application which is
directed directly to the whole device, the role of the components in the device and its
function. The author separates this into 2 main parts, which are main components and the
supporting components.
2.2 Main Components
2.2.1 Arduino Mega 2560
Figure 2.1Arduino Mega 2560
The Arduino Mega 2560, as shown in Figure 2.1, is a microcontroller board based on the
ATmega 2560. It has 54 digital input / output pins, which 14 of them can be used as PWM
outputs), more it has 16 analog inputs, 4UARTs or hardware serial ports, an oscillator
which is a 16 MHz crystal oscillator, a USB connection, a power jack, an ICSP header, and
the last one is the reset button. Arduino Mega 2560 contains everything needed to support
the microcontroller itself, the user just simply connect it to a computer with USB cable or
7
power it with a AC-to-DC adapter or battery to get started. This device is compatible with
most shields designed for the Arduino Duemilanove or Diecimila[1].
Arduino Mega 2560 does not need any voltage regulator and capacitor to be added on the
circuit with the Arduino, because all of the components that is needed to make the voltage
stable is already fix in the Arduino, the one that the user need to do is to connect it to the
power source with a power jack or USB connection.
The Mega 2560 is different from all preceeding boards in that it does not use the FTDI
USB-to-serial driver chip. After doing the revision, the Mega 2560 has new features which
make this device oftenly used in many projects. Here are the new features that are given by
the Mega 2560 :
1.0 pinout : added SDA and SCL pins that located nearly to the AREF pin
and two other new pins placed near to the RESET pin.
The IOREF exist that allow the shields to adapt to the voltage provided
from the board.
Stronger RESET circuit.
Figure 2.2Pin Configuration Arduino Mega 2560
8
The Arduino Mega 2560 has many pin configurations, these pin configurationscan be
divided in to many parts of characters. There are analog, digital, communication, and pulse
width modulator (PWM). For power part, it is very clear that Vcc can be controlled to 3,3V
or 5V. There is also a ground and reset. Here are the description of the pin configurations
based on Figure 2.2:
a. Pin Power:
Reset: Reset input to reset the program inside the Arduino Mega 2560,
connected to the ground by cable it can reset each second. In the Arduino
Mega 2560, it already give the easier way to reset the program inside the
Arduino Mega 2560 by just press the reset button.
3.3V & 5V: The output voltage that can be out from the Arduino Mega
2560, by connecting the cable through each one of the choices of voltage it
will give the output of 3.3V or 5V.
Ground: Common ground of the circuit ( Supply Negative Voltage ).
Vin: The input voltage that can become the source of the Arduino Mega
2560 if the user want to supply the voltage manually using the cable, the
range of the voltage is 7V – 12V.
b. Pin Analog In (PA0..PA15): Pin Analog In from A0 up to A15 are the analog
input pins which has DC current 40 mA per pin. Each of which also provide 10 bits
of resolution.
c. Pin Digital (P22..P53): Pin Digital from P22 up to P53 functioning as the digital
pins. Pin digital only gives the output of 0 or 1, differs from the analog which can
give vary output and input.
d. Pin Communication: Pin Communication is the most important pins in the
Arduino Mega 2560, this pin displayed in the device from TX0 up to TX3, RX0 up
to RX3, SDA, and SCL. Used to received (RX) and transmit (TX) TTL serial data,
it is a must that the connection of RX and TX to the circuit to be right, else the
circuit will not working properly. SDA and SCL are the supporting TWO
9
communication using the Wire library. Note that these pins are not in the same
location as the TWI pins on others Arduino version.
e. Pin PWM:These pins start from 2 up to 13, there will be 12 pins of PWM provide
8-bit PWM output with the analogWrite() function.
f. AREF:AREF is a voltage reference pin for the analog inputs. Used with
analogReference().
There are some pins that have specialization functions that has important role for some
circuit’s component :
a. External Interrupts: Pin 2 ( Interrupt 0 ), Pin 3 ( Interrupt 1 ), Pin 18 ( Interrupt 5,
Pin 19 ( Interrupt 4 ), Pin 20 ( interrupt 3 ), and Pin 21 ( Interrupt 2 ). These pins
can be configured to trigger an interrupt on a low value, a rising or falling edge, or
a change in value.
b. SPI: Pin 50 ( MISO ), Pin 51 ( MOSI ), Pin 52 ( SCK ), Pin 53 ( SS ). These pins
supporting the SPI communication using the SPI library. The SPI pins are also
broken out on the ICSP header.
c. LED: Pin 13. There is a built-in LED connected to digital pin 13. When the value
of the pin is HIGH then the LED is on and when the value of the pin is LOW, the
LED is off.
The Arduino Mega 2560 is created to be programmed with the Arduino software that will
be explained in the software section in this chapter.Arduino Mega 2560 communicates
using the original STK500 protocol ( C header files )[1].
10
2.2.2 Light Emitting Diode
Figure 2.3 Light Emitting Diode ( LED )
Light Emitting Diode (LED), which can be seen in Figure 2.3, is an indicator lamp in the
electronic devices that will emit the monochromatic light which is not coheren when the
voltage come in the LED[2].
LED will become the indicator in many devices to see whether there is a voltage across the
wire or not. LED configurations can be seen in Figure 2.4. It show how to connect the LED
in the circuit based on its polarity. Oftenly the LED will be paired with a resistor which has
330Ω, so the current that flows in to the LED will not burn the circuit inside the LED. The
matter is when the user wrongly connects the Vcc to the short lead (negative) and the
ground to the long lead (positive), the LED will not turn on. The author faced the difficulty
in correcting the circuit by testing all the components, but it came out that the problem is
the simplest one which is the wrong connection between the Vcc and ground to both long
and short lead.
Figure 2.4 Anode and Cathode of LED
11
LED is made of plastic and semiconductor diode that can emit lights when it gets the low
supply voltage (1.5 V). There are various color for LED, depending on the semiconductor
material that is used to make it. LEDs present many advantages over 20 incandescent light
sources. They includes lower energy consumption, longer lifetime, improved robustness,
smaller size, faster switching, and greater durability and reliability. LED can do
polarization. LED just allows the current to flow to one direction. That is why when the
author wrongly connects the positive side to the negative side, the LED does not emit the
light. The configuration of the LED can be seen in Figure 2.5.
There are several advantages in using LED as one of the main components of this project :
1. Energy Efficient.LED’s are now capable of outputting 135 lumens/watt[3]. In
conventional incandescent bulbs, the production of light will involve a process of
generating a lot of heat loss and it will consume much energy while the LEDs only
generate little heat loss.
2. Long Lifetime. By using the LED, people will get a long lifetime. The LEDs can
have lifetimes of 50,000 hours or more.
Figure 2.5 Configuration of LED
At this project, the author uses 2 types of LED which are :
a. Red LED. The red light emitting diode indicates that the power supply connect
close circuited, so the solenoid door can get enough voltage supply to operate. This
12
LED will emit light to show that 12V already in through the power supply to the
circuit the author made. The second red LED, is used for showing the user that the
password that inputed through the EasyVR is correct or not, if the first password is
correct, this LED will emit light and will off either the second password is correct
or not.
b. Green LED. The green light emitting diode indicates that the 12V already become
8V. The 8V is needed for the Arduino Mega 2560 to be operated. It will sign that
the current already flows in to the Arduino Mega 2560 device. It is an important
indicator, so the user can check easily if the device is not working properly, by
checking the voltage. The second green LED is used to show the user whether the
second password that inputed by the user through the EasyVR is correct or not.
When the second password is correct the green LED will emit light and will off
when the third password inputed whether the third password correct or not.
c. Super Bright LED. The super bright light emitting diode indicates that the
EasyVR is in the listening mode. If this LED emit light, that means people can
input their voice, but when this LED does not emit light, that means the EasyVR is
operating and not in the listening mode, so people can not input any voice. This
LED play the most important role of the device, because the input can be inputed or
not is depend on the signal to show the status of the EasyVR.
2.2.3 EasyVR (Easy Voice Recognition)
EasyVR is the second generation version of the successful VRbot Module. It is a multi-
purpose speech recognition module designed to easily add versatile, robust and cost
effective speech recognition capabilities to virtually any application. This device can be
used easily with any host with an UART interface powered at 3.3V – 5V (supply
voltage)[4], such as PIC and Arduino boards. Some application examples include home
automation. It can be for security reason, just like what the author did. The other
possibilities are voice controlled light switch or power switch. The EasyVR toolkit can be
seen in Figure 2.6.
13
Figure 2.6 Easy Voice Recognition Toolkit
EasyVR was built-in speaker independent commands, so it will ready to run basic controls.
This device supports up to 32 user-defined speaker dependent (SD) triggers or commands.
The special thing in this device is that the SD custom commands can be spoke in any
language. EasyVR can be used with stable voltage. This toolkit has 3 GPIO lines for input
and output (IO1, IO2, IO3) that can be controlled by the commands that user will give. All
3 GPIO are at nominal 3.0VDC, this is the requirement so the device can work properly.
The audio output that can support the work of this module is an 8 Ω speaker to make
EasyVR can perform effectively.
Figur 2.7 Easy VR Motherboard
Figure 2.7 shows the EasyVR motherboard that gives the information of the pin that is
needed to be plug in. The minimum Vcc for this module is 3.3 V and the maximum is 5 V.
For the ambient operation temperature range the maximum temperature is 700C. The
14
maximum value for ERX (Serial Port Receive Data) and ETX (Serial Port Transmit Data)
is the same as Vcc.
Each command sent on the TX line, with zero or more additional argument bytes, receives
an answer on the RX line in the form of a status byte followed by zero or more arguments.
There is a minimum delay before each byte sent out from the Easy VR to the RX line, that
is initially set to 20 ms and can be selected later in the ranges 0 - 9 ms, 10 - 90 ms, 100 ms
- 1 s. This module will automatically goes to lowest power sleep mode after power on and
to initiate communication, just send any character to wake-up the module. It will consume
the supply voltage less in the sleep mode. Here shown in the Table 2.1 the pin assignment
of the EasyVR module[5].
Table 2.1 Easy VR pin assignment ( J1, J2, J3, and J4 )
Connector Number Name Type Description
J1
1 GND - Ground
2 VCC I Voltage DC Input
3 ERX I Serial Port Receive Data ( TTL Level )
4 ETX O Serial Port Transmit Data ( TTL Level )
J2 1-2 PWM O Differential audio output ( Can directly drive
8Ω speaker ).
J3 1-2 MIC I Microphone input
J4
1 /RST I Reset
2 /XM I Reserved – leave unconnected
3 IO1 I/O General purpose I/O ( 3.0 VDC TTL Level )
4 IO2 I/O General purpose I/O ( 3.0 VDC TTL Level )
5 IO3 I/O General purpose I/O ( 3.0 VDC TTL Level )
The author does not use all the pin in J4. Based on the function that the author wants, here
is the explanation about the pin connections that are being used to give the signal to the
Arduino Mega 2560. This is the abbreviation of using the pin in J1 and J4 :
a. Pin # 01 ( J1 ) →Connected directly to the common ground of the circuit.
b. Pin # 02 ( J2 ) →Connected to the supply voltage ( Vcc ) through the voltage
that come out from the Arduino Mega 2560 which is 5 V.
15
c. Pin # 03 ( J4 ) → Connected to super bright LED to indicate the EasyVR in the
listening mode or not.
d. Pin # 1-2 ( J3 ) →Connected to the microphone, it is becoming the input of the
EasyVR, because the user’s voice will be inserted from the microphone.
e. Pin # 3 & 4 ( J1 )→ERX and ETX of EasyVR can play 2 roles in this device. This
both pin decided whether the EasyVR is in the Bridge Mode or in the Adapter
Mode. When the user want to make the EasyVR in Bridge Mode, user needs to
connect the ETX to the the Arduino Mega 2560 in Pin # 12 and the ERX to the Pin
# 13 when the Vcc to the 5V and the ground of the EasyVR to the ground of the
Arduino. When the user want to make the EasyVR in Adapter Mode, user needs to
connect the ETX to TX0 and the ERX to RX0 when the Vcc of the EasyVR to the
5V and the ground of the EasyVR to the ground of the Arduino and the Arduino
itself in the reset mode.
2.2.3.1 Adapter and Bridge Mode
The author uses the Arduino Mega 2560 as the device that will interface the EasyVR. By
using this Arduino, there are 2 ways to connect the EasyVR to the Arduino board easily :
a. Bridge Mode: This Bridge Mode is the preferred connection mode, because it
allows simple communication with both Arduino microcontroller and the device
(EasyVR). Automatic bridge mode used to be supported only on Arduino boards
with a bootloader implementing EEPROM programming. Figure 2.8 showsthe right
connection to make the Arduino and EasyVR as a bridge mode.
Figure 2.8 EasyVR in Bridge Mode with the Arduino
16
b. Adapter Mode: User can utilize the Arduino board as a USB/Serial adapter by
holding the microcontroller in reset. In this mode, user can control the module
using a software serial library and connect to the module with the EasyVR
Commander from user’s personal computer, with the same pin configuration. This
is the preferred connection mode, since it allows simple communication with both
the Arduino Mega 2560 and the personal computer. All the provided examples for
Arduino manage the adapter mode automatically when the EasyVR Commander
requests a connection. With this mode, user can program and record new word in
the EasyVR Commander and get the code to be opened using the Arduino software.
Also in this mode, user can download a sound table to the EasyVR module. Figure
2.9 shows clear view on how to make the EasyVR in Adapter Mode.
Figure 2.9 EasyVR in Adapter Mode with the Arduino
2.2.3.2 Theory of Voice Recognition
Speech recognition is a type of pattern recognition problem. The input is a steam of
sampled and digitized speech data. For the output itself is the sequence of words that were
spoken by the user. Incoming audio is “matched” against stored patterns that represent
various sounds in many language up to the demand of the user. Sound units maybe words,
phonemes or other similar units. Figure 2.19 shows the schematic of Voice Recognition.
17
Figure 2.10 Schematic of Voice Recognition
Acoustic patterns vary from instance to instance. Natural variations will make the voice
recognition hard to be operated sometimes, even the same person never speaks anything
exactly the same way twice because all the human being has its natural variations. Beside
natural variations, there is systematic variations too that will include:
1. Human being characteristic voice: deep voice or squeaky voice.
2. Speaking style: clear, spontaneous, or sloppy.
3. Speaking rate: quick or slow.
4. Emotional state: happy, sad, angry, sorrow.
5. Emphasis state: stressed speech or unstressed speech.
6. Other factors: accents, dialects, and foreign words.
Liguistic patterns of word are hard to recognize too. Large vocabulary and infinite
language make their ways to become the obstacle for the EasyVR to recognize the voice.
Inherent ambiguities play big part too. For example: “I scream” and “Ice Cream”, these
two pair of words are spoken similarly and can makes the EasyVR not able to recognize
the voice. The variations in speech make the pattern matching difficult to be recognized.
Figure 2.11Mechanism Signal in Speech Recognition
18
Figure 2.12 Discrete Signal Accepted by the Voice Recognition Module
Figure 2.11 shows the mechanism signal in speech recognition. It will give the clear view
of implementation in testing the voice recognition module. In Figure 2.12, the sample
signal when the voice is already inputed, can be observed. The green bars show the signal
of the voice that already inputed. It is necessarily to identify where speech is present in a
captured signal. The note is to avoid attempt to recognize speech in nonspeech regions
included the computional efficiency and hallucination of unspoken words. There are
several modes in speaking mode based on the device itself. Some of them are push to talk,
hit to talk, and continuous listening.
Figure 2.13 Various Phonemes of Basic Sounds
Each information in speech lies in the frequency distribution of the signal. As can be seen
in Figure 2.13, the conversion from speech to a time-frequency representation the x-axis
and the y-axis shows the frequency and the intensity at each location indicates the energy
on the signal. The phonemes have a distinct set of dominant frequency bands called
formants.
19
2.2.4 Grove Relay
Figure 2.14 Grove-Relay module
The Grove-Relay module, shown in Figure 2.10, is a digital normally-open switch. This
relay controlled by low voltage which is 5V to the pin D1 and is capable of switching a
much higher voltages and currents. When the user sets the control pin D1 to HIGH, the
port “Com” and “On” will be connected directly and the LED will emit light or other
outputs will work. When the user sets it to LOW, these 2 ports will be disconnected
directly and the LED will not emit any light and so do the other output, the solenoid door
lock, will not receive any voltage so it will not work. There is a maximum voltage and
current that can be received and controlled by Grove-Relay module which are 250V at 10
Amperes[8].
Figure 2.15 Grove-Relay Module Schematic
20
Figure 2.11 shows the schematic of the grove-relay for the clearer view of the relay. In this
project, the author uses Grove-Relay Module to drivethe solenoid door work when there is
a signal from the Arduino Mega 2560.Here are the connections which must be connected,
so that the Grove-Relay Module can work properly :
a) Vcc ( J2 ) → Connected to the 5V, this is the voltage that is needed to power up the
Grove-Relay. The author tapped the 5 V from the output voltage of the Arduino
Mega 2560 to power up the Grove-Relay.
b) Ground ( J2 )→ Connected the Ground to the common ground of the circuit.
c) D1 ( J2 )→ The D1 is connected to the Pin # 4 from the Arduino Mega. The D1 is
the pin that will receive the signal from the microcontroller. It is the input of the
Grove-Relay system. Any signal will go through D1 and it will transmit the signal
to the output to do an action.
d) ON ( J1 ) → The ON pin is connected to the positive pin from the solenoid door
lock, because the solenoid door is the output that has to do an action after given the
signal by Arduino through Grove-Relay. The voltage will go through the positive
pin of the solenoid door first so it is connected firmly.
e) COM ( J1 )→Com pin is connected to the positive pole of the voltage source that
is given 12V. 12V is the voltage that is needed by the solenoid door lock to be
operated. The positive pole will connected through this pin. Thus, after the relay
gets a signal, the Grove-Relay can make a connection between the positive pole of
12V with the positive pin of the solenoid door lock, so the solenoid door lock can
be operated.
2.2.5 Solenoid Door Lock
Solenoid door lock is a remote door locking mechanism that latches or opens by means of
an electromagnetic solenoid. In many cases, the actual locking mechanism of a solenoid
door lock will be identical to a conventional key-operated example. The only difference
between both is the inclusion of a low-voltage solenoid in the mechanism, which pulls the
latch back into the door lock when the push button or other controller is activated. The
latch will then be retained in the door lock for as long as the button is pushed. Otherwise,
the latch will stay out of the door lock until the controller is activated again. Usually, the
solenoid door lock is used in security matters or automotive doors.
21
The solenoid door lock makes use of a static wire wound coil and a moving armature to
perform work of the key and linkages in conventional locks. The coil is wired into a
circuit, which will include the low voltage, direct-current (DC) power source, and at least
one control input. When the control button is pushed, electric current flows to the coil,
energizing, and creating a strong magnetic field around it. Then, this magnetic field will
atract the armature and will cause it to move rapidly towards the coil. The locking
mechanism of the latch is attached to the armature via an actuator arm. It is consequently
pulled out of the locking position. Figure 2.12 shows the physical appearance of the
solenoid door lock.
Figure 2.16 Solenoid Door Lock
The author used this kind of door lock to become the output of the circuit. The solenoid
door lock needs a 12 V DC. The connection will look like this: the positive side of the
solenoid will be connected to the Grove- Relay at pin ON (J1) and the negative side of the
solenoid will be connected to the common ground of the circuit. So, the solenoid door will
be opened if there is a connection between the 12V voltage source and the common
ground, through solenoid door. This solenoid door lock needs 1.3 A current operated. Here
is the specification of the solenoid door lock, as can be seen in Table 2.2.
22
Table 2.2 Solenoid Door Lock Specification
CATEGORIES SPECIFICATION
Product Name Door Solenoid
Material Metal, Electronic Component
Color Silver
Voltage Needed 12V DC
Rated Stroke & Force 2mm, 1300kgf, 5mm, 850gf
Power Needed 16 Watt
Current Needed 1,3 Ampere
Total Size 6,6 x 4,2 x 3 cm ( L x W x H )
Cylinder Size 3 x 2cm or 1.2” x 0.8” ( L x D )
Cable Length 15 cm
Solenoid Weight 208 gr
2.2.6 AC/DC Adaptor
The AC/DC Adaptor is used as the voltage source of the whole circuit. The input will be
the AC because it comes from the PLN with magnitude 220V at 50/60 Hz. This adaptor
converts the 220 V AC from the power line to DC with magnitude from 3 V up to 12 V.
The maximum current that can be provided by the adaptor is 1200mA. There are 2
polarities in the adaptor, positive and negative. The author used 12V and negative polarity.
The output from the adaptor must be higher than 12V because the voltage regulator will
regulate the voltage to 12V, 8V, and 5V. The AC/DC Adaptor is shown in Figure 2.13.
23
Figure 2.17 Adaptor AC DC
2.3 Supporting Components
2.3.1 Voltage Regulator
Voltage regulator is an electrical regulator designed to automatically maintain a constant
voltage level. It may use an electromechanical mechanism, passive, or active electronic
components. A voltage regulator may be a simple “feed-forward” design. Voltage
regulator can be used both to regulate the AC or DC voltages. A voltage regulator
generates a fixed output voltage of a preset magnitude which is stable regardless of
changes to its input voltage or load conditions. Any difference is amplified and used to
control the regulation element in such a way as to reduce the voltage error. With the
exception of passive shunt regulators, all modern electronic voltage regulators operate by
comparing the actual output voltage to some internal fixed reference voltage. There will be
also a trade-off between stability and the speed of the response to changes. The input
voltage must be higher than the characteristic of the voltage regulator, in order to make the
voltage regulator operates well. If the output voltage is too low, the regulation element is
commanded, up to a point, to produce a higher output voltage- by dropping less of the
input voltage, or to draw input current for longer periods. Nevertheless, if the output
voltage is too high, the regulation element will normally be commanded to produce a lower
voltage[13].
At this project, 2 kinds of voltage regulator are used in the circuit, which are 7812 IC and
7808 IC. The voltage regulator 7812 IC is used to maintain a constant voltage level at 12V,
that is needed to power up the solenoid door lock. The actual voltage that is given from this
24
voltage regulator is 11.68V. The voltage regulator 7808 IC is used to power up the
Arduino Mega 2560. This device needs 7V-12V voltage source to be operable. The input
voltage is set to be higher than 12V so that by the first voltage regulator it can beregulated
to 12V. After that, 12V will go to the second voltage regulator and becomes 8V.
Here is the physical apperance of the applied voltage regulators, shown in Figure 2.14
Figure 2.18 Voltage Regulator 7812 IC and Voltage Regulator 7808 IC
To maximize the use of a voltage regulator, it must be put in into a circuit that consists of
capacitors. Figure 2.15 shows the implementation of voltage regulator in the circuit. The
voltage regulator 7812 IC is taken as example in this figure.
For obtaining the maximum performance of both voltage regulators, the author chose the
both capacitors for the 7812 IC and 7808 IC properly.
a) For voltage regulator 7812 IC :C1 : 1000 μF (35V) & C2 : 330 μF (25 V)
b) For voltage regulator 7808 IC :C1 : 1μF (25V) & C2 : 1μF (25V)
The first capacitor, 1000 μF for 7812 and 1 μF for 7808 is hooked after the voltage source
and connected with the ground, this is used to filter all the noise that will come from the
voltage source and make the signal clean from AC to DC. The author does not want the
noise of AC imposed on the DC line voltage, so this capacitor will act as the bypass
capacitor.
25
For the other capacitor, 330 μF for 7812 and 1 μF for 7808, is connected after the voltage
regulator, this is used to filter out any noise AC again that will come out from the voltage
regulator before the signal come out to the circuit, that is why the author use both capacitor
with their position.
The value of the capacitors can be measured by the voltage regulator itself, so the higher
tha voltage come in to be regulated the higher must be the magnitude of the capacitor that
shown in above points.
Figure 2.19 7812 IC Circuit
2.4 Software of the Circuit
In this project, software plays the same important role as the hardware (the main
components and the supporting components). There are 2 softwareswhich are used to
complete this project. The first software is the EasyVR Commander and the second one is
the Arduino software. See the Figures 2.16 and 2.17 for the preview of the software. By
using EasyVR Commander, the user can record new word, add new word, add new sound
table or format the old word. After finishing one of the activities, EasyVR Commander will
generate code. In the Arduino software, the user can open that code and integrate the
command to the microcontroller. This software is designed based on the functionality of
the Arduino Mega 2560.
26
Figure 2.20 Preview of EasyVR Commander
Figure 2.21 Preview of Arduino Software
27
The system design will be generally explained in the next chapter. After the programming
part is completed, the code needs to be downloaded to the Arduino or to the EasyVR
through Arduino. This is the most important thing and an USB connector is used as the
bridge between the PC to the Arduino in downloading the code to the microcontroller.
Figure 2.22 USB Connector
28
CHAPTER 3
DESIGN IMPLEMENTATION
3.1 System Design
The block diagram of the circuit of the project made by the author is shown in Figure 3.1.
Figure 3.1 Block Diagram
The block diagram above shows generally about the components which are used in this
project. Easy Voice Recognition play its role as the input of the system, whereas the LED
and the solenoid door lock perform as the output of the system. The Arduino itself, which
is Arduino Mega 2560, performs as the brain of the device. It will process the digital signal
that is sent from the input of the system and produce the digital signals to activate the
ouput system.
Whenever the input receive the voice, EasyVR will directly deliver the signal to the
Arduino Mega 2560. As the brain, Arduino Mega 2560 will process, the signal and decide
what action should be done by the LED and solenoid door lock.
In the next section, the details of each components that used to make the Automatic Door
Lock with Speech Recognition will be discussed.
Easy Voice Recognition Arduino Mega
2560
LED
Solenoid Door
29
The components can be categorized as the main components, supporting components, and
the software of the circuit. The full circuit diagram of the device can be seen in Figure 3.2.
The different colors of connections only mean to give clear presentation.
30
Figure 3.2 Device Design
31
This device needs one connection to the power source to work. It can be connected to the
power line of 220V, then anAC/DC connector is usedto convert the AC voltage to the DC
voltage. Each component needs different voltage. First the 12V DC is used to activate the
solenoid door lock through the relay. Next, 8V DC is required to activate the Arduino
Mgea 2560. Thus, it is needed to use the voltage regulator 8V DC. The last, 5V DC is
needed to power up the EasyVR and the relay for solenoid door lock.
The first red LED is used to show that the current flows to the voltage regulator 12V. The
blue LED is used to show that the current flows to the voltage regulator 8V. Both are used
to help the author to find any mistakes if the device does not work properly. In order to
find the wrong connection or others, it is very important for the LEDs to give the author
the status whether the currents flow or not.
The solenoid door lock can work in various voltages, with the maximum value of 12 V.
The solenoid door lock can work with its best performance in 12V. It can also work under
12V but the response is slower than when used under 12V. The minimum voltage for the
solenoid door lock to be operable is around 6V, but it will not function well.
The Grove-Relay needs 5V to be operable. The five connections must be connected as
well, so the solenoid door lock can operable work when the Arduino gives the signal to the
relay. The relay itself has a LED indicator in it to tell the user whether the relay is in
standby condition or in working condition. This relay gets the data input from the Arduino
Mega 2560 pin number 7 with the orange wire connection between the relay and the
Arduino Mega 2560.
The EasyVR needs 5V so it can works. The connections from EasyVR are very crucial
because any misconnection will make the device not working. The Arduino Mega 2560 pin
number 12 must be connected to the ETX pin of the EasyVR, while the Arduino Mega
2560 pin number 13 must be connected to the ERX pin of the EasyVR. The 5V from
Arduino is connected to the Vcc’s pin in the EasyVR and the ground to the common
ground of the circuit. For addition, the IO1 pin from the EasyVR is connected to the bright
LED to give an indication that the EasyVR is on listening mode. The EasyVR has an
external speaker which functions as the input of the EasyVR. The voice from the user is
fed to the EasyVR through the input speaker that is available in one package when the
author bought the EasyVR.
32
The Arduino Mega 2560 has 2 options to get the power for its operation. The first option
isto connect the power cable to the external power supply. The second option is by using a
USB cable.
3.2 Basic Concept
The main purpose of this final project is to make the high security level device. The
important element that decides the security of the room or house is the door. If anyone can
enter the door freely, the security level will be low. But, when the door can only be passed
by few people or the owner, the secutiry level will be high. This day, when people become
very busy with their jobs, there will be 2 problems that appear. The first one, the owners of
the room or the house forget to lock their room or house. By that, everyone can enter the
room and house and can do the robbery. The second one, the owners of the room or the
house forget to put their key or lost the key. So, no one can enter the door, even the owner.
Based on this problem, the author got the idea to solve both problems. The idea is to make
the lock that only can be opened by the owner but does not need any physical key to be
open with.
One realization of the idea is to implement the lock with voice recognition. The
implementation will works like this: the lock of the door will always be locked until there
is an input, the voice of the person. Whenever a person speaks a word, and the word
matchs the password, The lock will be opened.Otherwise, the lock will be kept locked. The
voice recognition will work effectively in certain conditions. So, the owner must provide
the conditions which make the voice recognition work effectively, and thus enablethe
device to work properly.
The problem comes when the other person know the password. It is possible because the
password consists of only one or two words. The author was aware on this condition and
took preventive measure. The author set the password in a continuous form, so the owner
or other people that want to unlock the door, must say three passwords. When the first
password is spoken correctly, the lock will not be opened directly. People must know the
second password and the third password. Only when all passwordsaresaid correctly, the
door will be unlocked. Nevertheless, the user can still choose whether to use three
passwords with high security or to use only one single password with simplicity and
quickness to pass the door.
33
In order to inform the owner about the status when the owner uses 3 passwords, the author
uses the LED to become the indicator.
After 10 seconds elapses from the time the last password is given, the solenoid door lock
will turn to lock position automatically. If the door is not pushed within this 10 seconds,
the user must repeat the procedure from the beginning again.
3.3 Programming Implementation
3.3.1 EasyVR Commander
The EasyVR Commander is the software through which the EasyVR is programmed. To
make this software working properly, the author changed the configuration of the Arduino
pin with the EasyVR from the bridge mode to the adapter mode. With this connection, the
groups of commands or words or passwords can be designed freely and basic code
template can be generated easily. The basic code is required to be opened and edited in the
Arduino software. This will be discussed in subchapter 3.3.2.
Here is brief explanation about how to insert the new word and the code to be generated in
the Arduino Software. After connecting the EasyVR to the Arduino Mega 2560 in adapter
mode, Easy VR Commander should be open. The display will be shown in Figure 3.3.
34
Figure 3.3 Main Application Window of Easy VR Commander
There are four groups of commands that are shown in the software and are available when
the EasyVR Commander is started, which are :
Trigger: Trigger is a special group where the user has the built-in SI trigger word “
Robot “ and the user can also add one user-defined SD trigger word. The function
of the trigger word is to start the recognition process.[5]
Group: In group, the user may add user-defined SD commands as much as the user
demanding. There are 15 groups that available to be inserted words.
Password: This part is a special group for “vocal password“ using the Speaker
Verification ( SV ).[5]
Wordset: Wordset consist of many words that already inputed by the factory, it is
already built-in set of many commands.
35
After getting into the main application window of EasyVR commander, a connection
between the EasyVR Commander and the EasyVR needs to be established. This is done by
choosingthe connect menu shown in Figure 3.4.
Figure 3.4 Connect Mode in Easy VR Commander
Figure 3.5 Connected from the Easy VR Commander to the Easy VR
36
If all the connections are done correctly, the EasyVR Commander will give the display
shown in Figure 3.5. At the beginning, the author met some difficulties in connecting the
EasyVR to the EasyVR Commander before successfully connect it. The error and warning
command can be seen on Figure 3.6. When this happens,there are several things that must
be checked by the user :
The Arduino Mega 2560 must be in RESET condition. There are 2 options. The
first is the user must press the reset button provided by the Arduino Mega 2560
manually all the time and release it when the user disconnects the EasyVR
Commander from EasyVR. The second is to connect the female reset pin with the
female ground pin with a male-male wire. If the user chooses the second option, the
user does not need to press the reset button manually.
The user must check the connection of ERX and ETX, whether both of them are in
adapter mode or still in bridge mode. Both connection can not be connected in
different modes. Many errors happen because of misconnection between the ERX
and ETX to the TX and RX in the Arduino Mega 2560.
Figure 3.6 Warning and Error Command in Easy VR Commander
37
After successfully connecting the EasyVR to the EasyVR Commander, the user can add
new words and new commands by controlling the EasyVR Commander. Shown in Figure
3.7 is the option the user needs to choose in order to add the command. Next, the user just
needs to type the password. In this example the author write “Television“ shown in Figure
3.8.
Figure 3.7 Add Command in Easy VR Commander
Now, the user needs to record his/her voice. After inputing the word, the user must train
the command, shown in Figure 3.9. The user must say the word within 5 seconds in both
phases. There will be first phase and second phase, and the password must be pronounced
in a same way. If the word is spoken differently, there will be error and the user needs to
train the command from the phase 1. If both phases are successfully done, the window will
be back to the basic as shown in Figure 3.7, with the new word “ Television “.
38
Figure 3.8 Add New Word to the Group in Easy VR Commander
Figure 3.9 Train Command for The New Word to do Speech Recognition
39
If the user is already done with adding the new word and training it, the user needs to edit
the code to be edited in the Arduino software. To get the code, user need to choose the icon
“ Generate Code “ shown in Figure 3.10. after generating the code, user will get the file,
that file can be opened by the Arduino software.
Figure 3.10 Generate Code Icon in Easy VR Commander
3.3.2 Arduino Programming Implementation
Arduino Mega 2560 is programmed by using Arduino Development Environment (IDE)
and its core libraries. This development environment is written in Java. The core libraries
are written in C and C++ and compiled using avr-gcc and AVR libc.
The author used the Arduino IDE 1.0.Arduino IDE has two main functions which are
setup() and loop(). The necessary thing is to include both functions in every Arduino
program, even if the user does not need them to be used. The functionality of both
functions in Arduino IDE will be explained now. First is the setup(), which has a function
to run only once and does not do any looping. This will happen after the user uploads his/
40
her skecth to this programand each time the user reset the Arduino. The second is the
loop(). This function runs continuously in an endless loop while the Arduino board is
powered. This function is the core of most programs.
Even though the programming language that the author describes is based on C++, the
program written using Arduino will not recognize a valid program by standat C++
compiler. However, the program is uploaded by using Arduino IDE. This is the copy of the
program which is written to a temporary file with additional header at the top of the code
and a simple main() function at the bottom. This will make a valid C++ program.
The code that is appropriate to be opened and edited by the Arduino IDE is obtained from
the EasyVR Commander. It already has the template for the Arduino IDE. So, when there
is a new word, the EasyVR directly addsthe new code to that template. When the user
choosesto generate the code, the user will get the code that already containes additional
code that shows the new word.
Here are the code that is generated by the EasyVR Commander and can be read by
Arduino IDE.
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#include "WProgram.h"
#include "SoftwareSerial.h"
#include "NewSoftSerial.h"
This is used to declare the header
library that will work in Arduino 1.0.
Wprogram.h will provides
declarations for the Arduino API and
has been renamed to Aruino.h[6].
Both these codes include are just the
evolution to each other. Thus, the
SoftwareSerial.h has been
reimplemented using the code that is
originally written for the
NewSoftSerial library. Both are used
to declare the header library. The
library can be used in all this code.
41
#include "EasyVR.h"
enum Groups
GROUP_0 = 0,
GROUP_1 = 1,
GROUP_2 = 2,
GROUP_16 = 16,
pinMode (4,OUTPUT);
pinMode (5,OUTPUT);
pinMode (6,OUTPUT);
pinMode (7,OUTPUT);
It is the header library for the
communication between the Arduino
Mega 2560 and the EasyVR. The
interfacing will be quickly delivered.
After the declaration, the library of
the EasyVR can be used through the
EasyVR Commander.
The enum Groups is used to declare
groups that are used in the function
of the EasyVR and the Arduino.
There are 4 groups that are used by
the author to control EasyVR.
For the next codesabove, the author
insert the void setup(). This is only
used in function declarations. It
indicates that the function is
expected to return information to the
function from which it was called
before.
This pinMode is used to configure
the specific pin as the output or as
the input. In this project, the author
assigns pinMode 4 up to 7 as the
output, since they will be used for
sending the data to LED and Groove-
Relay.
42
digitalWrite(4,LOW);
digitalWrite(5,LOW);
digitalWrite(6,LOW);
digitalWrite(7,LOW);
bridge.loop(0, 1, 12, 13);
Serial.begin(9600);
port.begin(9600);
if (!easyvr.detect())
Serial.println("EasyVR not detected!");
for (;;);
digitalWrite is used to declare
whether pin 4 up to pin 7 of the
Arduino Mega 2560 is in the LOW
condition which is 0V or in the
HIGH condition (not 0V) in the first
state. In this project, the author sign
all the pin to be in a LOW condition.
Thus, all the output will not have any
voltage across it at the beginning.
The next code is a bridge.loop. This
means that the device will be looping
an the operating pins. The pins
number are 0,1,12, and 13.
It is to initialize the serial at 9600
baud rate. The port.begin mean that
all the port is begin at 9600 baud rate
too.
This code is used to check whether
the EasyVR is already connected to
the Arduino Mega 2560. If it is not
connected, then the serial monitor
will indicate that “EasyVR not
detected”. The statement for(;;) is
used to repeat a block of statements
enclosed in curly braces[7].
43
easyvr.setPinOutput(EasyVR::IO1, LOW);
easyvr.setPinOutput(EasyVR::IO1, HIGH); //
LED on (listening)
easyvr.setPinOutput(EasyVR::IO1, LOW); //
LED off
group = EasyVR::TRIGGER; //<-- start group
(customize)
Serial.println("EasyVR detected!");
Serial.print("Say a command in Group ");
Serial.println(group);
Serial.print("Command: ");
Serial.print(idx);
Serial.print(" = ");
Serial.println(name);
Serial.println();
Serial.println("Timed out, try again...");
Serial.print("Error ");
Serial.println(err, HEX);
easyvr.setTimeout(5);
easyvr.setLanguage(0);
The command below is used to set
the pin from the EasyVR in the
LOW condition. This means that
there is no voltage across which
means not in HIGH condition.
This is to declare the group as the
trigger as the user can see in the
EasyVR Commander in the trigger
section. This is the beginning and
will be used in many parts of the
codes afterwards.
Serial.println is used to print out the
version data and to tell the user that
the EasyVR has been connected.
“Say a command in Group“ means
that an order to say the password and
all the input will be connected to the
trigger group which already been
declared previously.
The time out functions in the
connection in IO3 in EasyVR.
EasyVR will wait in the loop for all
the time and wait for the input from
the user. It will be off after 5 seconds
and immediately will be on again
and wait for the input for the next 5
seconds
44
3.3.3 Main Programming Code Explanation
In this sub section, the main programming code which plays the important role in
performing the device will be presented. The code below is modified by the author, so that
they can work properly as the author wanted. Here are the parts of the code :
void action()
switch (group)
case GROUP_0:
switch (idx)
case G0_PRESIDENT:
digitalWrite(5,HIGH);
delay(10000);// write your action code here
group = GROUP_1;// group = GROUP_X; <-- or jump to another group X for
composite commands
break;
break;
case GROUP_1:
switch (idx)
case G1_UNIVERSITY:
digitalWrite(5,LOW);
delay(10000);
digitalWrite(6,HIGH);// write your action code here
group = GROUP_2;// group = GROUP_X; <-- or jump to another group X for
composite commands
break;
break;
case GROUP_2:
switch (idx)
45
case G2_DORMITORY:
digitalWrite(6,LOW);
delay(10000);
digitalWrite(7,HIGH);
delay(10000);
digitalWrite(7,LOW);
delay(3000);// write your action code here
// group = GROUP_X; <-- or jump to another group X for composite commands
break;
break;
case GROUP_16:
switch (idx)
case G16_PASSWORD:
//write your action code here
// group = GROUP_X; <-- or jump to another group X for composite commands
break;
case G16_FINISH:
// write your action code here
// group = GROUP_X; <-- or jump to another group X for composite commands
break;
break;
Here is the explanation of the programming codes above. Basically, there are 5 words
which will effect the device and make the device work. But, by modifying the codes as
above, the author is able to just use 3 words which will give the required output to open the
lock if the words are said correctly. The words are “President”, “University”, and
“Dormitory”.Whenever the user says the word “President“, pin number 5 will goes to high
condition which means the voltage comes out from pin 5 for 10 seconds and will not goes
46
in the low condition anymore. This voltage will also light up the red LED in the circuit.
Then, the logic will move to the group 1 from the trigger group in the EasyVR.
The second word is “University“. After “President“ is inputed to the device, whenever the
user says “University“, pin number 5 will switch into low condition for 10 seconds and pin
number 6 of the Arduino Mega 2560 will go in high condition. This pin will go in high
condition all the time until the third password is spoken correctly. The processor is moving
from the group 1 to the group 2 in this part and the green LED will be lighted.
The third word is “Dormitory“. After word “President“ and “University“ are said before,
the logic code is in the group 2. Whenever, the word “Dormitory“ is said, pin number 6 of
the Arduino Mgea 2560 will go in low condition for 10 seconds and pin number 7 of the
Arduino will go in high condition for 10 seconds. After 10 seconds, pin number 7 of
Arduino will go in low condition for 3 seconds. In this part, the solenoid door lock will be
opened for 10 seconds and will be closed again after3 more seconds.
There are words “Password“ and “Finish“ which are not used in this device although they
are available. In order to make the security complex, the user can add more passwords.
There can be more than 5 levels of password that can be adjusted before the solenoid door
unlocks.
The delay operation mentioned in this main programming code does not mean that it will
change after the delay is over. It just meant that the condition can not be changed at all in
that period of seconds. For example, the red LED will go in high condition for 10 seconds,
and after 10 seconds the red LED will not change into low condition. It will still be in high
condition but in that 10 seconds period, any operation cannot be done on the red LED.
There are steps to make the solenoid door lock open. If the steps are not followed from the
beginning sequentially, the solenoid door will not be open. The steps depend on the
passwords. The word “President“ must be inputed at the first place before the word
“University“ and “Dormitory“.If the user inputs “Dormitory“ first, the device will not
work. It is the same when the first word inputed is “University“. Figure 3.11 gives a clear
explanation about the mechanism of the automatic door lock.
47
Figure 3.11 Flow Chart of Mechanism Device
Correct
False
Correct
False
Correct
False
IS FIRST
PASSWORD
CORRECT ?
START
SAY FIRST WORD
RED LED EMIT LIGHT
SAY SECOND WORD
IS SECOND
PASSWORD
CORRECT ?
GREEN LED EMIT LIGHT
SAY THIRD WORD
IS THIRD
PASSWORD
CORRECT ?
SOLENOID DOOR LOCK OPEN FOR 10S
SOLENOID DOOR LOCK CLOSED
48
CHAPTER 4
RESULT AND DISCUSSION
4.1 Results
Below is Figure 4.1 shown the complete implemented device named “Automatic Door
Lock with Speech Recognition“.
Figure 4.1 Automatic Door Lock with Speech Recognition
This project result in a small miniature with a small door, located in the right side of the
box. It has 2 holes which are used to let the Solenoid Door Lock lock the door, to pass the
power supply cable, and to pass the microphone input for the whole system.
49
Figure 4.2 The Miniature of the Door
Figure 4.2 shows the miniature of the door. This door is locked. In the Figure 4.2 there is a
red box that shows one of the hole of the box.This hole is used to let the lock out of the box
so it can lock the miniature door.
Figure 4.3 The Circuit of the Automatic Door Lock
50
Figure 4.3 show the initial condition when the power supply is not plugged yet.. The red
box in Figure 4.3 shows the other hole to allow the cable of the power supply out of the
box. Now, when the user is ready, the user just needs to plug in the cable of the power
supply to turn on the device. When the user plugs in the power supply cable, there will be
some indications, shown in Figure 4.4.
Figure 4.4 The Device’s Power Supply Plug In
When the power supply cable is plugged in, the red LED will always emit light because it
shows the condition of the voltage regulator 12V. Same as the red LED, the green LED
will always emit light, as shown in the Figure. It tells the user about the condition of the
8 V voltage regulator. Different from the others, the bright LED does not emit light all the
time. This bright LED shows the status of the EasyVR whether the EasyVR is in the
listening mode or not. In most of the time, the bright LED will emit light. It may blink for
some period in less than a second and then emit light againcontinuously.
51
There are 3 passwords that the author sets in order to open the door lock. All that 3
passwords must be said in an order. The passwords are “President“, “University“,
“Dormitory“. Whenever the first word is said by the user, there will be a sign of a LED that
the word is accepted, as shown in Figure 4.5.
Figure 4.5 The First Password Said Correctly
When the first password is said correctly, it also means that the device is already to
accepted the next password. When the EasyVR accepts the firstpassword, the bright LED
will not emit light because the EasyVR is not in the listening mode but in processing mode.
The EasyVR is transfering the signal to the Arduino. After the task is done, the bright LED
will emit light again, as shown in Figure 4.5. In this stage, whenever the user says the
second password, there will be the second effect of the device, shown in Figure 4.6.
52
Figure 4.6 The Second Password Said Correctly
Figure 4.6 shows the effect when the second password is correctly said. In this stage,
whenever the user says the third password, the door lockwill be open shown in Figure 4.7.
Figure 4.7 The Solenoid Door Lock in Lock Condition and in Unlock Condition
53
Figure 4.8 The Door Lock Open the Miniature Door
After the lastpassword is spoken, the door lock will be unlocked in this moment. The
miniature of the door can be opened. In 10 seconds, the door lock will be unlocked before
the lock goes back to the initial position, which is in lock position. When the door is open
and in case that the solenoid door lock is already in lock condition, the miniature door can
be locked any time because of the position of the door lock. So, the user does not need to
unlock the solenoid door first in order to lock the door locked. It can be done just by
pushing the miniature door in the initial position and it will be locked automatically.
When the solenoid door lock is already back in lock position after 10 seconds in unlock
position, all the device will go back to initial condition with only the red LED, the green
LED, and the bright LED emitting light.The device goes back to its initial condition.
54
4.2 Discussions
This subsection will discuss the performance of the automatic door lock and the speech
recognition.
4.2.1 Door Lock
After testing the function of the automatic door lock, the author found that there is no
problem existing in its function. In addition, when the author tried to unlock the door lock
for the long time, it will result in the heating of the voltage regulator 12V IC, which acts as
the voltage regulator for the solenoid door. To overcome this problem, there are 2 solutions
that can be taken :
a) Using the heat sink. Heat sink is a thermally conductive tab that normally absorb
heat from the component that has high heat. The heat sink does not need any power.
It is just the natural behaviour of the material that enables the heat sink to absorb
heat. Thus,the voltage regulator is not overheated anymore. It needs a screw to keep
the voltage regulator near and sticked to the heat sink, as shown in Figure 4.9.
Figure 4.9 Heat Sink and the use of the Heat Sink to the Voltage Regulator
b) Using the thermally conductive tape. Figure 4.10 shows the physically shape of the
thermally conductive tape. This solution is simpler than using the heat sink, but the
cost is higher. The user must buy one roll eventhough only a little piece is used.
55
Figure 4.10 Roll of Thermally Conductive Tape
The user just needs a little part of the conductive tape to cover the upper part of the voltage
regulator, as shown in Figure 4.11. The concept of the conductive tape is almost the same
as the heat sink. It generally removes unwanted heat and avoid the voltage regulator from
overheating. The author suggests the use of thermally conductive tape in the roll form.It
will act as a low-massheat sink and is very suitable for components with low power
dissipation such as the voltage regulator 7812 IC and voltage regulator 7808 IC.
Figure 4.11 The Upper Part of 7812 IC
The use of voltage regulator 7808 IC is the same as explained above for the voltage
regulator 7812 IC. The user just needs to cover the upper part of voltage regulator 7808 IC
with the thermally conductive tape.
56
4.2.2 Speech Recognition
After testing all the functions of the EasyVR, by downloading, recording, and inputing the
voice to the EasyVR, the author found problems in optimalizing the performance of
EasyVR as the speech recognition circuit. There are several tips that that can be shared
optimize the performance of EasyVR.
The speech recognition can recognize the words successfully depending on several factors.
Each factor contributesin the selection of an optimal recognition set. Problematic
recognition sets can often be corrected by replacing one or more words with a synonim, or
approximate synonym, shown in Table 4.1.This does not require any other changes. The
smaller the set, the higher the recognition rate.
Table 4.1 Examples of Problematic Recognition Sets Correction
The optimal set consists of : Avoid sets like : Aim for sets like :
Dissimlar sounding words
hat/cat/rat
home phone/ office phone
president/residence
hat/kitten/mouse
home/office
president/house
Varying numbers of syllables orange/apple/cherry orange/banana/grape
In addition, there are three main factors that are the key considerations for successful voice
recording and recognizing. They are :
1) Distance. The distance between the built-in microphone of the EasyVR Module
from the user’s mouth must be the same during the recording mode and during the
recognition mode. This will help the EasyVR to recognize better, because when the
EasyVR detects different frequency spectrum which can happen because of
distance difference, EasyVR may not be able to recognize the word eventhough the
word is the correct one.
2) Intonation of Voice. The user should speak in a normal voice with the same
intonation as the recording one. It will help the EasyVR to detect the voice if the
user does not imitate a foreign accent or use any unnatural intonation. The same
57
intonation and accent during the recording mode and during the recognizing mode
will give the best result in recognizing the word.
3) Background Noise. Background or environmental noise must be considered too.
When EasyVR is in the listening mode or in the recognizing mode, it is better if
there is no background noise. The sensitivity of the built-in microphone is -38dB
(0dB=1V/Pa @ 1KHz) and almost flat in frequency response in range 100 Hz – 20
kHz. If the voice inputed to the EasyVR through the built-in microphone is below
100 Hz, then it is very rare that the EasyVR can recognize the voice. The same case
happens when there is a voice that has frequency above 20 kHz. The EasyVR will
not recognize it because of the limitation of the frequency that the built-in
microphone can pick up.
The author gives the tips that will be very useful in handling the built-in microphone. By
this way, the built- in microphone can do its function well. Here are some guidelines :
1) Flush Mounting.
The microphone element should be positioned as close to the mounting surface as
possible and should be fully seated in the plastic housing. There must not exist
airspace between the built-in microphone and the plastic housing. Having such
airspace can give the acoustic resonance, which can reduce recognition accuracy.
See in Figure 4.4.
Figure 4.12 Flush Mounting in Built-In Microphone
58
2) No Obstructions, Large Hole.
The area facing the built-in microphone must be kept clear from any obstructions to
avoid interference during the recognition mode. The diameter of the hole in the
housing facing the built-in microphone should be at least 5mm far. If there is
plastic surface facing the built-in microphone, it must be made as thin as possible.
Recommended value is not more than 0.7 mm. See Figure 4.13.
Figure 4.13 No Obstruction, Large Hole in Built-In Microphone
3) Insulation
The built-in microphone should be acoustically insolated from the housing if it is
possible. This can be accomplished by surrounding the built-in microphone element
with a spongy material such as rubber or foam. The provided microphone already
has this kind of insulating foam. The purpose is to prevent any auditory noises
produced by handling or jarring the device from being “picked up” by the built-in
microphone. This Insulation issue described clearly in Figure 4.6.
Figure 4.14 Insulation Issue in Built-In Microphone
59
4.3 Strengths and Weaknesses
The strengths of the proposed system in this project are :
a. The automatic door lock is not difficult to activate due to the thorough simple
operation that is needed to be done by the user. The user just needs to say any word
as the password without any requirement to push any button. The lock will lock and
unlock automatically also when the password is correctly spoken. The user does not
need to do anything other at all to operate this security device.
b. This project is easy to built and to implement in many areas such as housing,
dormitory or other areas. With relatively cheap components, the device can give
security to the user.
c. EasyVR as the speech recognition circuit is simple to be trained and to be operated.
It is also able to recognize the user’s voice very well in a relatively quiet location.
The weaknesses of the proposed system in this project are :
a. The performance of the EasyVR in an irrelatively quiet location is not always good.
Sometimes, the EasyVR can not recognize the word well because of the noise and
different intonation. Because of that, it will become a problem if the user gets a
cough and cannot say the word properly in the way the user recorded it.
b. There are 2 different modes which EasyVR must do with the Arduino. By that, the
user must unplug cable to change to another configuration. For example, from
Bridge Mode to the Adapter Mode, or Adapter Mode to Bridge Mode. This must be
done manually to change the password or program the Arduino in different mode.
There is no automatic way to do it. After doing the programming, the user must
change the pin configurations again in order to download and enable the EasyVR to
recognize the word properly.
60
CHAPTER 5
CONCLUSION AND RECOMMENDATION
5.1 Conclusions
Based on the testing results of the whole function of Automatic Door Lock with Speech
Recognition circuit, there are several conclusions that can be taken. They are:
1. The Automatic Door Lock with speech recognition is designed and implemented
successfully. It can be locked and unlocked automatically if the passwords are true.
Basically, there are 3 passwords, but the user can change this by themselves, using
whether one password, two passwords, or three passwords.
2. The implementation includes Arduino Mega 2560 with EasyVR. The speech
recognition circuit has two important modes such as Bridge Mode (this mode is the
listening mode, where EasyVR is listening continuously to the environment.) and
Adapter Mode (in this mode, user can record the word by the EasyVR Commander
and can download the code to the microcontroller from the PC).
As additional conclusions written from this final project, the author can conclude that:
1. The security performance of automatic door lock and the speech recognition in to
the system proposed by the author is sufficient and satisfactory. The device can
response to the author nicely and can work properly in identifying the passwords
and open the solenoid door lock correspondingly.
2. The best recognition process results of the speech recognition circuit can be
obtained by saying the user’s recorded password in a relatively quiet location,
where there is no much noise. This ensures that the built-in microphone can catch
the voice of the user well.
61
5.2 Recommendation
In order to develop the existing project, which is Automatic Door Lock with Speech
Recognition, there are two recommended future improvements which are :
a. Applying the Speaker to the EasyVR Module.
Speaker is one of the innovation that can make this project operate better than
before. There is an additional feature given by the EasyVR which is that the user
can attached the external speaker by themselves. The requirement for the speaker is
external speaker with magnitude 8Ω, as shown in Figure 5.1. If the implementation
of the speaker goes well, the user can download the sound table from the EasyVR
Commander and give the different output sound (in .wav) through the speaker.
Thus, the user will know the status of the word. For example, “Access Granted”,
“Access Denied”, “Please Talk Louder”, “Please Try Again”, etc. By that output
command, the user will have more knowledge about the state of the device.
Figure 5.1 External Speaker 8Ω
There are 2 poles of the 8 Ω speaker, which are positive and negative. Both must be
connected to the EasyVR. It is very recommended to see the datasheet first, so the
user knows which pole should be connected to where.
b. Applying the Keypad to the Automatic Door Lock System.
Keypad is a set of buttons arranged in a block or “pad” which usually bear digits or
contain digits 0 up to 9. The use of keypad is to tighten the security systme by
62
making the combination of speech recognition and identification numbers that must
be entered through the keypad. In this way,when the voice password is already
right, the door will not be open directly. In the contrary,the second step by entering
the identification numbers using the keypad. If the number are right then the
solenoid door lock can be unlocked. Thus, the keypad is used to strengthten the
security level of the system. This serves as the prevention if the neighbour or
someone else knows the user’s password in verbal.
Figure 5.2 3x4 Keypad
The Figure 5.2 show the 3x4 keypad that consist of sixteen buttons. There are
numerical buttons which are consist of “ 0” up to “ 9 “. Besides that, there is “ * “
and “ # “. The combination of this can become the identification numbers and can
tighten the security level.
63
REFERENCES
[1] Arduino Mega 2560 datasheet. Retrieved January 2013 from
http://arduino.cc/en/Main/arduinoBoardMega2560
[2] LED knowledge and explanation. Retrieved January 2013 from
http://id.wikipedia.org/wiki/Diode_pancaran_cahaya
[3] LED advantages and disadvantages. Retrieved January 2013 from
http://www.continental-lighting.com/led-basics/advantages-disadvantages.php
[4] EasyVR datasheet. Retrieved February 2013 from
www.veear.eu
[5] EasyVR user manual guideline. Retrieved February 2013 from
www.robotshop.com/content/PDF/easyvr-user-manual-vrb-001.pdf
[6] Arduino release notes. Retrieved February 2013 from
http://arduino.cc/en/Main/ReleaseNotes
[7] Arduino reference. Retrieved March 2013 from
http://arduino.cc/en/Reference/for
[8] Relay specification. Retrieved March 2013 from
http://wiki.openpicus.com/index.php?title=GROVE_-_Relay
[9] Relay picture and internal design. Retrieved March 2013 from
http://www.seeedstudio.com/wiki/GROVE_-_Starter_Kit_V1.0b
[10] Solenoid door lock picture design. Retrieved March 2013 from
http://www.wisegeek.com/what-is-a-solenoid-door-lock.htm
[11] LED internal design specification. Retrieved March 2013 from
http://nie-lampuled.blogspot.com/
[12] Solenoid door lock specification. Retrieved March 2013 from
http://www.sourcingmap.com/12v-096a-2mm-12kg-open-frame-type-solenoid-
for-electric-door-lock-p-217979.html
[13] Voltage regulator specification. Retrieved March 2013 from
http://en.wikipedia.org/wiki/Voltage_regulator
[14] Kai–Fu Lee. Automatic Speech Recognition. Norwell, Massachusetts: Kluwer
Academic Publishers, 1999, pp. 32.
64
[15] Milan Sigmund. Voice Recognition by Computer. Milan: Tectum Verlag, 2003,
pp. 63.
[16] Manfred R. Schroeder. Computer Speech Recognition, Compression, Synthesis.
Germany: Springer-Verlag Berlin Heidelberg New York, 1999, pp 221.
65
APPENDIX
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#include "SoftwareSerial.h"
SoftwareSerial port(12,13);
#else // Arduino 0022 - use modified NewSoftSerial
#include "WProgram.h"
#include "NewSoftSerial.h"
NewSoftSerial port(12,13);
#endif
#include "EasyVR.h"
EasyVR easyvr(port);
//Groups and Commands
enum Groups
GROUP_0 = 0,
GROUP_1 = 1,
GROUP_2 = 2,
GROUP_16 = 16,
;
enum Group0
G0_PRESIDENT = 0,
;
enum Group1
G1_UNIVERSITY = 0,
66
;
enum Group2
G2_DORMITORY = 0,
;
enum Group16
G16_PASSWORD = 0,
G16_FINISH = 1,
;
EasyVRBridge bridge;
int8_t group, idx;
void setup()
pinMode (4,OUTPUT);
pinMode (5,OUTPUT);
pinMode (6,OUTPUT);
pinMode (7,OUTPUT);
digitalWrite(4,LOW);
digitalWrite(5,LOW);
digitalWrite(6,LOW);
digitalWrite(7,LOW);
// bridge mode?
if (bridge.check())
67
cli();
bridge.loop(0, 1, 12, 13);
// run normally
Serial.begin(9600);
port.begin(9600);
if (!easyvr.detect())
Serial.println("EasyVR not detected!");
for (;;);
easyvr.setPinOutput(EasyVR::IO1, LOW);
Serial.println("EasyVR detected!");
easyvr.setTimeout(5);
easyvr.setLanguage(0);
group = EasyVR::TRIGGER; //<-- start group (customize)
void action();
void loop()
easyvr.setPinOutput(EasyVR::IO1, HIGH); // LED on (listening)
Serial.print("Say a command in Group ");
Serial.println(group);
easyvr.recognizeCommand(group);
do
// can do some processing while waiting for a spoken command
68
while (!easyvr.hasFinished());
easyvr.setPinOutput(EasyVR::IO1, LOW); // LED off
idx = easyvr.getWord();
if (idx >= 0)
// built-in trigger (ROBOT)
// group = GROUP_X; <-- jump to another group X
return;
idx = easyvr.getCommand();
if (idx >= 0)
// print debug message
uint8_t train = 0;
char name[32];
Serial.print("Command: ");
Serial.print(idx);
if (easyvr.dumpCommand(group, idx, name, train))
Serial.print(" = ");
Serial.println(name);
else
Serial.println();
easyvr.playSound(0, EasyVR::VOL_FULL);
// perform some action
action();
else // errors or timeout
if (easyvr.isTimeout())
69
Serial.println("Timed out, try again...");
int16_t err = easyvr.getError();
if (err >= 0)
Serial.print("Error ");
Serial.println(err, HEX);
void action()
switch (group)
case GROUP_0:
switch (idx)
case G0_PRESIDENT:
digitalWrite(5,HIGH);// write your action code here
group = GROUP_1;// group = GROUP_X; <-- or jump to another group X for
composite commands
break;
break;
case GROUP_1:
switch (idx)
case G1_UNIVERSITY:
digitalWrite(5,LOW);
digitalWrite(6,HIGH);// write your action code here
group = GROUP_2;// group = GROUP_X; <-- or jump to another group X for
composite commands
break;
70
break;
case GROUP_2:
switch (idx)
case G2_DORMITORY:
digitalWrite(6,LOW);
digitalWrite(7,HIGH);
delay(10000);
digitalWrite(7,LOW);// write your action code here
group = GROUP_0;// group = GROUP_X; <-- or jump to another group X for
composite commands
break;
break;
case GROUP_16:
switch (idx)
case G16_PASSWORD:
// write your action code here
// group = GROUP_X; <-- or jump to another group X for composite commands
break;
case G16_FINISH:
// write your action code here
// group = GROUP_X; <-- or jump to another group X for composite commands
break;
break;