Fridge Door Open Alarm Project Advice

sheldons

Joined Oct 26, 2011
613
Heres the provisional schematic to play with for now...the extra for the beep when the doors open is on its way....the circuit posted which uses an ldr gives me another idea regarding the design which im working on(using a 555 as a schmidt trigger driven by the ldr,or to get size down a transistor schmidt trigger)soooooo there will be another to come.....
 

Attachments

Thread Starter

ajhoward

Joined Nov 16, 2011
46
Wow, I can't believe I missed this thread. I built a fridge door sensor as a lark a few years back, mostly to have an excuse to work with the tiniest microcontroller available.

Door sensing is done with a photoresistor (R2), so it is detecting light not a switch. You could replace that with the switch if you want. I drew this from memory, if there is interest I'll dig op the full project files. I even still have the prototype on hand (and it is still running, it beeps when I open the project box).




R1 was as large as I could make it, it might even be 10 or 22 Meg. The goal is to drive the current to as low as possible. The micro U1 spends most of the time in sleep mode using a microamp if that. A change in light triggers the pin that wakes the micro up to start timing and driving a sonalert beeper. It runs for at least a year on it's own off a single coin cell battery the size of a quarter.
If its not too much trouble, I would like to look at those project files.
 

thatoneguy

Joined Feb 19, 2009
6,359
For low battery indicator, first I'll state that battery life would go into several years if you used a switch instead of the LDR, using sleep mode, which draws 100nA until "woken up" by the switch change vs 175 μA if left running 24/7 (which is still close to "no current"). If using 2 AA batteries, they would probably go dead from self-discharge before the circuit drained them using either method, unless the buzzer was on continually. Using a CR2032 coin cell, probably a year or two with the LDR, 2 or 3 with a switch.

At the same time, the LDR method makes everything simpler, no wires are added to the fridge, just use a magnetic mount on the back of the tiny circuit and put it anywhere in view of the fridge light.

That said, the 10F204 has an internal 0.6V bandgap reference, so a low battery feature, such as fast chirps when open instead of the normal sound, would need 2 more resistors to make a voltage divider, which would actually cause the battery to drain quicker (nearly 2x) due to low battery voltage divider using as much current as the uC.

Otherwise, replace battery when beeper isn't as loud as normal, and use schematic above.
 

Thread Starter

ajhoward

Joined Nov 16, 2011
46
For low battery indicator, first I'll state that battery life would go into several years if you used a switch instead of the LDR, using sleep mode, which draws 100nA until "woken up" by the switch change vs 175 μA if left running 24/7 (which is still close to "no current"). If using 2 AA batteries, they would probably go dead from self-discharge before the circuit drained them using either method, unless the buzzer was on continually. Using a CR2032 coin cell, probably a year or two with the LDR, 2 or 3 with a switch.

At the same time, the LDR method makes everything simpler, no wires are added to the fridge, just use a magnetic mount on the back of the tiny circuit and put it anywhere in view of the fridge light.

That said, the 10F204 has an internal 0.6V bandgap reference, so a low battery feature, such as fast chirps when open instead of the normal sound, would need 2 more resistors to make a voltage divider, which would actually cause the battery to drain quicker (nearly 2x) due to low battery voltage divider using as much current as the uC.

Otherwise, replace battery when beeper isn't as loud as normal, and use schematic above.
Hmmm, good point. I'd prefer not to use the LDR as I have purchased 2 reed switches and I intend to place the case in between the fridge and the freezer and wire the switches in parallel.

Battery life is high importance for this, as I want it to be something that I can mount and forget about it, and it just does it's job.

So that circuit provides a delay via the programming, would the switch be just case of replacing the LDR in the circuit or would it need a series resistor?

So how complicated would it be to program the micro to get it up and running?. I have only done some basic machine code programming at TAFE in 98', and we covered the different types of programming language such as C and pascal but didn't actually program anything and its quite vaige now.
 
Last edited:

MrChips

Joined Oct 2, 2009
30,974
I did exactly the same project with an alarm to keep the basement door closed when the kids were babies. In fact the alarm is still there and still working.
 
Last edited:

thatoneguy

Joined Feb 19, 2009
6,359
Pretty simple if you have a PIC Kit 2

I'd suggest this

A 12F675 is an 8 pin PIC that can be programmed from many compilers, from BASIC to C to Pascal. I mostly use BoostC from sourceboost, or MikroC from Mikroelektronica Both offer BASIC as well, and are generous with their "evaluation period" limits (2k of code, the uCs we will be can't store 2k of code).

The 12F675 is an 8 pin DIP, same as the 10F200, but the 10F200 is available 2 extremely small 6 pin surface mount packages, making them attractive for extremely small projects. Choosing the 12F675 will allow you to write your code in BASIC or C if you know either language. Power use is about the same for both the 12F and 10F if you use the sleep mode.

Entire project would be roughly 3 cubic centimeters using the 12F675 DIP and coin cell, or 2 cubic cm using the 10F SOT-23 package, which is a bit difficult to solder to if you are new to soldering.

It's all up to you, but all of the uC options have essentially the same schematic as above, 5 parts. Yours would use the switch instead of the LDR is all.

Code could be provided as well, either the original project files or new ones for a slightly different PIC if you aren't eager to program the world's smallest microcontroller.
 

Thread Starter

ajhoward

Joined Nov 16, 2011
46
I am looking at going with the 8 pin PDIP. What is the difference between the PIC10F200-I/P, and the PIC10F200-E/P?
 

Thread Starter

ajhoward

Joined Nov 16, 2011
46
heres another design of the same thing
Hey Sheldon

I'm going to go with micro, sorry, I really appreciate your help. The power consumption, and circuit simplicity is perfect for this project. Not to mention I can use the PICKIT for other projects.
 

Thread Starter

ajhoward

Joined Nov 16, 2011
46
Pretty simple if you have a PIC Kit 2

I'd suggest this

A 12F675 is an 8 pin PIC that can be programmed from many compilers, from BASIC to C to Pascal. I mostly use BoostC from sourceboost, or MikroC from Mikroelektronica Both offer BASIC as well, and are generous with their "evaluation period" limits (2k of code, the uCs we will be can't store 2k of code).

The 12F675 is an 8 pin DIP, same as the 10F200, but the 10F200 is available 2 extremely small 6 pin surface mount packages, making them attractive for extremely small projects. Choosing the 12F675 will allow you to write your code in BASIC or C if you know either language. Power use is about the same for both the 12F and 10F if you use the sleep mode.

Entire project would be roughly 3 cubic centimeters using the 12F675 DIP and coin cell, or 2 cubic cm using the 10F SOT-23 package, which is a bit difficult to solder to if you are new to soldering.

It's all up to you, but all of the uC options have essentially the same schematic as above, 5 parts. Yours would use the switch instead of the LDR is all.

Code could be provided as well, either the original project files or new ones for a slightly different PIC if you aren't eager to program the world's smallest microcontroller.
Hey thatoneguy,

I have been doing some reading on the 12F675 and come across a section in a book that says that I need to make up a dongle because the pin that is used to switch to programming mode also has other uses. Is this still necessary with the PICKIT2?
 

Attachments

thatoneguy

Joined Feb 19, 2009
6,359
Hey thatoneguy,

I have been doing some reading on the 12F675 and come across a section in a book that says that I need to make up a dongle because the pin that is used to switch to programming mode also has other uses. Is this still necessary with the PICKIT2?
No, just run the Vpp, V+, GND, PGC and PGD lines out to a 5 pin header and the PICKit 2 will program it.

Stay away from DIY programmers, some will erase the OSSCAL and render the PIC non-running since the oscillator won't start, so you'll waste 2 pins on a resonator or crystal, which is kinda pointless on an 8 pin uC. :)
 

Thread Starter

ajhoward

Joined Nov 16, 2011
46
No, just run the Vpp, V+, GND, PGC and PGD lines out to a 5 pin header and the PICKit 2 will program it.

Stay away from DIY programmers, some will erase the OSSCAL and render the PIC non-running since the oscillator won't start, so you'll waste 2 pins on a resonator or crystal, which is kinda pointless on an 8 pin uC. :)
Cheers...... :)
 

Thread Starter

ajhoward

Joined Nov 16, 2011
46
No, just run the Vpp, V+, GND, PGC and PGD lines out to a 5 pin header and the PICKit 2 will program it.

Stay away from DIY programmers, some will erase the OSSCAL and render the PIC non-running since the oscillator won't start, so you'll waste 2 pins on a resonator or crystal, which is kinda pointless on an 8 pin uC. :)
So I can connect these pins to a header and program the PIC in circuit, does the battery need to be disconnected before I plug in the programmer?

Here is some JAL code attached, will this be ok do you think?
 

Attachments

Last edited:

thatoneguy

Joined Feb 19, 2009
6,359
If the board is powered, the PICKit 2 will use the board power to program the PIC, if the board isn't powered, the PICKit 2 will power the board in order to program the PIC.

It's a very intelligent programmer.

jal is a pretty cool language, though I've only tinkered with it. It's very pascal-ish, and Pascal is the first language I learned. However, all other stuff I do is with C or sometimes asm, so I pretty much stick with C. Other choices are out there and make just as good of code most of the time, so there's no problem as long as you get a .hex file in the end. I use BoostC from sourceboost the most. The free version even does minor optimizations and has a high memory limit. MikroC from MikroE is the second choice, but the free limitations are just code size, no free optimization.


For your jal code itself, I'd suggest reading the datasheet, and looking up sleep mode and "Interrupt on change" so that it doesn't really use any measurable power (with a typical DMM) when not in use.
 

Thread Starter

ajhoward

Joined Nov 16, 2011
46
If the board is powered, the PICKit 2 will use the board power to program the PIC, if the board isn't powered, the PICKit 2 will power the board in order to program the PIC.

It's a very intelligent programmer.

jal is a pretty cool language, though I've only tinkered with it. It's very pascal-ish, and Pascal is the first language I learned. However, all other stuff I do is with C or sometimes asm, so I pretty much stick with C. Other choices are out there and make just as good of code most of the time, so there's no problem as long as you get a .hex file in the end. I use BoostC from sourceboost the most. The free version even does minor optimizations and has a high memory limit. MikroC from MikroE is the second choice, but the free limitations are just code size, no free optimization.


For your jal code itself, I'd suggest reading the datasheet, and looking up sleep mode and "Interrupt on change" so that it doesn't really use any measurable power (with a typical DMM) when not in use.
OK, will do. Do you think it would be better to switch V+, instead of V- to further reduce power consumption or would that use more?
 

thatoneguy

Joined Feb 19, 2009
6,359
You don't change anything external for sleep, just sleep, but you need to set up the interrupt and the interrupt on change on the LDR pin.

I'm not sure how interrupts work in jal, the sleep and wake info is in the datasheet, it is the same as normal uC operation, but peripherals (in most cases) are shut down, and when something changes, it switches back to full speed.
 
:)

Fridge and Freezer Door Alarms

Guard against accidental de-frosting and loss of expensive refrigerator or freezer contents

These unique fridge alarms and freezer alarms fit quickly and easily to any type of free-standing appliance

Simple and effective solution to fridge or freezer protection and suitable for home and business applications

Also alarms suitable for monitoring internal doors around the home or business

UK AND REST OF THE WORLD SHIPPING IS ADDED ON AUTOMATICALLY AT CHECKOUT

AS RECOMMENDED IN GOOD HOUSEKEEPING MAGAZINE



FA-BASIC is a fridge or freezer door alarm with no time-delay and can also be used on internal house doors
 
Last edited by a moderator:

Thread Starter

ajhoward

Joined Nov 16, 2011
46
You don't change anything external for sleep, just sleep, but you need to set up the interrupt and the interrupt on change on the LDR pin.

I'm not sure how interrupts work in jal, the sleep and wake info is in the datasheet, it is the same as normal uC operation, but peripherals (in most cases) are shut down, and when something changes, it switches back to full speed.
No, not for sleep. I meant so that the current is only drawn through R1 when the switch is closed. I am reading the datasheet and other stuff on interrupt on change, but not sure how to implement it.
 
Top