User login

Powered by Drupal, an open source content management system

Theory and Practice of Tangible User Interfaces

Piezo Input Interaction

Submitted by jonyen on Thu, 10/09/2008 - 09:57

Assignment: Input / Output Coincidence Lab Assignment

Collaborators:

Description:

For this project, I used a portable bike pump as a way of creating a different type of interaction when using a Piezo buzzer as an input. The output goes to an LED.

Components used:

 

  • Bike pump
  • Piezo buzzer
  • LED
Code:
/* Piezo Knock
 * -----------
 * Turn a standard piezo buzzer into a force sensor
 *
 * Created 24 October 2006
 * copyleft 2006 Tod E. Kurt  THRESHOLD ) {      // is it bigger than our minimum?
    digitalWrite(ledPin, HIGH); // tell the world
    t = 0;
    while(analogRead(piezoPin) > THRESHOLD) {
      t++;
    } // wait for it to go LOW  (with a little hysteresis)
    if(t>100) {  // cut off the low values because they're noise
      Serial.println("knock! ");
      Serial.println(t);

    }
  }
}
 
Images:

Bike pump, connected to a Piezo buzzer.