Gesture-controlled RC Car
Hello my name is Rohan and I am a rising junior at Dougherty Valley High School in San Ramon, CA. I joined BlueStamp this year because I absolutely love engineering and wanted to grow my knowledge in this field to a very high level. For my main project I created a Gesture Controlled RC car with Robot Arm, in which the user’s glove effectively communicates with the robot in a matter that is both seamless and versatile.
Engineer
Rohan V.
Area of Interest
Computer Science and General Engineering
School
Dougherty Valley High School
Grade
Incoming Junior
Reflection on Bluestamp
I believe the BlueStamp program was very influential in growing my passion for engineering. At the start of the camp, I knew in general that I enjoyed problem-solving, however I had never experienced solving such an intense problem in relatively short period of time. I found the independence of BlueStamp to be emancipating in some ways due to the fact that it completely broke the restrictions of traditional education and exposed me to the benefits doing activities hands-on. Furthermore, when I ran into challenges I was not just simply given a lower grade, but asked to dive deeper into the source of issue and review possible solutions step by step. I hope to take the knowledge from this program into the real world and use it keep my work ethic strong and determination to succeed boundless.
Demo Night
Final Milestone
The completion of my final milestone brings together all the components of the prior milestones in a manner that does not leave out any of their functions. Furthermore, the circuit containing all the motors is mounted upon the plywood base and is attached to both a Lithium-Ion battery along with a portable phone charger as an external power supply. This setup connects wirelessly to the other XBee module attached to the glove. The input setup is made up of two primary portions, the glove and the Arduino wrist band. The glove contains all the flex sensors and wiring that permit it to easily send data with a bend of a combination of fingers. The wristband on the other hand has both a motor shield, Xbee wireless module, and Arduino microcomputer mounted upon it. These two portions of the input communicate with one other through the bundle of cables that flow across their gap. A major feature of this project is the flexibility of repairing the robot if it happens to no longer function as intended. The breadboard circuit and duct tape are in place as opposed to a PCB board or super glue so that if a connection breaks they can be examined and fixed almost immediately.
As I completed this milestone, I learned many valuable concepts and skills that permitted me to complete my project. A major aspect of my project was the extensive usage of the XBee wireless module. I first began my exploration of this innovative technology in milestone 3, where I began to experiment with its functionality in sending data. For my final project, I needed to have a far more detailed and advanced source code to run the several sets of combination of the bending of the flex sensors. I was fortunate enough to have had an initial program written on Arduino IDE provided to me by Robin Andersson’s version of this project. Working off of his source code, I had to modify it a fair amount in order to accomodate for the use of XBees. In his code there was not appearance of XBee, and rather had most functions print to the Serial Monitor rather than the XBee console. Along with this I learned how to work with and create circuits based upon given schematics that I was able to get from Robin Andersson as well. Finally, I learned how to create a mechanical drawing of a given project and use it to help place the locations of the components onto the base.
Along with concepts, I learned many valuable lessons that I hope to carry with me through the completion of similar tasks. Initially, when I back to construct the glove portion of the project I tried to mount the Arduino and Shield onto the glove as well but found that the mess of wires it created was far too disorganized and susceptible to damage. Therefore, I made the modification of introducing a separate arm band that shifts farther down the arm and provides space for the glove and the movement of fingers at its core. Through this change I learned that it is important to space out components of any project so that they can be far more functional by the user. I also learned that it is crucial to secure connections throughout a circuit with materials such as electrical tape, heat shrink, or zip-ties. In my project I found that many of the parts were extremely loose, and so would not remaining in an uniform position over time. Lastly, I also found that when mounting objects onto a base it is important to use a variety of mounting methods. This ensures that versatility while maintaining structural integrity remains the focus of the base.
Overall the conclusion of this project taught me a lot in terms of what is possible with flex sensors and how they can be used to better the current technology we have. In this scenario, remote controlled car that have been controlled with inputs such as joysticks, buttons, etc in the past. Now that control can be shifted to our fingers themselves and be controlled with a system that is far more natural for human usage. In addition, I learned so many concepts that range from all portions of engineering including, electrical, computer, mechanical, and more. However, by far the greatest knowledge I gained was the skills needed to effectively research and complete an intensive project from scratch.
// Router!
#include <SoftwareSerial.h>
SoftwareSerial XBee(2, 3);
int flexSensorPin1 = A0;
int flexSensorPin2 = A1;
int flexSensorPin3 = A2;
int flexSensorPin4 = A3;
int ledPin=13;
int button=8;
int button_read=0;
int b=0;
int k=0;
char s_str1[2];
char s_str2[2];
char s_str3[2];
char s_str4[2];
char command=’e’;
String str1,str2,str3,str4;
void setup(){
pinMode(button,INPUT); // The button is going to control if we are going to control either the robot arm or the motors.
Serial.begin(9600);
XBee.begin(9600);
}
void loop(){
if (digitalRead(button) == LOW) // check if button was pressed
{
b++;
b=b%2;
delay(250);
if (b==0){
command=’s’;
digitalWrite(ledPin,HIGH); // indicator on the hand to know if the motors is going to be controlled or the robot arm
}
else {
command=’e’;
digitalWrite(ledPin,LOW);
}
}
// Read the values
int flexS1 = analogRead(flexSensorPin1);
int flexS2 = analogRead(flexSensorPin2);
int flexS3 = analogRead(flexSensorPin3);
int flexS4 = analogRead(flexSensorPin4);
// Numbers below is individual for each of the flex sensors
if (flexS1 < 485) flexS1 = 485;
else if (flexS1 > 645) flexS1 = 645;
if (flexS2 < 475) flexS2 = 475;
else if (flexS2 > 637) flexS2 = 637;
if (flexS3 < 450) flexS3 = 450;
else if (flexS3 > 655) flexS3 = 655;
if (flexS4 < 500) flexS4 = 500;
else if (flexS4 > 686) flexS4 = 686;
// Mapping all the sensor values down between 0-9. (0 = full bent, 9 = unbent)
int flex_1_0to100 = map(flexS1, 645, 485, 9, 0);
int flex_2_0to100 = map(flexS2, 637, 475, 9, 0);
int flex_3_0to100 = map(flexS3, 655, 450, 9, 0);
int flex_4_0to100 = map(flexS4, 686, 500, 9, 0);
// Converting all strings to a single char
str1=String(flex_1_0to100);
str1.toCharArray(s_str1,2);
str2=String(flex_2_0to100);
str2.toCharArray(s_str2,2);
str3=String(flex_3_0to100);
str3.toCharArray(s_str3,2);
str4=String(flex_4_0to100);
str4.toCharArray(s_str4,2);
if (command==’e’){
// Send all values to coordinator
XBee.write(“e”); // Indicates the start of the message (e=motors, s=robot arm)
XBee.write(s_str4); // Thumb
XBee.write(s_str2); // Index-finger
XBee.write(s_str3); // Middle-finger
XBee.write(s_str1); // Pinky
delay(50);
}
else if (command==’s’){
//Send all values to coordinator
XBee.write(“s”); // Indicates the start of the message (e=motors, s=robot arm)
XBee.write(s_str4); // Thumb
XBee.write(s_str2); // Index finger
XBee.write(s_str3); // Middle finger
XBee.write(s_str1); // Pinky
delay(50);
}
}
// Coordinator!
#include <SoftwareSerial.h>
SoftwareSerial XBee(2, 3);
#include <Servo.h>
#define rightMotor1 8
#define rightMotor2 7
#define leftMotor1 9
#define leftMotor2 10
int claw_ang=0;
int tilt_ang=15;
Servo claw;
Servo tilt;
void setup()
{
claw.attach(5);
tilt.attach(6);
pinMode(rightMotor1, OUTPUT);
pinMode(rightMotor2, OUTPUT);
pinMode(leftMotor1, OUTPUT);
pinMode(leftMotor2, OUTPUT);
Serial.begin(9600);
XBee.begin(9600);
}
void loop()
{
if (XBee.available() >=5 ) {
char incomingByte1 = XBee.read();
char incomingByte2 = XBee.read();
char incomingByte3 = XBee.read();
char incomingByte4 = XBee.read();
char incomingByte5 = XBee.read();
if(incomingByte1==’e’){ // if the first byte is an ‘e’ then we going to control the motors
int val_1 = incomingByte2-‘0’;
int val_2 = incomingByte3-‘0’;
int val_3 = incomingByte4-‘0’;
int val_4 = incomingByte5-‘0′;
// For debugging
/* Serial.println(“Motor mode”);
Serial.println(val_1);
Serial.println(val_2);
Serial.println(val_3);
Serial.println(val_4);
Serial.println();
*/
//Drive forwards
if(val_1==0 && val_2==0 && val_3==0 && val_4==0 ){
digitalWrite(rightMotor1, LOW);
digitalWrite(rightMotor2, HIGH);
digitalWrite(leftMotor2, HIGH);
digitalWrite(leftMotor1, LOW);
}
//Drive backwards
else if(val_1==0 && val_2>0 && val_3>0 && val_4>0){
digitalWrite(rightMotor1, HIGH);
digitalWrite(rightMotor2, LOW);
digitalWrite(leftMotor2, LOW);
digitalWrite(leftMotor1, HIGH);
}
//Drive right
else if(val_1==0 && val_2>0 && val_3>0 && val_4==0){
digitalWrite(rightMotor1, LOW);
digitalWrite(rightMotor2, HIGH);
digitalWrite(leftMotor2, LOW);
digitalWrite(leftMotor1, LOW);
}
//Drive left
else if(val_1==0 && val_2>0 && val_3==0 && val_4==0){
digitalWrite(rightMotor1, LOW);
digitalWrite(rightMotor2, LOW);
digitalWrite(leftMotor2, HIGH);
digitalWrite(leftMotor1, LOW);
}
else if (val_1>0 && val_2>0 && val_3>0 && val_4>0){
digitalWrite(rightMotor1, LOW);
digitalWrite(rightMotor2, LOW);
digitalWrite(leftMotor2, LOW);
digitalWrite(leftMotor1, LOW);
}
}
else if (incomingByte1==’s’){ // if the first byte is ‘s’ then we will control the robot arm
int val_1 = incomingByte2-‘0’; // val_1 corresponds to the thumb
int val_2 = incomingByte3-‘0’; // val_2 corresponds to index finger
int val_3 = incomingByte4-‘0’; // val_3 corresponds to the middle finger
int val_4 = incomingByte5-‘0’; // val_4 corresponds to the pinky
//For debugging
/* Serial.println(“Robot arm mode”);
Serial.println(val_1);
Serial.println(val_2);
Serial.println(val_3);
Serial.println(val_4);
Serial.println();
*/
// Close claw
if(val_1==0 && val_2==0 && val_3==0 && val_4==0){
claw_ang-=5;
}
// Open claw
else if (val_1==0 && val_2>0 && val_3>0 && val_4>0){
claw_ang+=5;
}
// Tilt forward
else if (val_1==0 && val_2>0 && val_3>0 && val_4==0){
tilt_ang+=10;
}
//Tilt backward
else if (val_1==0 && val_2>0 && val_3==0 && val_4==0){
tilt_ang-=10;
}
if(claw_ang<0){
claw_ang=0;
}
if (claw_ang>145){
claw_ang=145;
}
if (tilt_ang<15){
tilt_ang=15;
}
if(tilt_ang>180){
tilt_ang=180;
}
// For debugging
/* Serial.println(“Claw angle:”);
Serial.println(claw_ang);
Serial.println();
Serial.println(“Tilt angle:”);
Serial.println(tilt_ang);
Serial.println();
*/
claw.write(claw_ang);
delay(10);
tilt.write(tilt_ang);
delay(10);
}
}
delay(10);
}