Announcements

November 24, 2007
Reading for November 27th, are now posted. Enjoy!

October 2, 2007
To upload your thoughtless acts, create a new assignment page like any other lab. You'll see "Thoughtless Acts" listed as one of the assignment options.

May 24, 2008
This site has been archived and is no longer editable. Stay tuned for the next version, coming in the fall!


Lab 5

Project Members: 
n8agrin

Assignment

Input
output coincidence exercise. Design an artifact where both input and
output occur at the same place. Use any combination of your input
transducers and output transducers (pot, photocell, FSR, LEDs, piezo,
screen). E.g., a ball that changes colors and/or plays different
sound/melody depending on the pressure being applied. A stick you can
twist to color or sound differently… These are just examples to spark
your imagination. Be creative!

Description

This week I constrained myself to making something I thought might be a usable interface, and built upon my mechanical force input from last week. Last week I developed a simple squeeze interface to the force sensor and thought that a similar interface, with some sort of feedback might be hypothetically useful in physical therapy. My tangible artifact this week is a squeeze ball that beeps when squeezed. After a certain number of squeezes it signals to the user that it's time to switch hands or to stop excersizing. A physical therapist would be able to change the total number of squeezes per session. The idea behind my artifact is to augment the patient's memory and allow them to concentrate on other concerns while still completing their necessary excercise.

Components Used

  • 1 FSR
  • 1 Peizo speaker
  • 1 Squeeze toy
  • Various lengths of wire
  • 1 breadboard
  • 1 arduino board

Code

Theremin

(straight from the lab page)

/* Theremin
* --------
*
*
* Created 24 October 2006
* copyleft 2006 Tod E. Kurt <tod@todbot.com
* http://todbot.com/
*/

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); // read value from the sensor
val = val*2; // process the value a little
//val = val/2; // process the value a little

for( int i=0; i<500; i++ ) { // play it for 50 cycles
digitalWrite(speakerPin, HIGH);
delayMicroseconds(val);
digitalWrite(speakerPin, LOW);
delayMicroseconds(val);
}
}
 


Physical Therapy Device

/*
Create a simple squeeze mechanism for physical therapy patients
n8agrin
10/3/07
*/
boolean DEBUG = false;

int squeezePin = 0; // input for a force sensor
int speakerPin = 7; // output for a speaker
int tones[] = {1915, 1700, 1519, 1432, 1275, 1136, 1014, 956};
int squeezes = 0; // number of times the ball was squeezed
int maxSqueezes = 8; // required squeezes per hand, so says the therapist
boolean wasSqueezed = false; // control the speaker so that each squeeze is defined clearly

void setup() {
pinMode(speakerPin, OUTPUT);
Serial.begin(9600);
}

void loop() {
if (squeezed()) {
if (squeezes == maxSqueezes) {
playFinalSqueeze();
resetSqueezes();
}
}
}

boolean squeezed() {
if (readInput() > 100 && wasSqueezed == false) {
wasSqueezed = true;
playSqueeze();
squeezes += 1;
if (DEBUG) Serial.println(squeezes);
return true;
}
else if (readInput() < 10) {
wasSqueezed = false;
}
return false;
}

void resetSqueezes() {
squeezes = 0;
}

// Play a note from a regular scale as they preform each squeeze
void playSqueeze() {
for( int i=0; i<150; i++ ) { // play it for 50 cycles
digitalWrite(speakerPin, HIGH);
delayMicroseconds(tones[squeezes]);
digitalWrite(speakerPin, LOW);
delayMicroseconds(tones[squeezes]);
}
}

// Play a scale when the user is done with the number of squeezes
void playFinalSqueeze() {
for(int j=0; j<=8; j++) {
for (int i=0; i<100; i++) { // play it for 50 cycles
digitalWrite(speakerPin, HIGH);
delayMicroseconds(tones[j]);
digitalWrite(speakerPin, LOW);
delayMicroseconds(tones[j]);
}
}
}

int readInput() {
int input = (-1 * (analogRead(squeezePin) - 1023)); // convert this to a positive value that starts at zero
if (DEBUG) Serial.println(input);
return input;
}

 



Comments

oh, nice job! that we you

oh, nice job! that we you can make sure to balance your excersizes without even thinking about it...


Powered by Drupal - Design by Artinet