Submitted in partial fulfillment of the requirements for the degree of Bachelor of Electrical (Electronics) Engineering
CERTIFICATE
It is certified that the contents and form of thesis entitled _________________ submitted by ____________ have been found satisfactory for the requirement of the degree.
Supervisor:
Examiner 1:
Examiner 2:
Declaration
I declare that all material in this thesis which is not my own work has been identified and that no material has previously been submitted and approved for the award of a degree by this or any other university.
It is certified that the work in this thesis is carried out and completed under my supervision.
Supervisor:
iii
DEDICATION
Dedicated with love to my parents
iv
ACKNOWLEDGEMENT
First of all I would like to thank Almighty Allah, the most beneficent and the most merciful, who lead us to the success.
I would like to thanks our project supervisor Madam Amina Ali who guided us throughout the project from the beginning of the research till the completion of project in the form of a smart device.
We would like to express our gratitude to Dr. Arif who co-operated with every student, realizes the weak points of the projects. They helped us in every aspect of our project.
Dr. Kamal Athar is very kind in guiding us regarding the project. He made sure that every facility is extended towards the students even in late hours and on holidays as well.
I would also like to thank National Development Complex (NDC) who give us opportunity to work in their Lab and also sponsored our project.
We would also like to thank all the faculty members who taught us in our four years of education and made us capable of doing all this.
It was all possible because of the support of our friends morally and technically. And more importantly we all express our extreme gratitude towards our families. Their patience, support, tolerance and blessings were the driving force for our group. v
Abstract
Virtual Speaker (VS) is designed for computer generated VOICE .This project is a speaking aid for communication between dumb, deaf and normal people. VS generate voice in response of two input modes: 1. Hand Movement mode 2. Text mode We can make different hand signs by changing fingers position and tilting of the hand. This motion can be determined by using different sensors, including flex sensors and accelerometers. VS can also speak in response of text entry. Controller is programmed to take these inputs, recognize the input and instructs the speech processor to generate voice and LCD to graphically display it. VS is divided into five modules; first module consists of Keypad for Text entry and the LCD for displaying the words, second module is the collection of five bend sensors mounted on the fingers and thumb of the glove, the third module has the accelerometer for sensing hands motion and the ADC for analogue to digital conversion of the output of accelerometer , the fourth module is the microcontrollers module that controls the flow of main program, takes the inputs from sensors and generates the signals for the output module to produce output, the fifth module is the speech synthesis part for generating the voice by concatenating the allophones.
vi
Table of Contents
ACKNOWLEDGEMENT ............................................................................................. v Abstract ......................................................................................................................... vi Table of Contents .........................................................................................................vii List of Figures ..............................................................................................................xii List of Tables .............................................................................................................. xiv Abbreviations ............................................................................................................... xv Chapter 1 1.1 1.2 1.3 1.4 Introduction, Objectives and Achievable Applications ......................... 16
Introduction ................................................................................................... 16 Objectives ...................................................................................................... 17 Block Diagram .............................................................................................. 18 Achievable Applications ............................................................................... 19 Communication with Disable persons ................................................... 19 Benefit of speech synthesis .................................................................... 19 Voice announcement systems ................................................................ 19 Message reader....................................................................................... 20 Computer Mouse movement .................................................................. 20 Robot hand movement control ............................................................... 20 Speech controlled car/ robot .................................................................. 20 Sign Language ....................................................................................... 21
1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 Chapter 2 2.1 2.2 2.3 2.4
Introduction ................................................................................................... 21 Characteristics of Sign Language .................................................................. 21 American Sign Language .............................................................................. 22 Baby Sign Language ..................................................................................... 23
vii
2.5
Other Signing Systems .................................................................................. 23 Signed Exact English (SEE) .................................................................. 24 Pakistan Sign Language & Proposed Hand Signs ................................. 25
Pakistan Sign Language ................................................................................ 25 History and development of Pakistan Sign Language .................................. 25 Sir Syed Deaf Association (SDA), Karachi ........................................... 26 ABSA Research Project ......................................................................... 26 NISE Research Project ........................................................................... 26 PAD Sign Language Research Group, Karachi ..................................... 27 Deaf Reach, FSF, Karachi ..................................................................... 27
Characteristics of the disabled Population of Pakistan ................................. 28 Proposed Hand Signs for our system ............................................................ 29 Proposed hand signs of ASL .................................................................. 29 Some common gestures selected are as follows .................................... 30 Speech Synthesis .................................................................................... 31
Speech Synthesis ........................................................................................... 31 Methods of Speech Synthesis........................................................................ 31 Concatenative Synthesis ........................................................................ 31 Formant Synthesis .................................................................................. 32 Articulatory synthesis ............................................................................ 33
Speech Processor (SP0256) ........................................................................... 34 Features of SP0256-AL2........................................................................ 34 The sp0256 Incorporates Four Basic Functions..................................... 34 Allophone Speech Synthesis .................................................................. 35 How to use allophone set ....................................................................... 35 Sensors ................................................................................................... 36
Application of Sensors .................................................................................. 37 Properties of an Ideal Sensor ......................................................................... 37 Need of Sensors in Our Design ..................................................................... 37 Sensors Available .......................................................................................... 37 Tilt Measurement ................................................................................... 37 Tilt Sensor .............................................................................................. 38 Accelerometer ........................................................................................ 38 Gyroscope .............................................................................................. 40
Bend Measurement ........................................................................................ 41 Optical Method ...................................................................................... 41 Flex Sensors ........................................................................................... 42 Flexible Stretch Sensors ......................................................................... 43
5.7 ............................................................................................................................. 44 5.8 Selected Sensors ............................................................................................ 44 Accelerometer MMA7261Q .................................................................. 44 Flex Sensor............................................................................................. 46 Hardware Designing .............................................................................. 47
Input Hardware .............................................................................................. 47 Processing Unit ............................................................................................. 47 Output Hardware ........................................................................................... 47 Block Diagram .............................................................................................. 48 Hardware Implementation ............................................................................. 49 Basic Hardware ...................................................................................... 49 Bend Detection....................................................................................... 51 Symbol Detection................................................................................... 54 Tilt Measurement ................................................................................... 55 Speech Generation ................................................................................. 58 ix
6.5.6 6.6
Amplification Circuitry.......................................................................... 59
Designing the Architecture............................................................................ 61 Final Schematic ...................................................................................... 62 Practically Implemented and Integrated Hardware................................ 63
Software Development .................................................................................. 65 Programming the Controlling Unit ............................................................... 65 Main Program Flow ...................................................................................... 66 Programming the ADC.................................................................................. 68 Hand Sign Detection ..................................................................................... 69 Speech Generation using Speech Processor .................................................. 70 Programming the LCD .................................................................................. 71 Conclusion and Future Enhancement .................................................... 73
Chapter 9
Appendix A A.1
Description of Input /Output Pins of Accelerometer ................................. 76 g-select Table for Accelerometer .................................................................. 76 ADC 0804 ...................................................................................... 77
Appendix C C.1
D.3
Pin Configuration SP0256-AL2 ................................................................ 79 Dictionary of SP0256 Allophones ............................................................. 79 Allophones Address Table ............................................................................ 81 Audio Amplifier UTC TEA2025 ................................................... 82
Appendix F F.1
Appendix G G.1
C Language Source Code for keypad and LCD ........................................ 83 C Language Source Code for Hand Sensing ........................................... 100 C Language Source Code for SP0256-AL2 ............................................ 123
Appendix I CD Contents ..................................................................................... 128 I.1 I.2 I.3 I.4 Chapter 10 Abstract of Virtual Speaker.doc .............................................................. 128 Project Report .doc.................................................................................. 128 Software code ......................................................................................... 128 Data sheets ............................................................................................... 128 References ............................................................................................ 129
xi
List of Figures
Figure 1 Block diagram............................................................................................ 18 Figure 2 American Manual Alphabets ........................................................................ 22 Figure 3 A baby signing .............................................................................................. 23 Figure 5 Victory Symbol ............................................................................................ 30 Figure 6 OK Symbol ................................................................................................... 30 Figure 7 Turn Left Symbol ......................................................................................... 30 Figure 8 Turn Right Symbol ....................................................................................... 30 Figure 9 Basic structure of cascade formant synthesizer ............................................ 32 Figure 10 Basic structure of a parallel formant synthesizer ....................................... 33 Figure 11 Speech Processor SP0256-AL2 .................................................................. 34 Figure 12 Sensors ........................................................................................................ 36 Figure 13 Construction of a Tilt Sensor ...................................................................... 38 Figure 14 Accelerometer............................................................................................. 39 Figure 16 Spinning Axis of Gyroscope ...................................................................... 40 Figure 17 Optical Method Bend Measurement ........................................................... 42 Figure 18 Flex Sensor ................................................................................................. 42 Figure 19 Working of Flex Sensors ............................................................................ 43 Figure 20 Flexible Stretch Sensors ............................................................................. 43 Figure 21 Accelerometer MMA 7261Q Evaluation Board......................................... 44 Figure 22 Accelerometer Evaluation Board Orientation ............................................. 45 Figure 24 Flex Sensor ................................................................................................. 46 Figure 26 Process Diagram ......................................................................................... 48 Figure 27 Block Diagram............................................................................................ 48 Figure 28 Keypad Functionality ................................................................................. 49 Figure 29 Schematic of Basic Hardware Including Keypad and GUI ........................ 50 Figure 30 Basic Hardware Including Keypad and GUI .............................................. 51 Figure 31 Flex Sensor Pins ......................................................................................... 52 Figure 32 Proteus Simulation Transistor in Cut-off mode.......................................... 53 xii
Figure 33 Proteus Simulation Transistor in saturation mode...................................... 53 Figure 34 Practically Implemented Bend Detection Circuit ........................................ 54 Figure 35 Schematic for Symbol Detection ................................................................ 54 Figure 36 Accelerometer MM7161Q Board ............................................................... 55 Figure 38 Schematic for Angle Measurement ............................................................ 57 Figure 39 Practically Implemented Angle Measurement Circuit ............................... 57 Figure 40 Schematic SP0256-AL2 ............................................................................. 58 Figure 41 Practically Implemented Circuit SP0256-AL2 ........................................... 59 Figure 42 DIP 16 UTC TEA 2025 ......................................................................... 59 Figure 43 Schematic UTC TEA 2025 ......................................................................... 60 Figure 44 Practically Implemented Circuit Audio Amplification .............................. 60 Figure 45 System Architecture ................................................................................... 61 Figure 46 Final Schematic .......................................................................................... 62 Figure 47 System Architecture Practically Implemented ........................................... 63 Figure 48 System Architecture Practically Implemented ........................................... 63 Figure 49 Final Outlook .............................................................................................. 64 Figure 50 Flow Chart for the Main Program Flow ..................................................... 67 Figure 51 Flow Chart for the Programming of ADC .................................................. 68 Figure 52 Flow Chart for Hand Sign Detection .......................................................... 69 Figure 53 Flow Chart for the Programming of Speech Processor .............................. 70 Figure 54 Flowchart for Programming of the LCD .................................................... 72
xiii
List of Tables
Table 1 Communication Table..................................................................................... 19 Table 2 Disability-wise breakup of the Pakistani population ...................................... 28 Table 3 Selected Hand Signs from International Sign Language ................................ 29
xiv
Abbreviations
VS GUI LCD ASL FSL PSL SDL ABSA NISE PAD FESF DGSE WFD FESF Virtual Speaker Graphical User Interface Liquid Crystal Display American Sign Language French Sign Language Pakistan Sign Language Sir Syed Deaf Association Anjuman-e-Behbood-e-Samat-e-Atfal) National Institute of Special Pakistan Association of the Deaf Family Educational Services Foundation Directorate General of Special Education World Federation of the Deaf Family Educational Services Foundation
xv
Introduction, Objectives and Achievable Applications The designed system may not be feasible for everyday use, however with the future advancements and more improved data gloves it can be made possible
1.2 Objectives
We aimed for following goals and objectives o Research on some international sign languages, select some signs and investigate the methods for detection of signs. o Research on sensors required detect the orientation of hand and bend of fingers and selecting the most feasible sensors that meets our requirement. o Mounting of sensors on a Glove for sensing hands movement. o Use of Keypad for controlling main program, and for entering words by multitapping keys in the text mode. o Software designing for the following purposes: Designing of GUI for showing outputs and also path of the main program. Algorithm for detection of hand signs. Designing software for taking the text input from keypad and also recognizing the words. Speech generation procedure by using speech processor.
17
Figure 1
Block diagram
18
INPUT MODES
Disability Text Mode Hand Movement Mode GUI DUMB DEAF BLIND Normal Yes Yes No Yes Yes Yes Yes Yes Yes Yes No Yes
19
20
Sign Language sequentially. In sign languages, units of form and meaning are typically combined simultaneously.
22
Sign Language
23
Sign Language
24
Variations in spoken languages are natural which are originated from cultural and environmental background. Urdu is spoken in a different way in different regions of Pakistan. In the same way PSL has regional variations in number of items. One sign is acceptable in one region but not preferred in another region.
27
The above statistics show that of the total 3.3 million disabled Pakistanis, 0.24 million suffer from hearing loss which is around 7.4% of the overall disabled population in the country. Also further analysis of figures reveals that 55% of the disabled are aged between age groups of 5 years to 29 years. This means that age structures among disabled persons are mainly either youthful or middle aged, just like the general population trends.
28
Two
Three
Four
Five
Six
Seven
Eight
Nine
Ten
29
3.4.2.1 Victory
3.4.2.2 OK
Figure 5 OK Symbol
30
Speech Synthesis There are several problems in concatenative synthesis compared to other methods.
o
Distortion from discontinuities in concatenation points, which can be reduced using some special methods for smoothing signal.
Memory requirements are usually very high, especially when long concatenation units are used, such as syllables or words.
Data collecting and labeling of speech samples is usually time-consuming. In theory, all possible allophones should be included in the material, but tradeoffs between the quality and the number of samples must be made.
Figure 8 Basic structure of cascade formant synthesizer The cascade structure has been found better for non-nasal voiced sounds and because it needs less control information than parallel structure and it is then simpler to implement.
32
Speech Synthesis A parallel formant synthesizer consists of resonators connected in parallel. Sometimes extra resonators for nasals are used. The excitation signal is applied to all formants simultaneously and their outputs are summed. The parallel structures enable controlling of bandwidth and gain for each formant individually.
Figure 9 Basic structure of a parallel formant synthesizer The parallel structure has been found to be better for nasals, fricatives, and stopconsonants, but some vowels can not be modeled with parallel formant synthesizer as well as with the cascade one.
33
Speech Synthesis
Speech Synthesis elements together, and the amplitude and pitch information to excite the digital filter. o A PULSE WIDTH MODULATOR that creates A digital output which is converted to an analog signal when filtered by an external low pass filter.
35
Chapter 5 Sensors
5.1 Sensors
Sensor is an electronic device used to measure a physical quantity such as temperature, pressure or loudness and convert it into an electronic signal of some kind (e.g. a voltage). Sensors are normally components of some larger electronic system such as a computer control or measurement system. Analog sensors most often produce a voltage proportional to the measured quantity. The signal must be converted to digital form with an ADC before the CPU can process it.
Figure 11 Sensors
Sensors
37
Sensors
5.5.3 Accelerometer
An accelerometer is an instrument for measuring acceleration, detecting and measuring vibrations, or for measuring acceleration due to gravity (inclination). Accelerometers can be used to measure vibration on vehicles, machines, buildings, process control systems and safety installations. They can also be used to measure seismic activity, inclination, machine vibration, dynamic distance and speed with or without the influence of gravity.
38
Sensors
Figure 13 Accelerometer 5.5.3.1 Kinds of Accelerometer The two kinds of basic accelerometers are: 5.5.3.2 Analog Accelerometer Analogue accelerometer outputs the analogue value as the change in acceleration. The main feature of this accelerometer is that the output tends to change when there is even a slight change in the input. 5.5.3.3 Digital Accelerometer The digital accelerometer is more sophisticated than the analog. Here the amount of high voltage time is proportional to the acceleration. One of its major advantages is that it is more stable and produces a direct output signal. 5.5.3.4 Piezoelectric Sensor These Accelerometers use piezoelectricity. In such accelerometers the acceleration is calculated based upon the charges derived from the microscopic crystalline structures when they are accelerated due to motion. 5.5.3.5 MEMS Accelerometer MEMS accelerometer works with capacitance and the changes initiated within it as a result of some accelerative force. This technology is used from automotive industry to agriculture industry and from NASA to military researches and operations.
39
Sensors 5.5.3.6 Uses of Accelerometer 5.5.3.7 Automotive Industry Due to high demand and wide spread use of accelerometers in the automotive industry and new hi-tech technology, these sensors are now light weight and are available at low cost and reduced prices. 5.5.3.8 Robotics The forces that can cause vibrations which are detected by the accelerometer can be static, dynamic or gravitational. Certain accelerometers are rated G. G stands for Gravity. Such accelerometers are used mostly in robotics. They are more sensitive to motion and can be triggered at the slightest changes in gravitational pulls.
5.5.4 Gyroscope
An instrument consisting of a heavy disk or wheel that spins rapidly about an axis. The angular momentum of the disk causes it to oppose change in the direction of its axis of rotation, due to the principle of conservation of angular momentum. Because of the gyroscope's tendency to remain oriented in one direction, it is used as a stabilizing device in missiles, as well as in the navigation and piloting systems of airplanes, ships, rockets, and other vehicles.
40
Inertial Measurement Units (IMUs) Handheld GPS Navigation Devices Radio controlled helicopters Toys and game devices Robotic and power tools Antenna positioning
Sensors
5.6.2.1 Working of Flex Sensors Flex sensors are analog resistors. They work as variable analog voltage dividers. Inside the flex sensor are carbon resistive elements within a thin flexible substrate. More carbon means less resistance. When the substrate is bent the sensor produces a resistance output relative to the bend radius. With a typical flex sensor, a flex of 0 degrees will give 10K resistance will a flex of 90 will give 30-40 K ohms. The Bend Sensor lists resistance of 30-250 K ohms.
42
Sensors
5.6.2.2
Applications
Flex sensors are used in gaming gloves, auto controls, fitness products, measuring devices, assistive technology, musical instruments, joysticks, and more.
5.6.3.1 Working of Flexible Stretch Sensors As the stretch sensor is stretched the resistance gradually increases. When the sensor is stretched 50 % its resistance will approximately double to 2.0k Ohms per inch. The stretch sensor is a new way to measure stretch, displacement and force. The sensor is a flexible cylindrical cord .060-.070 in diameter, with electrical terminals at each end. 43
Robotics Biometric displacement reading VR Gloves and VR suits Physics applications and experiments Feedback sensor for air muscles
44
Selectable Sensitivity (2.5g/3.3g/6.7g/10g) Low Current Consumption: 500 A Sleep Mode: 3 A Low Voltage Operation: 2.2 V 3.6 V Fast Turn On Time High Sensitivity (2.5 g) Integral Signal Conditioning with Low Pass Filter Robust Design, High Shocks Survivability
HDD MP3 Player: Freefall Detection Laptop PC: Freefall Detection, Anti-Theft Cell Phone: Image Stability, Text Scroll, Motion Dialing, and ECompass
o o o o o
Pedometer: Motion Sensing PDA: Text Scroll Navigation and Dead Reckoning: E-Compass Tilt Compensation Gaming: Tilt and Motion Sensing, Event Recorder Robotics: Motion Sensing
45
Sensors
Angle Displacement Measurement Bends and Flexes physically with motion device Simple Construction Low Profile
5.8.2.3 Electrical Specifications o Flat Resistance: 10K Ohms o Resistance Tolerance: 30% o Bend Resistance Range: 60K to 110K Ohms o Power Rating: 0.50 Watts continuous. 1 Watt Peak
46
Process diagram will briefly explain the process flow of the system and the hardware components involved in the design of Virtual Speaker.
Hardware Designing
INPUTS
GLOVE (Flex sensors, Accelerometer)
TEXT ENTRY
CONTROLLING UNIT
Hand Sign Detection Algorithm Word recognition Algorithm
OUTPUTS
VOICE GUI
Hardware Designing
6.5.1.1 Keypad functionality: Keypad is used to control the program in an organized way since it is the input to the control unit also it is used to decide the mode which we want to choose. Additionally it is used to input the text in the Text Mode of the input.
49
Hardware Designing 6.5.1.2 GUI LCD holds its importance in the output module from the beginning of the program, showing the main menu of the program. LCD also guides the user to interact with the system by properly displaying all the activities. It will be displaying the Hand signs and also the angle measured from an accelerometer.
6.5.1.3 Software Implementation of Basic Hardware Including Keypad and GUI When we started working on our hardware we simulated our hardware and controller program in software to get the assurance about the validation of our hardware. Snapshots of the schematic are given.
50
Hardware Designing 6.5.1.4 Basic Hardware Including Keypad and GUI Snapshot of the practically implemented hardware is given below. This work is completed successfully in the first phase of the project.
51
Second task is to convert this analogue output to the digital, the use of transistor as a switch can a successful way of converting the output to any of the two binary states 0 or 1 (bend or stretch). To use the transistor as a switch the input analogue signal is applied at the base of transistor when the resistance is less the transistor will not switch ON or it will be in cut-off mode, output at the collector will be high. As we bend the finger the resistance of flex sensor increases and more current will flow to the base, transistor in saturation mode and the output at the collector will be low.
6.5.2.2 Software Implementation of Bend Detection We implemented the digital switch with the input signal from a variable resistor (same as the bend sensor) at it base and the output connected to the collector of the transistor. We get two modes of output each representing the position of the figure.
52
Hardware Designing 6.5.2.5 Bend Detection Circuit Practically implemented circuit after is shown in the snapshot.
54
Hardware Designing
6.5.4.1 Accelerometer MMA7261Q The evaluation board has pads for interfacing to a 3.3 V power source or battery. The pads on the side of the board also provide a means for connecting to the accelerometer analog output by soldering a wire from the evaluation board to another breadboard or system. The ON/OFF switch provides power to the accelerometer and helps preserve battery life if a battery is being used as the power source. S1 must be set towards the ON position for the accelerometer to function. The green LED labeled PWR is lit when power is supplied to the accelerometer.
Figure 32 Accelerometer MM7161Q Board 6.5.4.2 Testing of Accelerometer 1. Connect the external power source to the Evaluation board. The 3.3 V input is connected to the POWER (Vdd) and Ground (Vss) using the solder pads.
55
Hardware Designing 2. Note that the Main Power LED will turn on when the Main Board Switch is turn ON. 3. Next use a pointed object to turn the Sleep Mode Dipswitch to the ON position. You will notice that the Sleep Mode LED will light up once the Sleep Mode Dip Switch is turned to the ON position. This means that the device will have X, Y, and Z outputs on the output pads. Sleep mode will actually be disabled and the device is now active. When OFF, no output voltages should be seen, and the LED will be off. This will mean the board is in Sleep Mode, in low power consumption. 4. Start to measure the voltages on the X, Y, and Z axes. Solder these pads to your microcontroller A/D terminals or other measuring devices.
6.5.4.3 Angle Measurement 6.5.4.4 ADC 0804 The easiest way to do analog to digital conversion is to use an IC such as the ADC0804 that does the work for you. The analog voltage from the accelerometer zaxis output pad is applied to pin 6 and the result is available at pins 11 through 18. We will connect pin 1 (Chip Select) to ground so that the chip is always enabled. If you wanted to use more than one ADC you could use this pin to control which chip is currently enabled. Connect pin 7 (Vin -) to ground. The ADC0804 includes an internal oscillator which requires an external capacitor and resistor to operate. Connect the 150 pF capacitor from pin 4 (CLOCK IN) to ground and the 10k ohm resistor from pin 4 to pin 19 (CLOCK R). Strobing (low to high) to write (WR) signal low for ADC to take the input data and start conversion, Wait for INTR pin to go low (means conversion ends). Once the conversion in ADC is done, data can be made available at the output port by strobing (high to low) to read (RD) signal.
56
Hardware Designing 6.5.4.5 Software Implementation of Angle Measurement Snapshot of the schematic of the angle measurement is shown.
6.5.4.6 Angle Measurement Successful software implementation leads us to the hardware implementation and testing of the above circuit. Practically implemented circuit is shown below.
Hardware Designing
Hardware Designing
59
Hardware Designing 6.5.6.1 Main Features o Working Voltage down to 3V o Few External components o High Channel isolation o Voltage gain up to 45dB(Adjustable with external resistor) o Internal Thermal protection
Hardware Designing
Keypad
Controlling Unit
GUI
Input 5V
Controlling Unit
GUI
3.5 mm
61
Hardware Designing
Hardware Designing
Hardware Designing
64
Conclusion and Future Enhancement with each execution yielding a potentially different result depending upon the options and data that the user gives the controlling unit.
66
Start
Input Keypad
Key = 1 if key = ?
Key = 2
Analyzing Alphabets
Recognizing Words
GUI
Allophones Generation
Output Speech
No if clr
No
Yes
Input INTR
No
if INTR == 0
Output Data
Input Keypad
Input Accelerometer
Angle Measurement No
Output Speech
No
if clr
Yes
Yes
if LRQ == 1 No
Output Speech
70
71
Start
Initialize LCD
Input D7
No
if D7 == 1 Yes
No
Output Data
GUI
Output Data
72
Conclusion and Future Enhancement o Instead of using a data glove image processing can be used to recognize the hand signs. o Voice can be generated by utilizing the Microsoft sound development kit included in windows; this requires the system to be dependant on pc. o A wireless interface between the sensor data glove and the controlling unit can be achieved. o The controlling unit can be replaced by FPGA or DSP to increase the memory instead of using multiple 89C51 microcontrollers.
74
Chapter 9 Appendix
Appendix A 89c51 Micro-controller A.1 Pin Configuration 89c51
Appendix
Appendix B
B.1
Accelerometer
76
Appendix
Appendix C
C.1
ADC 0804
Appendix D
D.1
LCD
77
Appendix
D.2
D.3
Instruction Table
78
Appendix
Appendix E
E.1
E.2
79
Appendix
80
Appendix
81
Appendix
Appendix F
F.1
82
Appendix
#include < reg52.h > #include < stdlib.h> #include < stdio.h > void lcd_cmd_reg(unsigned char lcd_cmd); void lcd_out(unsigned char lcd_value); void lcd_ready(); void init_lcd(); void init_msg(); void control(unsigned char *kyy, unsigned char data_3); unsigned char correct_key(unsigned char txt_ky); void Spkr_main_menu(); void menu_dcde(unsigned char kpad_out); void hand_entrance(); void text_entrance(); void s_delay(); unsigned char lcd_value=0x80; unsigned char text_data=0x00; unsigned char text_data2=0x00; unsigned char value=0x00; unsigned char cntr_out_value=0x00; unsigned char cntr_out_value2=0x00; sfr key_in = 0x90; sfr lcddata_out=0xA0; sbit check_bit=P2^7; sbit rs=P3^5; sbit rwlcd=P3^6; sbit en=P3^7; void trnsmt(unsigned char x); sbit hand_on=P3^3; // Used for activating hand's motion on // Register Select for LCD // Read/Write select for LCD // Enable bit for LCD // Address for port 1, here defining hex values // For data sending to LCD, P2 // for command registers to LCD
Microcontroller 2, by pulling this pin low sbit hand_off=P3^4; unsigned int i; // Used to off, by pulling this low
83
Appendix
unsigned int j; unsigned int counter=0; // For counting digits to be entered, not more then 4 unsigned int cntr_out=0; unsigned int remaining=0; unsigned char ky_1[3]={'A','B','C',}; unsigned char ky_2[3]={'D','E','F'}; unsigned char ky_3[3]={'G','H','I'}; unsigned char ky_4[3]={'J','K','L'}; unsigned char ky_5[3]={'M','N','O'}; unsigned char ky_6[3]={'P','Q','R'}; unsigned char ky_7[3]={'S','T','U'}; unsigned char ky_8[3]={'V','W','X'}; unsigned char ky_9[3]={'Y','Z',0x20}; unsigned char out[11]={0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20}; unsigned char letter_1[4]={'A','B'}; unsigned int clr_ky_cntr=0; // For correct storage of value in output buffer
SCON = 0x40; // setup serial port control, 8-bit UART TR1=1; init_lcd(); init_msg(); while ( 1 ) { Spkr_main_menu(); } } void init_lcd() { lcd_cmd_reg(0x38); lcd_cmd_reg(0x0C); lcd_cmd_reg(0x01); lcd_cmd_reg(0x80); } void init_msg() // Timer 1 Started
84
Appendix
{ unsigned char msg_init[]="VIRTUAL SPEAKER"; unsigned char msg_init2[]="(1)TEXT(2)HAND"; for (i=0; i<15; i++) { s_delay(); lcd_out(msg_init[i]); } lcd_cmd_reg(0xC0); for (j=0; j<14; j++) { s_delay(); lcd_out(msg_init2[j]); } } void Spkr_main_menu() { unsigned char key_data; // logic for detection of pressed key key_in=0xFE; key_data=key_in; if ( key_in == 0xFE ); // no key pressed else if ( key_in == 0xEE ) { text_entrance(); } else if ( key_in ==0xDE ) { hand_entrance(); } else; } // pulling high all columns for getting input
void text_entrance() { unsigned char msg_txt[]="TEXT MODE"; unsigned char msg_init[]="VIRTUAL SPEAKER";
85
Appendix
unsigned char msg_init2[]="(1)TEXT(2)HAND"; unsigned char msg_init3[]="SENDING..."; lcd_cmd_reg(0x01); lcd_cmd_reg(lcd_value); for (i=0; i<9; i++) { s_delay(); lcd_out(msg_txt[i]); } s_delay(); s_delay(); s_delay(); s_delay(); s_delay(); lcd_cmd_reg(0x01); lcd_cmd_reg(0x0D); lcd_cmd_reg(lcd_value); text_data=0x00; while ( text_data != 0xAA ) { key_in = 0xFE; // taking input from row 1 text_data = key_in; text_data=correct_key(text_data); if ( text_data == 0xEE ) { control(ky_1,0xFE); } else if ( text_data == 0xDE ) { control(ky_2,0xFE); } else if ( text_data == 0xBE ) { control(ky_3,0xFE); } else; key_in = 0xFD; // taking input from row 2 // if exit pressed so back to main menu // for clearing LCD // for cursor on
86
Appendix
text_data = key_in; text_data=correct_key(text_data); if ( text_data == 0xED ) // if key 1 is pressed { control(ky_4,0xFD); } else if ( text_data == 0xDD ) { control(ky_5,0xFD); } else if ( text_data == 0xBD ) { control(ky_6,0xFD); } else key_in = 0xFB; text_data = key_in; text_data=correct_key(text_data); if ( text_data == 0xEB ) { control(ky_7,0xFB); } else if ( text_data == 0xDB ) { control(ky_8,0xFB); } else if ( text_data == 0xBB ) { control(ky_9,0xFB); } else key_in = 0xF7; text_data = key_in; text_data=correct_key(text_data); if ( text_data == 0xE7 ) { if (lcd_value == 0x80 ); // if at start then cant erase // just here for control not for data
87
Appendix
else { lcd_cmd_reg(0xC0); lcd_cmd_reg(0x0C); for (j=0; j<15; j++) { lcd_out(0x20); } lcd_cmd_reg(lcd_value); out[cntr_out]=0x20; cntr_out=(cntr_out) - 1; lcd_value--; lcd_cmd_reg(0x0D); lcd_cmd_reg(lcd_value); lcd_out(0x20); s_delay(); s_delay(); s_delay(); s_delay(); s_delay(); } } else if ( text_data == 0xB7 ) { if (cntr_out << 11 ) { for ( j=cntr_out; j<11; j++) { out[j]=0x20; } } else { } if ( out[0] == ky_1[0] ) { lcd_cmd_reg(0x01); lcd_cmd_reg(0x80); for (i=0; i<8; i++) // for clearing LCD // for clearing LCD
88
Appendix
{ s_delay(); lcd_out(msg_init3[i]); } for (j=0; j<=cntr_out; j++) { s_delay(); lcd_out(out[j]); } cntr_out=0; text_data = 0xAA ; lcd_value=0x80; } else if ( (out[0] == ky_2[1]) && (out[1] == ky_8[2]) && (out[2] == ky_3[2]) && (out[3] == ky_7[1])&& (out[4] == 0x20)&& (out[5] == 0x20)&& (out[6] == 0x20)&& (out[7] == 0x20)&& (out[8] == 0x20)&& (out[9] == 0x20) && (out[9] == 0x20)) // for EXIT { lcd_cmd_reg(0x01); lcd_cmd_reg(0x0C); lcd_cmd_reg(0x80); for (i=0; i<15; i++) { s_delay(); lcd_out(msg_init[i]); } lcd_cmd_reg(0xC0); for (j=0; j<14; j++) { s_delay(); lcd_out(msg_init2[j]); } cntr_out=0; text_data = 0xAA ; lcd_value=0x80; } // for clearing LCD // for clearing LCD
89
Appendix
else if ( (out[0] == ky_3[2]) && (out[1] == 0x20) && (out[2] == ky_1[2]) && (out[3] == ky_1[0]) && (out[4] == ky_5[1])&& (out[5] == 0x20)&& (out[6] == ky_7[0])&& (out[7] == ky_6[0])&& (out[8] == ky_2[1])&& (out[9] == ky_1[0])&& (out[10] == ky_4[1])) // for I CAN SPEAK { lcd_cmd_reg(0x0C); lcd_cmd_reg(0x01); lcd_cmd_reg(0x80); for (i=0; i<10; i++) { s_delay(); lcd_out(msg_init3[i]); } trnsmt(0x01); s_delay(); s_delay(); s_delay(); lcd_cmd_reg(0x01); lcd_cmd_reg(0x80); for (i=0; i<15; i++) { s_delay(); lcd_out(msg_init[i]); } lcd_cmd_reg(0xC0); for (j=0; j<14; j++) { s_delay(); lcd_out(msg_init2[j]); } cntr_out=0; text_data = 0xAA ; lcd_value=0x80; } else if ( (out[0] == ky_3[1]) && (out[1] == ky_3[2]) && (out[2] == 0X20) && (out[3] == 0X20) && (out[4] == 0X20)&& (out[5] == 0X20)&& (out[6] == 0X20)&& (out[7] == 0X20)&& (out[8] == 0X20)&& (out[9] == 0X20)&& (out[10] == 0X20)) // for HI // for clearing LCD // for clearing LCD // CURSOR off // for clearing LCD // for clearing LCD
90
Appendix
{ lcd_cmd_reg(0x0C); lcd_cmd_reg(0x01); lcd_cmd_reg(0x80); for (i=0; i<10; i++) { s_delay(); lcd_out(msg_init3[i]); } trnsmt(0x06); s_delay(); s_delay(); s_delay(); lcd_cmd_reg(0x01); lcd_cmd_reg(0x80); for (i=0; i<15; i++) { s_delay(); lcd_out(msg_init[i]); } lcd_cmd_reg(0xC0); for (j=0; j<14; j++) { s_delay(); lcd_out(msg_init2[j]); } cntr_out=0; text_data = 0xAA ; lcd_value=0x80; } else { lcd_cmd_reg(0x0C); lcd_cmd_reg(0x01); lcd_cmd_reg(0x80); // for CURSOR off // for clearing LCD // starting LCD from 1nd Line // for clearing LCD // for clearing LCD // CURSOR off // for clearing LCD // for clearing LCD
lcd_out(ky_8[1]); s_delay();
91
Appendix
lcd_out(ky_6[2]); s_delay(); lcd_out(ky_5[2]); s_delay(); lcd_out(ky_5[1]); s_delay(); lcd_out(ky_3[0]); s_delay(); lcd_out(0x20); s_delay(); lcd_out(ky_2[1]); s_delay(); lcd_out(ky_5[1]); s_delay(); lcd_out(ky_7[1]); s_delay(); lcd_out(ky_6[2]); s_delay(); lcd_out(ky_9[0]); s_delay(); lcd_cmd_reg(0xC0); // starting LCD from 2nd Line
lcd_out(ky_7[1]); s_delay(); lcd_out(ky_6[2]); s_delay(); lcd_out(ky_9[0]); s_delay(); lcd_out(0x20); s_delay(); lcd_out(ky_1[0]); s_delay(); lcd_out(ky_3[0]); s_delay(); lcd_out(ky_1[0]); s_delay(); lcd_out(ky_3[2]); s_delay();
92
Appendix
lcd_out(ky_5[1]); s_delay(); s_delay(); cntr_out=0; lcd_cmd_reg(0x01); text_data = 0x00 ; lcd_value=0x80; lcd_cmd_reg(0x0D); } } else; } } unsigned char correct_key(unsigned char txt_ky) nothing { if ( txt_ky == 0xFE ); else if ( txt_ky == 0xEE ) { return ( txt_ky ); } else if ( txt_ky == 0xDE ) { return ( txt_ky ); } else if ( txt_ky == 0xBE ) { return ( txt_ky ); } else if ( txt_ky == 0xED ) { // just for detection and doing // for clearing LCD
93
Appendix
return ( txt_ky ); } else if ( txt_ky == 0xBD ) { return ( txt_ky ); } else if ( txt_ky == 0xEB ) { return ( txt_ky ); } else if ( txt_ky == 0xDB ) // for key=8 that is for changing letters { return ( txt_ky ); } else if ( txt_ky == 0xBB ) { return ( txt_ky ); } else if ( txt_ky == 0xB7 ) { return ( txt_ky ); } else if ( txt_ky == 0xD7 ) { return ( txt_ky ); } else if ( txt_ky == 0xE7 ) { return ( txt_ky ); } else; } void control(unsigned char *kyy,unsigned char data_3 { if ( lcd_value <= 0x8A ) { lcd_cmd_reg(0xC0); // for exit key // for deleting key // for sending key // for key=9 pressed
94
Appendix
lcd_cmd_reg(0x0C); for (j=0; j<15; j++) { lcd_out(0x20); } lcd_cmd_reg(0x0D); lcd_cmd_reg(lcd_value); lcd_out(kyy[0]); counter=1; cntr_out_value=kyy[0]; s_delay(); s_delay(); s_delay(); s_delay(); s_delay(); while ( text_data !=0xAB ) { key_in = data_3; text_data2 = key_in; text_data2 = correct_key(text_data2); if ( text_data2 == text_data ) { //when first time comes here so counter = 1 if ( counter == 0 ) { lcd_cmd_reg(lcd_value); lcd_out(kyy[0]); cntr_out_value=kyy[0]; counter++; s_delay(); s_delay(); s_delay(); s_delay(); s_delay(); } else if ( counter == 1 ) { lcd_cmd_reg(lcd_value); lcd_out(kyy[1]);
95
Appendix
cntr_out_value=kyy[1]; counter++; s_delay(); s_delay(); s_delay(); s_delay(); s_delay(); } else if ( counter == 2 ) { lcd_cmd_reg(lcd_value); lcd_out(kyy[2]); cntr_out_value=kyy[2]; counter=0; s_delay(); s_delay(); s_delay(); s_delay(); s_delay(); } }
else; key_in = 0xF7; text_data2 = key_in; text_data2 = correct_key(text_data2); if ( text_data2 == 0xD7 ) { out[cntr_out]=cntr_out_value; lcd_value++; value = 0xAB; text_data = value ; s_delay(); s_delay(); s_delay(); s_delay(); s_delay();
96
Appendix
cntr_out++; } else; }
} else { for ( i=0; i<4; i++ ) { lcd_cmd_reg(0x0C); lcd_cmd_reg(0xC0); // for CURSOR off // starting LCD from 2nd Line
lcd_out(ky_6[2]); lcd_out(ky_1[0]); lcd_out(ky_5[1]); lcd_out(ky_3[0]); lcd_out(ky_2[1]); lcd_out(0x20); lcd_out(ky_5[2]); lcd_out(ky_7[2]); lcd_out(ky_7[1]); lcd_out(0x20); lcd_out(0X5B); lcd_out(ky_1[2]); lcd_out(ky_4[2]); lcd_out(ky_6[2]); lcd_out(0X5D); s_delay(); s_delay();
97
Appendix
} value = 0xAB; text_data = value ; } } void hand_entrance() { unsigned char msg_hand[]="HAND MOTION"; unsigned char msg_init[]="VIRTUAL SPEAKER"; unsigned char msg_init2[]="(1)TEXT(2)HAND"; unsigned char hand_exit_key; hand_on = 0 ; hand_off = 1 ; lcd_cmd_reg(0x01); lcd_cmd_reg(0x80); for (i=0; i<11; i++) { s_delay(); lcd_out(msg_hand[i]); } s_delay(); s_delay(); s_delay(); key_in = 0xF7; hand_exit_key=key_in; while ( hand_exit_key != 0xE7 ) { key_in = 0xF7; hand_exit_key=key_in; } hand_on = 1 ; hand_off = 0 ; lcd_cmd_reg(0x01); lcd_cmd_reg(0x0C); lcd_cmd_reg(0x80); for (i=0; i<15; i++) { // for clearing LCD
98
Appendix
s_delay(); lcd_out(msg_init[i]); } lcd_cmd_reg(0xC0); for (j=0; j<14; j++) { s_delay(); lcd_out(msg_init2[j]); }
} void lcd_out(unsigned char lcd_value) { lcd_ready(); lcddata_out=lcd_value; rs=1; rwlcd=0; en=1; en=0; } void lcd_cmd_reg(unsigned char lcd_cmd) { lcd_ready(); lcddata_out=lcd_cmd; rs=0; rwlcd=0; en=1; en=0; } void lcd_ready() { check_bit=1; rs=0; rwlcd=1; en=0; en=1; while ( check_bit==1 ) {
99
Appendix
en=0; en=1; } } void trnsmt(unsigned char x) { SBUF = x; while ( TI == 0 ) ; TI = 0; } void s_delay() { unsigned int j; for (j=0; j<19000; j++); }
H.2
#include<reg52.h> #include <stdio.h> #include <string.h> #include <stdlib.h> void lcd_cmd_reg(unsigned char lcd_cmd); LCDvoid lcd_out(unsigned char lcd_value); void lcd_ready(); void delay(); void s_delay(); void init_lcd(); void init_msg(); sfr lcddata_out=0xA0; sbit check_bit=P2^7; sbit rs=P3^3; sbit rwlcd=P3^4; sbit en=P3^5; void getdata(); void outdata( unsigned char *output ); void sensing_on(); // Register Select for LCD // Read/Write select for LCD // Enable bit for LCD // For data sending to LCD, P2 // used for strings declaration, but not needed here
100
Appendix
sbit thumb=P0^0; sbit index=P0^1; sbit mid=P0^2; sbit mid_nxt=P0^3; sbit smal=P0^4; sbit chk_on= P3^7; sbit chk_off= P3^2; unsigned char adc_scan(); void adc_calc(unsigned char stored); sfr getadc=0x90; sbit rd=P0^5; sbit wr=P0^6; sbit intr=P0^7; unsigned int angle; void s_delay(); unsigned char datta[5]; unsigned int i; unsigned char message_1[]="SEARCHING"; unsigned char message_3[17]={'D','O','N','E','V','I','C','T','R','Y','U','L','F','G','H','A','K'}; unsigned char repeat=0; unsigned char cntr_sign=0; unsigned char cntr_sign1=0; unsigned char cntr_sign2=0; unsigned char cntr_sign3=0; unsigned char cntr_sign4=0; unsigned char cntr_sign5=0; unsigned char cntr_sign6=0; unsigned char cntr_sign7=0; unsigned char cntr_sign8=0; unsigned char cntr_sign9=0; unsigned char cntr_sign10=0; unsigned char cntr_sign11=0; unsigned char cntr_sign12=0; unsigned char storing; int compare_value; void main( ) { // Address for port 1, here defining hex values // Read pin from ADC // Write pin from ADC // INTR pin from ADC
101
Appendix
TMOD = 0x20; TH1 = -3; SCON = 0x40; TR1=1; init_lcd(); init_msg(); while (1) { sensing_on(); } } void sensing_on() { chk_on = 1; chk_off = 1;
if ( chk_on==0 && chk_off==1 ) { if ( repeat == 0 && cntr_sign == 0) { lcd_cmd_reg(0x01); // clear previous data lcd_cmd_reg(0xC0); lcd_out(message_3[15]); lcd_out(message_3[2]); lcd_out(message_3[13]); lcd_out(message_3[11]); lcd_out(message_3[3]); storing = adc_scan(); adc_calc(storing); getdata(); outdata(datta); repeat=1;
} else { getdata();
102
Appendix
outdata(datta); } } else if ( chk_on==1 && chk_off==0 ) { if ( repeat == 1 ) { lcd_cmd_reg(0x01); init_msg(); repeat=0; cntr_sign=0; cntr_sign1=0; // for reseting symbol VICTORY cntr_sign2=0; // for reseting symbol 1 cntr_sign3=0; // for reseting symbol 6 cntr_sign4=0; // for reseting symbol 10 cntr_sign5=0; // for reseting symbol 9 cntr_sign6=0; // for reseting symbol Turn Left cntr_sign7=0; // for reseting symbol Turn Right cntr_sign10=0; // for symbol 3 cntr_sign11=0; // for symbol 4 cntr_sign12=0; // for symbol 5 cntr_sign8=0; // for symbol 7 cntr_sign9=0; // for symbol 8 } else; } else; } void getdata() { datta[0]=thumb; datta[1]=index; datta[2]=mid; datta[3]=mid_nxt; datta[4]=smal; } void outdata(unsigned char *output)
103
Appendix
{ if ( angle >= 70 && angle <= 110 ) { if ( output[0]==0 && output[1]==1 && output[2]==1 && output[3]==1 && output[4]==1 ) { storing = adc_scan(); adc_calc(storing); if ( cntr_sign==0 ) { lcd_cmd_reg(0x80); lcd_out(message_3[1]); lcd_out(message_3[16]); for (i=0; i<11; i++) { lcd_out(0X20); trnsmt(0x20); s_delay(); }
cntr_sign=1 } else { storing = adc_scan(); adc_calc(storing); } cntr_sign1=0; cntr_sign2=0; cntr_sign3=0; cntr_sign4=0; cntr_sign5=0; cntr_sign6=0; cntr_sign7=0; cntr_sign10=0; cntr_sign11=0; cntr_sign12=0; cntr_sign8=0; cntr_sign9=0;
104
Appendix
} else if ( output[0]==1 && output[1]==0 && output[2]==1 && output[3]==1 && output[4]==1 ) { storing = adc_scan(); adc_calc(storing); if ( cntr_sign2==0 ) { lcd_cmd_reg(0x80); lcd_out(0x31); for (i=0; i<14; i++) { lcd_out(0X20); } trnsmt(0x23); s_delay(); cntr_sign2=1 ; } else { storing = adc_scan(); adc_calc(storing); } cntr_sign1=0; cntr_sign=0; cntr_sign3=0; cntr_sign4=0; cntr_sign5=0; cntr_sign6=0; cntr_sign7=0; cntr_sign10=0; cntr_sign11=0; cntr_sign12=0; cntr_sign8=0; cntr_sign9=0; } // output=1
105
Appendix
else if ( output[0]==1 && output[1]==0 && output[2]==0 && output[3]==1 && output[4]==1 )//x==0x19 { storing = adc_scan(); adc_calc(storing); if ( cntr_sign1==0 ) { lcd_cmd_reg(0x80); lcd_out(message_3[4]); lcd_out(message_3[5]); lcd_out(message_3[6]); lcd_out(message_3[7]); lcd_out(message_3[1]); lcd_out(message_3[8]); lcd_out(message_3[9]); VICTORY
for (i=0; i<8; i++) { lcd_out(0X20); } trnsmt(0x26); s_delay(); cntr_sign1=1 ; } else { storing = adc_scan(); adc_calc(storing); } cntr_sign=0; cntr_sign2=0; cntr_sign3=0; cntr_sign4=0; cntr_sign5=0; cntr_sign6=0; cntr_sign7=0; cntr_sign10=0;
106
Appendix
cntr_sign11=0; cntr_sign12=0; cntr_sign8=0; cntr_sign9=0; } else if ( output[0]==1 && output[1]==0 && output[2]==0 && output[3]==0 && output[4]==1 )// { storing = adc_scan(); adc_calc(storing); Symbol = 6
if ( cntr_sign3==0 ) { lcd_cmd_reg(0x80); lcd_out(0x36); for (i=0; i<15; i++) { } trnsmt(0x29); s_delay(); cntr_sign3=1 ; } else { storing = adc_scan(); adc_calc(storing); } cntr_sign=0; cntr_sign1=0; cntr_sign2=0; cntr_sign4=0; cntr_sign5=0; cntr_sign6=0; cntr_sign7=0; cntr_sign10=0; cntr_sign11=0; cntr_sign12=0; lcd_out(0X20);
107
Appendix
cntr_sign8=0; cntr_sign9=0; } else if ( output[0]==1 && output[1]==1 && output[2]==1 && output[3]==1 && output[4]==1 )// { storing = adc_scan(); adc_calc(storing); Symbol = 10
if ( cntr_sign4==0 ) { lcd_cmd_reg(0x80); lcd_out(0x31); lcd_out(0x30); for (i=0; i<13; i++) { lcd_out(0X20); trnsmt(0x32); s_delay(); }
cntr_sign4=1 ; } else { storing = adc_scan(); adc_calc(storing); } cntr_sign=0; cntr_sign1=0; cntr_sign2=0; cntr_sign3=0; cntr_sign5=0; cntr_sign6=0; cntr_sign7=0; cntr_sign10=0; cntr_sign11=0; cntr_sign12=0;
108
Appendix
cntr_sign8=0; cntr_sign9=0; } else if ( output[0]==1 && output[1]==1 && output[2]==0 && output[3]==0 && output[4]==0 )// { storing = adc_scan(); adc_calc(storing); if ( cntr_sign5==0 ) { lcd_cmd_reg(0x80); Symbol = 9
lcd_out(0x39);
cntr_sign5=1 ; } else { storing = adc_scan(); adc_calc(storing); } cntr_sign=0; cntr_sign1=0; cntr_sign2=0; cntr_sign3=0; cntr_sign4=0; cntr_sign6=0; cntr_sign7=0; cntr_sign10=0; cntr_sign11=0;
109
Appendix
cntr_sign12=0; cntr_sign8=0; cntr_sign9=0; } else if ( output[0]==1 && output[1]==0 && output[2]==0 && output[3]==0 && output[4]==0 ) { storing = adc_scan(); adc_calc(storing); if ( cntr_sign11==0 ) { lcd_cmd_reg(0x80); lcd_out(0x34); for (i=0; i<14; i++) { lcd_out(0X20); } trnsmt(0x43); s_delay(); cntr_sign11=1 ; } else { storing = adc_scan(); adc_calc(storing); } cntr_sign=0; cntr_sign1=0; cntr_sign2=0; cntr_sign3=0; cntr_sign4=0; cntr_sign6=0; cntr_sign7=0; cntr_sign5=0; cntr_sign10=0; cntr_sign12=0; cntr_sign8=0;
110
Appendix
cntr_sign9=0; } else if ( output[0]==0 && output[1]==0 && output[2]==0 && output[3]==1 && output[4]==1 ) { storing = adc_scan(); adc_calc(storing); if ( cntr_sign10==0 ) { lcd_cmd_reg(0x80); lcd_out(0x33); for (i=0; i<14; i++) { lcd_out(0X20); } trnsmt(0x46); s_delay(); cntr_sign10=1 ; } else { storing = adc_scan(); adc_calc(storing); } cntr_sign=0; cntr_sign1=0; cntr_sign2=0; cntr_sign3=0; cntr_sign4=0; cntr_sign6=0; cntr_sign7=0; cntr_sign5=0; cntr_sign11=0; cntr_sign12=0; cntr_sign8=0; cntr_sign9=0; }
111
Appendix
else if ( output[0]==0 && output[1]==0 && output[2]==0 && output[3]==0 && output[4]==0 )// Symbol = 5 { storing = adc_scan(); adc_calc(storing); if ( cntr_sign12==0 ) { lcd_cmd_reg(0x80); lcd_out(0x35); for (i=0; i<14; i++) { lcd_out(0X20); trnsmt(0x49); s_delay(); cntr_sign12=1 ; } else { storing = adc_scan(); adc_calc(storing); } cntr_sign=0; cntr_sign1=0; cntr_sign2=0; cntr_sign3=0; cntr_sign4=0; cntr_sign6=0; cntr_sign7=0; cntr_sign5=0; cntr_sign10=0; cntr_sign11=0; cntr_sign8=0; cntr_sign9=0; } else if ( output[0]==1 && output[1]==0 && output[2]==0 && output[3]==1 && output[4]==0 )// { Symbol = 7
112
Appendix
storing = adc_scan(); adc_calc(storing); if ( cntr_sign8==0 ) { lcd_cmd_reg(0x80); lcd_out(0x37); for (i=0; i<14; i++) { lcd_out(0X20); } trnsmt(0x51); s_delay(); cntr_sign8=1 ; } else { storing = adc_scan(); adc_calc(storing); } cntr_sign=0; cntr_sign1=0; cntr_sign2=0; cntr_sign3=0; cntr_sign4=0; cntr_sign6=0; cntr_sign7=0; cntr_sign5=0; cntr_sign10=0; cntr_sign11=0; cntr_sign12=0; cntr_sign9=0;
} else if ( output[0]==1 && output[1]==0 && output[2]==1 && output[3]==0 && output[4]==0 ) {
113
Appendix
storing = adc_scan(); adc_calc(storing); if ( cntr_sign9==0 ) { lcd_cmd_reg(0x80); lcd_out(0x38); for (i=0; i<14; i++) { lcd_out(0X20); trnsmt(0x54); s_delay(); cntr_sign9=1; } else { storing = adc_scan(); adc_calc(storing); } cntr_sign=0; cntr_sign1=0; cntr_sign2=0; cntr_sign3=0; cntr_sign4=0; cntr_sign6=0; cntr_sign7=0; cntr_sign5=0; cntr_sign10=0; cntr_sign11=0; cntr_sign12=0; cntr_sign8=0; } else { lcd_cmd_reg(0x80); for (i=0; i<9; i++) { lcd_out(message_1[i]); } }
114
Appendix
for (i=0; i<7; i++) { lcd_out(0X20); } storing = adc_scan(); adc_calc(storing); cntr_sign=0; cntr_sign1=0; cntr_sign2=0; cntr_sign3=0; cntr_sign4=0; cntr_sign5=0; cntr_sign6=0; cntr_sign7=0; cntr_sign10=0; cntr_sign11=0; cntr_sign12=0; cntr_sign8=0; cntr_sign9=0; } } else if ( angle >= 0 && angle <= 25 ) { if ( output[0]==0 && output[1]==1 && output[2]==1 && output[3]==1 && output[4]==1 )//x==0x1E { storing = adc_scan(); adc_calc(storing); if ( cntr_sign6==0 ) { lcd_cmd_reg(0x80); lcd_out(message_3[11]); lcd_out(message_3[3]); lcd_out(message_3[12]); lcd_out(message_3[7]); for (i=0; i<7; i++) { Symbol for TURN LEFT
115
Appendix
lcd_out(0X20); trnsmt(0x38); s_delay(); cntr_sign6=1 ; } else { storing = adc_scan(); adc_calc(storing); } cntr_sign1=0; cntr_sign2=0; cntr_sign3=0; cntr_sign4=0; cntr_sign5=0; cntr_sign7=0; cntr_sign10=0; cntr_sign11=0; cntr_sign12=0; cntr_sign8=0; cntr_sign9=0; } else { lcd_cmd_reg(0x80); for (i=0; i<9; i++) { lcd_out(message_1[i]); } for (i=0; i<7; i++) { lcd_out(0X20); } storing = adc_scan(); adc_calc(storing); cntr_sign=0; cntr_sign1=0; }
116
Appendix
cntr_sign2=0; cntr_sign3=0; cntr_sign4=0; cntr_sign5=0; cntr_sign6=0; cntr_sign7=0; cntr_sign10=0; cntr_sign11=0; cntr_sign12=0; cntr_sign8=0; cntr_sign9=0; } } else if ( angle >= 155 && angle <= 180 ) { if ( output[0]==0 && output[1]==1 && output[2]==1 && output[3]==1 && output[4]==1 )//x==0x1E { storing = adc_scan(); adc_calc(storing); if ( cntr_sign7==0 ) { lcd_cmd_reg(0x80); lcd_out(message_3[8]); lcd_out(message_3[5]); lcd_out(message_3[13]); lcd_out(message_3[14]); lcd_out(message_3[7]); Symbol for TURN RIGHT
117
Appendix
{ storing = adc_scan(); adc_calc(storing); } cntr_sign1=0; cntr_sign2=0; cntr_sign3=0; cntr_sign4=0; cntr_sign5=0; cntr_sign6=0; cntr_sign10=0; cntr_sign11=0; cntr_sign12=0; cntr_sign8=0; cntr_sign9=0; } else { lcd_cmd_reg(0x80); for (i=0; i<9; i++) { lcd_out(message_1[i]); } for (i=0; i<7; i++) { lcd_out(0X20); } storing = adc_scan(); adc_calc(storing); cntr_sign=0; cntr_sign1=0; cntr_sign2=0; cntr_sign3=0; cntr_sign4=0; cntr_sign5=0; cntr_sign6=0; cntr_sign7=0;
118
Appendix
cntr_sign10=0; cntr_sign11=0; cntr_sign12=0; cntr_sign8=0; cntr_sign9=0; } } else {
lcd_cmd_reg(0x80); for (i=0; i<9; i++) { lcd_out(message_1[i]); } for (i=0; i<7; i++) { lcd_out(0X20); } storing = adc_scan(); adc_calc(storing); cntr_sign=0; cntr_sign1=0; cntr_sign2=0; cntr_sign3=0; cntr_sign4=0; cntr_sign5=0; cntr_sign6=0; cntr_sign7=0; cntr_sign10=0; cntr_sign11=0; cntr_sign12=0; cntr_sign8=0; cntr_sign9=0; } } unsigned char adc_scan()
119
Appendix
{ unsigned char get_data; getadc=0xFF; rd=1; wr=0; wr=1; while ( intr==1 ); rd=0; get_data=getadc; return ( get_data ); } void adc_calc(unsigned char stored) { /* APPLYING FORMULA FOR ANGLE CALCULATIONS FROM ACCELEROMETER ----------------------------------------------------------------- ANGLE=( 180 ) x ( stored / 255 ) ----------------
total we get 0-255 from ADC, when we have to calibrate for our whole range of analog input. For our purpose we can tilt our hand in one axis from o to 180 degree. If no tilt then stored=0, ANGLE=0 Degree If max tilt then stored=255, ANGLE=180 Degree unsigned int val; unsigned char lcdstring[5]; val=(unsigned int)stored; angle = 180-((180*val)/255); sprintf(lcdstring,"%d",angle); if ( angle >= 100 ) { lcd_cmd_reg(0xC7); for ( i=0; i<3; i++) { lcd_out(lcdstring[i]); } } else if ( angle >= 10 && angle <100 ) { */
120
Appendix
lcd_cmd_reg(0xC7); for ( i=0; i<2; i++) { lcd_out(lcdstring[i]); } lcd_out(0x20); } else if ( angle >= 0 && angle <10 ) { lcd_cmd_reg(0xC7); lcd_out(lcdstring[0]); lcd_out(0x20); lcd_out(0x20); } else; compare_value=angle; s_delay(); s_delay(); s_delay(); s_delay(); } void init_lcd() { lcd_cmd_reg(0x38); lcd_cmd_reg(0x0C); lcd_cmd_reg(0x01); lcd_cmd_reg(0x80); } void init_msg() { unsigned char msg_init[]="HAND SENSING OFF"; for (i=0; i<16; i++) { s_delay(); lcd_out(msg_init[i]); } s_delay();
121
Appendix
} void lcd_out(unsigned char lcd_value) { lcd_ready(); lcddata_out=lcd_value; rs=1; rwlcd=0; en=1; en=0; } void lcd_cmd_reg(unsigned char lcd_cmd) { lcd_ready(); lcddata_out=lcd_cmd; rs=0; rwlcd=0; en=1; en=0; } void lcd_ready() { check_bit=1; rs=0; rwlcd=1; en=0; en=1; while ( check_bit==1 ) { en=0; en=1; } } void trnsmt(unsigned char x) { SBUF = x; while ( TI == 0 ) ; TI = 0;
122
Appendix
} void s_delay() { unsigned int j; for (j=0; j<19000; j++);
H.3
#include <AT89X52.H> #include <stdio.h> #include <string.h> #include <stdlib.h> void s_delay(); void chck_symbol(); void out_speech(unsigned char *donee, unsigned int length ); void chck_ready(); unsigned char receiver(); unsigned char rec_data=0; sfr data_out = 0xA0; sbit LRQ = P1^3; sbit ALD = P1^4; sbit chck= P1^0; sbit chck1= P1^1; sbit chck2= P1^2; unsigned char done []={0x17, 0x06, 0x03, 0x02, 0x2A, 0x1A, 0x0B, 0x03, 0x02, 0x37, 0x09, 0x13, 0x29, 0x03, 0x02}; // Allophones Adress for Speaking i can speak // Address for port 2, here defining hex values // checking speech processor is ready or not!
unsigned char done1[]={0x35, 0x2A, 0x13, 0x03, 0x02 }; // Allophones Adress for Speaking ok unsigned char done2[]={0x23, 0x0C, 0x2A, 0x0D, 0x17, 0x17, 0x33, 0x13, 0x03, 0x02 }; // Allophones Adress for Speaking victory unsigned char done3[]={0x0D, 0x1A, 0x33, 0x0B, 0x03, 0x02, 0x2D, 0x1A, 0x28, 0x0D, 0x03, 0x02 }; // Allophones Adress for Speaking tarn laft //unsigned char done4[]={0x1B, 0x20, 0x03, 0x02, 0x18, 0x34, 0x03, 0x02, 0x19, 0x1F, 0x03, 0x02 };// Allophones Adress for Speaking How are you
123
Appendix
unsigned char done5[]={0x1B, 0x18, 0x06, 0x03, 0x02 }; // Allophones Adress for Speaking HI unsigned char done6[]={0x2E, 0x0F, 0x0B, 0x03, 0x02 }; // Allophones Adress for Speaking one unsigned char done7[]={0x37, 0x0C, 0x2A, 0x37, 0x03, 0x02 }; // Allophones Adress for Speaking six unsigned char done8[]={0x0D, 0x07, 0x0B, 0x03, 0x02 }; // Allophones Adress for Speaking ten unsigned char done9[]={0x0B, 0x06, 0x0B, 0x03, 0x02 }; // Allophones Adress for Speaking nine unsigned char done10[]={0x0D, 0x1A, 0x33, 0x0B, 0x03, 0x02, 0x33, 0x06, 0x0D, 0x03, 0x02 }; // Allophones Adress for Speaking tarn right unsigned char done11[]={0x1D, 0x27, 0x13, 0x03, 0x02 }; // Allophones Adress for Speaking three unsigned char done12[]={0x28, 0x35, 0x33, 0x03, 0x02 }; // Allophones Adress for Speaking four unsigned char done13[]={0x28, 0x17, 0x06, 0x23, 0x03, 0x02 }; // Allophones Adress for Speaking five unsigned char done14[]={0x37, 0x1A, 0x23, 0x0B, 0x03, 0x02 }; // Allophones Adress for Speaking savn unsigned char done15[]={0x14, 0x36, 0x0D , 0x02}; // Allophones Adress for Speaking eight void main() { TMOD = 0x20; /* TMOD */ TH1 = -3; SCON = 0x50; /* SCON */ TR1=1; while ( 1 ) { rec_data = receiver(); if ( rec_data == 0x01 ) // GENERATE ALLOPHONES FOR SYMBOL 'I CAN SPEAK' { chck1=0; out_speech(done, 15); //0xFC; /* TH1 */ /* setup serial port control, 8-bit UART */ /* Timer 1 Starts */
124
Appendix
} else if ( rec_data == 0x03 ) // GENERATE ALLOPHONES FOR SYMBOL 'HOW ARE YOU' { chck=0; out_speech(done4, 12); } else if ( rec_data == 0x06 ) // GENERATE ALLOPHONES FOR SYMBOL 'HI' { chck1=0; out_speech(done5, 5); } else if ( rec_data == 0x20 ) // GENERATE ALLOPHONES FOR SYMBOL 'OK' { out_speech(done1, 5); } else if ( rec_data == 0x23 ) // GENERATE ALLOPHONES FOR SYMBOL '1' { out_speech(done6, 5); } else if ( rec_data == 0x26 ) // GENERATE ALLOPHONES FOR SYMBOL 'VICTORY' { out_speech(done2, 10); } else if ( rec_data == 0x29 ) // GENERATE ALLOPHONES FOR SYMBOL '6' { out_speech(done7, 6); } else if ( rec_data == 0x32 ) // GENERATE ALLOPHONES FOR SYMBOL '10' { out_speech(done8, 5);
125
Appendix
} else if ( rec_data == 0x35 ) // GENERATE ALLOPHONES FOR SYMBOL '9' { out_speech(done9, 5); } else if ( rec_data == 0x38 ) // GENERATE ALLOPHONES FOR SYMBOL 'TURN LEFT' { out_speech(done3, 12); } else if ( rec_data == 0x41 ) // GENERATE ALLOPHONES FOR SYMBOL 'TURN RIGHT' { out_speech(done10, 11); } else if ( rec_data == 0x43 ) // GENERATE ALLOPHONES FOR SYMBOL '4' { out_speech(done12, 5); } else if ( rec_data == 0x46 ) // GENERATE ALLOPHONES FOR SYMBOL '3' { out_speech(done11, 5); } else if ( rec_data == 0x49 ) // GENERATE ALLOPHONES FOR SYMBOL '5' { out_speech(done13, 6); } else if ( rec_data == 0x51 ) // GENERATE ALLOPHONES FOR SYMBOL '7' { out_speech(done14, 6); } else if ( rec_data == 0x54 )
126
Appendix
// GENERATE ALLOPHONES FOR SYMBOL '8' { out_speech(done15, 4); } else; } } unsigned char receiver() { unsigned char x; while ( RI == 0 ) ; x = SBUF;
RI = 0; return ( x ); } void out_speech(unsigned char *donee, unsigned int length) { int i=0; for (i=0; i<length; i++) { chck_ready(); data_out = donee[i]; } s_delay(); s_delay(); s_delay(); s_delay(); s_delay(); } void chck_ready() { LRQ = 1; while ( LRQ == 1 ); ALD = 0; ALD = 1; } void s_delay() { // LOW to HIGH pulse for latching data into speech processor // pulling high for taking input from this pin // if still 1 then wait here
127
Appendix
unsigned int j; for (j=0; j<19000; j++);
Appendix I
I.1 I.2 I.3
CD Contents
I.4
Data sheets
o Microcontroller 89C51 o Flex Sensor o Accelerometer o ADC 0804 o LF 33cv o SP0256 AL-2
128
Chapter 10
References
[ 1 ] Baron, Naomi S. Alphabet to Email: How Written English Evolved and Where It's Heading. Routledge, 2000, 2001. Explores how communication technologies, from early writing to present-day electronics, influence the way we speak and write. [ 2 ] Starr, Paul. The Creation of the Media: Political Origins of Modern Communications. Basic, 2004. Explores the influence of political forces in shaping the mass media in the United States. [ 3 ] Microsoft Encarta 2009 [ 4 ] Charlip, Remy; Mary Beth; and George Ancona. Handtalk: An ABC of Finger Spelling and Sign Language. Simon & Schuster, 1974, 1987. A classic work designed for ages 9 to 12. [ 5 ] Sternberg, Martin L. A. American Sign Language Dictionary. Rev. ed. HarperReference, 1998. A classic reference work. [ 6 ] http://www.amic.org.sg/ict/external/awards/0202a2_l59attachment2.pdf [ 7 ] www.geocities.com/musuf/bh/docs/.../Chapter3-BoltayHaath-PSL.pdf [ 8 ] http://www.amic.org.sg/ict/external/awards/0202a2_l59attachment3.pdf [ 9 ] http://www.lefande.com/hands.html [ 1 0 ] www.societyofrobots.com [ 1 1 ] http://ezinearticles.com/?How-does-an-Accelerometer-work?&id=28560
129