Introduction: Fabwear

Fabwear is a product envisioned to help assist those with hearing problems locate loud sounds around them. It uses a series of embedded microphones to spacial locate sound and give the user an slight haptic feedback pulse so they can look and visually check in that direction. The target audience is currently for biking and we hope to help users locate horns and other hazard warning sounds.

This is a work in progress project and can be improved through hardware and software audio filtering.

Step 1: Cut Fabric for Microphones

You will first need two items. A microphone (ideally on a board to facilitate easy wire attachments) and some felt or other "spun" fabric. You will be attaching these to your garment with velcro so you want a fabric that will attach to it. Alternatively you can add velcro to the back of any fabric you'd like.

-We used a fancy laser cutter available at our local university, but with scissors or other sharp instrument cut two circles about the size of a quarter out of the fabric

-Next cut a hole near one edge for the microphone to stick through in one of the pieces of fabric (leave the other piece unaltered).

Repeat this as many times as you want modules.

Step 2: Place Microphone and Cables Into Fabric

You need the three pieces from the last step and 3 sewable male snap pins.

-Place the microphone into the fabric with the round end sticking through.

-Sew 3 snap pins into the bottom piece of fabric near one edge. The snap pins should have holes in them to allow you to sew them in.

Step 3: Make Wire Connections and Finish

You will need bare and insulated wire, 6 female snap pins and the partially assembled top and bottom half from the previous step. You will want to size the wire based on where they go on the garment. Plan ahead and take measurements to avoid having to make new wires later.

-Take the bare wire and solder a connection between the three holes on the microphone board and the snap pins you sewed in the previous step.

-Use the insulated wire and the female snap pins to create jumper wires. Solder a pin to each side.

-Snap one pin to each male pin on the bottom half of the fabric circle.

-Glue the top and bottom fabric pieces together. Leave the area where the connection is made loose so you can change the wire out if needed.

Step 4: Make Your Connections to PLC

You will need a micro controller (we used an Arduino Uno) and a complete microphone assembly. We recommend using a smaller controller than we did so that you can sew into the fabric and hide.

Depending on your finished project you may make your connections in a variety of ways. We ran wires from the arduino to the garment and used male snap pins to create connection points. The female jumper cables (already connected to our microphone assembles) then connect to these.

Ideally you should use an arduino that does not have headers. You can then directly solder wires to the board and make the connection stronger and less likely to have a wire pull out.

You need to run power (5v), an analog pin, and a ground to each microphone assembly. This is where having snaps and cable runs into the garment come in handy as you can run the cables other than the analog wire in series to multiple microphones.

Step 5: Place Microphones Onto Garment

Finalize placement of microphones. You will want to cut slits into the fabric so you can hide the wires on the inside of the garment. Sew on velcro to your clothing so you can easily attach and remove the microphones. Alternatively you can use the garment itself instead of the back circle for a more finished and permanent look.

Step 6: Program Contoller

Use the below code to program your controller. Make sure to set the right number of mics and change the pins to whichever you used to make your connections.

const int numReadings = 10;
const int numberOfMics = 3; const int ambient = 600;
int index = 0;
int maxMic = 0;
boolean soundDetected = false;
int soundSensorPins[numberOfMics] = {A0, A1, A2};
int soundLEDPins[numberOfMics] = {3, 5, 7};
int soundArray[numberOfMics][numReadings];
int micTotals[numberOfMics];
boolean lightState[numberOfMics];
void setup() {
  Serial.begin(9600);
  // set LED pins to output
  for (int thisLED = 0; thisLED < numberOfMics; thisLED ++) {
    pinMode(soundLEDPins[thisLED], OUTPUT);
  }
  // init soundArray
  for (int thisReading = 0; thisReading < numReadings; thisReading++) {
    for (int thisMic = 0; thisMic < numberOfMics; thisMic++) {
      soundArray[thisMic][thisReading] = 0;
    }
  }
  // init micTotals
  for (int thisTotal = 0; thisTotal < numberOfMics; thisTotal ++) {
    micTotals[thisTotal] = 0;
  }
  // init lightState
  for (int thisState = 0; thisState < numberOfMics; thisState ++) {
    lightState[thisState] = false;
  }
}
void loop() {
  // smooth reading
  for (int thisMic = 0; thisMic < numberOfMics; thisMic ++) {
    // remove last value
    micTotals[thisMic] = micTotals[thisMic] - soundArray[thisMic][index];
    // read new value
    soundArray[thisMic][index] = analogRead(soundSensorPins[thisMic]);
    // get new total
    micTotals[thisMic] = micTotals[thisMic] + soundArray[thisMic][index];
  }
  
  // check for a mic above threshold
  soundDetected = false;
  for (int thisMic = 0; thisMic < numberOfMics; thisMic++) {
    if (micTotals[thisMic] / numReadings > ambient) {
      soundDetected = true;
      Serial.println("Sound Detected");
    }
  }
  // compare mics
  if (soundDetected == true) {
    maxMic = 0;
    for (int thisMic = 0; thisMic < numberOfMics; thisMic++) {
      if (micTotals[thisMic] > micTotals[maxMic]) {
        maxMic = thisMic;
        Serial.println(maxMic);
      } else {
        Serial.println(maxMic);
      }
    }
    for (int thisMic = 0; thisMic < numberOfMics; thisMic++) {
      if (thisMic == maxMic) {
        lightState[thisMic] = true;
        //Serial.println(thisMic);
      } else {
        lightState[thisMic] = false;
      }
    }
  } else {
    for (int thisMic = 0; thisMic < numberOfMics; thisMic++) {
      lightState[thisMic] = false;
    }
  }
  // advance to the next position in the array
  index = index + 1;
  // reset array
  if (index >= numReadings) {
    index = 0;
  }
  // set LEDs
  for (int thisLight = 0; thisLight < numberOfMics; thisLight++) {
    if (lightState[thisLight] == true) {
      digitalWrite(soundLEDPins[thisLight], HIGH);
    } else {
      digitalWrite(soundLEDPins[thisLight], LOW);
    }
  }
  delay(1);
}

Step 7: Add Haptic or LED Indication

You can add LED or haptic vibration into your microphone assembly. You can share the ground that is already there, but will need to add another pin for a digital out. The code is already posted in the previous step for activating the correct LED. You just need to make sure you change the pin variables to the ones you used.

You can now test your garment for locating sound.