Device have two parts. One is passive part containing earth magnet in an enclosure. Other part is Active one with microprocessor, REED sensor, LED and Sounder.
Both Enclosures are 3D Printed. STL files are available below. I've attached board design for purely Hole Trough Components and for some SMD replaced once. Note that Hole Trough sounder uses significantly more current.
Schematic and PCB is available below as well. I've attached pdf and Gerber files.
Operating Principle:
REED sensor (NO/NC contacts) reacts with magnet. When contact is met (doors are closed) device is in Power Down mode drawing minimum amount of power.
When doors are open (contact is open) then system wakes up using Pin Change Interrupt, flash lights LED for 5 sec and after 30 second Sounder will be activated. Program pulses Sounder.
I was planning to have the LED on all the time but Martin suggested to flash it to save energy. THANK YOU for that. Did have time yet to check visibility of the LED inside the enclosure with higher resistor which would limit the power farther.
If LED will not turn on then it will indicate that there is no power ie. Battery requires changing. I know it's counter intuitive but this project is design to last as long as possible on battery. Also Resistor chosen for the LED is Higher then required so the current in the circuit is lower. It will cause LED to be dimmed but it will preserve energy. Full brightness is achieved at 20mA.
I've added Diode to protect circuit from reverse polarity. For Coin Battery it's not going to work well since the Voltage drop on Diode will affect voltage supplied to rest of the components. Since my goal is extended battery life I will use jumper in the place of a diode.
Power Calculation:
Calculation is based on SMD version. Sounder is drawing 1mA and LED with 220ohm resistor will take less than 4mA. Controller will use 0.1uA when in Power Down Mode and about 180uA when in normal operation.
Assumption Fridge is opened daily 20 times and 10 times sounder is activated
Need to double check values but for an estimate
5s x 20 /2 - 1.815 mA = 30.25 uA/24h - LED operating for 5 seconds but only half of the time
25 s x 20 - 200 uA = 25 uA /24h - LED is off timer is counting for remaining 25 seconds
30 s x 10 / 4 - 0.3 mA = 25 uA/24h - LED is off sounder is activated for 30 seconds every 4 cycles (400 ms)
23.75h - 0.1 uA = 2.35 uA - System is in Power - Down Mode, Power Reduction Mode
Round up:
1 minute - 30.25 uA/day
9 minutes - 25 uA/day
5 minutes - 25 uA/day
15 minutes it will work 80.25 uA and 23 h and 45 minutes it will consume 2.35 uA
Daily it will consume about 83 uA
3 V Coin Battery has capacity of 240mAh. 240mAh/83uAh = 2891 days
That's about 7.9 years.
For calculation I used LED i had at home but thanks for a tip. I will look in to that.