• warning: imagecreatefromjpeg(): gd-jpeg, libjpeg: recoverable error: Premature end of JPEG file in /courses/i262/public_html/s11/includes/image.gd.inc on line 190.
  • warning: imagecreatefromjpeg(): 'sites/default/files/images/photo-5.JPG' is not a valid JPEG file in /courses/i262/public_html/s11/includes/image.gd.inc on line 190.
  • Unable to create scaled Thumbnail image.

FSR Ra!

Posted by Annie

Annie's picture

 

Description:

Use Force Sensitive Resistor (FSR) and Photocell to control a sketch on Processing and find a creative material to apply to the FSR.  

I taped the FSR onto the neck of a violin, under the strings.  Pressure would be applied from the fingers onto the neck while playing.  I imagine some interesting ways in which such technology could used in a concert setting, perhaps an orchestra performance might transcend beyond the sound to a projector, creating a visual show of really endless possibilities.  Might each instrument or individual player represent a color of the rainbow or a piece of a puzzle, the rainbow or puzzle would be complete by the end of the piece of music.  I also imagine there might be a way of sensing a musicians accuracy of pressure applied to the instrument which could then be represented by a color, providing an visual tool beyond sheet music.

Materials:

-LEDs

-Force Sensitive Resistor

-Ohm Resistors (220, 10k)

-Violin

Code:

I was initially having trouble with running the Serial on Processing on my Mac and finally figured out it would only run if the Arduino sketch was stopped.

I adapted Ariel's "KaPow!", it now reads: "Ra!". 

 

/*
 * Arduino Ball Paint
 * (Arduino Ball, modified 2011)
 * ---------------------- 
 *
 * Receives an ASCII number over the serial port, 
 * terminated with a carriage return (ascii 13) then newline (10).
 * 
 * This matches what Arduino's " Serial.println(val)" function
 * puts out.
 *
 * Created 25 October 2006
 * copyleft 2006 Tod E. Kurt <tod@todbot.com
 * http://todbot.com/ 
 */
import processing.serial.*;
// Change this to the portname your Arduino board
String portname = "/dev/tty.usbmodem411"; // or "COM5"
Serial port;
String buf="";
int cr = 13;  // ASCII return   == 13
int lf = 10;  // ASCII linefeed == 10
void setup() {
  size(300,300);
  frameRate(10);
  smooth();
  background(40,40,40);
  noStroke();
  port = new Serial(this, portname, 9600); 
}
void draw() {
}
void keyPressed() {
  if(key == ' ') {
    background(40,40,40);  // erase screen
  }
  else {
    int x = int(random(0,width));
    int y = int(random(0,height));
  }
}
 
 
// draw Ra
void Ra(int val){
    float i =random(100);
    float j =random(50);
    stroke(255);
    fill(255,i,j);
    if (val > 0){
    val = int (val/10);
    beginShape();  
    vertex(20*val,10*val);
    vertex(60*val,30*val); //1
    vertex(80*val,20*val); //2
    vertex(60*val,40*val); //3
    vertex(90*val,50*val); //4
    vertex(70*val,60*val); //5
    vertex(90*val,90*val); //6
    vertex(60*val,60*val); //7
    vertex(50*val,80*val); //8
    vertex(40*val,60*val); //9
    vertex(20*val,50*val); //11
    vertex(40*val,50*val); //12
    vertex(10*val,40*val); //13
    vertex(40*val,35*val); //14
    vertex(20*val,10*val); //14
    endShape(CLOSE) ;
    fill(255);
//    int textsize = int(14*val);
//    textSize(textsize);
    text("Ra!",45*val,45*val);
           
      }
      
  }
 
 
// called whenever serial data arrives
void serialEvent(Serial p) {
  int c = port.read();
  if (c != lf && c != cr) {
    buf += char(c);
  }
  if (c == lf) {
    int val = int(buf);
    if (val != 0) {
      println("val="+val); 
    }
    int x = int((width/2));
    int y = int((height/2));
//    drawball(x,y,val);
    ra(val);
    buf = "";
 
  }
}
 
photo-4.JPG
photo-2.JPG
0
Your rating: None