Summary
In this lab I created a gizmo that created a tone that matched my breathing. Both the input and output occur on my chest.
Materials
I used the force sensing pot. and and speaker as well as various poor materials such as cardboard, string, rubber bands, glue, electical tape, extra wires, an aligator clip, tissue paper, etc.
How it works
A strap around my chest transmits the force involved in the expansion of my lungs to put pressure on the force sensor via a jerryrigged cardboard chestpiece, as modulated by rubber bands and tissue paper. (Please see picture.) This input is processed by the arduino chip and the output is returned to play on the speaker located on the cardboard chestpiece.
Notes on code
I used the theramin code line for line with the exception of increasing the sampling rate to map the sound more closely with the music, and subtracting the pot. value from 1000 to invert the sound mapping so that the pitch rises as you inhale; an aesthetic decision based on the natural sounds of breath.
Conclusions
The sound produced by this device is rather displeasing; it tends to make an irregular and chaotic tone rather than a smooth tone, which has the effect of creating psychosomatic pain in the chest. Perhaps it can be used to discourage smoking, but otherwise I cannot recommend it...
If I had more time (and programming skill) I would like to program the tone to match my breathing rate, rather than the force of each individual breath. I think this would transform the aesthetic experience.
I created this particular piece because I am starting to develop ideas for my final project, which I think will use some aspects of bio-feedback. I am investigating what is possible to accomplish with a simply-produced TUI.
Code
int potPin = 0; // select the input pin for the potentiometer
int speakerPin = 7;
int val = 0;
void setup() {
pinMode(speakerPin, OUTPUT);
beginSerial(9600);
Serial.println("ready");
}
void loop() {
digitalWrite(speakerPin, LOW);
val = analogRead(potPin)*2; // read value from the sensor
for( int i=0; i<25; i++ ) { // play it for 2 cycles
digitalWrite(speakerPin, HIGH);
delayMicroseconds(1000-val); // to invert the sound mapping
digitalWrite(speakerPin, LOW);
delayMicroseconds(1000-val);
}
}