Raspberry Pi Fridge Minder: receive an email when the door is opened

The kit comes with project cards and a link to download the accompanying Python scripts. And projects already include a light meter and email notifier, so I decided to combine these two projects into one and make something that will send an email whenever the fridge door is opened.Raspberry Pi Fridge Minder receive an email when the door is opened
This is particularly timely as the MonkMakes team are trying to loose some weight at the moment. The paper template on the Raspberry Pi GPIO connector is called a Raspberry Leaf.
BTW. A big thank you to Fritzing for a great design tool.
The photoresistor needs to be inside the fridge, so we can use two of the male to female jumper leads. This will of course also provide us with proof to the eternal question of whether the light really goes off when you close the fridge door.
To install the program on the Raspberry Pi, you probably want to connect using SSH (see this Adafruit tutorial). Run the command “nano fridge.py” and paste the following code into the editor.
# fridge.py
import RPi.GPIO as GPIO
import time, math
import smtplib, time
Raspberry Pi Fridge Minder receive an email when the door is opened schematic
SMTP_SERVER = ‘smtp.gmail.com'
SMTP_PORT = 587
GPIO.setmode(GPIO.BCM)
a_pin = 18
b_pin = 23
led_pin = 24
GPIO.setup(led_pin, GPIO.OUT)
GPIO.output(led_pin, False)
def discharge():
GPIO.setup(a_pin, GPIO.IN)
GPIO.setup(b_pin, GPIO.OUT)
GPIO.output(b_pin, False)
 time.sleep(0.01)

 

For more detail: Raspberry Pi Fridge Minder receive an email when the door is opened


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top