Names: Joseph Bolling, Evan Strasnick, Jacob Simon, Xin Yang Yak

Group Number: 17

What we built: We created an alarm clock, aimed at heavy sleepers and chronic snoozers, that shuts off its buzz only when the user actually gets out of bed. It accomplishes this using a simply force-sensing resistor located under the bed that responds to the change in force of a human weight being lifted. Overall, we were delighted with how well the system functions, and how simple it was to implement such a practical feature that solves a real-world problem. We were dissatisfied, however, that the coding of the actual alarm had to be done by setting a variable in the source code of the arduino (and that only one alarm could be set at a time). An actual implementation of the device would communicate with a real alarm clock (or alarm clock interface) to allow the user to more easily set and change his alarms.

 

Sketches:

Our first design was of an insole that could be inserted into any shoe to add pedometer functionality. A force sensing resistor measured the number of steps, which could be uploaded via USB at the end of the day.

Our next design was of a device which used a thermistor to alert the user if (because of a malfunction or power outage) their refrigerator or freezer was at a temperature at which their food might spoil. In the event of a power outage, the user would exactly when their food was no longer good.

Our final design, which we decided to implement, was the alarm clock which shuts off when the user actually gets out of bed.

Storyboard:

Final System:

Here’s a video demonstration of our prototype. Since, to our surprise, we were unable to find a bed in the lab, our user demonstrated the system by falling asleep in a chair instead. http://www.youtube.com/watch?v=7fJjzzmrqKU&feature=youtu.be

List of Parts:

  • 1 x Arduino UNO connected to power supply
  • 1 x Force sensing resistor
  • Approx. 5 feet of wire
  • 1 x 10 kOhm resistor
  • 1 x 330 ohm resistor
  • 1 x Buzzer

Instructions to recreate:

To construct our alarm clock, simply connect the parts as indicated in the diagram above.  The force-sensing resistor should be connected to the Arduino using two wires long enough to reach from the location of your alarm clock to the point where you’d like the force-sensing resistor to be located-] (we recommend near the center of your mattress or underneath one of the legs of your bed).  One of these wires should travel from the +5V pin on your Arduino, and the other should connect with a 10kΩ resistor.  The other end of the 10kΩ should connect to ground.  Connect analog pin 0 on your Arduino to the junction between the force-sensing resistor and the 10kΩ resistor. Then, connect the buzzer in series with a 330Ω resistor between pin 3 and ground, set how long you’d like to sleep in our code (the “secondsUntilWake” parameter), and upload to your Arduino!

Source Code:

/*COS 436 Lab 1
*Joseph Bolling, Evan Strasnick, Jacob Simon, Xin Yang Yak
*Force Sensing Alarm Clock
*/

int fsrAnalogPin = 0; // FSR is connected to analog 0
int buzzerAnalogPin = 3; // Buzzer is connected to analog 1

int fsrReading; // the analog reading from the FSR resistor divider
int fsrInitialRead; // the value of fsrReading when the alarm begins

int secondsLeft;
// PARAMETERS:
int releaseThreshold = -50;
int buzzerTone = 50; // default buzzer pitch

// -------------------------------------------------------------------
// SET THE TIME UNTIL ALARM HERE:
int secondsUntilWake = 5;
//
//--------------------------------------------------------------------
boolean alarmOn;

void setup(void) {
secondsLeft = secondsUntilWake;
alarmOn = false;
pinMode(buzzerAnalogPin, OUTPUT);
}

void loop(void) {
if (!alarmOn) {
secondsLeft--;
}
else {
while (pressureOn()) {
buzzOn();
}

buzzOff();
while(true);

}

if (secondsLeft == 0) {
markPressure();
alarmOn = true;
}

delay(1000);
}

void markPressure(void) {
fsrInitialRead = analogRead(fsrAnalogPin);
}

boolean pressureOn(void) {
if ((analogRead(fsrAnalogPin) - fsrInitialRead) <= releaseThreshold) {
return false;
}
else return true;
}

void buzzOn(void) {
analogWrite(buzzerAnalogPin, buzzerTone);
}

void buzzOff(void) {
analogWrite(buzzerAnalogPin, 0);
}