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!


FOOD- Fridge dOor Opened Detector

Project Members: 
Emelie Cheng

Description

I design this device to remind me if the door of the refrigerator does not close properly. Sometimes I just leave the door half-opened by accident, and the cold air comes out, and waste energy. The input components include FSR and photocell and out component is Piezo Buzzer.
When the door is opened and closed correctly, the Piezo Buzzer will stay silent and won’t do anything. In the contrast, if I leave the door open by accident, there will be some noise until the door is been closed.  

Design Concept

  

Component

1.Arduino board
2.White breadboard
3.Piezo speaker (connect to Ground and pin 7)
4.FSR (Force Sensitive Resistor)
5.Photocell
6.10K resistor (labeled using brown, black orange and gold bands)
7.Wires connect FSR and photocell to Arduino board (black one and short blue ones connect 10K resistor to ground, red one connects to 5V, and yellow ones connect to pin 0 and 1 )
8.2 rubber bands
9.USB cable
10.Arduino environment

Code

// Debugging flag
int DEBUG = 0;

// input and output pin assignment
int fsrPin = 0;       // input pin for the fsr sensor
int photocellPin = 1; // input pin for photocell sensor
int speakerOut = 7;   // speaker pin

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

void playSound()
{
    for(int i=0; i<500; i++ ) {  // play it for 500 cycles
 digitalWrite(speakerOut, HIGH);
 delayMicroseconds(500);
 digitalWrite(speakerOut, LOW);
 delayMicroseconds(500);
    }
}

void loop()
{
    int fsrval = 0;
    int photoval = 0;

    fsrval = analogRead(fsrPin); // read the value from the fsr sensor, 0-1023
    photoval = analogRead(photocellPin); // read the value from photocell sensor, 0-1023

    if (!fsrval && photoval < 256) {
 // no pressure on fsr and no light from fridge
 // condition for playing back the melody
 playSound();
 // digitalWrite(speakerOut, HIGH);
    } else {
 // make sure speaker is off
 digitalWrite(speakerOut, LOW);
    }
   
    if (DEBUG) {
 Serial.print("fsrval=");
 Serial.print(fsrval);
 Serial.print("photoval=");
 Serial.println(photoval);
    }
   
    delay(1000);                   // rest a little...
}

Photograph

 

Video


Comments

way to be green! And nice

way to be green! And nice observation using the state of the door and the light to determine when you are in an "illegal door state"!


Powered by Drupal - Design by Artinet