mcs project report

16
MCS Project Report Control of Motors using Voice Recognition Submitted to: Ma’am Zunaira Submitted by: Kinza Maham 12-EE-40 Hafsa Iqbal 12-EE-68

Upload: kiinnza-maham

Post on 10-Dec-2015

15 views

Category:

Documents


1 download

DESCRIPTION

Voice recognition robot

TRANSCRIPT

Page 1: MCS Project Report

MCS Project ReportControl of Motors using Voice Recognition

Submitted to:

Ma’am Zunaira

Submitted by:

Kinza Maham 12-EE-40

Hafsa Iqbal 12-EE-68

Page 2: MCS Project Report

Block Diagram:

Components Used:1. VR3 Module

2. Microphone

3. Arduino UNO

4. Microcontroller (AT Mega 16)

5. L293D (H-bridge IC)

6. 9V DC motors

7. Capacitor

8. Resistor

9. LED

Microphone Voice Recognition Module Microcontroller H-bridge Motors

Page 3: MCS Project Report

WORKING:Converting a speech waveform into a sequence of words involves several essential steps:1. A microphone picks up the signal of the speech to be recognized and converts it into an electrical signal. A modern speech recognition system also requires that the electrical signal be represented digitally by means of an analog-to-digital(A/D) conversion process, so that it can be processed with a digital computer or a microprocessor.2. This speech signal is then analyzed (in the analysis block) to produce a representation consisting of salient features of the speech. The most prevalent feature of speech is derived from its short-time spectrum, measured successively over short-time windows of length 20–30 milliseconds overlapping at intervals of10–20 ms. Each short-time spectrum is transformed into a feature vector, and the temporal sequence of such feature vectors thus forms a speech pattern.3. The speech pattern is then compared to a store of phoneme patterns or models through a dynamic programming process in order to generate a hypothesis (or anumber of hypotheses) of the phonemic unit sequence. This process takes place in the VR3 module. This module is trained first using a microphone, Arduino and Arduino software. The speech pattern is stored temporarily in the module. This module is interfaced with Arduino UNO. On V3, voice commands are stored in one large group like a library. Any 7 voice commands in the library could be imported into recognizer. It means 7 commands are effective at the same time. It is trained using Arduino.exe and the v3 is then loaded with speech patterns. Arduino is programmed to recognize these patterns and then perform the required actions. In this case it is the switching on and off motors by providing high and low bits to microcontroller. Against each word spoken, arduino is programmed to generate a sequence of bits. These bits are then fed to microcontroller, which is further programmed to generate a hex value which is then given as input to L293D which is a dual H-bridge IC. It generates PWM which drives the motors.We used pin to 2 and 3 of arduino for transmission and reception (interfacing with V3). 5V and GND were provided to V3 using arduino. Pin number 11, 12, 13 were taken as outputs of arduino.

Page 4: MCS Project Report

V3 Module:On V3, voice commands are stored in one large group like a library. Any 7 voice commands in the library could be imported into recognizer. It means 7 commands are effective at the same time.

Voltage: 4.5-5.5V Current: <40mA Digital Interface: 5V TTL level for UART interface and GPIO Analog Interface: 3.5mm mono-channel microphone connector + microphone pin

interface Size: 31mm x 50mm Recognition accuracy: 99% Support maximum 80 voice commands, with each voice 1500ms (one or two

words speaking) Maximum 7 voice commands effective at same time Arduino library is supplied Easy Control: UART/GPIO User-control General Pin Output

Page 5: MCS Project Report

Arduino UNO: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. Flash Memory is 32 KB (ATmega328) of which 0.5 KB used by bootloader. SRAM is 2 KB (ATmega328) and EEPROM is 1 KB (ATmega328).

L293D:The L293 and L293D are quadruple high-current half-H drivers. The L293 is designed to provide bidirectional drive currents of up to 1 A at voltages from 4.5 V to 36 V. The L293D is designed to provide bidirectional drive currents of up to 600-mA at voltages from 4.5 V to 36 V. Both devices are designed to drive inductive loads such as relays, solenoids, dc and bipolar stepping motors, as well as other high-current/high-voltage loads in positive-supply applications.

Page 6: MCS Project Report

Code:

For Arduino:

#include <SoftwareSerial.h>

#include "VoiceRecognitionV3.h"

/**

Connection

Arduino VoiceRecognitionModule

2 -------> TX

3 -------> RX

*/

VR myVR(2,3); // 2:RX 3:TX, you can choose your favourite pins.

Page 7: MCS Project Report

uint8_t records[7]; // save record

uint8_t buf[64];

int led = 13;

int led2= 12;

int led3= 11;

#define onRecord (0)

#define moveRecord (1)

#define stopRecord (2)

/**

@brief Print signature, if the character is invisible,

print hexible value instead.

@param buf --> command length

len --> number of parameters

*/

void printSignature(uint8_t *buf, int len)

{

int i;

for(i=0; i<len; i++){

if(buf[i]>0x19 && buf[i]<0x7F){

Serial.write(buf[i]);

}

Page 8: MCS Project Report

else{

Serial.print("[");

Serial.print(buf[i], HEX);

Serial.print("]");

}

}

}

/**

@brief Print signature, if the character is invisible,

print hexible value instead.

@param buf --> VR module return value when voice is recognized.

buf[0] --> Group mode(FF: None Group, 0x8n: User, 0x0n:System

buf[1] --> number of record which is recognized.

buf[2] --> Recognizer index(position) value of the recognized record.

buf[3] --> Signature length

buf[4]~buf[n] --> Signature

*/

void printVR(uint8_t *buf)

{

Serial.println("VR Index\tGroup\tRecordNum\tSignature");

Serial.print(buf[2], DEC);

Serial.print("\t\t");

Page 9: MCS Project Report

if(buf[0] == 0xFF){

Serial.print("NONE");

}

else if(buf[0]&0x80){

Serial.print("UG ");

Serial.print(buf[0]&(~0x80), DEC);

}

else{

Serial.print("SG ");

Serial.print(buf[0], DEC);

}

Serial.print("\t");

Serial.print(buf[1], DEC);

Serial.print("\t\t");

if(buf[3]>0){

printSignature(buf+4, buf[3]);

}

else{

Serial.print("NONE");

}

Serial.println("\r\n");

}

Page 10: MCS Project Report

void setup()

{

myVR.begin(9600);

Serial.begin(115200);

Serial.println("Elechouse Voice Recognition V3 Module\r\nControl LED sample");

pinMode(led, OUTPUT);

pinMode (led2,OUTPUT);

pinMode (led3,OUTPUT);

if(myVR.clear() == 0){

Serial.println("Recognizer cleared.");

}else{

Serial.println("Not find VoiceRecognitionModule.");

Serial.println("Please check connection and restart Arduino.");

while(1);

}

if(myVR.load((uint8_t)onRecord) >= 0){

Serial.println("onRecord loaded");

}

if(myVR.load((uint8_t)moveRecord) >= 0){

Serial.println("moveRecord loaded");

}

Page 11: MCS Project Report

if(myVR.load((uint8_t)stopRecord) >= 0){

Serial.println("stopRecord loaded");

}}

void loop()

{

int ret;

ret = myVR.recognize(buf, 50);

if(ret>0){

switch(buf[1]){

case onRecord:

digitalWrite(led, HIGH);

digitalWrite(led2,LOW);

digitalWrite(led3,LOW);

break;

case moveRecord:

digitalWrite(led, HIGH);

digitalWrite(led2,LOW);

digitalWrite(led3,LOW);

break;

case stopRecord:

digitalWrite(led,LOW);

digitalWrite(led2,LOW);

digitalWrite(led3, LOW);

Page 12: MCS Project Report

break;

default:

Serial.println("Record function undefined");

break;

}

printVR(buf);

}

}

For MicroController:#include<mega16.h>

#define F PINB.0

#define R PINB.1

#define L PINB.2

void main (void)

{

DDRC=0xff;

PORTD=0x00;

DDRB=0x00;

PORTB=0xff;

while (1)

{

if (F==0)

PORTC=0x1B;

if (R==0)

Page 13: MCS Project Report

PORTC=0x03;

if (F==0 && R==0 && L==0)

PORTC=0x00;

}}

Applications:This can be applied to form a speech controlled robot which can perform tasks which humans can’t. It can also be used to control the speed of motors in industrial application with a little modification. It can also be used to control fans and lights and other home appliances.

Final Circuit: