Refrigerator Monitor

This was one of the first practical projects I did. It was filled with exciting new hardware and concepts about which I had to learn. This is a very feature-rich project.

Features
Audible indicator when the fridge door remains open more than 30 seconds. Instead of a ho hum beep, it the alarm plays “Blinded By The Light”.
Alarm if the fridge compartment rises above an adjustable temperature, this time playing “Hot Blooded”.
Alarm if the freezer compartment rises above an adjustable temperature. Because this is an important exception, a siren sound is played.
Text messages are automatically generated for all alarms. Texts will be re-sent every 10 minutes until the alarm condition clears.
A cloud-based dashboard that can be referenced anytime, anywhere.
Ability to change the temperature thresholds from the cloud in real time.

The project revolves around a light-sensitive resistor for knowing when the fridge light is on, and therefore that the door is open, and a pair of temperature sensors to monitor the the fridge and freezer compartments. Data is monitored by the Arduino code over Wifi. Arduino code manages the musical alerts and cloud data management. Python code takes care of the email/text management.

Sending alarm texts is done with a separate process managed by a Python program that I wrote running as a Windows service on my main desktop PC acting as a server. This Python monitor watches the cloud for an alarm being set by the Arduino. Once set, it chucks out a text using the API from a product called Twilio. Twilio is a commercial marketing application, but the price per text is ridiculously low ($.0079/text), so I don’t mind shelling out $20 every few years for some inexpensive peace of mind.

Basic Program Flow
Connect to local WiFi
Read fridge and freezer temperature sensor every 30 seconds
Read photoresistor sensor every 10 seconds
Asynchronously monitor for changes to the temperature thresholds via Adafuit IO
Send all readings to Adafruit IO feed
If any of the readings exceed the set threshold, play appropriate alarm
Simultaneous Python program monitors Adafruit IO for alarms and if received, sends a text message through Twilio
Project Toolkit
BoardESP8266 (WiFi)
Components> DS18B20 temperature sensor (2)
> GL5516 LDR photo resistor
> Piezo passive buzzer (speaker)
Programming> Arduino native (C++) for sensor monitoring and alarm triggering
> Python for responding to alarms by sending an SMS text
Cloud mechanismAdafruit IO
Text triggerTwilio API triggered by Python service

Adafruit IO manages the cloud dashboard and serves as the portal for changing the temperature thresholds.

Adafruit IO Dashboard Fields
StatusShows red if there is an alarm condition, otherwise it is green
Fridge alarm limitFridge compartment temperature below which an alarm will be triggered
Freezer alarm limitFreezer compartment temperature below which an alarm will be triggered
Refrigerator (current)Current temperature of the fridge compartment. Gauge will be red if in alarm condition.
Freezer (current)Current temperature of the freezer compartment. Gauge will be red if in alarm condition.
Fridge Temperature HistoryFridge temperatures recorded over the last 24 hours.
Freezer Temperature HistoryFreezer temperatures recorded over the last 24 hours.

Adafruit IO is made up of a code library for message send-and-receive services and customizable cloud dashboards. It includes a free service that I use in many of my projects.