Problem: Snoozing
We identified snoozing as a major problem amongst people today. We were intrigued by this fascination with the snooze button, and decided that tilt could be the first step in mediating this snoozing trend. People rely on the alarm snooze button to cram in a few more minutes of sleep, but end up wasting time in a state of limbo, neither awake nor asleep. This ability to snooze gives people a false sense of security. It is there to encourage people to lie in bed a little bit longer because there will be another reminder to get up in the near future.
Our Design: tilt
Our bed frame design will help those who are dependent or in the snooze button get up and out of bed in the morning and ultimately change their getting-up habits, thus making a more efficient use of their time.
Process:
In order to get to the end result we went through
countless ideation on form and technical mechanics on how best to physically
get people out of bed. Tilt was our final solution. The mechanical and physical
aspects of tilt consists of plywood, long wood blocks, inflatable tube, hose,
air pump, alarm, air mattress, arduino, relay, and microphone sensor.
Close up form and construction |
Sketches and tube |
Relay in case |
Soldered relay |
Testing bed |
Materials |
Tools |
Inflatable bed coming along |
tilt in environment |
Our codes:
Microphone Code
//Mic_Read
//Initialize variables
int micPin = 1; // select the input pin for sound sensor
int soundVal = 0; // receives value from microphone
int sampleCount = 0; // counts the number of times we’ve sampled the microphone
long sampleSum = 0; // sums the values to calculate an average
int average = 0; // the average value for the second
int minVal = 1023; // keeps the minimum value
int maxVal = 0; // keeps the maximum value
void setup()
{
Serial.begin(9600); // open the serial port at 9600 bps:
Serial.println(); // blank line to seperate run at reset
}
void loop()
{
soundVal = analogRead(micPin); // sample the microphone
sampleCount++; // count the samples
sampleSum += soundVal; // add the soundVal to the sum of the samples
if (sampleCount == 100 ) // do this every 100th sample which is 1 second
{ average = sampleSum/100; // calc the average
minVal = min(minVal, average); // keep if minimum
maxVal = max(maxVal, average); // Keep if mamimum
Serial.print("Average = "); // print results for second
Serial.print( average );
Serial.print(" / Min = "); // print the running minimun
Serial.print( minVal );
Serial.print(" / max = "); // print the running maximun
Serial.print( maxVal );
Serial.println(); // end the line
sampleSum = 0; // resets the sum variable
sampleCount = 0; // resets the sample count
}
delay(10); // wait 1/100 of a second
}
//Initialize variables
int micPin = 1; // select the input pin for sound sensor
int soundVal = 0; // receives value from microphone
int sampleCount = 0; // counts the number of times we’ve sampled the microphone
long sampleSum = 0; // sums the values to calculate an average
int average = 0; // the average value for the second
int minVal = 1023; // keeps the minimum value
int maxVal = 0; // keeps the maximum value
void setup()
{
Serial.begin(9600); // open the serial port at 9600 bps:
Serial.println(); // blank line to seperate run at reset
}
void loop()
{
soundVal = analogRead(micPin); // sample the microphone
sampleCount++; // count the samples
sampleSum += soundVal; // add the soundVal to the sum of the samples
if (sampleCount == 100 ) // do this every 100th sample which is 1 second
{ average = sampleSum/100; // calc the average
minVal = min(minVal, average); // keep if minimum
maxVal = max(maxVal, average); // Keep if mamimum
Serial.print("Average = "); // print results for second
Serial.print( average );
Serial.print(" / Min = "); // print the running minimun
Serial.print( minVal );
Serial.print(" / max = "); // print the running maximun
Serial.print( maxVal );
Serial.println(); // end the line
sampleSum = 0; // resets the sum variable
sampleCount = 0; // resets the sample count
}
delay(10); // wait 1/100 of a second
}
Relay Code
//Relay_Control
// Initialize Variables
int relayPin = 13; // relay is on pin 13
boolean alarmNotDetected = true; // it's true, we've not detected the alarm
boolean notInflated = true; // we've not inflated the tube yet
//int inflationTime = 30; // Number of seconds the compressor will run
int micPin = 1; // select the input pin for sound sensor
int soundVal = 0; // receives value from microphone
int sampleCount = 0; // counts the number of times we’ve sampled the microphone
long sampleSum = 0; // sums the values to calculate an average
int average = 0; // the average value for the second
int minVal = 506; // Put your value here
int maxVal = 512; // Put your value here
int triggerSeconds = 3; // the number of seconds the alarm must sound before we act
int alarmSeconds = 0; // the number of seconds that alarm has sounded
void setup()
{
Serial.begin(9600); // open the serial port at 9600 bps:
pinMode(relayPin, OUTPUT); // Set the relay pin to output mode
digitalWrite(relayPin, LOW); // ensure the relay is off
Serial.println("Starting.");
}
void loop()
{
while( alarmNotDetected) // Do this loop until alarm is detected
{ soundVal = analogRead(micPin); // sample the microphone
sampleCount++; // count the samples
sampleSum += soundVal; // add the soundVal to the sum of the samples
if (sampleCount == 100 ) // do this every 100th sample which is 1 second
{ average = sampleSum/100; // calc the average
if( average < minVal || maxVal < average) // average out of range implies alarm is sounding
{ alarmSeconds++; } // count the number of seconds the alarm is sounding
else
{
(alarmSeconds = 0);
}
if( alarmSeconds == triggerSeconds) // alarm sounding for the required number of seconds?
{ alarmNotDetected = false; } // if so, alarm is detected
Serial.print("Alarm detected for");
Serial.print(alarmSeconds);
Serial.println(" seconds.");
//Serial.println(sampleCount);
//Serial.println(sampleSum);
sampleSum = 0; // resets the sum variable
sampleCount = 0; // resets the sample count
//alarmSeconds = 0; //resets alarm seconds to 0
}
delay(10); // wait 1/100 of a second
}
if (notInflated) //
{ Serial.println("Inflating");
digitalWrite(relayPin,HIGH); // Start the compressor
//delay(1000 * inflationTime); // run compress for inflationTime seconds
delay(24000);
digitalWrite(relayPin,LOW); // Stop the compressor
notInflated = false; // We've now inflated the tube
Serial.println("Done!");
}
}
// Initialize Variables
int relayPin = 13; // relay is on pin 13
boolean alarmNotDetected = true; // it's true, we've not detected the alarm
boolean notInflated = true; // we've not inflated the tube yet
//int inflationTime = 30; // Number of seconds the compressor will run
int micPin = 1; // select the input pin for sound sensor
int soundVal = 0; // receives value from microphone
int sampleCount = 0; // counts the number of times we’ve sampled the microphone
long sampleSum = 0; // sums the values to calculate an average
int average = 0; // the average value for the second
int minVal = 506; // Put your value here
int maxVal = 512; // Put your value here
int triggerSeconds = 3; // the number of seconds the alarm must sound before we act
int alarmSeconds = 0; // the number of seconds that alarm has sounded
void setup()
{
Serial.begin(9600); // open the serial port at 9600 bps:
pinMode(relayPin, OUTPUT); // Set the relay pin to output mode
digitalWrite(relayPin, LOW); // ensure the relay is off
Serial.println("Starting.");
}
void loop()
{
while( alarmNotDetected) // Do this loop until alarm is detected
{ soundVal = analogRead(micPin); // sample the microphone
sampleCount++; // count the samples
sampleSum += soundVal; // add the soundVal to the sum of the samples
if (sampleCount == 100 ) // do this every 100th sample which is 1 second
{ average = sampleSum/100; // calc the average
if( average < minVal || maxVal < average) // average out of range implies alarm is sounding
{ alarmSeconds++; } // count the number of seconds the alarm is sounding
else
{
(alarmSeconds = 0);
}
if( alarmSeconds == triggerSeconds) // alarm sounding for the required number of seconds?
{ alarmNotDetected = false; } // if so, alarm is detected
Serial.print("Alarm detected for");
Serial.print(alarmSeconds);
Serial.println(" seconds.");
//Serial.println(sampleCount);
//Serial.println(sampleSum);
sampleSum = 0; // resets the sum variable
sampleCount = 0; // resets the sample count
//alarmSeconds = 0; //resets alarm seconds to 0
}
delay(10); // wait 1/100 of a second
}
if (notInflated) //
{ Serial.println("Inflating");
digitalWrite(relayPin,HIGH); // Start the compressor
//delay(1000 * inflationTime); // run compress for inflationTime seconds
delay(24000);
digitalWrite(relayPin,LOW); // Stop the compressor
notInflated = false; // We've now inflated the tube
Serial.println("Done!");
}
}
No comments:
Post a Comment