Close the Fridge Door !

Made by Kedi Zhang

Found in DIoT 2018 1- Home Hack

This product detects the light inside the fridge when we open it and begin to count time. If it lasts for more than 5 mins, then it means we forget to close the door and the product will beep.



I have an eco-enthusiast roommate who often gets angry when we forget to close the fridge door.
Therefore, this product will save both energy and our friendship haha~


The device will be placed in the refrigerator unit rather than freezer unit. The sensor will start a timing if it receives sufficient light, no matter the light from outside or the light from fridge bulbs. Timing is cut if the light goes. If it lasts for 5 mins, it will trigger the beeper and beep for 10 seconds to remind us that we forget to close our fridge door. After completing these steps, I will try how to generate push up message send to my phone because sometimes we may already leave the kitchen and may not hear the noise.


Process (Plan)

Major components will be a light sensor, a beeper, the particle board and a battery module.

Here are two steps to achieve the ideal performance. The first step is to build a minimal functioning prototyping working locally. It receives local data (light), processes on a local chip, and actuated local beeper. This device becomes a connected object in the second step when we monitor the data in the online console and send out messages to another device.



Quick summary:

1. Three components: photoresistor (SENSOR, INPUT), beeper(OUTPUT), resistor

2. Sensor data is available on Particle cloud and can trigger TWILIO API to send messages to the user.

3. Local feedback: beeper generate NOKIA TONE

The product will alert you locally by playing NOKIA TONE for 3 times if you leave your door open for more than 5 mins (3s in my current code). If you close the fridge door, it will not play another time. If you fail to close the door before the 3rd NOKIA TONE ends, you will receive an SMS. If you ignore all of these alerts, you will hear the alert and receive SMS every 20mins (1 min in my current code).

Nice :)

Here are videos:


Open the door for 3s and it begins to alert:


2. It rings 3 times and send you an SMS

// Creative Project 1: Home Hack, Kedi Zhang, 30 Jan 2018
int speakerPin = D0;
int photoCellPin = A1;
int photoCellReading = 0;
int count = 0;
String body = "Close your fridge door!!!";

// create an array for the notes in the melody:
int melody[] = {0,2637,2349,1480,1661,2217,1976,1175,1319,1976,1760,1109,1319,1760};

// create an array for the duration of notes.
// note durations: 4 = quarter note, 8 = eighth note, etc.:
int noteDurations[] = {4,8,8,4,4,8,8,4,4,8,8,4,4,2};

void playNotes()
    // iterate over the notes of the melody:
    for (int thisNote = 0; thisNote < 14; thisNote++) {

      // to calculate the note duration, take one second
      // divided by the note type.
      //e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.
      int noteDuration = 1000/noteDurations[thisNote];
      tone(speakerPin, melody[thisNote],noteDuration);

      // to distinguish the notes, set a minimum time between them.
      // the note's duration + 30% seems to work well:
      int pauseBetweenNotes = noteDuration * 1.30;
      // stop the tone playing:

void setup(){

  // Set up the LED for output
  pinMode(speakerPin, OUTPUT);

  // Create a cloud variable of type integer
  // called 'light' mapped to photoCellReading
  Particle.variable("light", &photoCellReading, INT);



void loop() {
  photoCellReading = analogRead(photoCellPin);

  Serial.print("Analog reading = ");
  Serial.print(photoCellReading);     // the raw analog reading

  // We'll have a few threshholds, qualitatively determined
  if (photoCellReading < 3250) {
      Serial.println(" - Dark");
      count = 0;
    } else {
      Serial.println(" - Bright");
      if (count == 0) {
        if (photoCellReading > 3249) {
      } else if (count < 4) {
      } else if (count == 4) {
        Particle.publish("twilio_sms", body, PRIVATE);
      } else {
        count = 0;

Click to Expand


Reflect on the process of making this project. What did you learn? What would you do differently?

Share this Project


49713 Designing for the Internet of Things

· 25 members

A hands-on introductory course exploring the Internet of Things and connected product experiences.

Focused on

This product detects the light inside the fridge when we open it and begin to count time. If it lasts for more than 5 mins, then it means we forget to close the door and the product will beep.


January 24th, 2018