Divergence

During my two week residency on board the Eleonore boat I have worked on creating a wearable prototype of an EMF (Electromagnetic Field) detector that will provide haptic and sonic feedback to the user that is wearing it. The wearable consists of a dress that has two handmade coils on the sleeves (inputs) that work as antenas for detecting electromagnetic sources, two vibration motors (outputs) and a mini jack (output) where the user can connect her headphones. These components are connected to an Adafruit Flora wearable microcontroller and programmed in the Arduino IDE in order to have the desired result.

I have started by setting up the lab with all the equipement that I would need: fabrics, needles, scissors, sewing machine, iron, fabric glue, conductive threads, conductive fabrics, enamelled copper wire for the coils, vibration motors, a zipper and a mini-jack, various microcontrollers, a breadboard, jumpers and crocodile clips, some resistors and some capacitors, pliers, a multimeter (to test my connections) and some cables and a soldering iron (for the connections that could not be made with conductive thread).

 

[[{"type":"media","view_mode":"media_large","fid":"1479","attributes":{"alt":"","class":"media-image","height":"359","typeof":"foaf:Image","width":"480"}}]]

[[{"type":"media","view_mode":"media_large","fid":"1480","attributes":{"alt":"","class":"media-image","height":"359","typeof":"foaf:Image","width":"480"}}]]

 

During the first days I have created the coils and the body of the dress so that I could start working on the soft circuit.

[[{"type":"media","view_mode":"media_large","fid":"1481","attributes":{"alt":"","class":"media-image","height":"359","typeof":"foaf:Image","width":"480"}}]]

 

My next step was to test the coils in order to see how sensitive they where. For testing the coils I based my code on Aaron Alai's EMF detector project and Collin Cunningham's EMF experiments. I tested various resistors for their sensitivity and also calculated the resistance of the conductive thread that would be used for the soft circuit and decided to use a 3.6 M Ohms resistor on the ground connection of the coil and connected the other end to an analog pin. I tested the values that I got by printing them on the Serial Monitor and then added a speaker to have a sonic feedback of what was going on. I used a "smoothing" technique of creating an array an calculating the average value (as the previous authors suggested) in order to filter any unwanted noise to the results and then I mapped the values to a range of frequencies between 20 and 880 Hz and their respected durations between 10 to 500 milliseconds. The frequency mapping as can be observed in the code is inversed so that the higher the signal the higher the pitch and the lower the signal the lower the pitch. I got quite some interesting results as when I moved the coil closer to my mobile phone and the laptop I was getting lower frequencies and when I moved it closer to the plug where my laptop's transformer was I got higher and higher frequencies.

[[{"type":"media","view_mode":"media_large","fid":"1482","attributes":{"alt":"","class":"media-image","height":"359","style":"font-size: 12px; background-color: rgb(232, 232, 232);","typeof":"foaf:Image","width":"480"}}]]

[[{"type":"media","view_mode":"media_large","fid":"1491","attributes":{"alt":"","class":"media-image","height":"359","typeof":"foaf:Image","width":"480"}}]]

[[{"type":"media","view_mode":"media_large","fid":"1492","attributes":{"alt":"","class":"media-image","height":"359","typeof":"foaf:Image","width":"480"}}]]

This is the code that I used:

// DivergenceCoil
// code on Flora
 
#define NUMREADINGS 15 // raise this number to increase data smoothing
 
int senseLimit = 15; // raise this number to decrease sensitivity (up to 1023 max)
int probePin = A7; // analog 7
int val = 0; // reading from probePin
 
int soundOut = 12; 
 
// variables for smoothing
 
int readings[NUMREADINGS];                // the readings from the analog input
int index = 0;                            // the index of the current reading
int total = 0;                            // the running total
int average = 0;                          // final average of the probe reading
 
 
void setup() {
  pinMode(soundOut, OUTPUT);  
 
  Serial.begin(9600);  // initiate serial connection for debugging/etc
 
  for (int i = 0; i < NUMREADINGS; i++)
    readings[i] = 0;                      // initialize all the readings to 0
}
 
void loop() {
 
  val = analogRead(probePin);  // take a reading from the probe
 
  if(val >= 1){                // if the reading isn't zero, proceed
 
    val = constrain(val, 1, senseLimit);  // turn any reading higher than the senseLimit value into the senseLimit value
    val = map(val, 1, senseLimit, 1, 1023);  // remap the constrained value within a 1 to 1023 range
 
    total -= readings[index];               // subtract the last reading
    readings[index] = val; // read from the sensor
    total += readings[index];               // add the reading to the total
    index = (index + 1);                    // advance to the next index
 
    if (index >= NUMREADINGS)               // if we're at the end of the array...
      index = 0;                            // ...wrap around to the beginning
 
    average = total / NUMREADINGS;          // calculate the average
    int freq = map(average, 0, 1023, 880, 20);
    int dur = map(freq, 880, 20, 10, 500);
    tone(soundOut, freq, dur);
 
    Serial.print(val); // use output to aid in calibrating
    Serial.print(" ");
    Serial.print(average);
    Serial.print(" ");
    Serial.println(freq);
    Serial.print(" ");
    Serial.println(dur);
    delay(1);
  }
}

 

My next step was to create a zipper slider that would be used as a low-pass filter between the microcontroller and the mini-jack to provide the user with some kind of volume control for the headphones (and also filter any possible noise). After experimenting with different materials and techniques I decided to go with Kobakant's "zipper slider", but instead of using resistive thread 66 Yarn 22+3ply 110 PET (4 K Ohms/20 cm resistance) and Lame Life Saver conductive thread, I have used Plug and Wear's resistive tape (3.2 K Ohms per linear meter/yard) form one side of the zipper and Spark Fun's Conductive Thread 60g (Stainless Steel) (28 Ohms/30 cm resistance) on the other side. The side with the resistive tape is hooked up in the microcontroller and programmed to play a square wave 800 Hz tone, using the internal pull up resistor of the board, while the side with the conductive thread passes through a 47uF capacitor and ends at the speaker. Unzipping produces a higher pitch and when the zipper is completely open you get the highest pitch (in this case 880 Hz).

The low-pass filter zipper slider documentation video is here.
 

[[{"type":"media","view_mode":"media_large","fid":"1483","attributes":{"alt":"","class":"media-image","height":"359","typeof":"foaf:Image","width":"480"}}]]

[[{"type":"media","view_mode":"media_large","fid":"1484","attributes":{"alt":"","class":"media-image","height":"359","typeof":"foaf:Image","width":"480"}}]]

This is code I used for testing:

// Low-pass filter that uses a zipper slider instead of a potentiometer
 
int speaker = 12; // speaker connected to digital pin 12 (on Flora, D12 and A11 are the same pin)
 
void setup() {
 pinMode(speaker, OUTPUT); // initialize speaker pin as an output
 pinMode(A11, INPUT_PULLUP); // use the internal pullup resistor
}
 
void loop() {
  tone(speaker, 880); // play a square wave of 880 Hz
 
After the tests I started to construct the soft circuit using Spark Fun's Conductive Thread 60g (Stainless Steel) and an Adafruit Flora microcontroller. I also created stripes of fabric where I embedded the cables that connect the coils with the circuit.
 
[[{"type":"media","view_mode":"media_large","fid":"1518","attributes":{"alt":"","class":"media-image","height":"359","typeof":"foaf:Image","width":"480"}}]]
 
[[{"type":"media","view_mode":"media_large","fid":"1519","attributes":{"alt":"","class":"media-image","height":"359","typeof":"foaf:Image","width":"480"}}]]
 
[[{"type":"media","view_mode":"media_large","fid":"1520","attributes":{"alt":"","class":"media-image","height":"359","typeof":"foaf:Image","width":"480"}}]]
 
Finally, I created the collar, where I incorporated the mini-jack with the 46uF capacitor that connects to the zipper to create the low pass/volume control slider.
 
[[{"type":"media","view_mode":"media_large","fid":"1521","attributes":{"alt":"","class":"media-image","height":"359","typeof":"foaf:Image","width":"480"}}]]
 
[[{"type":"media","view_mode":"media_large","fid":"1522","attributes":{"alt":"","class":"media-image","height":"359","typeof":"foaf:Image","width":"480"}}]]
 
For the full documentation on the schematics and the code, check out: