a digital scan of a 35mm film image of a processing sketch running on an LCD
Skip to Content

Media Controller Progress

Yin, Arturo, and I have started implementing a tap-inspired musical shoe. Right now we're working on a single shoe, with 5 force sensitive resistors (FSRs) on the bottom designed to capture nuances of a foot fall and translate them into sounds (either sampled or synthesized, we're not sure yet.)

Here's how the system looks so far:

On the bottom of the shoe, there's a layer of thin foam designed to protect the FSRs and evenly distribute the weight of the wearer. We ran into some trouble with the foam tearing on cracks in the floor, so we're looking for a way to improve durability or maybe laminate something over the foam to protect it.

The challenge now is to find a way to work with all of the data coming in from each foot... how best to map the FSR's response to the wearer's movements in an intuitive and transparent way. On technical fronts, we're going to need to make the system wireless so the wearer will have freedom of movement, and find a way to route the sensor wires in a more subtle way. There are also concerns about the long-term durability of the FSRs, so we might need to make them easily replaceable. This could be tricky since each sensor is buried under foam and tape...

We've written some very basic code for now, just enough to get the signal from each FSR and graph the response in Processing.

Here's the Arduino code:

  1. // Multi-channel analog serial reader.
  2.  
  3. // Adapted from "sensor reader".
  4. // reads whichever pins are specified in the sensor pin array
  5. // and sends them out to serial in a period-delimited format.
  6.  
  7. // Read the inputs from the following pins.
  8. int sensorPins[] = { 0, 1, 2, 3, 4, 5};
  9.  
  10. // Specify the length of the sensorPins array.
  11. int sensorCount = 6;
  12.  
  13. void setup() {
  14.   // Configure the serial connection:
  15.   Serial.begin(9600);
  16. }
  17.  
  18. void loop() {
  19.   // Loop through all the sensor pins, and send
  20.   // their values out to serial.
  21.   for (int i = 0; i < sensorCount; i++) {
  22.  
  23.     // Send the value from the sensor out over serial.
  24.     Serial.print(analogRead(sensorPins[i]), DEC);
  25.    
  26.     if (i < (sensorCount - 1)) {
  27.       // Separate each value with a period.
  28.       Serial.print(".");      
  29.     }
  30.     else {
  31.       // If it's the last sensor, skip the
  32.       // period and send a line feed instead.
  33.       Serial.println();
  34.     }
  35.   }
  36.  
  37.   // Optionally, let the ADC settle.
  38.   // I skip this, but if you're feeling supersitious...
  39.   // delay(10);  
  40. }

And the Processing code:

  1. // Multi-channel serial scope.
  2.  
  3. // Takes a string of period-delimited analog values (0-1023) from the serial
  4. // port and graphs each channel.
  5.  
  6. // Import the Processing serial library.
  7. import processing.serial.*;
  8.  
  9. // Create a variable to hold the serial port.
  10. Serial myPort;
  11.  
  12. int graphXPos;
  13.  
  14. void setup() {
  15.   // Change the size to whatever you like, the
  16.   // graphs will scale appropriately.
  17.   size(1200,512);
  18.  
  19.   // List all the available serial ports.
  20.   println(Serial.list());
  21.  
  22.   // Initialize the serial port.
  23.   // The port at index 0 is usually the right one though you might
  24.   // need to change this based on the list printed above.
  25.   myPort = new Serial(this, Serial.list()[0], 9600);
  26.  
  27.   // Read bytes into a buffer until you get a linefeed (ASCII 10):
  28.   myPort.bufferUntil('\n');  
  29.  
  30.   // Set the graph line color
  31.   stroke(0);        
  32. }
  33.  
  34. void draw() {
  35.   // Nothing to do here.
  36. }
  37.  
  38. void serialEvent(Serial myPort) {
  39.   // Read the serial buffer.
  40.   String myString = myPort.readStringUntil('\n');
  41.  
  42.   // Make sure you have some bytes worth reading.
  43.   if (myString != null) {
  44.  
  45.     // Make sure there's no white space around the serial string.
  46.     myString = trim(myString);
  47.  
  48.     // Turn the string into an array, using the period as a delimiter.
  49.     int sensors[] = int(split(myString, '.'));
  50.  
  51.     // Find out how many sensors we're working with.
  52.     int sensorCount = sensors.length;
  53.  
  54.     // Again, make sure we're working with a full package of data.
  55.     if (sensorCount > 1) {
  56.  
  57.       // Loop through each sensor value, and draw a graph for each.
  58.       for(int i = 0; i < sensorCount; i++) {
  59.  
  60.         // Set the offset based on which channel we're drawing.
  61.         int channelXPos = graphXPos + (i * (width / sensorCount));
  62.  
  63.         // Map the value from the sensor to fit the height of the window.
  64.         int sensorValue = round(map(sensors[i], 0, 1024, 0, height));
  65.  
  66.         // Draw a line to represent the sensor value.
  67.         line(channelXPos, height, channelXPos, height - sensorValue);
  68.       }
  69.  
  70.       // At the edge of the screen, go back to the beginning:
  71.       if (graphXPos >= (width / sensorCount)) {
  72.         // Reset the X position.
  73.         graphXPos = 0;
  74.  
  75.         // Clear the screen.
  76.         background(255);
  77.       }
  78.       else {
  79.         // Increment the horizontal position for the next reading.
  80.         graphXPos++;
  81.       }            
  82.     }
  83.   }
  84. }

October 24 2009 at 3 AM