As computing becomes more ubiquitous in our objects, designers need to be more aware of how to design meaningful interactions into electronically enhanced objects. At the University of Washington, a class of junior Interaction Design majors is exploring this question. These pages chronicle their efforts.

Tuesday, June 11, 2013

Randy & Charlie: Noyse

Concept Video

Description

Our project tackled the issue of sound sensing regarding Deaf and hard of hearing individuals. In describing our device we want to avoid calling it a hearing aid, because it in no way aids in hearing in the conventional sense. Rather, it provides a nuance form of sound feedback through haptics via vibration motors which can be taken advantaged by both the hearing and deaf. The device, worn around the neck, is embedded with four microphone-vibration motors pairs distributed evenly around it's perimeter. Sound that is registered by the microphones triggers their respective vibration motor. The strength of the vibration is proportional to the amplitude of the registered sound. Essentially, the user can feel the intensity and directionality of incoming sound. To combat issue of ambient sound, the device samples and retains the amplitude of the previous ten seconds, averages the ten samples, and sets it as the threshold at which new incoming sound must register in order to trigger vibrations.

Code


// The analogue input pins each microphone is plugged into.
const int electret1 = 0;  
const int electret2 = 1;
const int electret3 = 2;
const int electret4 = 3;

// The analogue output pins each vibration motor.
const int vibration1 = 10;  
const int vibration2 = 6;
const int vibration3 = 5;
const int vibration4 = 3;

// Variable to store the value read from the sensor pins.
int sensorReading1 = 0;     
int sensorReading2 = 0;
int sensorReading3 = 0;
int sensorReading4 = 0;

// The queue of running averages for each microphone to set threshold.
int sensorMax1[10];
int sensorMax2[10];
int sensorMax3[10];
int sensorMax4[10];

// Queue to temporarily store data.
int temp[10];

// The minimum.
int sensorMin = 1023;

// The threshold that needs to be surpassed to register.
int threshold1;
int threshold2;
int threshold3;
int threshold4;

// Keep track of time to take samples every instance.
int time;

// SETUP
void setup() {
  
  // Use the serial port 57600 to read faster than 9600.
  Serial.begin(57600);  

  // Set the vibration motors as output.
  pinMode(vibration1, OUTPUT);
  pinMode(vibration2, OUTPUT);
  pinMode(vibration3, OUTPUT);
  pinMode(vibration4, OUTPUT);
  
  delay(2000);
  
  // Record time it took to get here.
  time = millis();
  
  Serial.print("Time: ");
  Serial.println(time);
  // For ten seconds...
  for (int i = 0; i < 10; i++) {
    // Every 5 seconds, add a microphone reading to each microphone reading queue.
    Serial.print("Passed: ");
    Serial.println(millis() - time);
    
    sensorReading1 = analogRead(electret1);   
    push(sensorMax1, sensorReading1);
    
    sensorReading2 = analogRead(electret2); 
    push(sensorMax2, sensorReading2);
    
    sensorReading3 = analogRead(electret3); 
    push(sensorMax3, sensorReading3);;
    
    sensorReading4 = analogRead(electret4); 
    push(sensorMax4, sensorReading4);
    delay(1000);
  }
  
  Serial.print("Setup sensor1:");
  Serial.println(sizeof(sensorMax1));
  
  Serial.print("Setup sensor2:");
  Serial.println(sizeof(sensorMax2));
  
  Serial.print("Setup sensor3:");
  Serial.println(sizeof(sensorMax3));
  
  Serial.print("Setup sensor4:");
  Serial.println(sizeof(sensorMax4));
  
  // Set the threshold for each microphone as the average of the queue.
  Serial.println("Lets begin.");
  averageMicrophones();
}


// THE LOOP
void loop() {
  // For stability, start out with low on all vibration motors.
  digitalWrite(vibration1, LOW);
  digitalWrite(vibration2, LOW);
  digitalWrite(vibration3, LOW);
  digitalWrite(vibration4, LOW);
  
  // Read the sensor and store it in a variable.
  sensorReading1 = analogRead(electret1);
  sensorReading2 = analogRead(electret2);
  sensorReading3 = analogRead(electret3);
  sensorReading4 = analogRead(electret4);

  // if the sensor reading is greater than the threshold:
  if (sensorReading1 >= threshold1) {
    Serial.print("Mic1: ");
    Serial.print(sensorReading1-threshold1);
    Serial.print("    ");
    if (sensorReading1-threshold1 > 10) {
      digitalWrite(vibration1, HIGH);
    }
  } else {
    Serial.print("Mic1: 0    ");
  }
  
  if (sensorReading2 >= threshold2) {
    Serial.print("Mic2: ");
    Serial.print(sensorReading2-threshold2);
    Serial.print("    ");
    if (sensorReading2-threshold2 > 10) {
      digitalWrite(vibration2, HIGH);
    }
  } else {
    Serial.print("Mic2: 0    ");
  }
  
  if (sensorReading3 >= threshold3) {
    Serial.print("Mic3: ");
    Serial.print(sensorReading3-threshold3);
    Serial.print("    ");
    if (sensorReading3-threshold3 > 10) {
      digitalWrite(vibration3, HIGH);
    }
  } else {
    Serial.print("Mic3: 0    ");
  }
  
  if (sensorReading4 >= threshold4) {
    Serial.print("Mic4: ");
    Serial.print(sensorReading4-threshold4);
    Serial.print("    ");
    Serial.print("\n");  
    if (sensorReading4-threshold4 > 10) {
         digitalWrite(vibration4, HIGH);
    }
  } else {
    Serial.print("Mic4: 0    ");
    Serial.print("\n");  
  }
  
  // Every second, take a reading and use it to adjust the average.
  if (millis() % 1000 == 0) {
    // Put in new data.
    push(sensorMax1, sensorReading1);
    push(sensorMax2, sensorReading2);
    push(sensorMax3, sensorReading3);
    push(sensorMax4, sensorReading4);
    // Average the data.
    averageMicrophones();
  }
  
  delay(2);  // Better for Processing showing data
}


// Averages all the microphone readings.
void averageMicrophones() {
  
  // Average the recordings of micrphone 1.
  int sum = 0;
  for (int i = 0; i < 10; i++) {
     sum = sum + sensorMax1[i];
  }
  threshold1 = sum / 10;
  
  // Average the recordings of micrphone 2.
  sum = 0;
  for (int i = 0; i < 10; i++) {
     sum = sum + sensorMax2[i];
  }
  threshold2 = sum / 10;
  
  // Average the recordings of micrphone 3.
  sum = 0;
  for (int i = 0; i < 10; i++) {
     sum = sum + sensorMax3[i];
  }
  threshold3 = sum / 10;
  
  threshold4 = sum / 10;
  
  // Average the recordings of micrphone 4.
  sum = 0;
  for (int i = 0; i < 10; i++) {
     sum = sum + sensorMax4[i];
  }
  threshold4 = sum / 10;
}

References

Brains Of Deaf People Rewire To "Hear" Music. How the brain of a Deaf individual rewires to feel vibrations. Arduino listens to electret microphone. How to make an Arduino work with a elecret microphone. Professor Lance Forshay. Interviewed with Lance Forshay.

No comments:

Post a Comment