44
VOICE BASED APPLIANCE CONTROL Page i 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.Sushma(09241A04B5) Under the guidance of Mr.Y.Sudarshan Reddy (Assistant Professor)

Voice Based Appliance Control

Embed Size (px)

DESCRIPTION

Voice Based Appliance Control

Citation preview

Page 1: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page i

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.Sushma(09241A04B5)

Under the guidance of

Mr.Y.Sudarshan Reddy

(Assistant Professor)

Page 2: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page ii

Department of Electronics and Communication Engineering

GOKARAJU RANGARAJU INSTITUTE OF ENGINEERING & TECHNOLOGY,

BACHUPALLY, HYDERABAD-72

2013

GOKARAJU RANGARAJU INSTITUTE OF ENGINEERING & TECHNOLOGY

Hyderabad, Andhra Pradesh.

DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING

C E R T I F I C A T E

This is to certify that the project report entitled “IMPLEMENTATION OF DIRECT

DIGITAL SYTHESIZER AD9850 USING ARDUINO UNO” that is being submitted by

k.Sowjanya,G.Sowjanya,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 is a record of bonafide work carried out by them under my guidance and

supervision. The results embodied in this project report have not been submitted to any other

University or Institute for the award of any graduation degree.

Prof Ravi BillaMr.Y.SudarshanExternal Examiner

HOD, ECE Dept, Asst.Professor,ECEDept,

GRIET,Hyderabad GRIET, Hyderabad

(Internal Guide)

Page 3: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page iii

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 project.

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 project.

Finally we express our sincere gratitude to all the members of faculty and my friends

who contributed their valuable advice and helped to complete the project successfully.

K.Sowjanya (09241A04A6)

G.Sowjanya (09241A04A7)

M.Sridevi (09241A04B0)

K.Sushmasree (09241A04B5)

Page 4: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page iv

ABSTRACT

This is a wireless, voice control system. People can control almost all the appliances at home

including lights, fans or even back ground music. Microphone is interfaced with voice chip to

enable voice based recognition.special characters are used to control various peripheral

devices connected.EasyVR ,The goal of our project is to design real time voice controlled

appliances which brings more convenience to people's lives.

Hardware:

Aurduino Uno Board

Triac Shield

EasyVR Shield

Page 5: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page v

Page 6: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page vi

LIST OF FIGURES

1.Arduino

1.1 Arduino board…………………………………………………………………………..1

1.2 ATMEGA 328 pin mapping……………………………………………………………3

1.3 Arduino programming window…………………………………………………………3

1.4 Arduino port selection………………………………………………………………….4

1.5 Checking for connected ports…………………………………………………………..5

2.Triac shield

2.1Triac symbol…………………………………………………………………………….7

2.2 Basic structure of triac…………………………………………………………………..8

2.3 Opto isolator…………………………………………………………………………….10

3.EasyVR Shield

3.1 EasyVR module…………………………………………………………………………12

3.2 EasyVR chip…………………………………………………………………………….14

3.3 Serial data frame format………………………………………………………………...16

3.4 Bridge mode connection…………………………………………………………….…..18

3.5 Adapter mode connection…………………………………………………………….....19

3.6EasyVRlibraryinstallation………………………………………………………….…20

3.7 Testing EasyVRonarduino………………………………………………………….…21

3.8 Pin structure of EasyVR shield………………………………………………………....23

3.9 EasyVR commander……………………………………………………………….…....28

3.10Training phases of EasyVR………………………………………………………….....29

Page 7: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page vii

Contents:

1.Introduction to Arduino……………………………………………………………..1

2.Triac Shield

-Triac………………………………………………………………………..…7

-Opto-isolator…………………………………………………………………10

3.EasyVR Shield

-Introdution………………………………………………………………..…11

-Features………………………………………………………………….….12

-Working of hardware and software………………………………………...18

4.Interfacing and Proramming……………………………………………………..…31

5.References……………………………………………………………………….…36

Page 8: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page viii

Page 9: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page 1

Introduction to Arduino

. The Arduino Uno is a microcontroller board based on the ATmega328. It has 14 digital

input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz

ceramic resonator, a USB connection, a power jack, an ICSP header, and 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 adapter or battery to get started.

Fig 1.1 Arduino Board

Page 10: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page 2

Features of Uno board

Microcontroller ATmega328

Operating Voltage 5V

Input Voltage (recommended) 7-12V

Input Voltage (limits) 6-20V

Digital I/O Pins 14 (of which 6 provide PWM output)

Analog Input Pins 6

DC Current per I/O Pin 40 Ma

DC Current for 3.3V Pin 50 mA

Flash Memory 32 KB (ATmega328) of which 0.5 KB used by bootloader

SRAM 2 KB (ATmega328)

EEPROM 1 KB (ATmega328)

Clock Speed 16 MHz

POWER

The Arduino Uno can be powered via the USB connection or with an external power supply.

The power source is selected automatically.

External (non-USB) power can come either from an AC-to-DC adapter (wall-wart) or battery.

The adapter can be connected by plugging a 2.1mm center-positive plug into the board's

power jack. Leads from a battery can be inserted in the Gnd and Vin pin headers of the

POWER connector.

Page 11: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page 3

Fig 1.2 ATmega Pin Mapping

Arduino programming

Click on the Arduino executable which has the Arduino logo

The following screen com

Fig 1.3 Arduino Programming Window

Page 12: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page 4

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 the 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 mapped as a

serial port. To know the serial port to which your Arduino is mapped, follow the following

procedure

Right click on My Computer

Select the Manage option

In the pop up screen for Computer Management, select the Device Manager

Page 13: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page 5

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 as the port to which the Arduino is mapped.

Page 14: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page 6

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 the

program to work.

Page 15: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page 7

INTRODUCTION TO TRIAC SHIELD

Triac shield consists of triac and opto-isolator which are explained below:

Construction and Operation:

The triac is another three-terminal ac switch that is triggered into conduction when a low-

energy signal is applied to its gate terminal. Unlike the SCR, the triac conducts in either

direction when turned on. The triac also differs from the SCR in that either a positive or

negative gate signal triggers it into conduction. Thus the triac is a three 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 the field of power electronics for control purposes. Triacs

of 16 kW rating are readily available in the market.

“Triac” is an abbreviation for three terminal ac switch. „Tri‟-indicates that the device has

three terminals and „ac‟ indicates that the device controls alternating current or can conduct in

either direction.

Fig 2.1 Triac symbol

Construction of a Triac:

As mentioned above, triac is a three terminal, four layer bilateral semiconductor device. It

incorporates two SCRs connected in inverse parallel with a common gate terminal in a single

chip device. The arrangement of the triac is shown in figure. As seen, it has six doped

regions. The gate terminal G makes ohmic contacts with both the N and P materials. This

Page 16: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page 8

permits trigger pulse of either polarity to start conduction. Electrical equivalent 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 specify all voltages and currents using MT1 as

the reference.

Fig 2.2 Basic Structure of Triac

Operation and Working of a Triac:

Though the triac can be turned on without any gate current provided the supply voltage

becomes 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 larger the gate current, the

smaller the supply voltage at which the triac is turned on. Triac can conduct current

irrespective of the voltage polarity of terminals MT1 and MT2 with respect to each other and

that of gate and terminal MT2. Consequently four different possibilities of operation of

triacexists. They are:

1. Terminal MT2 and gate are positive with respect to terminal MT1

Page 17: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page 9

When terminal MT2 is positive with respect to terminal MT1 current flows through path P1-

N1-P2-N2. The two junctions P1-N1 and P2-N2 are forward biased whereas junction N1 P2 is

blocked. The triac is now said to be positively biased.

A positive gate with respect to terminal MT1 forward biases the junction P2-N2 and the break-

down occurs as in a normal SCR.

2. Terminal MT2 is positive but gate is negative with respect to terminal MT1

Though the flow path of current remains the same as in mode 1 but now junction P2-N3 is

forward biased and current carriers injected into P2 turn on the triac.

3.Terminal MT2 and gate are negative with respect to terminal MT1

When terminal MT2 is negative with respect to terminal MT1, the current flow path is P2-N1-

P1-N4. The two junctions P2-N1 and P1 - N4 are forward biased whereas junction N1-P1 is

blocked. The triac is now said to be negatively biased.

A negative gate with respect to terminal MT1 injects current carriers by forward biasing junc-

tion P2-N3 and thus initiates the conduction.

4. Terminal 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 turned on.

Generally, trigger mode 4 should be avoided especially in circuits where high 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. Though the triggering mode 1 is more

sensitive compared to modes 2 and 3, it requires a positive gate trigger. However, for

bidirectional control and uniform gate trigger modes 2 and 3 are preferred.

Applications of Triac

Next to SCR, the triac is the most widely used member of the thyristor family. In fact, in

many of control applications, it has replaced SCR by virtue of its bidirectional conductivity.

Motor speed regulation, temperature control, illumination control, liquid level control, phase

control circuits, power switches etc. are some of its main applications.

However, the triac is less versatile than the SCR when turn-off is considered. Because the

triac can conduct in either direction, forced commutation by reverse-biasing cannot

be employed. So turn-off is either by current starvation, which is usually impracticable,

Page 18: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page 10

or else by ac line commutation. There are two limitations enforced on the use oftriac 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 value is about 20 Vmicros-1

compared

with a general figure of 200 Vmicro s-1

for the SCR, so that the limitation of frequency is at

the power level of 50 Hz. The same dv/dt limitation means the load to be controlled is

preferably a resistive one. When high frequencies and high dv/dt are involved then the back-

to-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 circuits 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 light-emitting diode (LED), IRED

(infrared-emitting diode), or laser diode for signal transmission, and a photosensor for signal

reception. The "transmitter" takes 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 by the "receiver," which converts the modulated light or IR back into an electrical

signal. The electrical output waveform is identical to the electrical input waveform, although

the input and output amplitudes (signal strengths) often differ. The optoisolator is enclosed in

a single package, and has the appearance of an integrated circuit (IC) or a transistor with

extra leads.

Page 19: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page 11

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 of damage from electrical transients (also called

"surges" or "spikes"). Two optoisolators are employed in the analog section of the device:

one for upstream signals and the other for downstream signals. If a transient occurs on the

telephone line (and these are common), the computer will be unaffected because the optical

gap does not conduct electric current. For this reason, modems that use optoisolators provide

superior protection against transients compared with modems incorporating electrical surge

suppressors alone. (An electrical surge suppressor should be installed between the

optoisolator and the telephone line for optimum protection.)

Photodiode opto-isolators

Diode opto-isolators employ LEDs as sources of light and silicon photodiodes as sensors.

When the photodiode is reverse-biased with an external voltage source, incoming light

increases the reverse current flowing through the diode. The diode itself does not generate

energy; it modulates the flow of energy from an external source. This mode of operation is

called photoconductive mode. Alternatively, in the absence of external bias the diode

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 of incoming light. The energy is

harvested by draining the charge through an external high-impedance path; the ratio of

current transfer can reach 0.2%.] This mode of operation is called photovoltaic mode.

Page 20: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page 12

INTRODUCTION TO EASYVR:

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.

The EasyVR module can be used with any host with an UART interface powered at 3.3V –

5V, such as PIC and Arduino boards. Some application examples include home automation,

such as voice controlled light switches, locks or beds, or adding “hearing” to the most

popular robots on the market.

Fig 3.1 EasyVR Module

Page 21: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page 13

EasyVR Features:

A host of built-in Speaker Independent (SI) commands for ready to run basic controls, in

the followings languages:

o English (US)

o Italian

o German

o French

o Spanish

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 language.

Easy-to-use and simple Graphical User Interface to program Voice Commands 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 through the host

board

3 GPIO lines (IO1, IO2, IO3) that can be controlled by new protocol commands.

PWM audio output that supports 8Ω speakers.

Sound playback of up to 9 minutes of recorded sounds or speech.

Page 22: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page 14

Technical specifications

Physical dimensions and pin assignment

Fig 3.2 EasyVR Chip

Page 23: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page 15

Page 24: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page 16

Fig 3.3 Serial Data Frame Format

Page 25: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page 17

Microphone

The microphone provided with the EasyVR module is an omnidirectional electret condenser

microphone

(Horn EM9745P-382):

Sensitivity -38dB (0dB=1V/Pa @1KHz)

Load Impedance 2.2K

Operating Voltage 3V

Almost flat frequency response in range 100Hz – 20kHz

If you use a microphone with different specifications the recognition accuracy may 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 headphones, provided that you scale

down the

output power according to the speaker ratings, 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 10kΩ).

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 IO1–IO3 are connected directly to the embedded microcontroller on the

EasyVR module,so they are referenced to the internal 3.0V regulated power supply. If you

need to interface to circuits using adifferent supply, there are a number of solutions you can

adopt. Some of these are outlined below (here Ionindicates any one of the three I/O pins of

the EasyVR).

Page 26: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page 18

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 connect to

the

module with the EasyVR Commander from your PC, with the same pin configuration

2. Adapter mode – You can use the Arduino board as a USB/Serial adapter by holding the

microcontroller in reset, but you need to change the connections once 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 Arduino manage the

bridge mode automaticallywhen the EasyVR Commander requests a connection.

Fig 3.4 Bridge Mode Connection

Page 27: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page 19

Automatic bridge mode used to be supported only on Arduino boards with a bootloader

implementingEEPROM programming.

The latest version of EasyVR Commander (since 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 bridge mode.

Also, it does not rely on the AVR microcontroller to do any software bridge between

communication pins, soit can be used to check your hardware in case 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 boot mode

Fig 3.5 Adapter Mode Connection

This configuration, with Reset shorted to GND, is for connection with the EasyVR

Commander. To use themodule from the Arduino microcontroller, you need to remove the

short (yellow wire) and move the ETX/ERXconnection 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 28: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page 20

2. If you want audio output, connect an 8Ω speaker to J2 header

3. Connect the supplied microphone to the MIC (J3) connector

4. Copy the EasyVR library to your Arduino “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 adapter

mode

2. Open the EasyVR Commander and connect to the Arduino serial port (see Getting Started)

To download a new sound-table:

1. Power OFF the EasyVR module (for example removing the USB cable)

2. Connect the /XM pin of J4 on the EasyVR module for boot mode (see Flash Update for a

possible circuit)

3. Power ON again the EasyVR module and the Arduino board (reconnect the USB cable)

4. Make sure 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 29: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page 21

6. While disconnected choose “Update Sound Table” from the “Tools”menu .

Fig 3.7 Testing EasyVR Programming on Arduino

To test the EasyVR module with your Arduino programming IDE:

1. Make sure you did not activate bridge mode manually

2. Open the 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 for usage details

Page 30: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page 22

When the EasyVR Commander is connected, you can also generate a template code for

Arduino, that willuse the provided libraries .

Page 31: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page 23

Technical specifications

Physical dimensions and pin assignment

Fig 3.8 Pin Structure of EasyVR Shield

Page 32: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page 24

Jumper settings

J12 – Operating mode

This jumper selects the operating mode of the EasyVR Shield and it can be placed in one of

four positions:

oUP – Flash update mode

Use it for firmware updates or to download sound table data to the on-board flash memory

from 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 mode.

oPC – PC connection mode

Use it for direct connection with the EasyVR Commander. In this mode, the Arduino

controller is heldin reset and only the embedded USB/Serial adapter is used.

oHW – Hardware serial mode

Use it for controlling the EasyVR module from your Arduino sketch through the hardware

serial port(using pins 0-1).

oSW – Software serial mode

Page 33: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page 25

Use it for controlling the EasyVR module from your Arduino sketch through a software serial

port(using pins 12-13). You can also connect the EasyVR Commander in this mode, provided

that therunning sketch implements bridge mode (see libraries).

LEDs

A green LED (D6) is connected to IO1 pin and can be controlled by the user‟s program to

show feedbackduring recognition tasks, for example. This LED is on by default after reset or

power up.The red LED (D5) lights up when you set the shield to 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 output, either wire an 8Ω speaker into the screw terminals (J10) or

connectheadphones to the 3.5mm output jack (J9)

3. Connect the supplied microphone to the MIC IN (J11) 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 your Arduino programming IDE:

1. Set the jumper (J12) in the SW position

2. Open the 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 for 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 Commander 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 command.

Page 34: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page 26

EasyVR Programming

Communication Protocol

Introduction

Communication with the EasyVR module uses a standard UART interface compatible with

3.3-5V

TTL/CMOS logical levels, according 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 baud.

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 lines, chosen among

lower-caseletters.

Command arguments or status details, again on the TX and RX lines, spanning the range

of capitalletters.

Each command 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 arguments.

There is a minimum delay before each byte sent out from the EasyVR module to the RX line,

that is initiallyset to 20 ms and can be selected later in the ranges 0 - 9 ms, 10 - 90 ms, and

100 ms - 1 s. That accountsfor slower or faster host systems and therefore suitable also for

software-based serial communication (bitbanging).

Since the EasyVR serial interface also is software-based, a very short delay might be needed

beforetransmitting a character to the module, especially if the host is very fast, to allow the

EasyVR to get backlistening to a new character.

Page 35: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page 27

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 character. 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 of 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 host 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 edit the generated code to implement the application logic, but

the template contains all thefunctions or subroutines to handle the speech recognition tasks.

Getting Started

Connect the adapter board or a microcontroller host board with a running “bridge” program1

to your PC, andthen check that all devices are properly turned on and start the EasyVR

Commander.

Select the serial port to use from the toolbar or the “File” menu, and then go with the

“Connect” command.

Page 36: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page 28

Fig 3.9 EasyVR Commander

There are four kinds of commands in the software (see Figure 3 and Figure 6):

Trigger - is a special group where you have the built-in SI trigger word "Robot" and 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

Password - a special group for "vocal passwords" (up to five), using Speaker Verification

(SV)

technology

Wordset- built-in set of SI commands (for instance in Figure 3 above, the Wordset 1 is

selected)

Page 37: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page 29

Speech Recognition

The recognition function of the EasyVR works on a single group at a time, so that 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 all the user-defined

commands andgroups, which are stored into the EasyVR module non-volatile memory.

You can add a new command by first selecting the group in which the command needs to be

created andthen using the toolbar icons or the “Edit” menu.

A command should be given a label and then it should be trained twice with the user's voice:

the user will beguided throughout this process (see Figure 4) when the "Train Command"

action is invoked.

Fig 3.10 Training Phases of EasyVR

Guided training dialog

After clicking on Phase 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 user‟s

voice is notheard correctly, there is too much background noise or when the second word

heard is too different from thefirst one.

Page 38: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page 30

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 that

already containcommands are highlighted in bold.

The selected group of commands 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 39: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page 31

PROJECT PROGRAM:

#if defined(ARDUINO) && ARDUINO >= 100

#include "Arduino.h"

#include "SoftwareSerial.h"

SoftwareSerialport(12,13);

#else // Arduino 0022 - use modified NewSoftSerial

#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 40: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page 32

void setup()

{

pinMode(A4,OUTPUT);

pinMode(A5,OUTPUT);

digitalWrite(A4,HIGH);

digitalWrite(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!");

easyvr.setTimeout(5);

easyvr.setLanguage(0);

group = GROUP_1; //<-- start group (customize)

}

void action();

Page 41: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page 33

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

}

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: ");

Page 42: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page 34

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())

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 43: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page 35

{

case G1_LIGHTS_ON:

{Serial.println("lights on");

digitalWrite(A4,LOW);

digitalWrite(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 group X for composite commands

break;

}

break;

}

}

Page 44: Voice Based Appliance Control

VOICE BASED APPLIANCE CONTROL

Page 36

References:

https://www.sparkfun.com/products/10963

http://www.veear.eu/products/easyvr/

http://en.wikipedia.org/wiki/Voice_recognition

http://www.epictinker.com/ProductDetails.asp?ProductCode=

VAR-01770