Ankita, David, John, Stephen and Martin created an instrument to play chords on wine glasses. In order to have the hands free to play a melody on any conventional instrument along with the chords, we designed an input method for the head so that subtle tilts account for different keys. A video can be watched here: http://vimeo.com/32111887


Materials
-
9 wine glasses
-
bicycle helmet
-
3 servos
-
3 FSRs
-
1 potentiometer
-
styrofoam/wood board
-
3 resistors
-
wires/breadboard
-
old batteries
-
plastic tubes
Arduino code
#include <Servo.h>
Servo servoCh1; // create servo object to control a servo
Servo servoCh2;
Servo servoCh3;
int DEBUG = 0;
int fullAngle = 5; // variable to store the servo position
int servoDelay = 100;
int potMin = 271, potMax = 436, potRange;
int delayMin = 50, delayMax = 500;
int pinFSR_left = 0; // select the input pin for the sensors
int pinFSR_right = 1;
int pinFSR_front = 2;
int potPinSpeed = 3;
// FSRs
int valLeft = 0;
int valRight = 0;
int valFront = 0;
// potentiometer
int valSpeed = 0;
// jitter thresholds
int jitterThresh = 20;
void setup()
{
if(DEBUG) Serial.begin(9600);
servoCh1.attach(7);
servoCh2.attach(8);
servoCh3.attach(12);
servoCh1.write(0);
servoCh2.write(0);
servoCh3.write(0);
potRange = potMax - potMin;
}
void loop()
{
valLeft = analogRead(pinFSR_left); // read the value from the sensor, 0-1023
valRight = analogRead(pinFSR_right); // read the value from the sensor, 0-1023
valFront = analogRead(pinFSR_front);
valSpeed = analogRead(potPinSpeed);
if(DEBUG){
Serial.print("FSR1 ");
Serial.println(valLeft);
Serial.print("FSR2 ");
Serial.println(valRight);
Serial.print("FSR3 ");
Serial.println(valFront);
Serial.print("POT ");
Serial.println(valSpeed);
remapVal();
delay(1000);
}
else{
if(valFront > jitterThresh){
playChord(2);
}
else{
if(valLeft > jitterThresh)
playChord(0);
if(valRight > jitterThresh)
playChord(1);
}
}
}
void playChord(int servo)
{
moveServo(servo, fullAngle);
delay(servoDelay);
moveServo(servo, 0);
delay(remapVal());
}
void moveServo(int num, int angle){
switch(num){
case 0: servoCh1.write(angle); break;
case 1: servoCh2.write(angle); break;
case 2: servoCh3.write(angle); break;
}
}
int remapVal(){
int inVal;
float relPos;
inVal = (valSpeed > potMax) ? potMax : valSpeed;
inVal = (valSpeed < potMin) ? potMin : valSpeed;
relPos = (float)(inVal - potMin) / (float)potRange;
return delayMin + (delayMax - delayMin) * relPos;
}