MAGIC GLOVE- WIRELESS HAND GESTURE HARDWARE CONTROLLER

Description
Humans and machines do not interface well. In an attempt to bridge the gap between humans and the systems they interact with, a plethora of input methods have been devised: keyboards, mice, joysticks, game controllers, and touch screens are just a few examples. Unfortunately, none of these devices remove the barrier between man and machine. With the Magic Glove control system, we aim to remove this obstruction by allowing the user to control a hardware device using natural gestures. The Magic Glove takes advantage of a multitude of sensors to capture hand movements and uses this information control a device – in this case, a modified RC car. The goal of this project is to capture simple hand gestures from the Magic Glove and use that input to wirelessly control a modified RC car. Controlled variables include speed, steering, lights and sounds using a combination of flex, force and gyroscopic sensors. Multiple variables are controlled simultaneously as Magic Glove outputs a constant control signal. Testing showed that novice users were able to wear the glove and control the car with only a small amount of instruction. With some future improvements, it may be possible to remove the learning curve completely

MAGIC GLOVE: HAND GESTURE HARDWARE CONTROLLER

Submitted By ANAM KAMAL AKSHAY DEKATE

2D GYROSCOPE TESTING
/****************************************************************** **** MAGIK GLOVE - HAND GESTURE CONTROLLED CAR **** **** 2D GYROSCOPE TESTCODE **** ******************************************************************/ //Analog Inputs constint gyro_4Y = 1; constint gyro_4X = 2; //Variables for Gyro calibration intgy_low; intgy_high; intgx_low; intgx_high; //Variables for Holding Sensor Data intgy; intgx; //Mode of operation boolean debug = true; //true to print data on Serial monitor voidprint_data(intval) { intnew_val; if(val<0) new_val = 0; else if(val>255) new_val=255; elsenew_val = val; if(new_val<10) { Serial.print(0); Serial.print(0); Serial.print(new_val); } else if(new_val>=10 &&new_val<100) { Serial.print(0); Serial.print(new_val); } else Serial.print(new_val); } //Gyro Calibration void calibrate(int y, int x) { analogRead(x); delay(500); analogRead(y); delay(500); intsumx = 0; intsumy = 0; for(int i=0; i<30; i++)

{ sumx = sumx + analogRead(x); sumy = sumy + analogRead(y); delay(200); } doubleavgx = round(sumx/30); doubleavgy = round(sumy/30); gx_low = 0; gx_high = avgx*2; gy_low = 0; gy_high = avgy*2; } void setup() { pinMode(gyro_4Y, INPUT); pinMode(gyro_4X, INPUT); Serial.begin(9600); Serial.print(“CALIBRATING GYRO!!!”); calibrate(gyro_4Y,gyro_4X); Serial.println(“GLOVE READY!!!”); } void loop() { //3.3V reference //analogReference(EXTERNAL); gy = analogRead(gyro_4Y); gx = analogRead(gyro_4X); //Map values int Y = map(gy, gy_low, gy_high, 0, 255); int X = map(gx, gx_low, gx_high, 0, 255);

//Print mapped data if (debug == true) { Serial.print("Y "); //Serial.print(Y); print_data(Y); Serial.println(" "); Serial.print("X "); //Serial.print(X); print_data(X); Serial.println(" "); Serial.println(" "); delay(500); } }

FORCE SENSOR TESTING
/****************************************************************** **** MAGIK GLOVE - HAND GESTURE CONTROLLED CAR **** **** FORCE SENSOR TESTING CODE **** ******************************************************************/ //Analog Inputs int force = 0; void setup() { pinMode(flex, INPUT); Serial.begin(9600); Serial.println("FORCE SENSOR TESTING!!!"); Serial.println("GLOVE READY!!!"); } void loop() { analogReference(DEFAULT); //Averaging force value intfr = 0; for(int i=0;i<10;i++) { fr=fr+analogRead(flex); } int ring=round(fr/10); int FC = map(ring, 0, 800, 0, 255); Serial.print("FC? "); Serial.println(FC); delay(200); }

FLEX SENSOR TESTING
/****************************************************************** **** MAGIK GLOVE - HAND GESTURE CONTROLLED CAR ****

**** FLEX SENSOR TESTING CODE **** ******************************************************************/ //Analog Inputs int flex = 0; void setup() { pinMode(flex, INPUT); Serial.begin(9600); Serial.println("FLEX SENSOR TESTING!!!"); Serial.println("GLOVE READY!!!"); } void loop() { analogReference(DEFAULT); fr=analogRead(flex); } int FX = map(ring, 900,1023, 0, 255); Serial.print("FX? "); Serial.println(FX); delay(200); }

GLOVE CODE
/****************************************************************** **** MAGIK GLOVE - HAND GESTURE CONTROLLED CAR ****

**** GLOVE CODE **** AkshayDekate and Anam Kamal **** ******************************************************************/ //Analog Inputs constint gyro_4Y = 0; constint gyro_4X = 1; constint flex = 2; constint force = 3;; //Digital Inputs constint yellow = 7; constint red = 8; constint green = 6; //Variables for Gyro calibration intgy_low; intgy_high; intgx_low; intgx_high; //Variables for Holding Sensor Data intgy; intgx; intindex_flex; intring_force; //Mode of operation boolean debug = false; //boolean debug = true; boolean mode = false; //boolean mode = true;

****

//false to transmit the data //false to print unmapped data and true to print mapped data

//Variables to Map the values intflex_low = 900; intflex_high = 1015; intforce_low = 0; intforce_high = 800;

//Gyro thresholds int right = 23; int left =35; //Turn intold_turn = 2; intnew_turn = 2; int angle = 127;

//1 for left, 2 for middle and 3 for right //0 for left, 127 for middle and 255 for right

//Print data on Serial monitor and to adjust the sensor values upto 3 digits voidprint_data(intval) { intnew_val; if(val<0) new_val = 0; else if(val>255) new_val=255; elsenew_val = val; if(new_val<10)

{ Serial.print(0); Serial.print(0); Serial.print(new_val); } else if(new_val>=10 &&new_val<100) { Serial.print(0); Serial.print(new_val); } else Serial.print(new_val); }

//Gyro Calibration void calibrate(int y, int x) { analogRead(x); delay(500); analogRead(y); delay(500); intsumx = 0; intsumy = 0; for(int i=0; i<25; i++) { sumx = sumx + analogRead(x); sumy = sumy + analogRead(y); delay(100); } doubleavgx = round(sumx/25); doubleavgy = round(sumy/25); gx_low = 0; gx_high = avgx*2; gy_low = 0; gy_high = avgy*2; } void setup() { pinMode(gyro_4Y, INPUT); pinMode(gyro_4X, INPUT); pinMode(flex, INPUT); pinMode(force, INPUT); pinMode(yellow, OUTPUT); pinMode(red, OUTPUT); pinMode(green, OUTPUT); Serial.begin(9600);

//Gyro Y axis as input //Gyro X axis as input //Flex sensor as input //Force sensor as input //yellow indicating led as output //red indicating led as output //green indicating led as output //Setting the baud rate for communication

//Gyro Calibration digitalWrite(yellow, HIGH); delay(500); digitalWrite(yellow, LOW); digitalWrite(red, HIGH); delay(500);

digitalWrite(red, LOW); digitalWrite(green, HIGH); delay(500); digitalWrite(green, LOW); digitalWrite(yellow, HIGH); digitalWrite(green, HIGH); digitalWrite(red, HIGH); Serial.println(“CALIBRATING GYRO!!!”); calibrate(gyro_4Y,gyro_4X); digitalWrite(green, LOW); delay(500); digitalWrite(red, LOW); delay(500); digitalWrite(yellow, LOW); delay(500); Serial.println(“GLOVE READY!!!”); } void loop() { //3.3V reference analogReference(EXTERNAL); gy = analogRead(gyro_4Y); gx = analogRead(gyro_4X); //5V reference analogReference(DEFAULT); index_flex= analogRead(flex); //Averaging force value intfr = 0; for(int i=0;i<5;i++) { fr=fr+analogRead(force); } ring_force=round(fr/5); //Mapping sensor values int Y = map(gy, gy_low, gy_high, 0, 255); int X = map(gx, gx_low, gx_high, 0, 255); int FX = map(index_flex, flex_low, flex_high, 0, 255); int FC = map(ring_force, force_low, force_high, 0, 255); //Gyro Turning/steering if(Y > (127-left) && Y < (127+right) &&old_turn == 1) new_turn = 1; else if(Y > (127-left) && Y < (127+right) &&old_turn == 2) new_turn = 2; else if(Y > (127-left) && Y < (127+right) &&old_turn == 3) new_turn = 3; else if(Y >= (127 + right) &&old_turn == 1) new_turn = 2; else if(Y >= (127 + right) &&old_turn == 2) new_turn = 3; else if(Y >= (127 + right) &&old_turn == 3) new_turn = 3;

else if(Y <= (127 - left) &&old_turn == 1) new_turn = 1; else if(Y <= (127 - left) &&old_turn == 2) new_turn = 1; else if(Y <= (127 - left) &&old_turn == 3) new_turn = 2; elsenew_turn = 2; //Right turn if(new_turn == 1) { angle = 0; digitalWrite(yellow, HIGH); digitalWrite(red, LOW); digitalWrite(green, LOW); } //Middle turn else if(new_turn == 2) { angle = 127; digitalWrite(yellow, LOW); digitalWrite(red, HIGH); digitalWrite(green, LOW); } //Left turn else { angle = 255; digitalWrite(yellow, LOW); digitalWrite(red, LOW); digitalWrite(green, HIGH); } old_turn = new_turn; //Transmit data by Xbee if(debug == false) { Serial.print("."); // print_data(Y); print_data(angle); print_data(FX); print_data(FC); delay(125); } //Print unmapped data for debugging else if(debug == true && mode == true) { Serial.print("gy--> "); Serial.println(gy); Serial.print("gx--> "); Serial.println(gx); Serial.print("angle--> "); Serial.println(angle); Serial.print("index_flex--> "); Serial.println(index_flex);

Serial.print("ring_force--> "); Serial.println(ring_force); delay(300); } //Print mapped data for debugging else if(debug == true && mode == false) { Serial.print("Y--> "); print_data(Y); Serial.println(" "); Serial.print("X--> "); print_data(X); Serial.println(" "); Serial.print("angle--> "); Serial.println(angle); Serial.println(" "); Serial.print("FX--> "); print_data(FX); Serial.println(" "); Serial.print("FC--> "); print_data(FC); Serial.println(" "); delay(300); } }

CAR CODE
/****************************************************************** **** MAGIK GLOVE - HAND GESTURE CONTROLLED CAR ****

**** CAR CODE **** Akshay Dekate and Anam Kamal **** ******************************************************************/ //Headlight Taillight pin constinthlight = 13; constinttlight = 8; //L293D Motor PWM pins constint m1 = 5; constint m2 = 6; constint m3 = 10; constint m4 = 11; //Buffer declaration for storing the incoming sensor values char buffer[9]; // 3-bit data for 4 sensors constint length = 9; //total length of buffer //Incoming values int p = 0; int turn = 0; intfwd = 0; int rev = 0; //Boolean definiton //boolean debug = true; boolean debug = false;; //Threshold set Constintfwd_threshold = 30; Constintrev_thershold = 100; //Clear buffer befor starting Voidclrbuffer() { for(int i=0; i < length; i++) { buffer = 0; } } void setup() { pinMode(hlight, OUTPUT); //pinMode(tlight, OUTPUT); pinMode(m1, OUTPUT); pinMode(m2, OUTPUT); pinMode(m3, OUTPUT); pinMode(m4, OUTPUT); Serial.begin(9600); clrbuffer(); //Initial motor state(all OFF) analogWrite(m1, 0); analogWrite(m2, 0); analogWrite(m3, 0); analogWrite(m4, 0);

****

//drive //turn //forward //reverse

//for debugging //for debugging

//Headlight as OUTPUT //Taillight as OUTPUT //M1 as OUTPUT //M2 as OUTPUT //M3 as OUTPUT //M4 as OUTPUT //Setting baud rate for serial communication //Clear buffer function call

Serial.flush(); } void loop() { if(head == true) digitalWrite(hlight, HIGH); //receive commands while(Serial.available()) { char check = Serial.read(); if(check == '.') { for(int i=0; i<length; i++) { buffer = Serial.read(); //delay(10); } //Passing the values to buffer char angle[3] = { buffer[0], buffer[1], buffer[2] }; char flex[3] = { buffer[3], buffer[4], buffer[5] }; char force[3] = { buffer[6], buffer[7], buffer[8] };

//Flushing false incoming values

//Reading incoming value

//Storing incoming sensor values in buffer

//Decdoding incoming values //p = 100*(Y[0] - '0') + 10*(Y[1] - '0') + (Y[2] - '0'); turn = 100*(angle[0] - '0') + 10*(angle[1] - '0') + (angle[2] - '0'); fwd = 100*(flex[0] - '0') + 10*(flex[1] - '0') + (flex[2] - '0'); rev = 100*(force[0] - '0') + 10*(force[1] - '0') + (force[2] - '0'); //Turn function if(turn <= 70 ) { digitalWrite(m1, HIGH); digitalWrite(m2, LOW); } else if(turn >= 180) { digitalWrite(m1, LOW); digitalWrite(m2, HIGH); } else { digitalWrite(m1, LOW); digitalWrite(m2, LOW); } //Forward Acceleration function if(fwd<fwd_threshold) { analogWrite(m3, 0); analogWrite(m4, 0); digitalWrite(hlight, HIGH); } else

//drive //turn //forward //reverse

{ if(rev >rev_thershold) { analogWrite(m3, 0); analogWrite(m4, fwd); digitalWrite(tlight, HIGH); } else { analogWrite(m3, fwd); analogWrite(m4, 0); digitalWrite(hlight, HIGH); } } delay(150); //Print values for debugging if(debug == true) { //Serial.print("p--> "); //Serial.println(p); //Serial.print("turn--> "); Serial.println(turn); //Serial.print("Forward--> "); //Serial.println(fwd); //Serial.print("Reverse--> "); //Serial.println(rev); //Serial.println(" "); //delay(50); } } } }

//Reverse acceleration function



doc_629557030.docx
 

Attachments

Back
Top