Wake-up! Button

Posted by Annie

Annie's picture

Objective:

For this assignment we were asked to provide an input and output coincidence using the Piezo speaker and a sensor.

Components used:

Piezo Speaker, Breadboard, Arduino Board, 1 Force Sensor Resistor, 10kohm Resistor, Wires, Alarm Clock

Description:

Using the piezo speaker as an output device and the force sensor as the input, a tune from the thermin code was played and enhanced with the pressure from my finger.  I taped the FSR to my alarm clock's snooze button.  As a person who has had her fair amount of 'pressing the snooze button, falling back asleep, and waking up 2 hours later in a panic, realizing I will be late for class' incidents, I thought that having a counter-intuitive snooze button might be a good idea.  Instead of setting off the alarm's sound, the sound emitted from the alarm clock would increase in pitch and frequency when the snooze button is pressed.  Honestly, this is something I would appreciate.  For some, having a snooze button is just a bad idea.  But think if instead, when pressing a "snooze" button, it performed more of a "wake-up" task by making even more noise!  Seriously! Why have an alarm that could be so easily turned off by our touch in the morning when you could have one that could be turned on?!  Imagine what sounds could be produced by pushing the 'wake-up button'... How about a mother's voice singing, like my mom used to sing to me, "Good morning, good morning, ain't it great to stay up late!, good morning, good morning, to youuuuuuuu!"

Code

 

/* 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); 
  Serial.begin(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);
  }
}
 
photo-8.JPG
0
Your rating: None