You are on page 1of 72

Design & Implementation of a Person Authenticating & Commands Following Robot


Submitted In Partial Fulfillment of the Requirements for the Degree of BACHELOR OF TECHNOLOGY

Under the able guidance of Dr. Haranath Kar

Aditya Agarwal (2002519) Subhayan Banerjee (2003516) Nilesh Goel (2003560) Chandra Veer Singh (2002577)

Department of Electronics and Communication Engineering MOTILAL NEHRU NATIONAL INSTITUTE OF TECHNOLOGY ALLAHABAD 211004, INDIA MAY 2007

Abstract In this project, the algorithms for the speech recognition and face recognition have been developed and implemented on MATLAB 7.0.1.These algorithms can be used for any security system in which the person authentication is required. A security system developed using these two algorithms first recognizes the person to be authenticated using the face recognition algorithm and after proper authentication follows the commands of the person using the speech recognition algorithm. The speech recognition algorithm basically uses the speech templates and the face recognition algorithm uses the Fourier Descriptors for the identification purpose. The proposed algorithms are simpler, faster and economic as compare to previously reported algorithm. These algorithms can be easily implemented on DSP kits (Texas or Analog Devices) to develop an autonomous wireless security system. This security system has been easily mounted on SODDRO (Sound Direction Detection Robot) developed by the same group in November 2006.


Acknowledgments We take this opportunity to express our deep sense of gratitude and regard to Dr. Haranath Kar, Asst.Professor, Department of Electronics and Communication Engineering, MNNIT, Allahabad for his continuous encouragement and able guidance, we needed to complete this project. We are indebted to Dr. T.N.Sharma, Dr.Sudarshan Tiwari, Mr. Asim Mukherji, Mr.Arvind Kumar and Mr. Rajeev Gupta. of MNNIT Allahabad, for their valuable comments and suggestions that have helped us to make it a success. The valuable and fruitful discussion with them was of immense help without which it would have been difficult to present this Robot in its present form. We also wish to thank Mrs. Vijya Bhadauria, Project In-charge, ,Dr.V.K.Srivastava and Romesh Nandwana(B.Tech 2nd Yr.,ECE) for their very kind support throughout the project. Finally, we are grateful to P.P.Singh, staff, Project and PCB Lab, Chandra Vali Tiwari and Ram Sajivan, staff, Basic Electronics Lab, Ram ji, staff, Computer Architecture Lab of MNNIT, Allahabad and the administration of MNNIT, Allahabad for providing us the help required.

Aditya Agarwal Subhayan Banerjee Nilesh Goel Chandra Veer Singh


during the academic year 2006-07 is their original endeavor carried out under my supervision and guidance and has not been presented anywhere else. 2. 3. Allahabad . Haranath Kar Department of Electronics and Communication Engineering Motilal Nehru National Institute of Technology Allahabad Allahabad 211004 05 MAY 2007 v . Dr. in partial fulfillment of the requirement for the degree of Bachelor of Technology in Electronics & Communication Engineering.Tech 8th semester. MNNIT(Deemed University). Electronics & Communication Engineering. 4. Aditya Agarwal Subhayan Banerjee Nilesh Goel Chandra Veer Singh Of B.Certificate TO WHOM IT MAY CONCERN This is to certify that project titled “Design & Implementation of a Person Authenticating & Commands Following Robot” Submitted by: 1.

2e Processing & Decision Making Unit 10 4.2 Conclusion 52 Chapter 8: Future Scope 53 References 54 Appendix A 55 vi .1 Summary 52 7.1b web Camera 8 4.2d Band Pass Filter 10 4.2g Mechanical Assembly 11 4.1c Image Acquisition & Processing Tool Box 8 4.2f Microcontroller & Motor Controller Unit 10 4.2c Sampler 10 4.1a Person to be authenticated 8 4.2b Microphone 9 4.2 MATLAB Code for Speech Recognition 21 5.3 Assembly Code for Sound Detection 33 Chapter 6: Results 51 Chapter 7: Summary & Conclusion 52 7.2a Voice Commands 9 4.Table of Contents Page Abstract ii Acknowledgments iii Certificate iv Table of Contents v List of Tables vi List of Figures vii Chapter 1: Introduction 1 1.1 Purpose of This Document 2 Chapter 2: Algorithm for Face Recognition 3 Chapter 3: Algorithm for Speech Recognition 6 Chapter 4: System Description & Hardware Implementation 8 4.1 MATLAB Code for Face Recognition 14 5.3 List of Components 13 Chapter 5: Software Section 14 5.

1 6.List of Tables Table 6.2 Title Table for Results of Face Recognition Table for Results of Speech Recognition Page 51 51 vi .

1 2.2 4.2.1 4.1 Block Diagram of Face Recognition System Block Diagram of Speech Recognition System Microcontrollers & Motor Controller Unit Bottom View of Mechanical Assembly page 3 4 8 9 11 12 vii .2b Title A Simple Binary Image Result of Structuring element on Fig.2 4.List of Figures Figure 2.2a 4.

Chapter 1 Introduction Speech Recognition & Face Recognition are two important areas that have drawn the attention of so many researchers in the recent years. In Chapter 3. Apart from the humanoid robot the proposed algorithms can be also used in different real time industrial applications. The main advantage of using Fourier descriptors is that these are invariant to translation. The Chapter 4 consists of System Description and Hardware Implementation.To bind up the report Summary & Conclusion are shown in Chapter 7.Chapter 8 deals with Future Scope and at last References are given. The Speech Recognition and Face Recognition modules are the most important stages of any humanoid robot that needs proper authentication of the person before following any instruction. 1 . Face Recognition in a real time application with sufficient efficacy is still a challenge for the researchers keeping in mind the constraints imposed by memory availability and processing time. The Software Section is given in chapter 5. For Speech Recognition the speech templates are used that basically depends upon the intensity and the accent of the speech.Results are depicted in Chapter 6. an algorithm for reliable Recognition of Speech is proposed. rotation and scaling of the observed object. In the proposed algorithm for face recognition first the face is detected in the image using the techniques of edge detection and then the face is recognized with the help of Fourier descriptors. The description of the algorithm for Face Recognition is given in Chapter 2. The rest of the report is organized as follows. Here a two dimensional approach of face recognition is introduced.

The purpose of this project report is to give the detailed description of the algorithms used for speech recognition and face recognition.Tech final year project in Electronics and Communication Department.1. MNNIT. Allahabad.1 Purpose of this Document This project report is prepared as the part of B. 2 . hardware for speech recognition and software programs used for the development of the security system that at first authenticates the person using face recognition and after proper authentication follows the predefined commands given by him.

3. The edge of the face image ( I ) can be obtained by first eroding A by a structuring element B and then performing the set difference between A and its erosion. If edge of A is denoted by E (A) then E (A) = A – (AӨB) where AӨB shows erosion of image A by structuring element B. Use of this 5 ×5 structuring element on Fig.1: A simple binary image. 2 would result in an edge of between 2 and 3 pixels thick as shown in Fig. Figure 2. 3 .First the edge of the face is detected by using a morphological algorithm of boundary extraction. In this algorithm the image is first converted into a binary image and then erosion is performed after taking a structuring element of 1‘s and of suitable dimensions (generally 5 ×5).Chapter 2 Algorithm for Face Recognition This algorithm consists of both the face detection and recognition parts .

2: Result of structuring element in Fig. Let the complex array . The Fourier descriptors for each face edge will be invariant to rotation.1 After getting the edge Fourier descriptors for the edge are calculated. Fourier descriptors are used for the face detection of any object found on input image.So it is truncated while evaluating the Fourier descriptors. translation and scaling. The Fourier transform coefficient is calculated by The Fourier descriptors are obtained from the sequence by truncating the elements and . rotation and scaling of the observed object. Here value of n depends upon the size of the face and the dimensions of the image matrix obtained during image acquisition. Idealized rotation only causes the multiplication of with each element. The main advantage of using Fourier descriptors is their invariance to translation. To summarize the Fourier descriptors are Ck-2 .. Idealized translation only affects .Figure 2. k= 2. Idealized scaling accounts for 4 . 3….n-1. represent the edge belonging to face. 2. then by taking the absolute value of the remaining elements and dividing every element of thusly obtained array by . So while calculating Fourier descriptors the absolute value is calculated.

rotation and scaling—are not correct. one good choice is . two highest sums are taken and average of these two final sums is the final sum that is to be used for recognition purpose. but as the input images acquired by our acquisition system are spatially sampled and all of the transformations will occur before image sampling. For face recognition a library of images of the person to be authenticated is created.So every element is divided by . Sum= For a sample image there are 3 such sums are calculated for images of a person saved in the dictionary as there are 3 images saved for each person in the dictionary. For recognition the minimum sum is found out and this minimum sum corresponds to the image of the authenticated person. However. As has been already truncated. in practical usage this will not cause any difficulties. 5 . For authentication of a person the same procedure is repeated to calculate the edge of the face and its Fourier descriptors. rotation and scaling is considered. All of the properties described are correct when idealized case of translation. First 3 images of each of the persons are taken with the help of web camera and the image acquisition toolbox as described before and converted to binary image. The numbers of final sums depend upon the number of authenticated persons whose images are saved in the dictionary. After getting these sums. but are only approximations. the assumptions made concerning all of the transformations translation. For recognition purpose the absolute difference between the first 100 Fourier descriptors of the sample image and the Fourier descriptors of the dictionary images are calculated and summed using the following formula. The edge of the binary images and their corresponding Fourier descriptors are calculated according to the algorithm using image processing toolbox.multiplication of a constant C with every element and so this effect can be nullified by dividing all Fourier transforms by one of the calculated Fourier Transform Coefficient.

1-250. For recognition of commands first a dictionary is created that consists of templates of all the commands that the robot has to follow (like in our case these are ‗Turn Left‘. For creating the final template the average of all these templates is taken and stored. memory space available and the processing time. so according to Nyquist Sampling Theorem.15750-16000) is accumulated and represented by one value. the discrete data obtained is passed through a band pass filter having pass band frequency in the range of 300 4000 Hz. The basic purpose of using band pass filter is to eliminate the noise that lies at low frequencies (below 300 Hz) and generally above 4000 Hz there is no speech signal. First the voice commands are taken with the help of a microphone that is directly connected to PC. 6 . After it the analog voice signals are sampled using MATLAB 7. For example. in the implemented algorithm 16000 samples are taken.251-500…. ‗Come Forward‘ and ‗Go Back‘. To create the templates here the power of each sample is calculated and then the accumulated power of 250 subsequent samples is represented by one value. After sampling. ‗Move Right‘. The numbers of samples taken and grouped are absolutely flexible and can be changed keeping in mind the required accuracy. minimum sampling rate required should be 8000 samples/second.0. then power of discrete data will be represented by 64 discrete values as power of subsequent 250 samples (i.Chapter 3 Algorithm for Speech Recognition To recognize the voice commands efficiently different parameters of speech like pitch. For creating the dictionary the same command is taken several times (15 in this case) and template is created each time. amplitude pattern or power/energy can be used.e.1. This algorithm for voice recognition comprises of speech templates. As speech signals generally lie in the range of 300Hz-4000 Hz. Here to recognize the voice commands power of the speech signal is used. The templates basically consist of the power of discrete signals.

then the command received is considered as a strange one and robot requests for a familiar command. the efficiency of proposed algorithm will go up. After calculating Euclidian distance for each dictionary template. Then the Robot detects that particular command given by the operator and performs the task accordingly. which is 32 in the proposed algorithm.After creating the dictionary of templates. The formula can be given as Euclidian Distance= where i denotes the number of sample points. 7 . these distances are sorted in the ascending order to find out the smallest distance among them. The efficiency of the proposed algorithm depends on the mechanism of dictionary creation and comparison method of the dictionary templates with the received command template and also on the range of values for Euclidian distance. the command to be followed is taken with the help of the microphone and the template of the input command signal is created using the same procedure as mentioned earlier. It is the accumulation of the square of each difference between the value of dictionary template and that of command template at each sample points. If the command given by the operator does not match with any of the dictionary command then the Robot should not follow that command. Now the template of command received is compared with the templates of dictionary using Euclidian distance. In order to incorporate this feature in the system an individual maximum range of values of Euclidian distance for all the dictionary commands has been set. If the number of times the same command is taken for creating dictionary is increased. This distance corresponds to a particular dictionary template which is the template belonging to a particular dictionary command. If the calculated Euclidian distance of received command does not lie in the range for any dictionary command.

Image processing toolbox processes the image that has been obtained in the matrix form 8 . Image acquisition toolbox is used to acquire the image of the person to be observed with the help of web camera . 4. 4.0.1c Image Acquisition and Processing Toolbox Image acquisition toolbox and image processing toolbox are modules of MATLAB 7. Figure 4.1 installed in personal computer. So to prove one‘s authenticity one will have to come in front of Web Camera for giving shot. 4. The resolution generally used is 480 ×640 but higher resolution can also be used keeping in mind the processing time of the image acquired and complexity of the system.Chapter 4 System Description & Hardware Implementation The block diagram of the proposed system for the face recognition is shown in Figure 4.1.1b Web Camera The web camera used for getting the snapshots may be any simple web camera with an appropriate resolution.1a Person to be Authenticated The person who wants to get the robot following his/her commands should be an authenticated one.1: Block diagram of the face recognition system.

A brief description of various modules of the speech recognition system is given below.2b Microphone The microphone takes the commands from the authenticated person. Commands given by the person are taken as analog inputs using the Date Acquisition Toolbox of MATLAB.2. Figure 4.using web camera and image acquisition toolbox. The block diagram of the proposed system for the speech recognition is shown in Figure 4. 4. In the proposed algorithm a limit on the number of voice commands has been imposed to make the system useful for real world applications. It is directly connected to the personal computer. 9 . The main functions of this toolbox are to detect the face in image first using edge detection technique and then recognize it using Fourier descriptors.2: Block diagram of the speech recognition system.2a Voice Commands The voice commands are given by the person who has been authenticated by the face recognition algorithm. 4.

4000 Hz. so according to Nyquist Sampling Theorem minimum sampling rate required should be 8000 samples/second.5V and Speed Grade is 0 .2d Band Pass Filter After sampling the discrete signal obtained is passed through a band pass filter. It has 32K Bytes of In-System Self-Programmable Flash with endurance: 10.5. Here A/D converter (Port A) is used for converting analog signal from the output of band pass filter to digital signal which is processed by the processing unit of microcontroller and accordingly.000 Write/Erase Cycles. 4.1 is used as processing and decision making unit. 2K Byte Internal SRAM. Here. The sampling is done in MATLAB. 10 bit A/D converter.8 MHz for ATmega32L.2c Sampler The speech signal obtained is sampled to convert it into discrete from. It has an inbuilt 8 channel.4) for sound detection and then for required is ATMEL‘s AVR family ATMEGA32L microcontroller. But in order to obtain the required accuracy sampling rate is decided as 16000 samples/second. it will generate appropriate control signals (at Port D 10 .4.2f Microcontroller & Motor Controller Unit Here the processing and decision making unit (See Figure 3. The band pass filter is used to remove the noise existed outside the pass band.7 .000 Write/Erase Cycles. The Operating Voltage is 2.2e Processing and Decision Making Unit The processing unit does all the processing of the speech signals required for the voice commands recognition. the fourth order Chebysheb band pass filter having the pass band 300 Hz . Compare Mode and Capture Mode. 4. Here personal computer with MATLAB 7. This microcontroller has 32k programmable flash memory and maximum clock frequency 8 MHz It consists of 32 x 8 General Purpose Working Registers. 1024 Bytes EEPROM with endurance: 100. As speech signals lies in the range of 300 Hz-4000 Hz. 4.0. Two 8-bit Timer/Counters with Separate Prescalers and Compare Modes and One 16-bit Timer/Counter with Separate Prescaler.

Motor 1 controls the motion of left wheels and motor 2 controls the right wheels as shown in the Figure 3. Basically L298 acts as an interface between the low power control signals generated by microcontroller and the motor assembly which requires relatively high power for driving of motors. Figure 4. In this system the logic supply voltage used is 5V and motor supply voltage is 6V. The implemented side steering mechanism in mechanical assembly can effectively control the motors for taking sharp turns. 11 . gear boxes and vehicle chassis. to drive the motors used in Dual full H bridge motor driver IC L298 as shown in Figure 3. Using IC L298.5.2g Mechanical assembly This module mainly consists of two 3V brushed DC microcontroller for ‗SODDRO‘) mechanical assembly.4 is used to control the movement of motors. it is possible to ‗jam‘ or ‗free‘ the motors if required. Each H bridge is capable of moving the motor ‗clockwise‘ or ‗anticlockwise‘ depending upon the direction of current flow through the circuit.2a: Microcontroller and motor controller unit 4.

Figure 4.2b: Bottom view of mechanical assembly 12 .

3) 1N4007 rectifier diode (Qty. 0. 8) 3. 7. 3) DC motors from toy car (Qty. 14. 1) L298 Dual Full Bridge Driver (Qty. 0. 4) 4. 12) 10 K ohm (Qty. 7805 +5V Dc Regulator (Qty. 3) Capacitors: 1. 1 K ohm (Qty. ±5% carbon) 1. 1) 5V Battery pack (Qty. 10. 1) Condenser Microphone (Qty. 1) LM324 Quad Op-amp (Qty.3 List of components used for Sound Detection. 11. 8) Resistors (all ¼ watt. 4) IC base 14 pin (Qty. 3. 2. 470 μF electrolytic (Qty. 1) Battery Connector (Qty. 4. 4. 10) Miscellaneous: 1. 15) 100 K ohm (Qty. 9V Battery (Qty. 5. 1) 5mm Light Emitting Diode (Qty. 3. 6. 3. 5. 2) Ply wood sheet for vehicle chassis Web camera Personal Computer 13 . 1) 1N4148 Switching Diode (Qty. 6. 13. 2) Gear reduction box from toy car (Qty. 9. 1) 2.7 K ohm (Qty. Semiconductor: 1. 2. 4.1 μF ceramic disk Qty. 1) Connecting Wires PCB Wire Connectors (Qty.01 μF ceramic disk (Qty. 3) 470 K ohm pots (Qty.4. 5. Face Recognition and Speech Recognition.4) General purpose PCB (Qty. 7. 1) ATMEGA32L AVR Microcontroller (Qty. 8. 2. 2) Bread Board (Qty. 12.

imshow(b) level=graythresh(b).Chapter 5 Software section In this section the description of the MATLAB 7.1 codes for Speech & Face Recognition is given. imshow(b) level=graythresh(b).se). end for i=1:3 preview(vid) a=getsnapshot(vid).1 MATLAB Code for Face Recognition 5. f = imerode(e. 14 . c=im2bw(b. imshow(c) e = imfill(c.level). c=im2bw(b. imshow(e) se = strel('disk'. 5. imshow(f) f=imdilate(f. image2(1.5). image1(1.'RGB24_640x480').se).1A MATLAB Code for Image Capturing out=imaqhwinfo('winvideo').i)={f}. f = imerode(e. closepreview. imshow(a) b=rgb2gray(a).0.i)={f}.'holes').se).1.'holes').level). imshow(e) se = strel('disk'. imshow(a) b=rgb2gray(a).5). imshow(c) e = imfill(c. closepreview. for i=1:3 preview(vid) a=getsnapshot(vid).se). imshow(f) f=imdilate(f. vid=videoinput('winvideo'. end for i=1:3 preview(vid) a=getsnapshot(vid).

imshow(f) f=imdilate(f. imshow(a) b=rgb2gray(a). imshow(f) f=imdilate(f. 15 .'image2'. [row({f}.'image2'.1). imshow(c) e = imfill(c. end save('radhe'. imshow(e) se = strel('disk'.'image1'. imshow(c) e = imfill(c.'image3'.level).'holes'). imshow(temp) s=~temp. image4(1. f = imerode(e. t1=imfill(s. end temp1=row(1.col(1.level). c=im2bw(b.i)).'image4') 5.1)).5). closepreview.j). num=1. imshow(a) b=rgb2gray(a). f = imerode(e. c=im2bw(b.closepreview.i)={f}. image3(1. imshow(b) level=graythresh(b). [row1.j)]=size(bound3). for i=1:3 temp=cell2mat(image1(1.'image1'. imshow(e) se = strel('disk'. end for i=1:3 preview(vid) a=getsnapshot(vid).'image4').'holes').col1]=size(bound).5).1B MATLAB Code for Fourier Descriptors & Dictionary Creation load('radhe'. for j=1:row1 bound3=cell2mat(bound('image3'.se).se). imshow(t1). imshow(s).'holes'). bound = bwboundaries(t1). imshow(b) level=graythresh(b).

for j=2:row1 if(row(1,j)>temp1) temp1=row(1,j); num=j; end end bound1=bound(num); bound2=cell2mat(bound1); n1=size(bound2); n=n1(1,1); for k=1:102 z(k)=0; end for k=1:102 for m=1:n p=bound2(m,1); q=bound2(m,2); t=complex(p,q); z(k)=z(k)+ t*exp(-(i*2*pi*k*m)/n); end end d=abs(z(2)); c=abs(z); c=c/d; for k=3:102 pl(k-2)=c(k); end dict1(1,i)={pl}; end for i=1:3 temp=cell2mat(image2(1,i)); imshow(temp) s=~temp; imshow(s); t1=imfill(s,'holes'); imshow(t1); imshow(t1) bound = bwboundaries(t1); [row1,col1]=size(bound); for j=1:row1 bound3=cell2mat(bound(j,1)); [row(1,j),col(1,j)]=size(bound3); end temp1=row(1,1); num=1; for j=2:row1 if(row(1,j)>temp1) temp1=row(1,j); num=j; end end bound1=bound(num); bound2=cell2mat(bound1); n1=size(bound2); n=n1(1,1);


for k=1:102 z(k)=0; end for k=1:102 for m=1:n p=bound2(m,1); q=bound2(m,2); t=complex(p,q); z(k)=z(k)+ t*exp(-(i*2*pi*k*m)/n); end end d=abs(z(2)); c=abs(z); c=c/d; for k=3:102 pl(k-2)=c(k); end dict1(1,(i+3))={pl}; end

for i=1:3 temp=cell2mat(image3(1,i)); imshow(temp) s=~temp; imshow(s); t1=imfill(s,'holes'); imshow(t); bound = bwboundaries(t1); [row1,col1]=size(bound); for j=1:row1 bound3=cell2mat(bound(j,1)); [row(1,j),col(1,j)]=size(bound3); end temp1=row(1,1); num=1; for j=2:row1 if(row(1,j)>temp1) temp1=row(1,j); num=j; end end bound1=bound(num); bound2=cell2mat(bound1); n1=size(bound2); n=n1(1,1); for k=1:102 z(k)=0; end for k=1:102 for m=1:n p=bound2(m,1); q=bound2(m,2); t=complex(p,q); z(k)=z(k)+ t*exp(-(i*2*pi*k*m)/n); end


end d=abs(z(2)); c=abs(z); c=c/d; for k=3:102 pl(k-2)=c(k); end dict1(1,i+6)={pl}; end for i=1:3 temp=cell2mat(image1(1,i)); imshow(temp) s=~temp; imshow(s); t1=imfill(s,'holes'); imshow(t1); bound = bwboundaries(t1); [row1,col1]=size(bound); for j=1:row1 bound3=cell2mat(bound(j,1)); [row(1,j),col(1,j)]=size(bound3); end temp1=row(1,1); num=1; for j=2:row1 if(row(1,j)>temp1) temp1=row(1,j); num=j; end end bound1=bound(num); bound2=cell2mat(bound1); n1=size(bound2); n=n1(1,1); for k=1:102 z(k)=0; end for k=1:102 for m=1:n p=bound2(m,1); q=bound2(m,2); t=complex(p,q); z(k)=z(k)+ t*exp(-(i*2*pi*k*m)/n); end end d=abs(z(2)); c=abs(z); c=c/d; for k=3:102 pl(k-2)=c(k); end dict1(1,i+9)={pl}; end


for k=1:100 sum2(1. for j=1:100 sum1=sum1 + abs(temp(1. imshow(c) e = imfill(c.'dict1'). for j=i+1:12 temp1 =cell2mat(dict1(1.1C MATLAB Code for Image Comparison load('dictionary'. sum1=0. imshow(a) b=rgb2gray(a).3).i) flag = sum2(1. vid=videoinput('winvideo'. for i=2:66 if flag<sum2(1.m)+abs(temp(1. imshow(b) level=graythresh(b). imshow(e) se = strel('disk'. closepreview. samp=descriptor(f).i)=sum1. 5.k)). end for i=1:4 suma(1.'holes').'dict1'). preview(vid) a=getsnapshot(vid).k)-temp1(1.1). end end end flag=sum2(1.i).j)).m)=sum2(1.k)=0.i)).se).j)). c=im2bw(b.i)'RGB24_640x480'). imshow(f) f=imdilate(f. f = imerode('dictionary'. out=imaqhwinfo('winvideo'). for k=1:66 sum2(1.1.i)). end sum(1. end 19 . end end for i=1:12 temp=cell2mat(dict1(1. m=0.j)-samp(1. m=m+1. end for i=1:11 temp =cell2mat(dict1(1.level).

seq=i.1C) function[pl]=descriptor(f) load('sound'. for j=2:row1 if(row(1.j)]=size(bound(j. end end if seq==1 disp('Hi end if seq==2 disp('Hi end if seq==3 disp('Hi end if seq==4 disp('Hi end Mr.1)). end temp1=row(1.col(1. for j=1:row1 [row(1.'subhayan'.i). end end flag1=suma(1.Aditya') Mr.for i=1:4 for j=3*i-2:3*i suma(1. for i=2:4 if flag1 > suma(1.i)+sum(1.j).j). end end bound1=bound(num).1).'aditya'. bound = bwboundaries(t).i) flag1 = suma(1.1).1D MATLAB Code for module Descriptor (Called in line 19 of 5. n1=size(bound2). 20 .Chandra Veer') 5.j).'chandraveer'.j)>temp1) temp1=row(1. bound2=cell2mat(bound1). imshow(s). t=imfill(s.'nilesh'. num=j. [row1.i)=suma(1.col1]=size(bound).Subhayan') Mr. imshow(f) s=~f.'stranger'). imshow(t). num=1.'holes').Nilsh') Mr. seq=1.

[b.'TriggerType'. for k=1:102 z(k)=0.p) = getdata(ai). c=c/d. left1=left11'. 21 .n=n1(1.'TriggerDelay'.left1).Rp.chan) set(ai.3) n = 4. q=bound2(m.'Rising') set(ai. % subplot(3. % subplot(2.q).'TriggerDelayUnits'.16000). end left11=sum(left')/2.p) = getdata(ai).4. Rp = 0. chan=addchannel(ai. filter(b.'TriggerConditionValue'. t=complex(p. for k=3:102 pl(k-2)=c(k).'TriggerCondition'. z(k)=z(k)+ t*exp(-(i*2*pi*k*m)/n). c=abs(z).Wn).16000).-50) start(ai) noinput(:.1) set(ai. Wn = [300 3400]/4000.2 MATLAB Code for Speech Recognition 5.1) = getdata(ai).'Software') set(ai. set(ai. end 5.2).0.p)). set(ai.'Samples') set(ai.p+2).1).2A MATLAB Code for Dictionary Creation ai = analoginput('winsound').1). set(ai.a] = cheby1(n. for p = 1:2 start(ai) left(:. end end d=abs(z(2)).'SamplesPerTrigger'.'TriggerConditionValue'. end for k=1:102 for m=1:n p=bound2(m.a.'SampleRate'.'TriggerChannel'. set(ai.05.p).4. for p = 1:2 start(ai) right(:.1). a=plot(left(:.0.

right1). for p = 1:2 start(ai) forward(:.4. end end for k=1:16000 forward2(k)=forward1(k)*forward1(k).a.p)).a.p+4).p) = getdata(ai). for p = 1:2 start(ai) backward(:. end 22 . end backward11=sum(backward')/2.a. end right11=sum(right')/2. for k=1:16000 right2(k)=right1(k)*right1(k). end for j=1:64 right_final(j)=0. end for j=1:64 left_final(j)=0. end forward11=sum(forward')/2.'descend'). % subplot(2. noise=0. noinput1(k)=noinput(k)*noinput(k).p+6).4.p) = getdata(ai). % subplot(2. filter(b. end for j=0:63 for l=(250*j+1):(250*j+250) left_final(j+1)=left_final(j+1)+left2(l).forward1). filter(b.a=plot(right(:. noinput_final(j+1)=noinput_final(j+1)+noinput1(l).p)).04.backward1). noinput_final(j)=0. backward1=backward11'. end end % noise=sort(noinput_final. right1=right11'. for k=1:16000 left2(k)=left1(k)*left1(k). filter(b. end for j=0:63 for l=(250*j+1):(250*j+250) right_final(j+1)=right_final(j+1)+right2(l). a=plot(backward(:. a=plot(forward(:.p)). forward1=forward11'.

backward_final2(j)=backward_final(j)-noise. end for j=0:63 for l=(250*j+1):(250*j+250) backward_final(j+1)=backward_final(j+1)+backward2(l). D(j)=dict(j)-d_.'forward_final'. forward_final2(j)=forward_final(j)-noise. d_ = mean(dict). I(j)=input(j)-i_. end end for j=1:64 left_final2(j)=left_final(j)-noise. end save('dictionary'. end for j=1:64 backward_final(j)=0.2B MATLAB Code for Correlation function coff = correlation(input. end for j=0:63 for l=(250*j+1):(250*j+250) forward_final(j+1)=forward_final(j+1)+forward2(l). end for j=1:num sqi(j)=I(j)*I(j).num) i_ = mean(input).for j=1:64 forward_final(j)=0. for j=1:64 ID(j)=0.'right_final'.dict. sqi(j)=0. sqd(j)=D(j)*D(j). ID(j)=I(j)*D(j).'bac kward_final') 5.'left_final'. end end for k=1:16000 backward2(k)=backward1(k)*backward1(k). 23 . right_final2(j)=right_final(j)-noise. sqd(j)=0.

Wn = [300 3400]/4000. chan1=addchannel(aj.'Rising') set(aj.chan1) set(aj. r=0.001) set(aj. filter(b.2) start(aj) compare(:.16000).'TriggerType'.1).2.'TriggerConditionValue'.'TriggerChannel'.1)). [b.'TriggerConditionValue'.1) = getdata(aj).1) = getdata(aj).'forward_final'.'Software') set(aj.0. if den1~=0 r=num1/den1.'TriggerDelayUnits'.1). n = 4. p=plot(compare(:.0. set(aj.'SampleRate'. subplot(2.-50) start(aj) noiseinput(:.'SamplesPerTrigger'.'Samples') set(aj. subplot(2. end for j=1:64 compare_final(j)=0.16000).a. 5.'right_final'. noinput1(k)=noiseinput(k)*noiseinput(k).'TriggerDelay'. for j=1:num num1=num1+ID(j).05.'TriggerCondition'. set( Rp = 0. end coff=r.end num1=0. for k=1:16000 compare1(k)=compare(k)*compare(k).'bac kward_final') aj = analoginput('winsound'). end for j=0:63 for l=(250*j+1):(250*j+250) 24 . set(aj. set(aj.2).2.'left_final'. p=plot(compare(:. noinput_final(j)=0.2C MATLAB Code for Template Comparison load('dictionary'.Rp.1)). end den1=sqrt((sum(sqi)*sum(sqd))).a] = cheby1(n.Wn).

cback1=0. number8=0. ccom1=0. cback2=0. number2=0. cleft2=0. ccom2=0. number5=0. right_final3(j)=0. number4=0. end l=1. end end noise=0. number3=0. left_final4(j)=0. for j=1:64 compare_final3(j)=0. cright1=0. 25 . backward_final4(j)=0. backward_final2(j)=backward_final(j)-noise.'descend').compare_final(j+1)=compare_final(j+1)+compare1(l). backward_final3(j)=0. number6=0. cfor1=0. compare_final4(j)=0. right_final4(j)=0.3. for j=1:64 left_final2(j)=left_final(j)-noise. cleft1=0. right_final2(j)=right_final(j)-noise. for j=1:64 compare_final2(j)=compare_final(j)-noise. forward_final3(j)=0. left_final3(j)=0. number1=0. end for j=1:64 if (((j==1)|(j==64))&(compare_final2(j)>0)) compare_final3(l)=compare_final2(j). noinput_final(j+1)=noinput_final(j+1)+noinput1(l). end % noise=sort(noinput_final. forward_final2(j)=forward_final(j)-noise. forward_final4(j)=0. cright2=0. number7=0. cfor2=0.

ccom1=ccom1+1.l=l+1. for j=1:64 if ((left_final2(j)>0)&((j==1) |(j==64))) left_final3(l)=left_final2(j). l=l+1. l=l+1. elseif ((left_final2(j)>0)&(left_final2 (j-1)>0) & (left_final2 (j+1))>0) left_final3(l)=left_final2(j). elseif (j~=(1 |64)) & (compare_final2 (j-1)<0) & (compare_final2 (j+1)<0) break end end l=1. elseif (j~=(1 |64)) & (left_final2 (j-1)<0) & (left_final2 (j+1)<0) break end end 26 . cleft1=cleft1+1. elseif ((compare_final2(j)>0)&(compare_final2 (j-1)>0) & (compare_final2 (j+1))>0) compare_final3(l)=compare_final2(j). l=l+1. for k=j+1:64 if ((k==64|k==63)& compare_final2(k)>0) compare_final4(l)=compare_final2(k). % elseif (k~=(1 |64)) & (compare_final2 (k-1)<0) & (compare_final2 (k+1)<0) % break end end l=1. elseif ((compare_final2(k)>0)&(compare_final2 (k-1)>0) & (compare_final2 (k+1)>0)& (compare_final2 (k-2)>0) & (compare_final2 (k+2)>0)) compare_final4(l)=compare_final2(k). cleft1=cleft1+1. ccom2=ccom2+1. l=l+1. ccom2=ccom2+1. l=l+1. ccom1=ccom1+1.

% elseif (k~=(1 |64)) & (left_final2 (k-1)<0) & (left_final2 (k+1)<0) % break % end end l=1. cleft2=cleft2+1. for k=j+1:64 if ((k==64|k==63)& right_final2(k)>0) right_final4(l)=right_final2(k). l=l+1. elseif ((right_final2(k)>0)&(right_final2 (k-1)>0) & (right_final2 (k+1))>0 &(right_final2 (k-2)>0) & (right_final2 (k+2)>0)) right_final4(l)=right_final2(k). elseif (j~=(1 |64)) & (right_final2 (j-1)<0) & (right_final2 (j+1)<0) break end end l=1. l=l+1. l=l+1. for j=1:64 if ((right_final2(j)>0)&((j==1) |(j==64))) right_final3(l)=right_final2(j).l=1. for k=j+1:64 if ((k==64|k==63)& compare_final2(k)>0) left_final4(l)=left_final2(k). cright2=cright2+1. cleft2=cleft2+1. % elseif (k~=(1 |64)) & (right_final2 (k-1)<0) & (right_final2 (k+1)<0) 27 . cright2=cright2+1. elseif ((left_final2(k)>0)&(left_final2 (k-1)>0) & (left_final2 (k+1)>0)&(left_final2 (k-2)>0) & (left_final2 (k+2)>0)) left_final4(l)=left_final2(k). l=l+1. cright1=cright1+1. elseif ((right_final2(j)>0)&(right_final2 (j-1)>0) & (right_final2 (j+1))>0) right_final3(l)=right_final2(j). l=l+1. l=l+1. cright1=cright1+1.

for j=1:64 if ((forward_final2(j)>0)&((j==1)|(j==64))) forward_final3(l)=forward_final2(j). l=l+1. cfor2=cfor2+1. for j=1:64 if ((backward_final2(j)>0)&((j==1)|(j==64))) backward_final3(l)=backward_final2(j). l=l+1. l=l+1. 28 .% % end end break l=1. elseif (j~=(1 |64)) & (forward_final2 (j-1)<0) & (forward_final2 (j+1)<0) break end end l=1. cfor2=cfor2+1. cfor1=cfor1+1. l=l+1. elseif ((forward_final2(k)>0)&(forward_final2 (k-1)>0) & (forward_final2 (k+1))>0 &(forward_final2 (k-2)>0) & (forward_final2 (k+2)>0)) forward_final4(l)=forward_final2(k). for k=j+1:64 if ((k==64|k==63)& forward_final2(k)>0) forward_final4(l)=forward_final2(k). cfor1=cfor1+1. cback1=cback1+1. l=l+1. elseif ((forward_final2(j)>0)&(forward_final2 (j-1)>0) & (forward_final2 (j+1))>0) forward_final3(l)=forward_final2(j). elseif ((backward_final2(j)>0)&(backward_final2 (j-1)>0) & (backward_final2 (j+1))>0) backward_final3(l)=backward_final2(j). % elseif (k~=(1 |64)) & (forward_final2 (k-1)<0) & (forward_final2 (k+1)<0) % break % end end l=1.

end if ccom2<=cleft2 number2=cleft2. end if ccom1<=cright1 number3=cright1. l=l+1. cback2=cback2+1. cback1=cback1+1. end 29 . % elseif (k~=(1 |64)) & (backward_final2 (k-1)<0) & (backward_final2 (k+1)<0) % break end end plot(compare_final2) for j=1:4 t(j)=0. for k=j+1:64 if ((k==64|k==63)& backward_final2(k)>0) backward_final4(l)=backward_final2(k). else number2=ccom2. end if ccom1<=cleft1 number1=cleft1. l=l+1.l=l+1. else number3=ccom1. else number1=ccom1. elseif ((backward_final2(k)>0)&(backward_final2 (k-1)>0) & (backward_final2 (k+1)>0) &(backward_final2 (k-2)>0) & (backward_final2 (k+2)>0)) backward_final4(l)=backward_final2(k). elseif (j~=(1 |64)) & (backward_final2 (j-1)<0) & (backward_final2 (j+1)<0) break end end l=1. cback2=cback2+1.

number1). q(m+1)=temp.number3). end if ccom1<=cfor1 number5=cfor1.(forward_final4)'. end if ccom2<=cback2 number8=cback2. end if ccom2<=cfor2 number6=cfor2.(left_final3)'. t(1)=t11+t12 t(2)=t21+t22 t(3)=t31+t32 t(4)=t41+t42 for j=1:4 q(j)=t(j).(right_final4)'.number2).(backward_final3)'.(backward_final4)'. else number5=ccom1. t41=correlation((compare_final3)'. q(m)=q(m+1).number5). end if ccom1<=cback1 number7=cback1. end 30 .(left_final4)'. t42=correlation((compare_final4)'.number6). end for j=0:3 for m=1:3-j if q(m)>q(m+1) temp=q(m). else number7=ccom1. else number6=ccom2.(forward_final3)'. else number4=ccom2. t22=correlation((compare_final4)'. t31=correlation((compare_final3)'.number7). end t11=correlation((compare_final3)'.number4).(right_final3)'. t32=correlation((compare_final4)'.number8). t12=correlation((compare_final4)'. t21=correlation((compare_final3)'. else number8=ccom2.if ccom2<=cright2 number4=cright2.

end if cfor1<=cright1 number7=cright1. end if cfor2<=cright2 number8=cright2. else number7=cfor1. else number5=cback1. else number6=cback2. else number3=cfor1. end if cfor2<=cleft2 number4=cleft2. end if cfor1<=cleft1 number3=cleft1. end if cback2<=cleft2 number6=cleft2. else number2=cright2. end if cback1<=cleft1 number5=cleft1. else number8=cfor2. end if cback1<=cright1 31 . end if cright2<=cleft2 number2=cleft2. else number4=cfor2.end end q(4) if cright1<=cleft1 number1=cleft1. else number1=cright1.

number7).(right_final3)'.(left_final3)'.(left_final4)'. s(4)=s41+s42. s(5)=s51+s52. for j=1:6 p(j)=s(j).(forward_final4)'. end s11=correlation((right_final3)'. s42=correlation((forward_final4)'.(forward_final4)'. s(1)=s11+s12. s(2)=s21+s22. s(3)=s31+s32. p(m)=p(m+1). end if cback2<=cright2 number10=cright2.number9=cright1. end 32 . s31=correlation((backward_final3)'.(left_final3)'.number8).number5). s22=correlation((forward_final4)'.(right_final4)'.number1).number2).number12).(right_final3)'.(left_final3)'. else number11=cback1. else number9=cback1.(left_final4)'. s(6)=s61+s62. end if cback2<=cfor2 number12=cfor2. s32=correlation((backward_final4)'.number11). s41=correlation((forward_final3)'.number4). s62=correlation((backward_final4)'. p(m+1)=temp.number10). end for j=0:5 for m=1:5-j if p(m)>p(m+1) temp=p(m). s12=correlation((right_final4)'.(forward_final3)'.number9). s51=correlation((backward_final3)'.number3). s61=correlation((backward_final3)'. else number12=cback2.(left_final4)'. end if cback1<=cfor1 number11=cfor1. s52=correlation((backward_final4)'. s21=correlation((forward_final3)'.number6). else number10=cback2.

end if q(4)==t(2) data=a(2).=========INITIALISATION STARTS HERE========= 33 . end delete(parport) clear parport 5. end if q(4)==t(3) data=a(3).data). end if q(4)==t(4) data=a(4).data). disp('The given command is RIGHT'). b=[2 2 2 2]. pause(y). putvalue(parport.cseg . putvalue(parport. disp('The given command is GO FORWARD').org 0 rjmp INITIALISATION INITIALISATION: .data).data). if q(4)==t(1) data=a(1).end end a=[04 02 01 03]. disp('The given command is MOVE BACK'). pause(y). putvalue(parport. disp('The given command is LEFTSIDE'). pause(y). y=b(2).3 Assembly Code for Sound Detection .include "m32def. y=b(3). pause(y). putvalue(" . y=b(4). y=b(1).

================================ ldi r19.r19 ldi r19.reset the register r0 .r16 ENDS HERE .r16 ddrb.r16 tcnt1l.$01 34 .$d1 sts $6a.$01 ldi r18.$ff ddrc.$2a sts $0062.configure prot b as i/p port .$53 sts $0064.$00 ldi r18.$24 sts $6e.$00 ldi r18.r16 tcnt1h.$00 sts $0060.reset the timer1 .r16 tccr1b.r19 ldi r19.$00 ldi r18.================================ .r18 sts $6f.high(RAMEND) SPH.$00 ldi r18.$00 ldi r18.r18 sts $0065.r19 ldi r19.$a7 sts $68.r16 tccr1a.====save data in data memory==== .r18 sts $6b.r18 sts $0061.r16 ddrd.r18 sts $69. INITIALISATION .r19 ldi r19.ldi out ldi out ldi mov out out out out ldi out out ldi out out r16.r19 ldi r19.r19 ldi r19.initalising stack pointer starts SPL.r18 sts $6d.0b10000000 adcsra.low(RAMEND) .r19 ldi r19.r18 sts $0063.r16 r16.$00 ldi r18.stack initialisation ends here r16.configure port c as o/p port .r18 sts $67.$7d sts $66.r16 r16.$fa sts $6c.enable ADC .r19 ldi r19.$00 r3.r16 r16.$00 ldi r18.r16 .configure prot d as o/p port .

r19 r19.r18 $79.r18 $7d.$f3 $84.r19 r19.r18 $81.r18 $77.r18 $73.$4e $70.$1d $86.$03 r18.r19 r19.$02 r18.r19 r19.$a2 $74.$03 r18.$9e $80.$02 r18.$01 r18.r19 r19.r19 r19.$01 r18.$9d 35 .$02 r18.$03 r18.$4a $7c.$01 r18.r18 $89.r18 $75.r18 $87.r19 r19.r18 $8b.$c8 $82.r19 r19.$02 r18.$47 $88.$f6 $78.r19 r19.r18 $85.$72 $8a.$01 r18.$78 $72.$02 r18.r18 $71.r18 $7f.r19 r19.$02 r18.r19 r19.$74 $7e.ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi r18.$cc $76.r19 r19.r19 r19.r19 r19.r18 $7b.$03 r18.$20 $7a.r18 $83.

r19 r19.r19 r19.r18 $99.$05 r18.$1d $92.r19 r19.$ca $9a.r19 r19.$04 r18.r19 r19.r19 r19.r18 $97.$03 r18.$48 $94.$78 $a2.r18 $a5.r19 r19.$f2 $90.$f5 $9c.r19 r19.$c7 $8e.r19 r19.r18 $8d.r18 36 .$d1 $a6.$04 r18.$05 r18.r18 $95.$73 $96.r19 r19.$05 r18.r18 $9f.r18 $9b.r18 $a7.r18 $a3.r19 r19.$4d $a0.$21 $9e.r18 $8f.$a4 $a4.$03 r18.$04 r18.r19 r19.$04 r18.r19 r19.r18 $91.r18 $9d.$fd $a8.r19 r19.r18 $93.$05 r18.$05 r18.r18 $a1.sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts $8c.$05 r18.$9e $98.$04 r18.$04 r18.

$95 $ba.r18 $af.r19 r19.r19 r19.$83 $ae.r18 $ad.r19 r19.r18 $b7.r18 $c1.r18 $ab.r19 r19.r19 r19.$08 r18.r18 $b1.$0b $b4.$06 r18.$66 $b8.r19 r19.$08 r18.r18 $bf.sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts $a9.r18 $bd.r18 $b9.$c3 $bc.r18 $c5.$20 $c0.$07 r18.r19 r19.$f2 $be.r19 r19.r18 $c3.$56 $ac.r19 r19.r19 r19.r18 $b3.$06 r18.$07 r18.$39 $b6.r19 r19.r19 r19.$b0 $b0.r18 $bb.$07 r18.r19 r19.$2a $aa.$06 r18.$dd $b2.$06 r18.$08 r18.$06 r18.$7f $c4.$07 r18.$07 r18.r18 $b5.r19 r19.$4f $c2.r19 37 .$07 r18.

r19 r19.r19 r19.$de $c8.$3a $e0.$0a r18.$a1 $d0.$0a r18.$70 $ce.$0b 38 .$09 r18.r19 r19.r19 r19.r19 r19.$09 r18.r18 $cd.r18 $dd.$d3 $d2.$0b r18.$9d $da.r18 $d1.r19 r19.$08 r18.$0a r18.$3f $cc.$0f $ca.$0a r18.r18 $df.$08 r18.r18 $db.$0b r18.r18 $d7.r19 r19.r19 r19.$05 $de.$d1 $dc.r18 $cf.r19 r19.r18 $c9.$37 $d6.r18 $d9.ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi r19.$09 r18.r18 $d5.r19 r19.$0a r18.r18 $e1.r18 $d3.r19 r19.r19 r19.$af $c6.$05 $d4.$6a $d8.r19 r19.r19 r19.$09 r18.$09 r18.r18 $c7.r18 $cb.

r19 r19.ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi sts sts ldi ldi r18.$0d r18.$6f $e2.r18 $f3.$f2 $f0.$0c r18.$67 $f4.r19 r19.r18 $e3.r19 r19.r19 r19.r18 $f9.$0c r18.r19 r19.$0e r18.$b9 $ee.$9a 39 .r19 r19.$11 $e8.$0d r18.$2c $f2.$0c r18.$0e r18.r18 $e9.r18 $ef.r18 $e5.r18 $f7.$0c r18.r19 r19.$df $f8.r18 $e7.$a3 $f6.$5b $fc.r19 r19.$80 $ec.$a4 $e4.$0d r18.$0c r18.r19 r19.$1c $fa.r18 $fb.r18 $f5.$0e r18.r19 r19.r19 r19.$48 $ea.r19 r19.r18 $eb.r19 r19.r18 $ed.$0b r18.r18 $fd.r19 r19.$da $e6.$0b r18.$0d r18.r18 $f1.

$11 ldi r18.r19 ldi r19.r18 sts $10f.r19 ldi r19.r19 ldi r19.r19 .$00 ldi r19.r19 ldi r19.$10 ldi r18.$da sts $100.$5f sts $104.$2f sts $10a.r18 sts $115.r18 sts $113.$0f sts $110.$a3 sts $106.r18 sts $ff.$0f ldi r18.$af sts $114.$11 ldi r18.$0f ldi r18.sts $fe.====ends==== .r18 sts $103.r18 sts $10d.$64 THRESHOLD_SETTING: .r18 sts $107.$00 ldi r17.r19 ldi r19.r19 ldi r19.$1c sts $102.$e8 sts $108.r18 sts $109.r18 sts $111.r18 sts $10b.$c3 sts $10e.r18 sts $105.$5e sts $112.================================ .$10 ldi r18.r19 ldi r19.$0f ldi threshold setting loop 100 times 40 .r19 ldi r19.$78 sts $10c.================================ ldi r18.$11 ldi r18.r19 ldi r19.$0e ldi r18.r18 sts $101.$10 ldi r18.$0f ldi r18.r19 ldi r19.r19 ldi r19.

r3 brsh MIC_2_JUMP call SAMPLE_ADC2 cp r16.r3 brsh MIC_1_JUMP call SAMPLE_ADC1 cp r16.r16 lsl r3 .r3 brsh MIC_1_CW call SAMPLE_ADC2 cp r16. higher nibble for 0 degree offset r25.$0f out portc.r16 or r3.r16 tcnt1l. lower nibble for 0 degree offset .siganl for ready to get sound signal MIC_1: ldi r20.$ff r29.reset the timer1 .=============================== MAIN: ldi r16.r16 call SAMPLE_ADC2 or r3. call SAMPLE_ADC0 or r3.r3 brsh MIC_1_CCW rjmp MIC_1 MIC_1_CW: ldi ldi clockwise..r16 call SAMPLE_ADC1 or r3.$65 r16.$00 call SAMPLE_ADC1 cp r16.reset the timer 41 . ldi out out .r16 .$00 ldi r21.======Main loop starts here==== .$00 tcnt1h.generate control signals for .r16 call SAMPLE_ADC0 cp r16.r3 brsh MIC_3_JUMP rjmp MAIN MIC_1_JUMP: rjmp MIC_1 MIC_2_JUMP: rjmp MIC_2 MIC_3_JUMP: rjmp MIC_3 . angle is to be added in offset .$4f mov r3.r16 dec r17 brne THRESHOLD_SETTING ldi r16.setting the threshold value .=============================== .

tcnt1h .$00 out tcnt1h. read the timer low byte in r27.r16 in r26.start the timer CONTINUE_11: call SAMPLE_ADC1 cp r16.tcnt1h ldi r16.lower nibble for 120 degree offset .r3 brsh MIC_2_CW call SAMPLE_ADC0 cp r16.ldi r16.stop the timer in r26.r3 brlo CONTINUE_10 ldi r16.tcnt1l in r27.r16 .r3 brsh MIC_2_CCW rjmp MIC_2 MIC_2_CW: ldi r25.$ff ldi r29.$56 ldi r16.angle is to be added in offset .start the timer CONTINUE_10: call SAMPLE_ADC2 cp r16.higher nibble for 120 degree offset .$00 out tccr1b.r16 .r3 brlo CONTINUE_11 ldi r16. read the timer low byte .$01 out tccr1b.$01 .angle is to be added in offset 42 . read the timer high byte ldi r16.$01 out tccr1b.r16 .tcnt1l .reset the timer .$23 call SAMPLE_ADC2 cp r16.$00 out tccr1b. read the timer high byte rjmp ANGLE_CALCULATE MIC_1_CCW: ldi r25.r16 out tcnt1l.stop the timer .reset the timer1 .$02 rjmp ANGLE_CALCULATE MIC_2: ldi r20.generate control signals for CCW .r16 ldi r16.$9b ldi r21.$ff .

r3 brlo CONTINUE_20 ldi r16.$00 .r3 brlo CONTINUE_21 ldi r16.$65 clockwise. stop the timer .$00 out tccr1b.$08 .reset the timer1 out tcnt1l.$00 out tcnt1h. read the timer low byte . ldi out out ldi out r16.$01 out tccr1b.$23 call SAMPLE_ADC0 cp r16.generate control signals for .start the timer CONTINUE_21: call SAMPLE_ADC2 cp r16. angle is to be subtracted from offset ldi r29.r16 .$65 . read the timer low byte .tcnt1h ldi r16.reset the timer1 .tcnt1l in r27.tcnt1h ldi r16.r16 .reset the timer .r3 brsh MIC_3_CCW rjmp MIC_3 .r16 .ldi r29.$00 tcnt1h.$01 tccr1b.start the timer CONTINUE_20: call SAMPLE_ADC0 cp r16.tcnt1l in r27. read the timer high byte rjmp ANGLE_CALCULATE MIC_2_CCW: ldi r25.r16 r16.$04 .lower nibble for 120 degree offset .$9b ldi r21.r3 brsh MIC_3_CW call SAMPLE_ADC1 cp r16.r16 in r26.generate control signals for clockwise ldi r16.higher nibble for 120 degree offset 43 .r16 in r26.r16 tcnt1l.r16 .stop the timer . read the timer high byte rjmp ANGLE_CALCULATE MIC_3: ldi r20.reset the timer ldi r16.$00 out tccr1b.

stop the timer . read the timer low byte .r16 .=============================== 44 .$00 r29.tcnt1h ldi r16.reset the timer .=============================== .MIC_3_CW: ldi ldi ldi out out ldi out .reset the timer1 .r16 in r26.$00 out tccr1b.$10 .r16 r16.start the timer CONTINUE_30: call SAMPLE_ADC1 cp r16.r3 brlo CONTINUE_30 ldi r16. stop the timer .tcnt1h byte ldi r16.$ff ldi ldi out out ldi out r29.======Main loop ends here====== .generate control signals for CCW .r16 in r26.r16 tcnt1l.$56 r16.generate control signals for CCW . read the timer low . read the timer high byte rjmp ANGLE_CALCULATE .start the timer CONTINUE_31: call SAMPLE_ADC0 cp r16.tcnt1l in r27.$56 r16.$01 tccr1b.r16 . angle is to be subtracted from offset .reset the timer .$00 tcnt1h.$00 tcnt1h. read the timer high rjmp ANGLE_CALCULATE MIC_3_CCW: ldi r25.reset the timer1 .$01 tccr1b.r16 r16.r3 brlo CONTINUE_31 ldi r16. r25.tcnt1l byte in r27.r16 tcnt1l.angle is to be added in offset .$20 .$00 out tccr1b.

at AREF out admux.$62 .volt.ref.4 rjmp LOOP2 in r16. ====FOR ADC Ch.4 rjmp LOOP1 in r16.1 sbi adcsra.====FOR ADC Ch.start conversion LOOP2: sbis adcsra.X+ 45 .adch ret SAMPLE_ADC1: .4 rjmp LOOP0 in r16.SAMPLE_ADC0: .2 sbi adcsra.volt. 2==== ldi r16.$30 adiw r27:r26. at AREF out admux. is AVCC with cap. is AVCC with cap. ====FOR ADC Ch.ref.r16 .adch ret ANGLE_CALCULATE: andi r26.$61 . is AVCC with cap.$30 ld r18.ref.volt.0==== ldi r16.6 .0 sbi adcsra.start conversion LOOP1: sbis adcsra.6 .6 .r16 . start conversion LOOP0: sbis adcsra. 1==== ldi r16.adch ret SAMPLE_ADC2: .$f0 clc ror r27 ror r26 ror r27 ror r26 ror r27 ror r26 adiw r27:r26.$60 .left adjusted ADC and Ch.r16 .left adjusted ADC and Ch.left adjusted ADC result and Ch. at AREF out admux.

----------------------------.$11 value ldi r18. ----------------------------.$12 1140 brlo CONTINUE store $ff ldi r19. delay loop of . 100. delaying 63 cycles: 46 .000 cycles: .r29 rotate .$ff brlo SUBTRACT ADDITION: add r20. ============================= .r18 adc r21.if timer value N exceeds .corrosponding to 60 NEXT: out portd. $C9 WGLOOPdd1: dec R23 brne WGLOOPdd1 dec R22 brne WGLOOPdd0 . ============================= . $03 WGLOOPdd2: dec R22 brne WGLOOPdd2 .r18 sbc r21.r19 rjmp NEXT SUBTRACT: sub r20. ----------------------------.give control signal to port D to LOOPCC: . delay loop of . delaying 9 cycles: ldi R22.then r19 and r18 will . 64 cycles: .X cpi r19.ld r19.r19 . ----------------------------. delaying 99990 cycles: ldi R22. ============================= .if this occurs then store .$af degree (11af) CONTINUE: cpi r25. delaying 1 cycle: nop . $A5 WGLOOPdd0: ldi R23.

============================= ldi r29.ldi R22. $A7 WGLOOP10: ldi R23.000 cycles: . ----------------------------. 1. ----------------------------. ----------------------------. $02 WGLOOP13: dec R22 brne WGLOOP13 . jam both motors 47 . ============================= dec r20 brne LOOPCC cpi r21. $C1 WGLOOP12: dec R24 brne WGLOOP12 dec R23 brne WGLOOP11 dec R22 brne WGLOOP10 . delaying 1749993 cycles: ldi R22.$ff out portd.750.send ctrl signal to port d to move FWD . delay loop of .$55 out portd. $12 WGLOOP11: ldi R24.r29 . delaying 6 cycles: ldi R22. $15 WGLOOPcc0: dec R22 brne WGLOOPcc0 . delaying 1 cycle: nop . delaying 1 cycle: nop . ============================= .$00 breq LOOP_END dec r21 brne LOOPCC LOOP_END: ldi r29.r29 . ----------------------------.

data to move robo FWD .000.$00 breq READ_PORTB cpi r16. ----------------------------.r16 .$02 breq TURN_LEFT cpi to move robo CCW .=============================================================== ldi r16. $F0 WGLOOPqq3: dec R21 brne WGLOOPqq3 . masking the upper five bits cpi r16.==now wait for the command signal from the pc and then do tha== . $F8 WGLOOPqq1: ldi R23.$01 breq MOVE_FORWARD cpi r16.$1a call MOVE rjmp MAIN TURN_LEFT: ldi r29. ============================= .$ff out portc.$55 out portd. delaying 14999280 cycles: ldi R21.$56 . 15.000 cycles: .. ============================= .$03 breq GO_BACK cpi r16. delay loop generator . ----------------------------.pinb .$b4 ldi r21. $50 WGLOOPqq0: ldi port B on which signal from pc is present andi r16.=============================================================== . delaying 720 cycles: ldi R21. $FB WGLOOPqq2: dec R23 brne WGLOOPqq2 dec R22 brne WGLOOPqq1 dec R21 brne WGLOOPqq0 .siganl for ready to get command i/p READ_PORTB: in r16.$07 .$04 breq TURN_RIGHT rjmp READ_PORTB MOVE_FORWARD: ldi r29.r29 ldi r20.give control signal to port D to move 48 .

============================= LOOPABCD: .r29 ldi r20.$1a call MOVE rjmp MAIN TURN_RIGHT: ldi to move robo back . ----------------------------. delaying 9 cycles: ldi R22. delaying 1 cycle: nop . delay loop of .000 cycles: . $C9 WGLOOPdd01: dec R23 brne WGLOOPdd01 dec R22 brne WGLOOPdd00 . $03 WGLOOPdd02: dec R22 brne WGLOOPdd02 . $A5 WGLOOPdd00: ldi R23. delay loop of . delaying 99990 cycles: ldi R22.$b4 ldi r21.out portd. ----------------------------. ============================= .give control signal to port D to move .give control signal to port D to move .$b4 ldi r21.r29 ldi to move robo cw .$1a call MOVE rjmp MAIN . 100. ----------------------------.$b4 ldi r21.$1a call MOVE rjmp MAIN GO_BACK: ldi r29.$65 out portd. 64 cycles: 49 .$66 out portd.r29 ldi r20.give control signal to port D to move MOVE: . ============================= .

000 cycles: . ----------------------------. ----------------------------. $21 WGLOOPqqq0: ldi R23. delaying 3 cycles: ldi R22.$00 breq END_LOOP dec r21 brne LOOPABCD END_LOOP: ldi r29.. $15 WGLOOPcc000: dec R22 brne WGLOOPcc000 . $01 WGLOOPqqq3: dec R22 brne WGLOOPqqq3 . delaying 1 cycle: nop . ============================= . delaying 63 cycles: ldi R22. $D6 WGLOOPqqq1: ldi R25.000. $EB WGLOOPqqq2: dec R25 brne WGLOOPqqq2 dec R23 brne WGLOOPqqq1 dec R22 brne WGLOOPqqq0 .$ff out portd.r29 . ============================= dec r20 brne LOOPABCD cpi r21. ----------------------------. delaying 4999995 cycles: ldi R22. ============================= ret 50 . delaying 2 cycles: nop nop . ----------------------------. 5. jam both motors . delay loop generator . ----------------------------.

6.1 Face Recognition Results Recognition Efficiency 85% 85% 82% 90% Person Aditya Subhayan Nilesh Chandra Veer .1 and the results are given below. 51 .2 Speech Recognition Results Recognition Efficiency Words TURN LEFT 85% MOVE RIGHT 80% COME FORWARD 85% GO BACK 75% The above results are taken in very stringent environmental conditions. it is very necessary to maintain same environmental conditions during creation of dictionary and while taking sample voice commands. The efficiency of the proposed algorithm can be improved significantly if the strict and suitable laboratory conditions are provided. For speech recognition. For face recognition it is always required to maintain same light conditions and image background during creation of dictionary and while taking sample image.0.Chapter 6 Results The algorithms for face recognition and speech recognition have been successfully implemented on the MATLAB 7. 6.

This system can be made highly efficient and effective if stringent environmental conditions are maintained. 7. This system also incorporates the same. Apart from it. The running cost of this system is much lower as compare to other systems used for the same purpose. The setup for maintaining these environmental conditions will be a onetime investment for any real life application. 52 .2 Conclusion A system for reliable recognition of speech and face has been designed and developed. this system is highly efficient and economic as compare to other systems generally used for providing security.1 Summary The algorithms for the Speech Recognition and Face Recognition are of utmost importance as far as any security system is concerned. simpler and economic as compare to previous algorithms. This security system is faster. This system can be used as authentication module of a humanoid robot or in real time industrial applications for security. In a reliable security system at least two stages of security exist. At first the person is authenticated using face recognition and after proper authentication of the person voice commands of the person is accepted by the system and the system works according to that.Chapter 7 Summary and Conclusion 7.

The efficiency of the same algorithms can be improved significantly if the concept of Neural Networks is also incorporated in the implementation of the proposed algorithms. To improve the efficiency of these algorithms some other parameters for speech and image can be used but this will definitely increase the system complexity and the processing time. In the proposed system for speech recognition the accent is used as distinguishing parameter and for face the boundary points are used as distinguishing parameters.Chapter 8 Future Scope The proposed system is highly efficient and effective .The accuracy of the system can be improved remarkably if a setup for providing stringent environmental conditions is provided. 53 .

2537-2540. Int’l Conf. “50 years of acoustic signal processing for detection: coping with the digital revolution. Speed and Signal Processing. 2004. India.‖ Annals of the History of Computing. Estrada. [7] R. 296-301. Issue: 2. Poggio. No. . pp. IEEE. Digital Image Processing. C. [2] A. 1997. ―Linear subspace for illuminationrobust face recognition.‖ Proc.H. of ICASSP. [6] K. K. Jan. 2001.‖ Proc. Pentland. Delhi. of IEEE Conf.4. Kotropoucos and I. pp. Gonzalez and R. Batur and M. [9] A. ―A dsp based approach for the implementation of face recognition algorithms. Ltd. and E. 39-51.0. Programming in MATLAB 7. [3] M. pp. Pattern Analysis and Machine Intelligence. 1998. India. ―Example Based Learning for ViewBased Human Face Detection.‖ IEEE Trans. IEEE Conf. Delhi. Vol. B.E.19. Computer Vision and Pattern Recognition.P. Hayes. A.‖ Proc. pp. pp. U. 27. Computer Vision and Pattern Recognition.‖ Proc. Acoustics. Vol. U.1. ―Face recognition using eigenfaces. 519-560. 2003. 253-256. ―Probabilistic Visual Learning for Object Representation. April-June 2005. Pearson Education (Singapore) Pte.H.F. Vol. pp. 65 – 78. Woods. 1991 [4] B. vol. Pentland. A. Sung and T.Jain. Hayes. Turk and A. Starr. ―Rule –Based Face Detection in Frontal Views. pp. Moghaddam and A.‖ IEEE Trans.REFERENCES [1] A. July 1997 [5] C. Pattern Analysis and Machine Intelligence. Mishra and A. 696-710. pp. 20. Flinchbaug and M. Batur. [8] R. E. 54 . Pitas. Agarwal Publication. 586-91. 1.

Appendix A Pin Diagrams of Different Electronic Components PIN DIAGRAM OF ATMEGA32L 55 .

56 .

57 .

58 .

59 .

60 .

61 .

62 .

63 .

64 .

65 .