Needy Wearable is a shirt that reacts heavily when no one is close/when someone is far away, and only calms down the closer one gets. The shirt moves with the help of two servomotors and an ultrasonic ranger positioned on the chest. The wearable goes to a full stop once person2 is within 20cm of the individual wearing the shirt (i.e. way too close).

Process 

Original wearable design plans (cloth draping).

 

 

Movement trials. 

Internal sewing detail. 

Final documentation

 

Working gif

 

Roles

Mohan: wearable creation and design.

Chloé:  programming and wiring.

 

Schematic

 

Code

 

// Needy Wearable: Project I
// by Mohan Yeh (menghany) and Chloé Desaulles (cdesaull)
// Intro to Physical Computing, Fall 2018

// A shirt worn by person1 which moves due to the active state of servomotors
// if a person2 is far away from it. The Needy Wearble calms down
// as the person2 gets closer. 
// This project was built upon the NewPing library sketch.
// ---------------------------------------------------------------------------

#include <NewPing.h>
#include<Servo.h> // Object oriented programming 

#define TRIGGER_PIN  12  // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN     11  // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX_DISTANCE 200 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.

int pingVal; 

Servo charlie;
const int CHARLIE = 6;

Servo june;
const int JUNE = 9;


NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.

void setup() {
  
  Serial.begin(115200); // Open serial monitor at 115200 baud to see ping results.
  charlie.attach(CHARLIE);
  june.attach(JUNE);
}

void loop() {

  //__________________________________ ULTRASONIC RANGER _____________________________________________
  
  delay(50);                     // Wait 50ms between pings (about 20 pings/sec). 29ms should be the shortest delay between pings.
  Serial.print("Ping: ");
  Serial.print(sonar.ping_cm()); // Send ping, get distance in cm and print result (0 = outside set distance range)
  Serial.println("cm");

  pingVal = sonar.ping_cm();
  
  //__________________________________ SERVOMOTORS __________________________________________________


//LARGE DISTANCE
  if (pingVal > 100 || pingVal == 0){
  charlie.write(10);
  june.write(10);
  delay(450);
  
  charlie.write(179);
  june.write(179);
  delay(450);

  charlie.write(10);
  june.write(10);
  delay(450);
  
  charlie.write(179);
  june.write(179);
  delay(450);

  charlie.write(10);
  june.write(10);
  delay(450);
  
  charlie.write(179);
  june.write(179);
  delay(450);
    }

//MEDIUM DISTANCE
 else if (50 < pingVal && pingVal <100){

  Serial.println("WORKING?");
  
  charlie.write(10);
  june.write(10);
  delay(600);

  june.write(120);
  charlie.write(120);
  delay(600);

  charlie.write(10);
  june.write(10);
  delay(600);

  june.write(120);
  charlie.write(120);
  delay(600);

  charlie.write(10);
  june.write(10);
  delay(600);

  june.write(120);
  charlie.write(120);
  delay(600);
 }

//TINY DISTANCE
  else if (20 < pingVal && pingVal < 50){

  charlie.write(10);
  june.write(10);
  delay(2000);

  charlie.write(30);
  june.write(30);
  delay(2000);

    
  charlie.write(10);
  june.write(10);
  delay(2000);

  charlie.write(30);
  june.write(30);
  delay(2000);

    
  charlie.write(10);
  june.write(10);
  delay(2000);

  charlie.write(30);
  june.write(30);
  delay(2000);

 }


 //WEARABLE CALM (CLOSE ENOUGH)
  else if (1 < pingVal && pingVal < 19){
    
  //charlie.detach();
  //june.detach();
  charlie.write(10);
  june.write(10);
  delay(2000);
  charlie.write(10);
  june.write(10);
  delay(2000);
 }

}