Introduction: How to Make a SensorGlove With Android Connection
The aim is to create an input system for mobile devices, which is controlled by the movements of the fingers, in this case with the help of a glove.
Para ver este tutorial en español, por favor haga click aqui: https://www.instructables.com/id/Como-Hacer-Un-Guan...
Step 1: Creating the Glove Connectors
Materials:
- Gloves
- 5 sensorFlex(2.2in or 5.4in)
- 7 black breadboard jumper wires (for negative)
- 7 red breadboard jumper wires(for positives)
- 5 green breadboard jumper wires (for signal)
- 2 yellow breadboard jumper wires (for Bluetooth Tx/Rx)
- 5 ohm resistors 330
- 1 PCB Board Perforated
- 1 arduino UNO
- 1 bluetooth module HC-06
Step 2: Welding SensorFlex With Jumpers
- Right: Positive
- Left: Negative
Step 3: Join SensorFlex and the Glove by Sewing
*IMPORTANT: The purpose of this is to move the SensorFlex so close to the fingers as be possible
Step 4: Welding Glove With PCB Board
- Solder the 5 red jumpers to the same bus and 2 red jumpers as Output
- Solder a black jumper with a resistance and a green jumper as Output to the same side of resistance (Between black jumper and resistance)
- Solder the 5 resistance to the same bus and 2 black jumpers as Output
Step 5: Connect With Arduino and Bluetooth
Connect the green jumpers to the Arduino Analog Inputs.
- Thumb jumper = A0
- Index jumper = A1
- Middle jumper = A2
- Ring jumper = A3
- Pinky jumper = A4
Connect a black jumper to the Arduino GND Output and the other to Bluetooth GND Input
Connect a red jumper to the Arduino 5v Output and the other to Bluetooth +5v Input
Bluetooth:
- Bluetooth Tx -> Pin2 Arduino
- Bluetooth Rx -> Pin3 Arduino
Step 6: Arduino Code
#include <SoftwareSerial.h>
SoftwareSerial bluetooth(2,3);
int flex1 = A0; int flex2 = A1; int flex3 = A2; int flex4 = A3; int flex5 = A4; int valorflex1; int valorflex2; int valorflex3; int valorflex4; int valorflex5; int estadoTotal_valorflex; int num_anterior = 0; int lista_num[] = {2,3,4}; int contador =0;
void setup() { Serial.begin(9600); bluetooth.begin(9600);
}
void loop() {
valorflex1 = analogRead(flex1); valorflex2 = analogRead(flex2); valorflex3 = analogRead(flex3); valorflex4 = analogRead(flex4); valorflex5 = analogRead(flex5);
int array_valoresflex[] = {valorflex1,valorflex2,valorflex3,valorflex4,valorflex5};
estadoTotal_valorflex = valorTotal(array_valoresflex);
int num_bytes_enviar=(bindec(estadoTotal_valorflex));
lista_num[contador]=num_bytes_enviar; if (contador<2){ contador = contador+1; } else{ contador=0; }
if (lista_num[0]==lista_num[1] && lista_num[0]==lista_num[2]){ if (num_anterior!=num_bytes_enviar){ bluetooth.write(num_bytes_enviar); print_valores(); num_anterior = num_bytes_enviar; } } delay(25); }
int valorTotal(int lista[]) { int pulgar= lista[0]; int indice= lista[1]; int medio= lista[2]; int anular= lista[3]; int menique= lista[4]; int result= 11111;
if (pulgar>=2) { result= result-10000; } if (indice>=6) { result= result-1000; } if (medio>=6) { result= result-100; } if (anular>=6) { result= result-10; } if (menique>=6) { result= result-1; } return result; }
int bindec(int num) { int dedo= 0; if (num%10==1) { dedo=dedo+1; } if (((num/10)%10)==1) { dedo=dedo+2; } if ((((num/10)/10)%10)==1) { dedo=dedo+4; } if (((((num/10)/10)/10)%10)==1) { dedo=dedo+8; } if ((((((num/10)/10)/10)/10)%10)==1) { dedo=dedo+16; } return dedo; }
void print_valores(){
Serial.print("Pulgar:"); Serial.print(valorflex1); if (valorflex1<10){ Serial.print(" "); } Serial.print(" Indice:"); Serial.print(valorflex2); if (valorflex2<10){ Serial.print(" "); } Serial.print(" Medio:"); Serial.print(valorflex3); if (valorflex3<10){ Serial.print(" "); } Serial.print(" Anular:"); Serial.print(valorflex4); if (valorflex4<10){ Serial.print(" "); } Serial.print(" Menique:"); Serial.print(valorflex5); if (valorflex5<10){ Serial.print(" "); }
Serial.print(" Binario:"); Serial.print(estadoTotal_valorflex); if (estadoTotal_valorflex<10000){ Serial.print(" "); if (estadoTotal_valorflex<1000){ Serial.print(" "); if (estadoTotal_valorflex<100){ Serial.print(" "); if (estadoTotal_valorflex<10){ Serial.print(" "); } } } } Serial.print(" Decimal:"); Serial.println(bindec(estadoTotal_valorflex)); }
Attachments
Step 7: AppInventor Code:
Import on AppInventor (Editable Code)
Attachments
Step 8: .APK File for Android
Finale file for Android