Fridge Door Detector Alarm

120K23757

Intro: Fridge Door Detector Alarm

Has it ever happened to you to go to the fridge and discover that its door is slightly opened ... and probably most your food went to the trash ... Ghhhrr that jammed door that needs an extra push to make it close properly .......

This instructables will show you how to make an alarm system that will beep a buzzer if you leave the fridge door opened for a long time to remind to you to close the door. All new fridges on the market have this option built in, but some may want to upgrade their old fridges.

This video shows the system in action:


  • The Fridge Door Detector Alarm is easy to make - uses only 8components including the batteries!
  • Easy to set to your preferences for the time that the door is left opened - fully customizable!
  • Cheap - less than 5kg potatos.
  • Easy to install - installation means sticking a small box inside your fridge using sticky tape!
  • Easy to maintain - change batteries just every four-five months!
  • Encourages thinking and logic problem solving for the young electricians that will try to make it!
  • Finally - saves electricity costs if you forget the door opened for a long time.

Update History:
  • 1st Oct 2012 - Added several schematics in steps 4 and 5.
  • 4th Oct 2012 - Visually changed the code appearance in step 3.
  • 7th Oct 2012 - Instructions made more clear in step 3.
  • NEW: 8th Oct 2012 - Major changes in the ATtiny85 code: better power mode - enabled power save mode to reduce consumption. New code in step 3.
  • NEW: 9th Oct 2012 - Added description for how to set the circuit sensitivity up. See step 7.

STEP 1: The Idea

What the Fridge Door Detector Alarm does is to detect whether there is some ambient light in the food compartment of your fridge or freezer. This happens when you open the door and the Fridge Door Detector Alarm system senses some light that may be coming from the bulb light in the fridge or from the door opening itself.

The Brain

I use an ATtiny85 microcontroller which is easy to program with an Arduino if you have one ;) Than you can write the code that will suit your needs perfectly - for example one may want to hear the buzzer 2- seconds after opening the door ... or maybe 45 or 2 minutes - you decide!

Using a microcontroler minimises the use of external elements which saves you time and cost!

The Components
  • ATtiny85 microcontroller
  • Arduino Uno
  • Prototyping board + wires
  • Buzzer
  • Switch
  • Plastic box
  • 180 kOhms resistor
  • 0-100 kOhms variable resistor
  • LDR - light dependent resistor
  • Batteries
  • Empty PCB to solder the schematic
  • Board holder for the ATtiny

The Tools
  • Soldering iron
  • Double sided sticky tape
  • Cable cutters and knife

STEP 2: ATtiny85 Programming Hardware Connections

As shown on the diagram:

ATtiny pin   <>  Arduino Uno pin

        1           <>            10
        5           <>            11
        6           <>            12
        7           <>            13
        4           <>          GND
        8           <>            5V

STEP 3: Programming Software Development

You can follow my steps or alternatively here is a link that will show you how to connect the ATtiny to the Arduino: http://hlt.media.mit.edu/?p=1695

Steps to connect ATtiny85 to Arduino Uno for programming:
  1. Download this file: https://github.com/damellis/attiny/zipball/Arduino1
  2. Unzip and put the "attiny" folder in the "hardware" folder where tha Arduino is installed on your PC. The path looks like this: Documents > Arduino > hardware > attiny> (Other downloaded files... etc)
  3. Start the Arduino Application and open the ArduinoISP from the FIle>Examples menu
  4. Upload the sketch to the Arduino Uno.
  5. Now change the following settings:
  6. Check the ATtiny85 (8 Mhz) checkbox in the Tools > Board menu.
  7. Check the: "Arduino as ISP" in the Tools > Programmer menu.
I have uploaded two versions of the software.

The first works on Arduino Uno only and this is because I made the experimental circuit on the Arduino firstly. See the pictures for the camponent arangement that I made. You have a choice of lots of pins for the inputs and outputs, so it depends on you how you name them in the coding. I used pin A0 for the analogue input from the LDR and then I have pins 2, 3 and 4 for the rest of the circuit.

YOU can skip connecting all components to the Arduino if you prefer. There is no need to do it, you can go straight on the ATtiny programming.

Basic software understanding - READ THIS TO SEE HOW THE SOFTWARE WORKS

The basic program concept is that every second there is a pin that powers the LDR and some current flows through it and the variable resistor. Then the middle point between the LDR and the variable resistor is measured from the microcontroller and the measurement (voltage between 0 and 5 volts) is compared to a set value (2.5 volts in my case) and a logic decision is made.

In one case nothing happens and the measurement continues on and on.

In the other case an LED lights up to show that the door has been opened. At the same time a timer starts counting seconds and if it reaches the set number of seconds (i.e. 10 seconds), then a beep sounds until the door is closed. While seconds are counted down and the beeps sound, measurements are also taken to see what is the situation with the door. We will be using an Arduinho Uno to program the ATtiny85.


For the Attiny Version  02:

/* Fridge Door Alarm Detector Version 02 Written by Pavel Mihaylov and Tatqna Mihaylova 11 September 2012 This version is ready to be uploaded to ATtiny85 microcontroller using Arduino Uno as a programmer. */ int pwr = 1; //(Could be pin 3 on Arduino) hard pin 6 on ATtiny int alarm = 4; //(Could be pin 4 on Arduino) hard pin 3 on ATtiny int door = 2; //(Could be pin 5 on Arduino) hard pin 7 on ATtiny int LDR = 3; //(Could be pin A0 on Arduino) hard pin 2 on ATtiny int time_door_open = (3)*1000; //Time that sets the beep alarm on after the fridge door is opened int time = 50; //Time delay int time_tone = 40; //Time delay to make the beep tone int time_tone2 = 20; //Time delay to make the beep tone float trig = 4.5; //Trigger level for the LDR float LDRval = 0; //Initial value of the LDR measurement level int door_left = 0; //Variable to set whether the door is left opened (1) or closed (0) extern volatile unsigned long timer0_overflow_count; //This is required to know when a rollover occurs void setup() { pinMode(pwr, OUTPUT); pinMode(alarm, OUTPUT); pinMode(door, OUTPUT); pinMode(LDR, INPUT); } //Main program loop void loop() { if(read_light()) { door_left = 1; timer0_overflow_count = 0; unsigned long start = millis(); // This is the time countdown when the door is opened while( (millis() - start) <= time_door_open ) { if(millis() - start < 0) //break while loop if rollover occures { break; } if(read_light() == 0) // If door is closed the program does nothing and starts again { door_left = 0; break; } delay(time); //delay needed } if(door_left == 1) // If door is opened start the beep sound! { alarm_sound(); } } delay(time); delay(time); delay(time); } //Function to read the light sensor (LDR) and return either 0 (door is closed) or 1 (door is opened) int read_light() { digitalWrite(pwr, HIGH); // turn the pwr pin on by making the voltage high to allow a measurement to be taken delay(10); // wait for some time LDRval = analogRead(LDR); // read the sensor value delay(5); // wait some time digitalWrite(pwr, LOW); // turn the pwr pin off by making the voltage low LDRval = LDRval/1024*5; // sensor value is in the range 0 to 1023 and we need it between 0 and 5 - this is the calculation required if(LDRval<trig) // This compares the reading to the trigger level { digitalWrite(door, HIGH); // Turn the external LED ON to show that the door is opened return 1; // Means door is opened } else { digitalWrite(door, LOW); // Turn the external LED OFF to show that the door is closed return 0; // Means door is closed } } /* Loop to make the beep sounds First makes three 3-beep sounds Then makes 4-beep spunds for ever if the door remains opened */ void alarm_sound() { int looop1=0; int sound_loop1_skip = 0; while(read_light() && looop1<3 && sound_loop1_skip == 0) // This makes the loop beep 3 times a 3-beep tone { int i; digitalWrite(alarm, HIGH); //make beep sound on delay(time_tone); delay(time_tone2); digitalWrite(alarm, LOW); //make beep sound stop delay(time_tone2); digitalWrite(alarm, HIGH); //make beep sound on delay(time_tone2); digitalWrite(alarm, LOW); //make beep sound stop delay(time_tone2); digitalWrite(alarm, HIGH); //make beep sound on delay(time_tone2); digitalWrite(alarm, LOW); //make beep sound stop delay(time_tone2); looop1++; read_light(); delay(290); } //second beep loop now begins looop1 = 0; while(read_light()) { delay(300); int i; digitalWrite(alarm, HIGH); //make beep sound on delay(time_tone); delay(time_tone); digitalWrite(alarm, LOW); //make beep sound stop delay(time_tone2); digitalWrite(alarm, HIGH); //make beep sound on delay(time_tone2); digitalWrite(alarm, LOW); //make beep sound stop delay(time_tone2); digitalWrite(alarm, HIGH); //make beep sound on delay(time_tone2); digitalWrite(alarm, LOW); //make beep sound stop delay(time_tone2); digitalWrite(alarm, HIGH); //make beep sound on delay(time_tone2); digitalWrite(alarm, LOW); //make beep sound stop delay(time_tone2); delay(270); } //now go on beeping if door is still opened if(read_light()) { sound_loop1_skip = 1; // This will make the program skip the 3-beep sound and continue the 4-beep sound delay(2000); alarm_sound(); } else { sound_loop1_skip = 0; } }


For the ATtiny Version 03:

Changes to v02 - basically sleep mode is enabled. The ATtiny sleeps on every cycle for the duration of 4 seconds. While sleeping power consumption is very small - in the order of 7uA.

/* Fridge Door Alarm Detector Version 03 Written by Pavel Mihaylov and Tatqna Mihaylova 09 October 2012 This version is ready to be uploaded to ATtiny85 microcontroller using Arduino Uno as a programmer. For full instructions see: https://www.instructables.com/id/Fridge-Door-Detector-Alarm/ */ // Following lines are essential to enable sleep mode #include <avr/sleep.h> #include <avr/wdt.h> #ifndef cbi #define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) #endif #ifndef sbi #define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit)) #endif volatile boolean f_wdt = 1; int pwr = 1; //(Could be pin 3 on Arduino) hard pin 6 on ATtiny int alarm = 4; //(Could be pin 4 on Arduino) hard pin 3 on ATtiny int door = 2; //(Could be pin 5 on Arduino) hard pin 7 on ATtiny int LDR = 3; //(Could be pin A0 on Arduino) hard pin 2 on ATtiny int time_door_open = (3)*300; //Time that sets the beep alarm on after the fridge door is opened int time = 50; //Time delay int time_tone = 40; //Time delay to make the beep tone int time_tone2 = 20; //Time delay to make the beep tone float trig = 3.5; //Trigger level for the LDR float LDRval = 0; //Initial value of the LDR measurement level int door_left = 0; //Variable to set whether the door is left opened (1) or closed (0) extern volatile unsigned long timer0_overflow_count; //This is required to know when a rollover occurs //Pins setup void setup() { pinMode(pwr, OUTPUT); pinMode(alarm, OUTPUT); pinMode(door, OUTPUT); pinMode(LDR, INPUT); setup_watchdog(8); // approximately 4 seconds sleep // 0=16ms, 1=32ms,2=64ms,3=128ms,4=250ms,5=500ms 6=1 sec,7=2 sec, 8=4 sec, 9= 8sec } //Main program loop void loop() { // if (f_wdt==1) { // wait for timed out watchdog / flag is set when a watchdog timeout occurs f_wdt=0; // reset flag // if(read_light()) //In case the door is opened this statement will be true { door_left = 1; timer0_overflow_count = 0; unsigned long start = millis(); // This is the time countdown when the door is opened while( (millis() - start) <= time_door_open ) { if(millis() - start < 0) break; //break while loop if rollover occures if(read_light() == 0) // If door is closed the program does nothing and starts again { door_left = 0; break; } delay(time); //delay needed } if(door_left == 1) alarm_sound(); // If door is opened start the beep sound! } //Now put the system to sleep system_sleep(); } } //Function to read the light sensor (LDR) and return either 0 (door is closed) or 1 (door is opened) int read_light() { digitalWrite(pwr, HIGH); // turn the pwr pin on by making the voltage high to allow a measurement to be taken LDRval = analogRead(LDR); // read the sensor value digitalWrite(pwr, LOW); // turn the pwr pin off by making the voltage low LDRval = LDRval/1024*5; // sensor value is in the range 0 to 1023 and we need it between 0 and 5 - this is the calculation required if(LDRval<trig) // This compares the reading to the trigger level { digitalWrite(door, HIGH); // Turn the external LED ON to show that the door is opened return 1; // Means door is opened } else { digitalWrite(door, LOW); // Turn the external LED OFF to show that the door is closed return 0; // Means door is closed } } /* Loop to make the beep sounds First makes three 3-beep sounds Then makes 4-beep spunds for ever if the door remains opened */ void alarm_sound() { int looop_1_count=0; int sound_loop1_skip = 0; while(read_light() && looop_1_count<3 && sound_loop1_skip == 0) // This makes the loop beep 3 times a 3-beep tone { digitalWrite(alarm, HIGH); //make beep sound on delay(time_tone); delay(time_tone2); digitalWrite(alarm, LOW); //make beep sound stop delay(time_tone2); digitalWrite(alarm, HIGH); //make beep sound on delay(time_tone2); digitalWrite(alarm, LOW); //make beep sound stop delay(time_tone2); digitalWrite(alarm, HIGH); //make beep sound on delay(time_tone2); digitalWrite(alarm, LOW); //make beep sound stop delay(time_tone2); looop_1_count++; read_light(); delay(290); } //second beep loop now begins looop_1_count = 0; while(read_light()) { digitalWrite(alarm, HIGH); //make beep sound on delay(time_tone); delay(time_tone); digitalWrite(alarm, LOW); //make beep sound stop delay(time_tone2); digitalWrite(alarm, HIGH); //make beep sound on delay(time_tone2); digitalWrite(alarm, LOW); //make beep sound stop delay(time_tone2); digitalWrite(alarm, HIGH); //make beep sound on delay(time_tone2); digitalWrite(alarm, LOW); //make beep sound stop delay(time_tone2); digitalWrite(alarm, HIGH); //make beep sound on delay(time_tone2); digitalWrite(alarm, LOW); //make beep sound stop delay(time_tone2); delay(570); } //now go on beeping if door is still opened if(read_light()) { sound_loop1_skip = 1; // This will make the program skip the 3-beep sound and continue the 4-beep sound delay(2000); if(read_light()) alarm_sound(); } else sound_loop1_skip = 0; } // set system into the sleep state // system wakes up when wtchdog is timed out void system_sleep() { cbi(ADCSRA,ADEN); // switch Analog to Digitalconverter OFF set_sleep_mode(SLEEP_MODE_PWR_DOWN); // sleep mode is set here sleep_enable(); sleep_mode(); // System sleeps here sleep_disable(); // System continues execution here when watchdog timed out sbi(ADCSRA,ADEN); // switch Analog to Digitalconverter ON } // 0=16ms, 1=32ms,2=64ms,3=128ms,4=250ms,5=500ms // 6=1 sec,7=2 sec, 8=4 sec, 9= 8sec void setup_watchdog(int ii) { byte bb; int ww; if (ii > 9 ) ii=9; bb=ii & 7; if (ii > 7) bb|= (1<<5); bb|= (1<<WDCE); ww=bb; MCUSR &= ~(1<<WDRF); // start timed sequence WDTCR |= (1<<WDCE) | (1<<WDE); // set new watchdog timeout value WDTCR = bb; WDTCR |= _BV(WDIE); } // Watchdog Interrupt Service / is executed when watchdog timed out ISR(WDT_vect) { f_wdt=1; // set global flag }


For the Arduino Version 01:

/* Fridge Door Alarm Detector Version 01 Written by Pavel Mihaylov and Tatqna Mihaylova 11 September 2012 This version is ready to be uploaded to Arduino Uno microcontroller using Arduino Uno as a programmer. */ int led = 2; int pwr = 3; int alarm = 4; int door = 5; int LDR = A0; int time_door_open = (3)*1000; // value in brackets is in seconds int time = 500; int time2 = time*2; int time_tone = 80; //make the beep tone int tx = 1; //set this to 1 if you want to monitor the serial port debugging info, 0 otherwise float trig = 2.5; float LDRval = 0; int door_left = 0; //whether the door is left opened (1) or closed (0) extern volatile unsigned long timer0_overflow_count; // the setup routine runs once when you press reset: void setup() { // initialize the digital pin as an output. if(tx) Serial.begin(9600); pinMode(led, OUTPUT); pinMode(pwr, OUTPUT); pinMode(alarm, OUTPUT); pinMode(door, OUTPUT); pinMode(LDR, INPUT); } // the loop routine runs over and over again forever: void loop() { if (tx) delay(time); if (tx){ Serial.print("--------------------------------------------\n");} read_light(); if(read_light()) { if (tx) delay(time); if (tx){ Serial.print("Door just opened!\n");} digitalWrite(door, HIGH); door_left = 1; int n = 0; timer0_overflow_count = 0; unsigned long start = millis(); while( (millis() - start) <= time_door_open ) { if(millis() - start < 0) //break while loop if rollover occures { if (tx){ Serial.print("ROLLOVER OCCURED");} break; } if (tx){ Serial.print("Counting seconds down\n");} if (tx){ Serial.print(millis());} n++; read_light(); if(read_light() == 0) { if (tx) delay(time); if (tx){ Serial.print("Door just closed!\n");} digitalWrite(door, LOW); door_left = 0; break; } delay(time); //delay needed } if (tx){ Serial.print("Out of while loop!\n");} if(door_left == 1) { if (tx) delay(time); if (tx){ Serial.print("> > > Alarm triggered!\n");} alarm_sound(); } else { if (tx) delay(time); if (tx){ Serial.print("Alarm not triggered!\n");} } } else { if (tx) delay(time); if (tx){ Serial.print("Door stays closed!\n");} } delay(time2); } //Function to read the light sensor (LDR) and return either 0 (door is closed) or 1 (door is opened) int read_light() { digitalWrite(led, HIGH); // turn the LED on by making the voltage High digitalWrite(pwr, HIGH); // turn the pwr pin on by making the voltage high to allow a measurement to be taken delay(30); // wait for some time LDRval = analogRead(LDR); // read the sensor value delay(10); // wait for some time digitalWrite(led, LOW); // turn the LED off by making the voltage LOW digitalWrite(pwr, LOW); // turn the pwr pin off by making the voltage low LDRval = LDRval/1024*5; // sensor value is in the range 0 to 1023 and we need it between 0 and 5 - this is the calculation required if (tx) { Serial.print("\nLDR value in volts = "); Serial.println(LDRval); } if(LDRval<trig) { return 1; // Means door is opened } else { return 0; // Means door is closed } } /* Loop to make the beep sounds First makes three 3-beep sounds Then makes 4-beep sounds */ void alarm_sound() { // digitalWrite(alarm, HIGH); int looop1=0; while(read_light() && looop1<3) { if (tx) delay(time); if (tx){ Serial.print("Door is still opened - now beep second time!\n");} int i; digitalWrite(alarm, HIGH); //make beep sound delay(80); digitalWrite(alarm, LOW); //make beep sound delay(320); digitalWrite(alarm, LOW); //make beep sound delay(time_tone); digitalWrite(alarm, LOW); //make beep sound for(i = 15; i>=0; i--) { digitalWrite(alarm, HIGH); //make beep sound delay(i); digitalWrite(alarm, LOW); //make beep sound } digitalWrite(alarm, LOW); //make beep sound delay(time_tone); digitalWrite(alarm, LOW); //make beep sound for(i = 18; i>=0; i--) { digitalWrite(alarm, HIGH); //make beep sound delay(i); digitalWrite(alarm, LOW); //make beep sound } digitalWrite(alarm, LOW); //make beep sound delay(time_tone); digitalWrite(alarm, LOW); //make beep sound delay(1500); looop1++; read_light(); } delay(2000); //second beep loop now begins looop1 = 0; while(read_light() && looop1<3) { if (tx) delay(time); if (tx){ Serial.print("Door is still opened - now beep second time!\n");} int i; digitalWrite(alarm, HIGH); //make beep sound delay(80); digitalWrite(alarm, LOW); //make beep sound delay(320); digitalWrite(alarm, LOW); //make beep sound delay(time_tone); digitalWrite(alarm, LOW); //make beep sound for(i = 15; i>=0; i--) { digitalWrite(alarm, HIGH); //make beep sound delay(i); digitalWrite(alarm, LOW); //make beep sound } digitalWrite(alarm, LOW); //make beep sound delay(time_tone); digitalWrite(alarm, LOW); //make beep sound for(i = 18; i>=0; i--) { digitalWrite(alarm, HIGH); //make beep sound delay(i); digitalWrite(alarm, LOW); //make beep sound } digitalWrite(alarm, LOW); //make beep sound delay(time_tone); digitalWrite(alarm, LOW); //make beep sound for(i = 18; i>=0; i--) { digitalWrite(alarm, HIGH); //make beep sound delay(i); digitalWrite(alarm, LOW); //make beep sound } delay(1000); looop1++; read_light(); } //now go on if door is still opened if(read_light()) { delay(3000); //time to restart the two beep loops alarm_sound(); } else { // digitalWrite(alarm, LOW); if (tx) delay(time); if (tx){ Serial.print("Door was just closed by the angry guy!\n");} digitalWrite(door, LOW); } }

STEP 4: Arduino Fridge Door Detector Alarm

On Arduino:

Pin A0 is the analogue input pin.
Digital pins: 2 is the power pin: each time a measurement of the light is taken, the red LED lights up (this is only for debugging); 3 is just another pin that does the same as pin 2; 4 - there is the buzzer alarm output; 5 - the yellow LED lights up when the fridge door is opened.

I did both the Arduino and ATtiny circuits on the same breadbord. Both are separate from each other, I only took power supplies from the Arduino for the ATtiny.



STEP 5: ATtiny85 Fridge Door Detector Alarm

On ATtiny:

Pin 2 - Middle point between the LDR and the 0-100kOhms variable resistor
Pin 3 - Positive terminal for the buzzer
Pin 4 - Ground, also negative terminal for the buzzer
Pin 6 - 0-100kOhms variable resistor
Pin 7 - LED and a current limiting resistor - I used a 100kOhms to limit the power consumption and still be able to see the LED light up
Pin 8 - Power 2 to 5 V DC

Now test test test!

STEP 6: Setting the Alarm Time

The only thing that you would like to change in the code is the time that is needed befor the buzzer starts making beep sounds after you open the fridge door.

On line 16 in the code, there is a variable called time_door_open.

It determines this time after you open the door and until you hear the beep sound. It depends on the clock frequency how many seconds the delay will be. I wrote 1000, which on the Arduino Uno would mean 1000 milliseconds = 1 second. But on the ATtiny this is about 9-10 seconds. 

Set this variable to the suitable time that you want the delay to be!

int time_door_open = (3)*1000 will make the delay 25 seconds.

STEP 7: Setting the Light Detection Sensitivity

There are two ways to set the light detection senor sensitivity.
  • Analogue - using the potentiometer on the board
  • Digitally - by changing the trig value in the code
The trig variable can take any number between 0.00 and 5.00. It is a floating point number, so you can use 3.56 for example.

Make trig higher (closer to 5.00) to set the sensitivity higher i.e. when you want the sensor to trigger the output if a very little amount of light is present.

Make trig lower (closer to 0.00) to set the sensitivity lower i.e. when you want the sensor to trigger the output if quite a lot of light is present.

STEP 8: FInal Circuit Diagram

Here is the final diagram for the ATtiny connections. You can change the order of all pins with the software for the optimum components arangement when you start soldering. I would not reccomend you to change the place of pin 2 - the analogue input .... just because I tried with all other pins and only this one works as an analogue input!

STEP 9: Soldering Time!!!

I'm not showing the soldering process itself, there is the final result!

It is best to solder a holder for the microcontroller, just in case that you want to reprogram it. You'll be able to unplug it, not desolder.

STEP 10: Power and Test

Test the soldered circuit!

I use three batteries AA type. Their overal voltage is 4.5 V which is just perfect for the ATtiny.

Measuring the consumption gives 1mA current up to 2mA with the buzzer sounding. If you use a 3200mAh batteries, this means you will have to change them at intervals = 3200/1.5 [overal consumption] = 2133 hours = 3 months. Not bad!


STEP 11: Fit It All in a Box

Drill holes for the switch, LED, LDR and the buzzer sound.

Make it all fit in one box.

I had to cut off the mounting brackets on the sides of the buzzer to make it fit in.

STEP 12: Final Touches

Finally attach the switch that connects the battery pack to the 8th pin of the ATtiny and the buzzer. At this stage your circuit should be operating completely and without any problems.

STEP 13: Tape It to the Fridge

Finally use some double-sided adhesive tape to mount the alarm system in the fridge!

Flip the switch and it is done.

55 Comments

Hello, thank you for these instructions and providing the code. I'm wondering how to troubleshoot because the buzzer barely makes a sound and we wouldn't be able to hear it from five feet away with ambient noise. Otherwise it works just fine.

I'm building your project. Thank you for sharing.

Excellent project! Do you think it would be possible to make one that sits externally to, say, a -20C freezer (that doesn't swing shut and a certain absent minded laboratory research assistant occasionally defrosts on accident with lots of expensive microbiology reagents inside of it)? Like, replacing the photo-resistor with a magnet and setting the device over the top? I just don't think batteries would work too well in -20C!

Thank you!

Yes, you can replace the photoresistor with a reed switch (like thishttps://www.amazon.com/Directed-Electronics-8600-Magnetic-Switch/dp/B0009SUEZY) and read its state with the analog input of the Arduino.

awesome but when my mom opened the frige door she got electrocuted!

:-P

That is 0% likely to happen if you have followed the instructions. What power source did you use?

CanI pay someone to make this for me?

Can Moisture inside the fridge affect the ckt??

Hello,

I am having problems compiling code ?

In function 'void setup_watchdog(int)'

'WDTCR' was not declared in this scope

I have tried compiling in v1.2 and v1.4 as well as earlier version of Arduino.

I also could not get to this link:


  1. Download this file: https://github.com/damellis/attiny/zipball/Arduino1

Any help would be appreciated,

Build_it_Bob

Hey, I've just realized that the WDTCR is now WDTCSR for ATtiny 24/44/84. So just replace that in your code. Hope it helps.

Regards,

tiagovaz,

Thank you so much ! I have been doing a lot of playing around with the ATTiny85 and now I see that the change for WDTCR / WDTCSR is required when moving from a test sketch on an Uno to the ATTiny85 .

Build_it_Bob

Thank you for your help!!! :-)

Dear,

i am newbie. when i compile the code. it's show error problem : port_to_output_PGM has a previous declaration. Please help me

Planning on this project..................what is the spec on the buzzer?

Most 12V piezo buzzers should work. Try this one for example: http://uk.farnell.com/pro-signal/abi-023-rc/piezo-buzzer-12vdc-leads/dp/1022400

Incredible ...excellent work . I want to make this to practice with the Attiny , and your commenting will help a great deal. Thank you so much for sharing this gem.

Build_it_Bob

I also made a very crude version of this instructable.
https://www.instructables.com/id/Refrigerator-Alarm/
Credits to hertzgamma for enabling me to have this as my reference! :)
Congratulations!
Please also visit my site for Arduino beginners who wanted to learn more:
http://arduinodude11.tumblr.com/
Hi, I'm really interested in doing this project. I have never programmed an Arduino or anything else for that matter. I've got basic soldering know-how, but that's it.

One question though. Which version of the ATtiny85 microcontroller do you use? At Atmel's webpage there's 12 different versions.

Alternatively, is it possible to use the ATmega328 mc that comes with the Arduino Uno when purchased from Arduino's store?

Thanks in advance.
More Comments