Introduction: Texting Mat

Picture of Texting Mat
 
Lusha and May created a "Text-Mat”. This surface can allow the user to write and send messages using one’s feet. This text-mat is designed to send secret messages during meetings or classes. The design utilizes conductive fabric and thread, as well as a flora-board. The program contains 7 preset sentences. The user can press a button to select the appropriate sentence and then a final button to send.

Please enjoy the video:
https://vimeo.com/81472818

Step 1: Text-Mat

Picture of Text-Mat

Lusha and May created a "Text-Mat”. This surface can allow the user to write and send messages using one’s feet. This text-mat is designed to send secret messages during meetings or classes. The design utilizes conductive fabric and thread, as well as a flora-board. The program contains 7 preset sentences. The user can press a button to select the appropriate sentence and then a final button to send.

Step 2:

Picture of

 Next, we cut the wool, felt and conductive fabrics to the desired sizes.

Step 3:

Picture of

3. We then used the sewing machine to sew the fabrics together.

Step 4:

Picture of

. 4. Next, we sewed the conductive thread to make a circuit with the conductive fabric.

Step 5:

Picture of

5. Then we ironed the edges flat.

Step 6:

Picture of

6. Then we connected the flora board into the circuit.

Step 7:

Picture of

7. We prepared the following code for the flora: _________

Step 8:

Picture of

8. We then connected the smart phone and Arduino with the USB connection.

Step 9: Code

The code: 
*/
#include

CapPin cPin_10 = CapPin(10);    // read pin 10 (D10 on Flora) - connect to NES B
CapPin cPin_9  = CapPin(9);     // read pin 9 (D9 on Flora)   - connect to NES A
CapPin cPin_6  = CapPin(6);     // read pin 6 (D6 on Flora)   - connect to NES Start
CapPin cPin_12 = CapPin(12);    // read pin 12 (D12 on Flora) - connect to NES Select
CapPin cPin_1  = CapPin(1);     // read pin 1 (TX on Flora)   - connect to NES right
CapPin cPin_0  = CapPin(0);     // read pin 0 (RX on Flora)   - connect to NES up
CapPin cPin_2  = CapPin(2);     // read pin 2 (SDA on Flora)  - connect to NES left
CapPin cPin_3  = CapPin(3);     // read pin 3 (SCL on Flora)  - connect to NES down

CapPin pins[] = {cPin_10, cPin_9, cPin_6, cPin_12, cPin_1, cPin_0, cPin_2, cPin_3};
// check http://arduino.cc/en/Reference/KeyboardModifiers for more info on unique keys

// WASD D-pad, select = Return, start = Space, LeftButton = z, RightButton = x
//char Keys[] =   {  'x',    'z',    ' ',     KEY_RETURN,    'd',     'w',    'a',    's'};

// arrow D-pad, select = Return, start = Space, LeftButton = b, RightButton = a
//char Keys[] =   {  'a',    'b',    ' ',     KEY_RETURN, KEY_RIGHT_ARROW, KEY_UP_ARROW, KEY_LEFT_ARROW, KEY_DOWN_ARROW};

char* Keys[] =   {"hello", "winkyface", "you there?", "hi", "I'm bored", "let's meet for lunch", "zzz", "bye"};

boolean currentPressed[] = {false, false, false, false, false, false, false, false};

// Capactive touch threashhold, you might want to mess with this if you find its too
// sensitive or not sensitive enough
#define THRESH 500

float smoothed[8] = {0,0,0,0,0,0,0,0};

void setup()
{
  //while (!Serial)
  Serial.begin(115200);
  Serial.println("start");
  Keyboard.begin();
}


void loop()                   
{
  for (int i=0;i<8;i++) {
    delay(1);
    long total1 = 0;
    long start = millis();
    long total =  pins[i].readPin(2000);

    // check if we are sensing that a finger is touching the pad
    // and that it wasnt already pressed
    if ((total > THRESH) && (! currentPressed[i])) {
      Serial.print("Key pressed #"); Serial.print(i);
      Serial.print(" ("); Serial.print(Keys[i]); Serial.println(")");
      currentPressed[i] = true;

      Keyboard.println(Keys[i]); //sends string as keyboard presses, ending with the ENTER key
    }
    else if ((total <= THRESH) && (currentPressed[i])) {
      // key was released (no touch, and it was pressed before)
      Serial.print("Key released #"); Serial.print(i);
      Serial.print(" ("); Serial.print(Keys[i]); Serial.println(")");
      currentPressed[i] = false;
     
      Keyboard.releaseAll();
    }
   
/*
    // simple lowpass filter to take out some of the jitter
    // change parameter (0 is min, .99 is max) or eliminate to suit
    smoothed[i] = smooth(total, .8, smoothed[i]);  

    Serial.print(i); Serial.print(": ");
    Serial.print( millis() - start);      // time to execute in mS
    Serial.print("ms \t");
    Serial.print(total);                  // raw total
    Serial.print("\t->\t");
    Serial.println((int) smoothed[i]);       // smoothed
*/
    delay(5);
  }
}

// simple lowpass filter
// requires recycling the output in the "smoothedVal" param
int smooth(int data, float filterVal, float smoothedVal){

  if (filterVal > 1){      // check to make sure param's are within range
    filterVal = .999999;
  }
  else if (filterVal <= 0){
    filterVal = 0;
  }

  smoothedVal = (data * (1 - filterVal)) + (smoothedVal  *  filterVal);

  return (int)smoothedVal;
}

Step 10:

Comments

icekid (author)2013-12-12

Cool!

bob3030 (author)2013-12-11

Interesting idea. Using the Arduino as an interface makes it very flexible. Thanks for posting.

mothman92 (author)2013-12-11

Your code is missing, otherwise a rather interesting idea.

About This Instructable

6,944views

36favorites

License:

More by lushahuang:Texting mat
Add instructable to: