You are on page 1of 45

VOICE BASED APPLIANCE CONTROL

Project report submitted in partial fulfilment of the requirements For the award
of the degree of
BACHELOR OF TECHNOLOGY In ELECTRONICS AND COMMUNICATION ENGINEERING
By K.Sowjanya(09241A04A6) G.Sowjanya (09241A04A7) M.Sridevi (09241A04B0) K.Sushm
a(09241A04B5)
Under the guidance of Mr.Y.Sudarshan Reddy (Assistant Professor)
Page i
VOICE BASED APPLIANCE CONTROL
Department of Electronics and Communication Engineering GOKARAJU RANGARAJU INSTI
TUTE OF ENGINEERING & TECHNOLOGY, BACHUPALLY, HYDERABAD-72 2013 GOKARAJU RANGARA
JU INSTITUTE OF ENGINEERING & TECHNOLOGY Hyderabad, Andhra Pradesh.
DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING
CERTIFICATE
This is to certify that the project report entitled IMPLEMENTATION OF DIRECT DIGI
TAL SYTHESIZER AD9850 USING ARDUINO UNO that is being submitted by k.Sowjanya,G.S
owjanya,M.Sridevi,K.sushmaunder the guidance of Mr.Y.Sudarshan Reddy in partial
fulfilment for the award of the Degree of Bachelor of Technology in Electronics
and Communication Engineering to the Jawaharlal Nehru Technological University i
s a record of bonafide work carried out by them under my guidance and supervisio
n. The results embodied in this project report have not been submitted to any ot
her University or Institute for the award of any graduation degree.
Prof Ravi BillaMr.Y.SudarshanExternal Examiner HOD, ECE Dept, GRIET,Hyderabad (I
nternal Guide) Asst.Professor,ECEDept, GRIET, Hyderabad
Page ii
VOICE BASED APPLIANCE CONTROL
ACKNOWLEDGEMENT
We have immense pleasure in expressing our thanks and deep sense of gratitude to
our guide Mr.Y.SudarshanRedddy, Assistant Professor, Department of Electronics
and Communication Engineering, G.R.I.E.T for his guidance throughout this projec
t.
We also express our sincere thanks to Prof. Ravi Billa, Head of the Department,
G.R.I.E.Tfor extending his help.
We wish to express our profound sense of gratitude to Prof. P. S. Raju, Director
, G.R.I.E.Tfor his encouragement, and for all facilities to complete this projec
t.
Finally we express our sincere gratitude to all the members of faculty and my fr
iends who contributed their valuable advice and helped to complete the project s
uccessfully.
K.Sowjanya G.Sowjanya
(09241A04A6) (09241A04A7)
M.Sridevi (09241A04B0) K.Sushmasree (09241A04B5)
Page iii
VOICE BASED APPLIANCE CONTROL
ABSTRACT
This is a wireless, voice control system. People can control almost all the appl
iances at home including lights, fans or even back ground music. Microphone is i
nterfaced with voice chip to enable voice based recognition.special characters a
re used to control various peripheral devices connected.EasyVR ,The goal of our
project is to design real time voice controlled appliances which brings more con
venience to people's lives.
Hardware:
Aurduino Uno Board Triac Shield EasyVR Shield
Page iv
VOICE BASED APPLIANCE CONTROL
Page v
VOICE BASED APPLIANCE CONTROL
LIST OF FIGURES
1.Arduino
1.1 Arduino board..1 1.2 ATMEGA 328 pin mapping
2.Triac shield
2.1Triac symbol.7 2.2 Basic structure of triac
3.EasyVR Shield
3.1 EasyVR module12 3.2 EasyVR chip.
R.....29
Page vi
VOICE BASED APPLIANCE CONTROL
Contents:
1.Introduction to Arduino..1 2.Triac Shield -Triac
3.EasyVR Shield -Introdution..11 -Features.
Page vii
VOICE BASED APPLIANCE CONTROL
Page viii
VOICE BASED APPLIANCE CONTROL
Introduction to Arduino
. The Arduino Uno is a microcontroller board based on the ATmega328. It has 14 d
igital input/output pins (of which 6 can be used as PWM outputs), 6 analog input
s, a 16 MHz ceramic resonator, a USB connection, a power jack, an ICSP header, a
nd a reset button. It contains everything needed to support the microcontroller;
simply connect it to a computer with a USB cable or power it with a AC-to-DC ad
apter or battery to get started.
Fig 1.1 Arduino Board
Page 1
VOICE BASED APPLIANCE CONTROL
Features of Uno board Microcontroller Operating Voltage ATmega328 5V
Input Voltage (recommended) 7-12V Input Voltage (limits) Digital I/O Pins Analog
Input Pins DC Current per I/O Pin DC Current for 3.3V Pin Flash Memory SRAM EEP
ROM Clock Speed POWER The Arduino Uno can be powered via the USB connection or w
ith an external power supply. The power source is selected automatically. Extern
al (non-USB) power can come either from an AC-to-DC adapter (wall-wart) or batte
ry. The adapter can be connected by plugging a 2.1mm center-positive plug into t
he board's power jack. Leads from a battery can be inserted in the Gnd and Vin p
in headers of the POWER connector. 6-20V 14 (of which 6 provide PWM output) 6 40
Ma 50 mA 32 KB (ATmega328) of which 0.5 KB used by bootloader 2 KB (ATmega328)
1 KB (ATmega328) 16 MHz
Page 2
VOICE BASED APPLIANCE CONTROL
Fig 1.2 ATmega Pin Mapping Arduino programming Click on the Arduino executable w
hich has the Arduino logo The following screen com
Fig 1.3 Arduino Programming Window
Page 3
VOICE BASED APPLIANCE CONTROL
The programs written for Arduino are called sketches. For the sketch to work on
your Arduino Uno, there are two hardware related settings you need to make in th
e Arduino IDE Board Serial Port For selecting the board, go to the Tools tab and
select Board. From the menu select Uno.
Fig 1.4 Arduino Port selection
When you connect your Arduino Uno to the USB port of your laptop, it will be map
ped as a serial port. To know the serial port to which your Arduino is mapped, f
ollow the following procedure
Right click on My Computer Select the Manage option In the pop up screen for Com
puter Management, select the Device Manager
Page 4
VOICE BASED APPLIANCE CONTROL
Expand the Ports item, the Arduino Uno will appear as one of the drop down items
Fig 1.5 Checking for connected Port In the Arduino IDE, select the Serial Port a
s the port to which the Arduino is mapped.
Page 5
VOICE BASED APPLIANCE CONTROL
The basic structure of the Arduino sketch is fairly simple and has two required
functions: void setup() { statements; } void loop() { statements; } Where setup(
) is the preparation, loop() is the execution. Both functions are required for t
he program to work.
Page 6
VOICE BASED APPLIANCE CONTROL
INTRODUCTION TO TRIAC SHIELD Triac shield consists of triac and opto-isolator wh
ich are explained below: Construction and Operation: The triac is another three-
terminal ac switch that is triggered into conduction when a lowenergy signal is
applied to its gate terminal. Unlike the SCR, the triac conducts in either direc
tion when turned on. The triac also differs from the SCR in that either a positi
ve or negative gate signal triggers it into conduction. Thus the triac is a thre
e terminal, four layer bidirectional semiconductor device that controls ac power
whereas an SCR controls dc power or forward biased half cycles of ac in a load.
Because of its bidirectional conduction property, the triac is widely used in t
he field of power electronics for control purposes. Triacs of 16 kW rating are r
eadily available in the market. Triac is an abbreviation for three terminal ac swi
tch. Tri-indicates that the device has three terminals and ac indicates that the dev
ice controls alternating current or can conduct in either direction.
Fig 2.1 Triac symbol Construction of a Triac: As mentioned above, triac is a thr
ee terminal, four layer bilateral semiconductor device. It incorporates two SCRs
connected in inverse parallel with a common gate terminal in a single chip devi
ce. The arrangement of the triac is shown in figure. As seen, it has six doped r
egions. The gate terminal G makes ohmic contacts with both the N and P materials
. This
Page 7
VOICE BASED APPLIANCE CONTROL
permits trigger pulse of either polarity to start conduction. Electrical equival
ent circuit and schematic symbol are shown in figure.b and figure.c respectively
. Since the triac is a bilateral device, the term anode and cathode has no meaning,
and therefore, terminals are designated as main terminal 1. (MT1), main terminal
2 (MT2) and gate G. To avoid confusion, it has become common practice to specif
y all voltages and currents using MT1 as the reference.
Fig 2.2 Basic Structure of Triac Operation and Working of a Triac: Though the tr
iac can be turned on without any gate current provided the supply voltage become
s equal to the breakover voltage of the triac but the normal way to turn on the
triac is by applying a proper gate current. As in case of SCR, here too, the lar
ger the gate current, the smaller the supply voltage at which the triac is turne
d on. Triac can conduct current irrespective of the voltage polarity of terminal
s MT1 and MT2 with respect to each other and that of gate and terminal MT2. Cons
equently four different possibilities of operation of triacexists. They are:
1. Terminal
MT2 and gate are positive with respect to terminal MT1
Page 8
VOICE BASED APPLIANCE CONTROL
When terminal MT2 is positive with respect to terminal MT1 current flows through
path P1N1-P2-N2. The two junctions P1-N1 and P2-N2 are forward biased whereas j
unction N1 P2 is blocked. The triac is now said to be positively biased. A posit
ive gate with respect to terminal MT1 forward biases the junction P2-N2 and the
breakdown occurs as in a normal SCR. 2. Terminal MT2 is positive but gate is neg
ative with respect to terminal MT1 Though the flow path of current remains the s
ame as in mode 1 but now junction P 2-N3 is forward biased and current carriers
injected into P2 turn on the triac. 3.Terminal MT2 and gate are negative with re
spect to terminal MT1 When terminal MT2 is negative with respect to terminal MT1
, the current flow path is P2-N1P1-N4. The two junctions P2-N1 and P1 - N4 are f
orward biased whereas junction N1-P1 is blocked. The triac is now said to be neg
atively biased. A negative gate with respect to terminal MT1 injects current car
riers by forward biasing junction P2-N3 and thus initiates the conduction. 4. Te
rminal MT2 is negative but gate is positive with respect to terminal MT1 Though
the flow path of current remains the same as in mode 3 but now junction P2-N2 is
forward biased, current carriers are injected and therefore, the triac is turne
d on. Generally, trigger mode 4 should be avoided especially in circuits where h
igh di/dt may occur. The sensitivity of triggering modes 2 and 3 is high and in
case of marginal triggering capability negative gate pulses should be used. Thou
gh the triggering mode 1 is more sensitive compared to modes 2 and 3, it require
s a positive gate trigger. However, for bidirectional control and uniform gate t
rigger modes 2 and 3 are preferred.
Applications of Triac Next to SCR, the triac is the most widely used member of t
he thyristor family. In fact, in many of control applications, it has replaced S
CR by virtue of its bidirectional conductivity. Motor speed regulation, temperat
ure control, illumination control, liquid level control, phase control circuits,
power switches etc. are some of its main applications. However, the triac is le
ss versatile than the SCR when turn-off is considered. Because the triac can con
duct in either direction, forced commutation by reverse-biasing cannot be employ
ed. So turn-off is either by current starvation, which is usually impracticable,
Page 9
VOICE BASED APPLIANCE CONTROL
or else by ac line commutation. There are two limitations enforced on the use of
triac at present state of commercially available devices (200 A and 1,000 PRV).
The first is the frequency handling capability produced by the limiting dv/dt at
which the triac remains blocking when no gate signal is applied. This dv/dt val
ue is about 20 Vmicros-1 compared with a general figure of 200 Vmicro s-1 for th
e SCR, so that the limitation of frequency is at the power level of 50 Hz. The s
ame dv/dt limitation means the load to be controlled is preferably a resistive o
ne. When high frequencies and high dv/dt are involved then the backto-back SCRs
cannot be replaced by the triac.
Opto-isolator: An optoisolator, also known as an optical coupler or optocoupler,
is a semiconductor device that allows signals to be transferred between circuit
s or systems, while keeping those circuits or systems electrically isolated from
each other. Optoisolators are used in a wide variety of communications, control
, and monitoring systems. In its simplest form, an optoisolator consists of an l
ight-emitting diode (LED), IRED (infrared-emitting diode), or laser diode for si
gnal transmission, and a photosensor for signal reception. The "transmitter" tak
es the electrical signal and converts it into aa beam of modulated visible light
or infrared (IR). This beam travels across a transparent gap and is picked up b
y the "receiver," which converts the modulated light or IR back into an electric
al signal. The electrical output waveform is identical to the electrical input w
aveform, although the input and output amplitudes (signal strengths) often diffe
r. The optoisolator is enclosed in a single package, and has the appearance of a
n integrated circuit (IC) or a transistor with extra leads.
Page 10
VOICE BASED APPLIANCE CONTROL
Fig 2.3 Optoisolator A common application of an optoisolator is in a specialized
modem that allows a computer to be connected to a telephone line without risk o
f damage from electrical transients (also called "surges" or "spikes"). Two opto
isolators are employed in the analog section of the device: one for upstream sig
nals and the other for downstream signals. If a transient occurs on the telephon
e line (and these are common), the computer will be unaffected because the optic
al gap does not conduct electric current. For this reason, modems that use optoi
solators provide superior protection against transients compared with modems inc
orporating electrical surge suppressors alone. (An electrical surge suppressor s
hould be installed between the optoisolator and the telephone line for optimum p
rotection.) Photodiode opto-isolators Diode opto-isolators employ LEDs as source
s of light and silicon photodiodes as sensors. When the photodiode is reverse-bi
ased with an external voltage source, incoming light increases the reverse curre
nt flowing through the diode. The diode itself does not generate energy; it modu
lates the flow of energy from an external source. This mode of operation is call
ed photoconductive mode. Alternatively, in the absence of external bias the diod
e converts the energy of light into electric energy by charging its terminals to
a voltage of up to 0.7 V. The rate of charge is proportional to the intensity o
f incoming light. The energy is harvested by draining the charge through an exte
rnal high-impedance path; the ratio of current transfer can reach 0.2%.] This mo
de of operation is called photovoltaic mode.
Page 11
VOICE BASED APPLIANCE CONTROL
INTRODUCTION TO EASYVR: EasyVR is the second generation version of the successfu
l VRbot Module. It is a multipurpose speech recognition module designed to easil
y add versatile, robust and cost effective speech recognition capabilities to vi
rtually any application. The EasyVR module can be used with any host with an UAR
T interface powered at 3.3V 5V, such as PIC and Arduino boards. Some application
examples include home automation, such as voice controlled light switches, lock
s or beds, or adding hearing to the most popular robots on the market.
Fig 3.1 EasyVR Module
Page 12
VOICE BASED APPLIANCE CONTROL
EasyVR Features:
A host of built-in Speaker Independent (SI) commands for ready to run basic contr
ols, in the followings languages: o English (US) o Italian o German o French o S
panish o Japanese Supports up to 32 user-defined Speaker Dependent (SD) triggers
or commands as well as VoicePasswords. SD custom commands can be spoken in ANY l
anguage. Easy -to-use and simple Graphical User Interface to program Voice Command
s and audio. Module can be used with any host with an UART interface (powered at 3
.3V- 5V) Simple and robust documented serial protocol to access and program throug
h the host board 3 GPIO lines (IO1, IO2, IO3) that can be controlled by new protoc
olcommands. PWM audio output that supports 8 speakers. Sound playback of up to 9 minu
tes of recorded sounds or speech.
Page 13
VOICE BASED APPLIANCE CONTROL
Technical specifications
Physical dimensions and pin assignment
Fig 3.2 EasyVR Chip
Page 14
VOICE BASED APPLIANCE CONTROL
Page 15
VOICE BASED APPLIANCE CONTROL
Fig 3.3 Serial Data Frame Format
Page 16
VOICE BASED APPLIANCE CONTROL
Microphone
The microphone provided with the EasyVR module is an omnidirectional electret co
ndenser microphone (Horn EM9745P-382): Sensitivity -38dB (0dB=1V/Pa @1KHz) Load Impe
dance 2.2K Operating Voltage 3V Almost flat frequency response in range 100Hz 20kHz I
f you use a microphone with different specifications the recognition accuracy ma
y be adversely affected. No other kind of microphone is supported by the EasyVR.
Audio Output
The EasyVR audio output interface is capable of directly driving an 8 speaker. It
could also be connected to an external audio amplifier to drive lower impedance
loudspeakers It is possible to connect higher impedance loads such as headphone
s, provided that you scale down the output power according to the speaker rating
s, for example using a series resistor. The exact resistor value depends on the
headphone power ratings and the desired output volume (usually in the order of 1
0k).
General Purpose I/O
Since the EasyVR communication interface takes two pins of the host controller,
a few spare I/O pins are provided, that can be controlled with the communication
protocol, to get those pins back for basic tasks, such as lighting an LED. The
three I/O pins IO1IO3 are connected directly to the embedded microcontroller on t
he EasyVR module,so they are referenced to the internal 3.0V regulated power sup
ply. If you need to interface to circuits using adifferent supply, there are a n
umber of solutions you can adopt. Some of these are outlined below (here Ionindi
cates any one of the three I/O pins of the EasyVR).
Page 17
VOICE BASED APPLIANCE CONTROL
Quick start for using the module EasyVR on Arduino
You can connect the EasyVR module to an Arduino board basically in two ways: 1.
Bridge mode You can control the module using a software serial library and conne
ct to the module with the EasyVR Commander from your PC, with the same pin confi
guration 2. Adapter mode You can use the Arduino board as a USB/Serial adapter b
y holding the microcontroller in reset, but you need to change the connections o
nce you want to control the module from the microcontroller
Bridge mode
This is the preferred connection mode, since it allows simple communication with
both the Arduinomicrocontroller and the PC. All the provided examples for Ardui
no manage the bridge mode automaticallywhen the EasyVR Commander requests a conn
ection.
Fig 3.4 Bridge Mode Connection
Page 18
VOICE BASED APPLIANCE CONTROL
Automatic bridge mode used to be supported only on Arduino boards with a bootloa
der implementingEEPROM programming. The latest version of EasyVR Commander (sinc
e 3.1.x) and Arduino libraries (since 1.1) does not rely on thatfeature anymore,
so it should work on all Arduino boards.
Adapter mode
This connection scheme has the advantage of working with any Arduino board that
has an on-boardUSB/Serial adapter and not needing a spare input pin to enter bri
dge mode. Also, it does not rely on the AVR microcontroller to do any software b
ridge between communication pins, soit can be used to check your hardware in cas
e of connection problems. Using this method also allows you to download a Sound
Table to the EasyVR module, provided you alsoconfigure the module to start in bo
ot mode
Fig 3.5 Adapter Mode Connection This configuration, with Reset shorted to GND, i
s for connection with the EasyVR Commander. To use themodule from the Arduino mi
crocontroller, you need to remove the short (yellow wire) and move the ETX/ERXco
nnection to other pins. The example code uses pin 12 for ETX and pin 13 for ERX,
like the above bridgemode.
Arduino software
Follow these few steps to start playing with your EasyVR module and Arduino: 1.
Connect the EasyVR module to your Arduino board as outlined before
Page 19
VOICE BASED APPLIANCE CONTROL
2. If you want audio output, connect an 8 speaker to J2 header 3. Connect the sup
plied microphone to the MIC (J3) connector 4. Copy the EasyVR library to your Ar
duino libraries folder on your PC 5. Connect your Arduino board to your PC via USB
.
Fig 3.6 EasyVR Library Installation To check everything is working fine: 1. Make
sure you activate bridge mode (either manually or automatically) or you use ada
pter mode 2. Open the EasyVR Commander and connect to the Arduino serial port (s
ee Getting Started) To download a new sound-table: 1. Power OFF the EasyVR modul
e (for example removing the USB cable) 2. Connect the /XM pin of J4 on the EasyV
R module for boot mode (see Flash Update for a possible circuit) 3. Power ON aga
in the EasyVR module and the Arduino board (reconnect the USB cable) 4. Make sur
e you activate bridge mode (either manually or automatically) or you use adapter
mode 5. Open the EasyVR Commander and select the Arduino serial port
Page 20
VOICE BASED APPLIANCE CONTROL
6. While disconnected choose Update Sound Table from the Toolsmenu .
Fig 3.7 Testing EasyVR Programming on Arduino
To test the EasyVR module with your Arduino programming IDE: 1. Make sure you di
d not activate bridge mode manually 2. Open the example sketch TestEasyVR from y
our IDE menu File > Examples > EasyVR 3. Upload the sketch and open the Serial Monitor
indow 4. See comments on top of the sketch for usage details
Page 21
VOICE BASED APPLIANCE CONTROL
When the EasyVR Commander is connected, you can also generate a template code fo
r Arduino, that willuse the provided libraries .
Page 22
VOICE BASED APPLIANCE CONTROL
Technical specifications Physical dimensions and pin assignment
Fig 3.8 Pin Structure of EasyVR Shield
Page 23
VOICE BASED APPLIANCE CONTROL
Jumper settings
J12 Operating mode This jumper selects the operating mode of the EasyVR Shield a
nd it can be placed in one of four positions: oUP Flash update mode Use it for f
irmware updates or to download sound table data to the on-board flash memory fro
m theEasyVR Commander. In this mode, the Arduino controller is held in reset and
only the embeddedUSB/Serial adapter is used. The EasyVR module is set in boot m
ode. oPC PC connection mode Use it for direct connection with the EasyVR Command
er. In this mode, the Arduino controller is heldin reset and only the embedded U
SB/Serial adapter is used. oHW Hardware serial mode Use it for controlling the E
asyVR module from your Arduino sketch through the hardware serial port(using pin
s 0-1). oSW Software serial mode
Page 24
VOICE BASED APPLIANCE CONTROL
Use it for controlling the EasyVR module from your Arduino sketch through a soft
ware serial port(using pins 12-13). You can also connect the EasyVR Commander in
this mode, provided that therunning sketch implements bridge mode (see librarie
s).
LEDs
A green LED (D6) is connected to IO1 pin and can be controlled by the users progr
am to show feedbackduring recognition tasks, for example. This LED is on by defa
ult after reset or power up.The red LED (D5) lights up when you set the shield t
o flash update mode (see Jumper settings).
Quick start for using the Shield
Follow these few steps to start playing with your EasyVR Shield and Arduino: 1.
Insert the EasyVR Shield on top of your Arduino board 2. If you want audio outpu
t, either wire an 8 speaker into the screw terminals (J10) or connectheadphones t
o the 3.5mm output jack (J9) 3. Connect the supplied microphone to the MIC IN (J
11) connector. 4. Copy the EasyVR library to your Arduino libraries folder on your
PC 5. Connect your Arduino board to your PC via USB. To test the Shield with yo
ur Arduino programming IDE: 1. Set the jumper (J12) in the SW position 2. Open t
he example sketch TestEasyVR from your IDE menu File > Examples > EasyVR 3. Upload the
sketch and open the Serial Monitor window 4. See comments on top of the sketch fo
r usage details Keep in mind that if you have a bridge code running (all examples
do) on Arduino, you can connect theEasyVR Commander leaving the jumper in the SW
position, just make sure the monitor window is closed. When the EasyVR Commande
r is connected, you can also generate a template code for Arduino, that willuse
the provided libraries . All you need is to write actions for each recognized co
mmand.
Page 25
VOICE BASED APPLIANCE CONTROL
EasyVR Programming
Communication Protocol Introduction Communication with the EasyVR module uses a
standard UART interface compatible with 3.3-5V TTL/CMOS logical levels, accordin
g to the powering voltage VCC. A typical connection to an MCU-based host:
The initial configuration at power on is 9600 baud, 8 bit data, No parity, 1 bit
stop. The baud rate can bechanged later to operate in the range 9600 - 115200 b
aud. The communication protocol only uses printable ASCII characters, which can
be divided in two main groups: Command and status characters, respectively on the
TX and RX lin es, chosen among lower-caseletters. Command arguments or status deta
ils, again on the TX and RX lines, spanning the range of capitalletters. Each co
mmand sent on the TX line, with zero or more additional argument bytes, receives
an answer on theRX line in the form of a status byte followed by zero or more a
rguments. There is a minimum delay before each byte sent out from the EasyVR mod
ule to the RX line, that is initiallyset to 20 ms and can be selected later in t
he ranges 0 - 9 ms, 10 - 90 ms, and 100 ms - 1 s. That accountsfor slower or fas
ter host systems and therefore suitable also for software-based serial communica
tion (bitbanging). Since the EasyVR serial interface also is software-based, a v
ery short delay might be needed beforetransmitting a character to the module, es
pecially if the host is very fast, to allow the EasyVR to get backlistening to a
new character.
Page 26
VOICE BASED APPLIANCE CONTROL
The communication is host-driven and each byte of the reply to a command has to
be acknowledged by thehost to receive additional status data, using the space ch
aracter. The reply is aborted if any other characteris received and so there is
no need to read all the bytes of a reply if not required. Invalid combinations o
f commands or arguments are signaled by a specific status byte.
EasyVR Commander
The EasyVR Commander software can be used to easily configure your EasyVR module
connected to yourPC through an adapter board, or by using the microcontroller h
ost board with the provided bridge program(available for ROBONOVA controller board
, Arduino 2009/UNO, Parallax Basic Stamp). You can define groups of commands or
passwords and generate a basic code template to handle them. It isrequired to ed
it the generated code to implement the application logic, but the template conta
ins all thefunctions or subroutines to handle the speech recognition tasks. Gett
ing Started Connect the adapter board or a microcontroller host board with a run
ning bridge program1 to your PC, andthen check that all devices are properly turne
d on and start the EasyVR Commander. Select the serial port to use from the tool
bar or the File menu, and then go with the Connect command.
Page 27
VOICE BASED APPLIANCE CONTROL
Fig 3.9 EasyVR Commander
There are four kinds of commands in the software (see Figure 3 and Figure 6): Tri
gger - is a special group where you have the built-in SI trigger word "Robot" an
d you may add one user-defined SD trigger word. Trigger words are used to start
the recognition process Group - where you may add user-defined SD commands Passwor
d - a special group for "vocal passwords" (up to five), using Speaker Verificati
on (SV) technology Wordset- built-in set of SI commands (for instance in Figure 3
above, the Wordset 1 is selected)
Page 28
VOICE BASED APPLIANCE CONTROL
Speech Recognition
The recognition function of the EasyVR works on a single group at a time, so tha
t users need to grouptogether all the commands that they want to be able to use
at the same time. When EasyVR Commander connects to the module, it reads back al
l the user-defined commands andgroups, which are stored into the EasyVR module n
on-volatile memory. You can add a new command by first selecting the group in wh
ich the command needs to be created andthen using the toolbar icons or the Edit me
nu. A command should be given a label and then it should be trained twice with t
he user's voice: the user will beguided throughout this process (see Figure 4) w
hen the "Train Command" action is invoked.
Fig 3.10 Training Phases of EasyVR Guided training dialog After clicking on Phas
e 1 or Phase 2 buttons, remember to start speaking only when you see this little
window:
If any error happens, command training will be cancelled. Errors may happen when
the users voice is notheard correctly, there is too much background noise or whe
n the second word heard is too different from thefirst one.
Page 29
VOICE BASED APPLIANCE CONTROL
Alert dialog in case of conflictThe software will also alert if a command is too
similar to an existing one by specifying the index of theconflicting command in
the "Conflict" column. For example, in the following Figure 6 the command"TEST_
CMD_ONE" sounds too similar to "TEST_CMD_ZERO" (i.e. they have been trained with
a similarpronunciation).
The current status is displayed in the EasyVR Commander list view where groups t
hat already containcommands are highlighted in bold. The selected group of comma
nds can also be tested, by using the icon on the toolbar or the Tools menu,to make
sure the trained commands can be recognized successfully.
Page 30
VOICE BASED APPLIANCE CONTROL
PROJECT PROGRAM:
#if defined(ARDUINO) && ARDUINO >= 100 #include "Arduino.h" #include "SoftwareSe
rial.h" SoftwareSerialport(12,13); #else // Arduino 0022 - use modified NewSoftS
erial #include "WProgram.h" #include "NewSoftSerial.h" NewSoftSerialport(12,13);
#endif
#include "EasyVR.h" EasyVReasyvr(port);
//Groups and Commands enum Groups { GROUP_1 = 1, };
enum Group1 { G1_LIGHTS_ON = 0, G1_LIGHTS_OFF = 1, };
EasyVRBridgebridge;
int8_t group, idx;
Page 31
VOICE BASED APPLIANCE CONTROL
void setup() { pinMode(A4,OUTPUT); pinMode(A5,OUTPUT); digitalWrite(A4,HIGH); di
gitalWrite(A5,HIGH); // bridge mode? if (bridge.check()) { 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!"); easyv
r.setTimeout(5); easyvr.setLanguage(0);
group = GROUP_1; //<-- start group (customize) }
void action();
Page 32
VOICE BASED APPLIANCE CONTROL
void loop() {
easyvr.setPinOutput(EasyVR::IO1, HIGH); // LED on (listening)
Serial.print("Say a command in Group "); Serial.println(group); easyvr.recognize
Command(group);
do { // can do some processing while waiting for a spoken command } while (!easy
vr.hasFinished());
easyvr.setPinOutput(EasyVR::IO1, LOW); // LED off
idx = easyvr.getWord(); if (idx>= 0) { // built-in trigger (ROBOT) // group = GR
OUP_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("Co
mmand: ");
Page 33
VOICE BASED APPLIANCE CONTROL
Serial.print(idx); if (easyvr.dumpCommand(group, idx, name, train)) { Serial.pri
nt(" = "); Serial.println(name); } else Serial.println(); easyvr.playSound(0, Ea
syVR::VOL_FULL); // perform some action action(); } else // errors or timeout {
if (easyvr.isTimeout()) 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_1: switch (idx)
Page 34
VOICE BASED APPLIANCE CONTROL
{ case G1_LIGHTS_ON: {Serial.println("lights on"); digitalWrite(A4,LOW); digital
Write(A5,LOW);
}
// write your action code here // group = GROUP_X; <-- or jump to another group
X for composite commands break; case G1_LIGHTS_OFF: { Serial.println("lights off
"); digitalWrite(A4,HIGH); digitalWrite(A5,HIGH);
} // write your action code here // group = GROUP_X; <-- or jump to another grou
p X for composite commands break; } break; } }
Page 35
VOICE BASED APPLIANCE CONTROL
References: https://www.sparkfun.com/products/10963 http://www.veear.eu/products
/easyvr/ http://en.wikipedia.org/wiki/Voice_recognition http://www.epictinker.co
m/ProductDetails.asp?ProductCode= VAR-01770
Page 36

You might also like