Project 2 – Alternative Interface Prototype

Mock Up – Surveillance Jacket

The overall concept which I have designed is a jacket integrated with a sensor suite and computer to increase situational awareness and provide surveillance related functionality. Such a garment would be intended for undercover operations ranging from low to high risk and therefore be constructed from Kevlar and other durable materials and electronic components. An array of ultrasonic distance sensors would be located along the sides and back of the jacket and used to sense if the wearer is approached from these vulnerable directions. These would be integrated with other sensors such as an accelerometer (not included in my diagram) and programmed in such a way to ignore scans against stationary objects that are passed while the wearer in motion. A corresponding feedback array would be used to alert the wearer to the location and distance of incoming contacts. Vibrating motors or even another wearable such as a smart watch or Google Glass-like device could be used for this purpose, though in my diagrams I have opted for a simple set of 4 LED associated with each sensor. The jacket will also come equipped with a hidden front-facing camera and accompanying microphone. In my design above, the camera is represented by the small black box on the left side. Serving a dual purpose, the microphone could be utilized for both voice-activated commands affecting the jacket’s functions as well as for recording surrounding audio. Audio feedback given to the user is also a possibility via a separate device or an integrated speaker, which I have included in the diagram.

Because of the jacket’s emphasis on awareness and concealment, the wearer would likely not want to visibly be seen interacting with a secondary device when controlling functions of the jacket. As such, primary interaction would be handled via haptic pressure sensors within the jacket’s pocket. In my diagram I have used Fritzing’s Force Sensitive Resistors to represent these, however in reality they would use Velostat or a drawing-tablet like interface that can track both the position of interaction and varying levels of pressure to control the jacket. Various combinations of tapping, holding, sliding, etc. enable, disable, or adjust the many functions of the jacket, such as activating the recording functionality or disabling the proximity scanning or modifying the range at which it alerts the wearer.

Prototype

For my prototype of the surveillance jacket, I focused primarily upon the interface of the force sensors. As in my concept above I have represented them in my breadboard and schematic diagrams using FSRs as a stand-in. My material of choice for the prototype of this sensor was Velostat, which turned out to be particularly challenging to work with. After making several iterations based upon various examples, I finally was able to create a functioning pressure-sensitive circuit. Unfortunately, the reading given by the sensors were not always accurate, making it difficult to get consistent readings of light, medium, and hard presses as well as the difference between pressing the sensors temporarily and holding them down.

Initial attempts to create the sensor with two pieces of tin tape at the wire ends and from one to several sheets of Velostat bridging the gap. Several types of diodes were also included based on examples.

First accurate revision consisting of a single square of Velostat in series with a 10k resistor .

Final version of three separate pressure sensors.

Along with the pressure sensors are an ultrasonic distance sensor, microphone, and speaker, along with accompanying LEDs to function as indicator lights. As implemented, the microphone only simulates the act of recording. Two LEDs are associated with the microphone, the green indicating whether it is “recording” and the red whether input is being received. The second red light activates relative to the ultrasonic sensor. When an object passes within six feet of the sensor, the light will activate. At two feet or less, the sensor will cause the speaker will play a series of four notes as an alarm. By either tapping the Velostat sensors, the microphone, speaker, and ultrasonic sensor can all be turned on or off. Because of how the Velostat works, various functions can also be assigned to when they are held individually, or when multiple are tapped or held simultaneously.

Main File

/*
 * Jordan Machalek
 * Project 2
 * Prototype utilizing pressure and ultrasonic sensors to create an interactive
 * proximity sensor device intended to be integrated with a jacket or other
 * outerwear as a wearable device
 * Ultrasonic sensor code adapted from: https://howtomechatronics.com/tutorials/arduino/ultrasonic-sensor-hc-sr04/
 * Microphone code adapted from: https://learn.adafruit.com/adafruit-microphone-amplifier-breakout/measuring-sound-levels
 * Velostat pressure sensor code adapted from: https://gist.github.com/sshadmand/34a2f73e48a731c3c2e86b2171d6c41e
 * Speaker code adapted from: https://www.arduino.cc/en/Tutorial/toneMelody
 */
#include <math.h>
#include "pitches.h"

int myPin = 0;  


// Digital Pins
const int speakerPin = 13;
const int ultraEchoPin = 12;
const int ultraTrigPin = 11;
const int recStatusPin = 9;
const int recInputPin = 7;
const int proxAlertPin = 6;
// Analog Pins
const int pressPin0 = A0;
const int pressPin1 = A1;
const int pressPin2 = A2;
const int micPin = A3;

// Pressure Sensor Values
int press0Value = 0; // First pressure sensor
int press1Value = 0; // Second pressure sensor
int press2Value = 0; // Third pressure sensor
int isTouching = false;
int touchCount0 = 0;
int touchCount1 = 0;
int touchCount2 = 0;

// Mic Variables
boolean isRecording = true;
int micValue = 0;
//unsigned int micValue = 0;
//const int sampleWidth = 50;

// Ultrasonic Sensor Variables
boolean isSensing = true;
long travelTime;
int travelDistance; // measured in inches

// Speaker
boolean isMuted = true;

void setup() {
  // Speaker
  pinMode(speakerPin, OUTPUT);
  // Ultrasonic Sensor
  pinMode(ultraEchoPin, INPUT);
  pinMode(ultraTrigPin, OUTPUT);
  // Microphone
  pinMode(micPin, INPUT);
  // Lights
  pinMode(recStatusPin, OUTPUT);
  pinMode(recInputPin, OUTPUT);
  pinMode(proxAlertPin, OUTPUT);
  // Velostat Pressure Sensors
  pinMode(pressPin0, INPUT);
  pinMode(pressPin1, INPUT);
  pinMode(pressPin2, INPUT);
  
  Serial.begin(9600);
}

// the loop function runs over and over again forever
void loop() {
  // Get readings from Velostat pressure sensors
  press0Value = analogRead(pressPin0);
  press1Value = analogRead(pressPin1);
  press2Value = analogRead(pressPin2);

  // Check proximity sensor
  if(isSensing){
    CheckProximity();  
  }

  if(isRecording){
    Record();
  }

  // Check for input from the velostat sensors
  PressureInputCheck(0, press0Value);
  PressureInputCheck(1, press1Value);
  PressureInputCheck(2, press2Value);
}

void CheckProximity(){
  // Clear ultraTrigPin data
  digitalWrite(ultraTrigPin, LOW);

  // Send a sound wave for 10ms
  digitalWrite(ultraTrigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(ultraTrigPin, LOW);

  // Read the ultraEchoPin to get the travel time in ms
  travelTime = pulseIn(ultraEchoPin, HIGH);

  // Determine the distance in inches
  travelDistance = travelTime * 0.0133 / 2;

  // Check if something is less than 2 yards away, if so alert the user
  if(travelDistance < 54){
    digitalWrite(proxAlertPin, HIGH);

    if(travelDistance < 24 && isMuted == false){
      AudioAlert();
    }
  }
  else{
    digitalWrite(proxAlertPin, LOW);
  }
}

void PressureInputCheck(int ID, int value){
  String touchType = "";
  
  if (value > 90) {
    isTouching = true;

    // Increment count per sensor
    if(ID == 0){
      touchCount0++;
    }
    if(ID == 1) {
      touchCount1++;
    }
    if(ID == 2) {
      touchCount2++;
    }
  } else {
    isTouching = false;
    // Clear count per sensor
    if(ID == 0){
      touchCount0 = 0;
    }
    if(ID == 1) {
      touchCount1 = 0;
    }
    if(ID == 2) {
      touchCount2 = 0;
    }
  }

  if (isTouching && (touchCount0 > 3 || touchCount1 > 3 || touchCount2 > 3)) {
    touchType = "Hold";
  } else if (isTouching) { 
    touchType = "Tap";
  }

  if (value < 90) {
    //Serial.println("Not touched");
  } 
  else if (value < 120) {
    String output = String("Light " + touchType);
    Serial.println(output);
    // Perform action based on the sensor pressed
    switch(ID){
      case 0:
        if(touchType == "Tap"){
          // Toggle Recording
          isRecording = !isRecording;
          
          // Indicate that the speaker is recording
          if(isRecording){
            digitalWrite(recStatusPin, HIGH);
          }
          else {
            digitalWrite(recStatusPin, LOW);
          }
        }
        else {
          
        }
        break;
      case 1:
        if(touchType == "Tap"){
          // Toggle speaker
          isMuted = !isMuted;
        }
        else {
          
        }
        break;
      case 2:
        if(touchType == "Tap"){
          // Toggle proximity sensing
          isSensing = !isSensing;
        }
        else {
          
        }
        break;
    }
  } 
  else if (value < 160) {
    String output = String("Strong " + touchType);
    Serial.println(output);
    // Perform action based on the sensor pressed
    
    // Switch in same format as the first, assigned to different functionality
    // Removed here for length considerations
  } 
  else if (value < 190) {
    String output = String("Hard " + touchType);
    Serial.println(output);
    // Perform action based on the sensor pressed

    // Switch in same format as the first, assigned to different functionality
    // Removed here for length considerations
  }
}

// Simulates the action of recording
void Record(){  
  micValue = digitalRead(micPin);
  //Serial.println("Mic value: " + micValue);
  if(micValue == HIGH) {
    digitalWrite(recInputPin, HIGH);
  }
  else {
    digitalWrite(recInputPin, LOW);
  }
}

// Plays a tone alerting the wearer to a contact within 2 feet
void AudioAlert(){
  int alarm[] = {
    NOTE_FS6, NOTE_C6, NOTE_FS6, NOTE_C6
  };

  int noteLengths[] = {
    6, 6, 6, 6
  };

  for (int i = 0; i < 4; i++) {
    // Calculate time the note should play
    int noteLength = 1000 / noteLengths[i];
    tone(speakerPin, alarm[i], noteLength);

    // Set minimum time between notes
    int pauseTime = noteLength * 1.30;
    delay(pauseTime);
    
    // stop the tone
    noTone(speakerPin);
  }
}

pitches.h File from: https://www.arduino.cc/en/Tutorial/toneMelody

/*************************************************
 * Public Constants
 *************************************************/

#define NOTE_B0  31
#define NOTE_C1  33
#define NOTE_CS1 35
#define NOTE_D1  37
#define NOTE_DS1 39
#define NOTE_E1  41
#define NOTE_F1  44
#define NOTE_FS1 46
#define NOTE_G1  49
#define NOTE_GS1 52
#define NOTE_A1  55
#define NOTE_AS1 58
#define NOTE_B1  62
#define NOTE_C2  65
#define NOTE_CS2 69
#define NOTE_D2  73
#define NOTE_DS2 78
#define NOTE_E2  82
#define NOTE_F2  87
#define NOTE_FS2 93
#define NOTE_G2  98
#define NOTE_GS2 104
#define NOTE_A2  110
#define NOTE_AS2 117
#define NOTE_B2  123
#define NOTE_C3  131
#define NOTE_CS3 139
#define NOTE_D3  147
#define NOTE_DS3 156
#define NOTE_E3  165
#define NOTE_F3  175
#define NOTE_FS3 185
#define NOTE_G3  196
#define NOTE_GS3 208
#define NOTE_A3  220
#define NOTE_AS3 233
#define NOTE_B3  247
#define NOTE_C4  262
#define NOTE_CS4 277
#define NOTE_D4  294
#define NOTE_DS4 311
#define NOTE_E4  330
#define NOTE_F4  349
#define NOTE_FS4 370
#define NOTE_G4  392
#define NOTE_GS4 415
#define NOTE_A4  440
#define NOTE_AS4 466
#define NOTE_B4  494
#define NOTE_C5  523
#define NOTE_CS5 554
#define NOTE_D5  587
#define NOTE_DS5 622
#define NOTE_E5  659
#define NOTE_F5  698
#define NOTE_FS5 740
#define NOTE_G5  784
#define NOTE_GS5 831
#define NOTE_A5  880
#define NOTE_AS5 932
#define NOTE_B5  988
#define NOTE_C6  1047
#define NOTE_CS6 1109
#define NOTE_D6  1175
#define NOTE_DS6 1245
#define NOTE_E6  1319
#define NOTE_F6  1397
#define NOTE_FS6 1480
#define NOTE_G6  1568
#define NOTE_GS6 1661
#define NOTE_A6  1760
#define NOTE_AS6 1865
#define NOTE_B6  1976
#define NOTE_C7  2093
#define NOTE_CS7 2217
#define NOTE_D7  2349
#define NOTE_DS7 2489
#define NOTE_E7  2637
#define NOTE_F7  2794
#define NOTE_FS7 2960
#define NOTE_G7  3136
#define NOTE_GS7 3322
#define NOTE_A7  3520
#define NOTE_AS7 3729
#define NOTE_B7  3951
#define NOTE_C8  4186
#define NOTE_CS8 4435
#define NOTE_D8  4699
#define NOTE_DS8 4978

Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create your website at WordPress.com
Get started
%d bloggers like this: