Devices & Components
Arduino Nano
Analog Accelerometer: ADXL335
Jumper wires (generic)
Alphanumeric LCD, 16 x 2
HC-05 Bluetooth Module
Inertial Measurement Unit (IMU) (6 deg of freedom)
Flex Sensors
Solderless Breadboard Full Size
USB-A to Micro-USB Cable
Resistor 10k ohm
Hardware & Tools
Soldering iron (generic)
Solder Wire, Lead Free
Hot glue gun (generic)
PCB Holder, Soldering Iron
Software & Tools
MIT App Inventor 2
Arduino IDE
Project description
Code
Code for Operation
arduino
Make necessary adjustments you need, then upload the code to the Arduino Nano
1#include <SoftwareSerial.h> 2SoftwareSerial mySerial(2, 3); // RX, TX 3 4 const int flex1 = A0; 5 const int flex2 = A1; 6 const int flex3 = A2; 7 const int xpin = A3; // x-axis of the accelerometer 8 const int ypin = A4; // y-axis 9 const int zpin = A5; // z-axis (only on 3-axis models) 10 11 12void setup() { 13 // put your setup code here, to run once: 14 Serial.begin(9600); 15 mySerial.begin(9600); 16 delay(15000); 17} 18 19void loop() { 20 // put your main code here, to run repeatedly: 21 int x = analogRead(xpin); 22 delay(50); 23 24 int y = analogRead(ypin); 25 delay(50); 26 27 int z = analogRead(zpin); 28 delay(50); 29 int thumb; 30 int pointer; 31 int middle; 32 int nomx; 33 int nomy; 34 int nomz; 35 36 thumb = analogRead(flex1); 37 pointer = analogRead(flex2); 38 middle = analogRead(flex3); 39 nomx = x-265; 40 nomy = y-253; 41 nomz = z-323; 42 43 44 Serial.print(thumb); 45 Serial.print("\ "); 46 Serial.print(pointer); 47 Serial.print("\ "); 48 Serial.print(middle); 49 Serial.print("\ "); 50 Serial.print(nomx); 51 Serial.print("\ "); 52 Serial.print(nomy); 53 Serial.print("\ "); 54 Serial.print(nomz); 55 Serial.print("\ 56"); 57 Serial.println(""); 58 delay(500); 59 60 61 //group1 62 if ((thumb > 175) && (thumb < 210) && (pointer > 210) && (pointer < 235) && (nomy > 75) && (nomy < 95)) { 63 mySerial.print("LOOK FORWARD"); 64 } 65 else if ((thumb > 175) && (thumb < 200) && (pointer > 210) && (pointer < 235) && (nomy > 160) && (nomy < 175)) { 66 mySerial.print("LOOK DOWN"); 67 } 68 else if ((thumb > 175) && (thumb < 200) && (pointer > 210) && (pointer < 230)&& (nomy > 20) && (nomy < 35)) { 69 mySerial.print("LOOK UP"); 70 } 71 72 //group2 73 else if ((thumb > 160) && (thumb < 195) &&(pointer > 160) && (pointer < 200) && (nomy > 28) && (nomy < 43)) { 74 mySerial.print("OKAY"); 75 } 76 else if ((thumb > 190) && (thumb < 210) && (pointer > 180) && (pointer < 200) && (nomy > 160) && (nomy < 180)) { 77 mySerial.print("HOLD"); 78 } 79 else if ((thumb > 160) && (thumb < 200) &&(pointer > 160) && (pointer < 190) && (nomy > 60) && (nomy < 75)) { 80 mySerial.print("PRONTO"); 81 } 82 83 //group3 84 else if ((thumb > 230) && (thumb < 250) && (pointer > 150) && (pointer < 180) && (nomy >80) && (nomy < 100)) { 85 mySerial.print("CALL ME"); 86 } 87 else if ((thumb > 230) && (thumb < 250) && (pointer > 150) && (pointer < 180) && (nomy >105) && (nomy < 125)) { 88 mySerial.print("THUMBS DOWN"); 89 } 90 else if ((thumb > 230) && (thumb < 250) && (pointer > 150) && (pointer < 189) && (nomy >58) && (nomy < 70)) { 91 mySerial.print("I LOVE YOU"); 92 } 93 else if ((thumb > 230) && (thumb < 250) && (pointer > 220) && (pointer < 235) && (nomy > 80) && (nomy < 105)) { 94 mySerial.print("GIVE ME"); 95 } 96 else if ((thumb > 175) && (thumb < 195) && (pointer > 170) && (pointer < 190) && (nomy > 90) && (nomy < 110)) { 97 mySerial.print("GIVE ME SOME"); 98 } 99 else{ 100 mySerial.print("..."); 101 } 102 }
Downloadable files
Circuit Schematic
This Schematic shows a general overview of how components are connected. It was designed with fritzing
Circuit Schematic

Circuit diagram
This circuit diagram was made on fritzing and shows how the components are connected together. Note that the use of an LCD is a choice you should make. Even though I included an LCD in my circuit diagram, I did not incorporate it into my final prototype and ended up using only the Android app I developed. Finally, I used an Arduino Mega in the circuit diagram but used a Nano in the final prototype
Circuit diagram

Comments
Only logged in users can leave comments